Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyNatureMapping.java')
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyNatureMapping.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyNatureMapping.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyNatureMapping.java
new file mode 100644
index 0000000000..960b0a2640
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/RemoteProxyNatureMapping.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rodrigo Fraxino Araujo <rfaraujo@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.profiling.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.internal.profiling.launch.ProfileLaunchPlugin;
+
+public class RemoteProxyNatureMapping {
+
+ String EXTENSION_POINT_ID = "RemoteProxyNatureMapping"; //$NON-NLS-1$
+ String MANAGER_NAME = "mapping"; //$NON-NLS-1$
+ String NATURE_ID = "nature"; //$NON-NLS-1$
+ String SCHEME_ID = "schema"; //$NON-NLS-1$
+
+ public String getSchemeFromNature(IProject project) throws CoreException {
+
+ IProjectDescription description = project.getDescription();
+ String[] natures = description.getNatureIds();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ProfileLaunchPlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
+ for(int i = 0; i < infos.length; i++) {
+ IConfigurationElement configurationElement = infos[i];
+ if (configurationElement.getName().equals(MANAGER_NAME)) {
+ for (int j=0;j<natures.length;j++) {
+ if (configurationElement.getAttribute(NATURE_ID).equals(natures[j])) {
+ return configurationElement.getAttribute(SCHEME_ID);
+ }
+ }
+ }
+ }
+ return null;
+ }
+}

Back to the top