diff options
author | Doug Schaefer | 2015-02-16 18:28:26 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-02-17 19:48:08 +0000 |
commit | cd65a290169f473d1c615182207db6bfa5a6bc65 (patch) | |
tree | c7f9dabf4e4417e1dafbc62574ed6e774beed165 /build/org.eclipse.cdt.autotools.core | |
parent | 9471bc7bc1031ebbc86a539fc82664dcc677f758 (diff) | |
download | org.eclipse.cdt-cd65a290169f473d1c615182207db6bfa5a6bc65.tar.gz org.eclipse.cdt-cd65a290169f473d1c615182207db6bfa5a6bc65.tar.xz org.eclipse.cdt-cd65a290169f473d1c615182207db6bfa5a6bc65.zip |
Bug 459972 - Update CDT to use o.e.remote 2.0.
Requires a couple of changes in the autotools plug-ins. Change the
4.5 target to refer to the remote 2.0 build and update the pom to
use the 4.5 target.
Also fixes autotools test so they run on the Mac.
Change-Id: I145de3ea3f14d61ffba7354ad0fa3e0ec2467e26
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core')
2 files changed, 26 insertions, 10 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java index 862d445f278..6b5bc0d2ec7 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsPlugin.java @@ -37,6 +37,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; /** * The main plugin class to be used in the desktop. @@ -102,6 +103,18 @@ public class AutotoolsPlugin extends AbstractUIPlugin { } /** + * Return the OSGi service with the given service interface. + * + * @param service service interface + * @return the specified service or null if it's not registered + */ + public static <T> T getService(Class<T> service) { + BundleContext context = plugin.getBundle().getBundleContext(); + ServiceReference<T> ref = context.getServiceReference(service); + return ref != null ? context.getService(ref) : null; + } + + /** * Returns active shell. */ public static Shell getActiveWorkbenchShell() { diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java index 4172136783f..ade4cc22248 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java @@ -80,12 +80,13 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.remote.core.IRemoteConnection; +import org.eclipse.remote.core.IRemoteConnectionControlService; +import org.eclipse.remote.core.IRemoteConnectionPropertyService; +import org.eclipse.remote.core.IRemoteConnectionType; import org.eclipse.remote.core.IRemoteResource; -import org.eclipse.remote.core.IRemoteServices; -import org.eclipse.remote.core.RemoteServices; +import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.exception.RemoteConnectionException; - @SuppressWarnings("deprecation") public class AutotoolsNewMakeGenerator extends MarkerGenerator { @@ -1073,21 +1074,23 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { (IRemoteResource)getProject().getAdapter(IRemoteResource.class); if (remRes != null) { URI uri = remRes.getActiveLocationURI(); - IRemoteServices remServices = RemoteServices.getRemoteServices(uri); - if (remServices != null) { - IRemoteConnection conn = - remServices.getConnectionManager().getConnection(uri); + IRemoteServicesManager remoteServiceManager = AutotoolsPlugin.getService(IRemoteServicesManager.class); + IRemoteConnectionType connectionType = remoteServiceManager.getConnectionType(uri); + if (connectionType != null) { + IRemoteConnection conn = connectionType.getConnection(uri); if (conn != null) { if (!conn.isOpen()) { try { conn.open(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)); - if (conn.isOpen()) { - return conn.getProperty(IRemoteConnection.OS_NAME_PROPERTY); - } } catch (RemoteConnectionException e) { // Ignore and return platform OS } } + + if (conn.isOpen()) { + return conn.getProperty(IRemoteConnection.OS_NAME_PROPERTY); + } + } } } |