Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-04-22 18:13:56 -0400
committerIgor Fedorenko2014-04-23 07:19:35 -0400
commit67fce5dbb00d72f2d951a4f61b0c73631b52f080 (patch)
treed32f4e573bb04c9d0d0517796ab76f678a586149 /org.eclipse.m2e.launching
parentcc933903cb2f37a855f35ddea630a3bab373e878 (diff)
downloadm2e-core-67fce5dbb00d72f2d951a4f61b0c73631b52f080.tar.gz
m2e-core-67fce5dbb00d72f2d951a4f61b0c73631b52f080.tar.xz
m2e-core-67fce5dbb00d72f2d951a4f61b0c73631b52f080.zip
deprecated MavenRuntimeManager and friends
At very least this API was misplaced, it should have been exposed from o.e.m2e.launch bundle, not from the core. More realistically, all maven launch support should be moved to o.e.m2e.launch implementation and exposed as API when we get at least few real consumers. Change-Id: I6250d5c8d1a05801ca7dbdc2e628906c809b3441 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.launching')
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java15
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java11
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java5
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenRuntimeSelector.java31
4 files changed, 32 insertions, 30 deletions
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
index 3b625bb5..0e753de1 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
@@ -26,9 +26,9 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.osgi.util.NLS;
import org.eclipse.m2e.actions.MavenLaunchConstants;
-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.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
+import org.eclipse.m2e.core.internal.launch.MavenRuntimeManagerImpl;
/**
@@ -36,12 +36,13 @@ import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
*
* @author Igor Fedorenko
*/
+@SuppressWarnings("restriction")
public class MavenLaunchUtils {
- public static MavenRuntime getMavenRuntime(ILaunchConfiguration configuration) throws CoreException {
- MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
+ public static AbstractMavenRuntime getMavenRuntime(ILaunchConfiguration configuration) throws CoreException {
+ MavenRuntimeManagerImpl runtimeManager = MavenPluginActivator.getDefault().getMavenRuntimeManager();
String name = configuration.getAttribute(MavenLaunchConstants.ATTR_RUNTIME, ""); //$NON-NLS-1$
- MavenRuntime runtime = runtimeManager.getRuntimeByName(name);
+ AbstractMavenRuntime runtime = runtimeManager.getRuntimeByName(name);
if(runtime == null) {
throw new CoreException(new Status(IStatus.ERROR, MavenLaunchConstants.PLUGIN_ID, -1, //
NLS.bind(Messages.MavenLaunchUtils_error_no_maven_install, name), null));
@@ -49,7 +50,7 @@ public class MavenLaunchUtils {
return runtime;
}
- public static String getCliResolver(MavenRuntime runtime) throws CoreException {
+ public static String getCliResolver(AbstractMavenRuntime runtime) throws CoreException {
String jarname;
String runtimeVersion = runtime.getVersion();
if(runtimeVersion.startsWith("3.0")) { //$NON-NLS-1$
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
index 5779c3c7..ad631df1 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
@@ -37,8 +37,8 @@ import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
-import org.eclipse.m2e.core.embedder.MavenRuntime;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
import org.eclipse.m2e.core.internal.project.WorkspaceStateWriter;
@@ -60,10 +60,11 @@ import org.eclipse.m2e.core.internal.project.WorkspaceStateWriter;
*
* @since 1.4
*/
+@SuppressWarnings("restriction")
public class MavenRuntimeLaunchSupport {
private static final String LAUNCH_M2CONF_FILE = "org.eclipse.m2e.internal.launch.M2_CONF"; //$NON-NLS-1$
- private final MavenRuntime runtime;
+ private final AbstractMavenRuntime runtime;
private final MavenLauncherConfigurationHandler cwconf;
@@ -97,8 +98,8 @@ public class MavenRuntimeLaunchSupport {
}
}
- private MavenRuntimeLaunchSupport(MavenRuntime runtime, MavenLauncherConfigurationHandler cwconf, File cwconfFile,
- boolean resolveWorkspaceArtifacts) {
+ private MavenRuntimeLaunchSupport(AbstractMavenRuntime runtime, MavenLauncherConfigurationHandler cwconf,
+ File cwconfFile, boolean resolveWorkspaceArtifacts) {
this.runtime = runtime;
this.cwconf = cwconf;
this.cwconfFile = cwconfFile;
@@ -107,7 +108,7 @@ public class MavenRuntimeLaunchSupport {
public static MavenRuntimeLaunchSupport create(ILaunchConfiguration configuration, ILaunch launch,
IProgressMonitor monitor) throws CoreException {
- MavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration);
+ AbstractMavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration);
boolean resolveWorkspaceArtifacts = configuration.getAttribute(ATTR_WORKSPACE_RESOLUTION, false);
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
index 6050ccc9..3ba8ef39 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
@@ -41,7 +41,7 @@ import org.apache.maven.artifact.Artifact;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMaven;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
-import org.eclipse.m2e.core.embedder.MavenRuntime;
+import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
@@ -51,6 +51,7 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade;
*
* @author Eugene Kuleshov
*/
+@SuppressWarnings({"restriction", "deprecation"})
public class MavenSourcePathComputer implements ISourcePathComputer {
public MavenSourcePathComputer() {
@@ -69,7 +70,7 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
entries.add(jreEntry);
}
- MavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration);
+ AbstractMavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration);
IMavenLauncherConfiguration collector = new IMavenLauncherConfiguration() {
public void addArchiveEntry(String entry) throws CoreException {
addArchiveRuntimeClasspathEntry(entries, entry);
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 0a07664d..a045f140 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
@@ -38,12 +38,11 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.m2e.actions.MavenLaunchConstants;
-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.MavenPluginActivator;
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.MavenRuntimeManagerImpl;
import org.eclipse.m2e.core.internal.launch.MavenWorkspaceRuntime;
@@ -55,8 +54,8 @@ public class MavenRuntimeSelector extends Composite {
ComboViewer runtimeComboViewer;
- private static MavenRuntimeManager getRuntimeManager() {
- return MavenPlugin.getMavenRuntimeManager();
+ private static MavenRuntimeManagerImpl getRuntimeManager() {
+ return MavenPluginActivator.getDefault().getMavenRuntimeManager();
}
public MavenRuntimeSelector(final Composite mainComposite) {
@@ -106,7 +105,7 @@ public class MavenRuntimeSelector extends Composite {
StringBuilder sb = new StringBuilder();
if(runtime.isLegacy()) {
- sb.append(MavenRuntimeManager.EXTERNAL).append(" ").append(runtime.toString());
+ sb.append(MavenRuntimeManagerImpl.EXTERNAL).append(" ").append(runtime.toString());
} else if(!runtime.isEditable()) {
sb.append(getType(runtime)).append(" (").append(runtime.toString()).append(')');
} else {
@@ -143,30 +142,30 @@ public class MavenRuntimeSelector extends Composite {
});
}
- protected String getType(MavenRuntime runtime) {
+ protected String getType(AbstractMavenRuntime runtime) {
if(runtime instanceof MavenEmbeddedRuntime) {
- return MavenRuntimeManager.EMBEDDED;
+ return MavenRuntimeManagerImpl.EMBEDDED;
} else if(runtime instanceof MavenWorkspaceRuntime) {
- return MavenRuntimeManager.WORKSPACE;
+ return MavenRuntimeManagerImpl.WORKSPACE;
} else if(runtime instanceof MavenExternalRuntime) {
- return MavenRuntimeManager.EXTERNAL;
+ return MavenRuntimeManagerImpl.EXTERNAL;
}
throw new IllegalArgumentException();
}
protected void setInput() {
- MavenRuntimeManager runtimeManager = getRuntimeManager();
+ MavenRuntimeManagerImpl runtimeManager = getRuntimeManager();
runtimeComboViewer.setInput(runtimeManager.getMavenRuntimes());
runtimeComboViewer.setSelection(new StructuredSelection(runtimeManager.getDefaultRuntime()));
}
- public void setSelectRuntime(MavenRuntime runtime) {
+ public void setSelectRuntime(AbstractMavenRuntime runtime) {
this.runtimeComboViewer.setSelection(new StructuredSelection(runtime));
}
- public MavenRuntime getSelectedRuntime() {
+ public AbstractMavenRuntime getSelectedRuntime() {
IStructuredSelection selection = (IStructuredSelection) runtimeComboViewer.getSelection();
- return (MavenRuntime) selection.getFirstElement();
+ return (AbstractMavenRuntime) selection.getFirstElement();
}
public void addSelectionChangedListener(ISelectionChangedListener listener) {
@@ -180,14 +179,14 @@ public class MavenRuntimeSelector extends Composite {
} catch(CoreException ex) {
// TODO log
}
- MavenRuntime runtime = getRuntimeManager().getRuntimeByName(name);
+ AbstractMavenRuntime runtime = getRuntimeManager().getRuntimeByName(name);
if(runtime != null) {
setSelectRuntime(runtime);
}
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- MavenRuntime runtime = getSelectedRuntime();
+ AbstractMavenRuntime runtime = getSelectedRuntime();
configuration.setAttribute(MavenLaunchConstants.ATTR_RUNTIME, runtime.getName());
}
}

Back to the top