Skip to content

Commit 2ad28f9

Browse files
eharris369GitHub Enterprise
authored andcommitted
Merge pull request #203 from eharris/202-aCoupleMoreActions
Issue #202: Add a couple more actions and do some cleanup
2 parents e96ce8b + 0bd414c commit 2ad28f9

23 files changed

+292
-27
lines changed

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/MCEclipseApplication.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,33 @@ public void reconnectDebugger() {
152152
}
153153
}
154154
}
155-
155+
156+
public void attachDebugger() {
157+
// Remove any existing launch such as for a disconnected debug target
158+
if (launch != null) {
159+
IDebugTarget debugTarget = launch.getDebugTarget();
160+
if (debugTarget != null && !debugTarget.isDisconnected()) {
161+
// Already attached
162+
return;
163+
}
164+
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
165+
launch = null;
166+
}
167+
connectDebugger();
168+
}
169+
170+
public IDebugTarget getDebugTarget() {
171+
if (launch != null) {
172+
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
173+
for (ILaunch launchItem : launchManager.getLaunches()) {
174+
if (launch.equals(launchItem)) {
175+
return launch.getDebugTarget();
176+
}
177+
}
178+
}
179+
return null;
180+
}
181+
156182
@Override
157183
public void dispose() {
158184
// Clean up the launch
@@ -217,7 +243,6 @@ private void validationEvent(int severity, String filePath, String message, Stri
217243
}
218244
final IMarker marker = resource.createMarker(MARKER_TYPE);
219245
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
220-
marker.setAttribute(IMarker.LINE_NUMBER, 1);
221246
marker.setAttribute(IMarker.MESSAGE, message);
222247
if (quickFixId != null && !quickFixId.isEmpty()) {
223248
marker.setAttribute(CONNECTION_URL, mcConnection.baseUrl.toString());

dev/com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal/MicroclimateApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public boolean isRunning() {
173173
}
174174

175175
public boolean hasBuildLog() {
176-
return (!projectType.isType(ProjectType.TYPE_NODE));
176+
return (!projectType.isType(ProjectType.TYPE_NODEJS));
177177
}
178178

179179
public synchronized void setHttpPort(int httpPort) {

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.net.ConnectException;
1414
import java.net.URI;
1515
import java.net.URISyntaxException;
16+
import java.net.URL;
1617
import java.util.ArrayList;
1718
import java.util.LinkedHashMap;
1819
import java.util.List;
@@ -515,4 +516,21 @@ public void requestProjectDelete(String projectId)
515516
public IPath getWorkspacePath() {
516517
return localWorkspacePath;
517518
}
519+
520+
public URL getAppMonitorURL(MicroclimateApplication app) {
521+
return getAppViewURL(app, MCConstants.VIEW_MONITOR);
522+
}
523+
524+
public URL getAppViewURL(MicroclimateApplication app, String view) {
525+
try {
526+
URI uri = baseUrl;
527+
String query = MCConstants.QUERY_PROJECT + "=" + app.projectID;
528+
query = query + "&" + MCConstants.QUERY_VIEW + "=" + view;
529+
uri = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), query, uri.getFragment());
530+
return uri.toURL();
531+
} catch (Exception e) {
532+
MCLogger.logError("Failed to get the URL for the " + view + " view and the " + app.name + "application.", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
533+
}
534+
return null;
535+
}
518536
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ private MCConstants() {}
103103

104104
// Microclimate files
105105
DOCKERFILE = "Dockerfile",
106-
DOCKERFILE_BUILD = "Dockerfile-build"
106+
DOCKERFILE_BUILD = "Dockerfile-build",
107+
108+
QUERY_PROJECT = "project",
109+
QUERY_VIEW = "view",
110+
VIEW_MONITOR = "monitor",
111+
VIEW_OVERVIEW = "overview"
107112

108113
;
109114

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ public class ProjectType {
1818

1919
public static final String TYPE_LIBERTY = "liberty";
2020
public static final String TYPE_SPRING = "spring";
21-
public static final String TYPE_NODE = "nodejs";
21+
public static final String TYPE_NODEJS = "nodejs";
2222
public static final String TYPE_DOCKER = "docker";
2323

2424
public static final String LANGUAGE_JAVA = "java";
25+
public static final String LANGUAGE_NODEJS = "nodejs";
26+
public static final String LANGUAGE_SWIFT = "swift";
2527
public static final String LANGUAGE_PYTHON = "python";
28+
public static final String LANGUAGE_GO = "go";
2629

2730
public static final ProjectType UNKNOWN_TYPE = new ProjectType(UNKNOWN, UNKNOWN);
2831

674 Bytes
Loading
645 Bytes
Loading
827 Bytes
Loading
685 Bytes
Loading
619 Bytes
Loading

0 commit comments

Comments
 (0)