Lines 74-80
Link Here
|
74 |
import org.openide.awt.ActionRegistration; |
74 |
import org.openide.awt.ActionRegistration; |
75 |
import org.openide.awt.HtmlBrowser.URLDisplayer; |
75 |
import org.openide.awt.HtmlBrowser.URLDisplayer; |
76 |
import org.openide.util.Exceptions; |
76 |
import org.openide.util.Exceptions; |
77 |
import org.openide.util.NbBundle; |
77 |
import org.openide.util.NbBundle.Messages; |
|
|
78 |
import static org.netbeans.modules.hudson.ui.actions.Bundle.*; |
78 |
import org.openide.util.RequestProcessor; |
79 |
import org.openide.util.RequestProcessor; |
79 |
import org.openide.xml.XMLUtil; |
80 |
import org.openide.xml.XMLUtil; |
80 |
import org.w3c.dom.Document; |
81 |
import org.w3c.dom.Document; |
Lines 85-109
Link Here
|
85 |
@ActionID(category="Team", id="org.netbeans.modules.hudson.ui.actions.CreateJob") |
86 |
@ActionID(category="Team", id="org.netbeans.modules.hudson.ui.actions.CreateJob") |
86 |
@ActionRegistration(displayName="#CTL_CreateJob", iconInMenu=false) |
87 |
@ActionRegistration(displayName="#CTL_CreateJob", iconInMenu=false) |
87 |
@ActionReference(path="Menu/Versioning", position=400) |
88 |
@ActionReference(path="Menu/Versioning", position=400) |
|
|
89 |
@Messages("CTL_CreateJob=Create Build Job...") |
88 |
public class CreateJob extends AbstractAction { |
90 |
public class CreateJob extends AbstractAction { |
89 |
|
91 |
|
90 |
private final HudsonInstance instance; |
92 |
private final HudsonInstance instance; |
91 |
|
93 |
|
92 |
public CreateJob() { |
94 |
public CreateJob() { |
93 |
super(NbBundle.getMessage(CreateJob.class, "CTL_CreateJob")); |
95 |
super(CTL_CreateJob()); |
94 |
this.instance = null; |
96 |
this.instance = null; |
95 |
} |
97 |
} |
96 |
|
98 |
|
|
|
99 |
@Messages("CreateJob.new_build=New Build...") |
97 |
public CreateJob(HudsonInstance instance) { |
100 |
public CreateJob(HudsonInstance instance) { |
98 |
super(NbBundle.getMessage(CreateJob.class, "CreateJob.new_build")); |
101 |
super(CreateJob_new_build()); |
99 |
this.instance = instance; |
102 |
this.instance = instance; |
100 |
} |
103 |
} |
101 |
|
104 |
|
|
|
105 |
@Messages({ |
106 |
"CreateJob.title=New Continuous Build", |
107 |
"CreateJob.create=Create" |
108 |
}) |
102 |
public void actionPerformed(ActionEvent e) { |
109 |
public void actionPerformed(ActionEvent e) { |
103 |
final CreateJobPanel panel = new CreateJobPanel(); |
110 |
final CreateJobPanel panel = new CreateJobPanel(); |
104 |
final DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateJob.class, "CreateJob.title")); |
111 |
final DialogDescriptor dd = new DialogDescriptor(panel, CreateJob_title()); |
105 |
final AtomicReference<Dialog> dialog = new AtomicReference<Dialog>(); |
112 |
final AtomicReference<Dialog> dialog = new AtomicReference<Dialog>(); |
106 |
final JButton createButton = new JButton(NbBundle.getMessage(CreateJob.class, "CreateJob.create")); |
113 |
final JButton createButton = new JButton(CreateJob_create()); |
107 |
createButton.addActionListener(new ActionListener() { |
114 |
createButton.addActionListener(new ActionListener() { |
108 |
public void actionPerformed(ActionEvent e) { |
115 |
public void actionPerformed(ActionEvent e) { |
109 |
RequestProcessor.getDefault().post(new Runnable() { |
116 |
RequestProcessor.getDefault().post(new Runnable() { |
Lines 135-140
Link Here
|
135 |
dialog.get().setVisible(true); |
142 |
dialog.get().setVisible(true); |
136 |
} |
143 |
} |
137 |
|
144 |
|
|
|
145 |
@Messages("CreateJob.failure=Could not create job. Please check your server's log for details.") |
138 |
private void finalizeJob(HudsonInstance instance, ProjectHudsonJobCreator creator, String name, Project project) { |
146 |
private void finalizeJob(HudsonInstance instance, ProjectHudsonJobCreator creator, String name, Project project) { |
139 |
try { |
147 |
try { |
140 |
Document doc = creator.configure(); |
148 |
Document doc = creator.configure(); |
Lines 152-158
Link Here
|
152 |
OpenProjects.getDefault().open(new Project[] {project}, false); |
160 |
OpenProjects.getDefault().open(new Project[] {project}, false); |
153 |
UI.selectNode(instance.getUrl(), name); |
161 |
UI.selectNode(instance.getUrl(), name); |
154 |
} catch (IOException x) { |
162 |
} catch (IOException x) { |
155 |
Exceptions.attachLocalizedMessage(x, NbBundle.getMessage(CreateJob.class, "CreateJob.failure")); |
163 |
Exceptions.attachLocalizedMessage(x, CreateJob_failure()); |
156 |
Logger.getLogger(CreateJob.class.getName()).log(Level.WARNING, null, x); |
164 |
Logger.getLogger(CreateJob.class.getName()).log(Level.WARNING, null, x); |
157 |
} |
165 |
} |
158 |
} |
166 |
} |