Skip to content

Commit d7b89ad

Browse files
committed
Validate project start before launch
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
1 parent 874e01e commit d7b89ad

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,8 @@ public void start(IProject iProject, String parms, String javaHomePath, ILaunch
182182
return;
183183
}
184184

185-
// Check if the start action has already been issued.
186185
String projectName = iProject.getName();
187186

188-
// Check if we already have a start process running for this project
189-
if (processController.isProcessStarted(projectName)) {
190-
191-
if (Trace.isEnabled()) {
192-
Trace.getTracer().trace(Trace.TRACE_TOOLS, "The start request was already issued on project " + projectName
193-
+ ". No-op. ProcessController: " + processController);
194-
}
195-
ErrorHandler.processErrorMessage(NLS.bind(Messages.start_already_issued, projectName), true);
196-
return;
197-
}
198-
199187
Project project = null;
200188

201189
try {
@@ -303,20 +291,8 @@ public void startInContainer(IProject iProject, String parms, String javaHomePat
303291
return;
304292
}
305293

306-
// Check if the start action has already been issued.
307294
String projectName = iProject.getName();
308295

309-
// Check if we already have a start process running for this project
310-
if (processController.isProcessStarted(projectName)) {
311-
312-
if (Trace.isEnabled()) {
313-
Trace.getTracer().trace(Trace.TRACE_TOOLS, "The start in container request was already issued on project " + projectName
314-
+ ". No-op. ProcessController: " + processController);
315-
}
316-
ErrorHandler.processErrorMessage(NLS.bind(Messages.start_container_already_issued, projectName), true);
317-
return;
318-
}
319-
320296
Project project = null;
321297

322298
try {

bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/ui/launch/StartTab.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ public boolean isValid(ILaunchConfiguration config) {
218218
return false;
219219
}
220220
}
221+
222+
// Check if project is already started
223+
if (devModeOps.isProjectStarted(configProjectName)) {
224+
if (Trace.isEnabled()) {
225+
Trace.getTracer().trace(Trace.TRACE_TOOLS, "The start request was already issued on project " + configProjectName);
226+
}
227+
228+
super.setErrorMessage(NLS.bind(Messages.start_already_issued, configProjectName));
229+
return false;
230+
}
221231
} catch (CoreException ce) {
222232
String msg = "Error getting project name";
223233
if (Trace.isEnabled()) {

bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/ui/launch/shortcuts/StartAction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ public static void run(IProject iProject, String mode) throws Exception {
104104
DevModeOperations devModeOps = DevModeOperations.getInstance();
105105
devModeOps.verifyProjectSupport(iProject);
106106

107+
// Check if project is already started
108+
String projectName = iProject.getName();
109+
if (devModeOps.isProjectStarted(projectName)) {
110+
111+
if (Trace.isEnabled()) {
112+
Trace.getTracer().trace(Trace.TRACE_TOOLS, "The start request was already issued on project " + projectName);
113+
}
114+
ErrorHandler.processErrorMessage(NLS.bind(Messages.start_already_issued, projectName), true);
115+
return;
116+
}
117+
107118
// Determine what configuration to use.
108119
LaunchConfigurationHelper launchConfigHelper = LaunchConfigurationHelper.getInstance();
109120
ILaunchConfiguration configuration = launchConfigHelper.getLaunchConfiguration(iProject, mode, RuntimeEnv.LOCAL);

bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/ui/launch/shortcuts/StartInContainerAction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ public static void run(IProject iProject, String mode) throws Exception {
107107
DevModeOperations devModeOps = DevModeOperations.getInstance();
108108
devModeOps.verifyProjectSupport(iProject);
109109

110+
// Check if project is already started
111+
String projectName = iProject.getName();
112+
if (devModeOps.isProjectStarted(projectName)) {
113+
114+
if (Trace.isEnabled()) {
115+
Trace.getTracer().trace(Trace.TRACE_TOOLS, "The start in container request was already issued on project " + projectName);
116+
}
117+
ErrorHandler.processErrorMessage(NLS.bind(Messages.start_container_already_issued, projectName), true);
118+
return;
119+
}
120+
110121
// Determine what configuration to use.
111122
LaunchConfigurationHelper launchConfigHelper = LaunchConfigurationHelper.getInstance();
112123
ILaunchConfiguration configuration = launchConfigHelper.getLaunchConfiguration(iProject, mode, RuntimeEnv.CONTAINER);

0 commit comments

Comments
 (0)