Skip to content

Commit ede9905

Browse files
eharris369GitHub Enterprise
authored andcommitted
Merge pull request #191 from eharris/185-limitQuickFixesToDockerfile
Issue #185: Limit quick fixes to the ones that actually work.
2 parents a6101df + e98610d commit ede9905

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/connection/MicroclimateSocket.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.ibm.microclimate.core.internal.MicroclimateApplication;
2626
import com.ibm.microclimate.core.internal.console.SocketConsole;
2727
import com.ibm.microclimate.core.internal.constants.MCConstants;
28+
import com.ibm.microclimate.core.internal.constants.ProjectType;
2829
import com.ibm.microclimate.core.internal.constants.StartMode;
2930
import com.ibm.microclimate.core.internal.messages.Messages;
3031

@@ -440,7 +441,7 @@ private void onValidationEvent(JSONObject event) throws JSONException {
440441
String details = result.getString(MCConstants.KEY_DETAILS);
441442
String quickFixId = null;
442443
String quickFixDescription = null;
443-
if (result.has(MCConstants.KEY_QUICKFIX)) {
444+
if (result.has(MCConstants.KEY_QUICKFIX) && supportsQuickFix(app, type, filename)) {
444445
JSONObject quickFix = result.getJSONObject(MCConstants.KEY_QUICKFIX);
445446
quickFixId = quickFix.getString(MCConstants.KEY_FIXID);
446447
quickFixDescription = quickFix.getString(MCConstants.KEY_DESCRIPTION);
@@ -455,6 +456,19 @@ private void onValidationEvent(JSONObject event) throws JSONException {
455456
MCLogger.log("Validation event indicates failure but no validation results,"); //$NON-NLS-1$
456457
}
457458
}
459+
460+
private boolean supportsQuickFix(MicroclimateApplication app, String type, String filename) {
461+
if (!MCConstants.VALUE_TYPE_MISSING.equals(type) || app.projectType.isType(ProjectType.TYPE_DOCKER)) {
462+
return false;
463+
}
464+
if (MCConstants.DOCKERFILE.equals(filename)) {
465+
return true;
466+
}
467+
if (app.projectType.isType(ProjectType.TYPE_LIBERTY) && MCConstants.DOCKERFILE_BUILD.equals(filename)) {
468+
return true;
469+
}
470+
return false;
471+
}
458472

459473
boolean blockUntilFirstConnection() {
460474
final int delay = 100;

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/constants/MCConstants.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ private MCConstants() {}
9494
KEY_AUTO_GENERATE = "autoGenerate",
9595

9696
// JSON attribute values
97-
REQUEST_STATUS_SUCCESS = "success"
97+
REQUEST_STATUS_SUCCESS = "success",
98+
99+
// Microclimate files
100+
DOCKERFILE = "Dockerfile",
101+
DOCKERFILE_BUILD = "Dockerfile-build"
98102

99103
;
100104

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/constants/StartMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static StartMode get(JSONObject obj) {
5252
mode = obj.getString(MCConstants.KEY_START_MODE);
5353
}
5454
if (mode == null) {
55-
MCLogger.logError("No start mode was specified on JSON object");
55+
MCLogger.log("No start mode was specified on JSON object");
5656
return StartMode.RUN;
5757
} else {
5858
StartMode startMode = StartMode.get(mode);

dev/com.ibm.microclimate.ui/plugin.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ACTION_REMOVE_CONNECTION=&Remove Connection
1717

1818
ACTION_OPEN_APP=&Open Application
1919
ACTION_CONTAINER_SHELL=Open &Container Shell
20-
ACTION_START_BUILD=Start &Build
20+
ACTION_START_BUILD=&Build
2121
ACTION_IMPORT_PROJECT=&Import Project
2222
ACTION_SHOW_APP_CONSOLE=&Show App Console
2323
ACTION_SHOW_BUILD_CONSOLE=S&how Build Console

0 commit comments

Comments
 (0)