Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-04-20 18:50:08 -0400
committerIgor Fedorenko2014-04-20 19:04:43 -0400
commitcc933903cb2f37a855f35ddea630a3bab373e878 (patch)
tree68c9ea252a74c0be9b7e4072a4c988a1d0075ca2
parent84f23c8d08c0a71b81af9695965f9f42f879824c (diff)
downloadm2e-core-cc933903cb2f37a855f35ddea630a3bab373e878.tar.gz
m2e-core-cc933903cb2f37a855f35ddea630a3bab373e878.tar.xz
m2e-core-cc933903cb2f37a855f35ddea630a3bab373e878.zip
432436 better maven runtime display
Change-Id: If223d0b3ee3561650e988431626b19f7dd9310e9 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/MavenRuntimeManager.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/DefaultWorkspaceRuntime.java4
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java8
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenWorkspaceRuntime.java6
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java28
6 files changed, 38 insertions, 12 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/MavenRuntimeManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/MavenRuntimeManager.java
index 98c17da8..69e06b44 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/MavenRuntimeManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/MavenRuntimeManager.java
@@ -51,7 +51,7 @@ public class MavenRuntimeManager {
public static final String WORKSPACE = "WORKSPACE"; //$NON-NLS-1$
- private static final String EXTERNAL = "EXTERNAL"; //$NON-NLS-1$
+ public static final String EXTERNAL = "EXTERNAL"; //$NON-NLS-1$
private final IEclipsePreferences[] preferencesLookup = new IEclipsePreferences[2];
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/DefaultWorkspaceRuntime.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/DefaultWorkspaceRuntime.java
index 57d2ef4b..cf306811 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/DefaultWorkspaceRuntime.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/DefaultWorkspaceRuntime.java
@@ -27,8 +27,4 @@ public class DefaultWorkspaceRuntime extends MavenWorkspaceRuntime {
return false;
}
- public String toString() {
- return "Maven Workspace (" + getVersion() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java
index 695add45..2c9da47f 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenEmbeddedRuntime.java
@@ -219,15 +219,15 @@ public class MavenEmbeddedRuntime extends AbstractMavenRuntime {
public String toString() {
Bundle embedder = findMavenEmbedderBundle();
- StringBuilder sb = new StringBuilder();
- sb.append("Embedded (").append(getVersion()); //$NON-NLS-1$
if(embedder != null) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(getVersion(embedder)); //$NON-NLS-1$
String version = embedder.getHeaders().get(Constants.BUNDLE_VERSION);
sb.append('/').append(version);
+ return sb.toString();
}
- sb.append(')');
- return sb.toString();
+ return MAVEN_EMBEDDER_BUNDLE_SYMBOLICNAME;
}
private synchronized String getVersion(Bundle bundle) {
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java
index 80583c03..c12cc42b 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java
@@ -155,7 +155,7 @@ public class MavenExternalRuntime extends AbstractMavenRuntime {
}
public String toString() {
- return "External" + " " + location + " (" + getVersion() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return location + ' ' + getVersion();
}
private static class ExceptionWrapper extends RuntimeException {
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenWorkspaceRuntime.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenWorkspaceRuntime.java
index d98c60bb..d631ce29 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenWorkspaceRuntime.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenWorkspaceRuntime.java
@@ -156,7 +156,11 @@ public class MavenWorkspaceRuntime extends AbstractMavenRuntime {
}
public String toString() {
- return "Maven Workspace (" + getVersion() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ IMavenProjectFacade maven = getMavenDistribution();
+ if(maven != null) {
+ return maven.getProject().getName() + ' ' + maven.getArtifactKey().getVersion();
+ }
+ return getDistributionArtifactKey().getVersion();
}
protected void addArtifact(IMavenLauncherConfiguration collector, Artifact artifact) throws CoreException {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java
index 297944f9..0a07664d 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java
@@ -42,6 +42,9 @@ import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenRuntime;
import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
+import org.eclipse.m2e.core.internal.launch.MavenEmbeddedRuntime;
+import org.eclipse.m2e.core.internal.launch.MavenExternalRuntime;
+import org.eclipse.m2e.core.internal.launch.MavenWorkspaceRuntime;
/**
@@ -100,7 +103,19 @@ public class MavenRuntimeSelector extends Composite {
public String getText(Object element) {
AbstractMavenRuntime runtime = (AbstractMavenRuntime) element;
- return runtime.isLegacy() ? runtime.toString() : runtime.getName();
+ StringBuilder sb = new StringBuilder();
+
+ if(runtime.isLegacy()) {
+ sb.append(MavenRuntimeManager.EXTERNAL).append(" ").append(runtime.toString());
+ } else if(!runtime.isEditable()) {
+ sb.append(getType(runtime)).append(" (").append(runtime.toString()).append(')');
+ } else {
+ sb.append(runtime.getName()).append(" (");
+ sb.append(getType(runtime)).append(' ').append(runtime.toString());
+ sb.append(')');
+ }
+
+ return sb.toString();
}
public Image getImage(Object element) {
@@ -128,6 +143,17 @@ public class MavenRuntimeSelector extends Composite {
});
}
+ protected String getType(MavenRuntime runtime) {
+ if(runtime instanceof MavenEmbeddedRuntime) {
+ return MavenRuntimeManager.EMBEDDED;
+ } else if(runtime instanceof MavenWorkspaceRuntime) {
+ return MavenRuntimeManager.WORKSPACE;
+ } else if(runtime instanceof MavenExternalRuntime) {
+ return MavenRuntimeManager.EXTERNAL;
+ }
+ throw new IllegalArgumentException();
+ }
+
protected void setInput() {
MavenRuntimeManager runtimeManager = getRuntimeManager();
runtimeComboViewer.setInput(runtimeManager.getMavenRuntimes());

Back to the top