aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Pontes2011-09-26 16:25:32 (EDT)
committerOtavio Pontes2011-11-09 13:58:51 (EST)
commit6c7ad8886d30f36f38c2b86bca4e9cbddc3d3782 (patch)
tree500a3d1ed12b077981e55b0d7bc43ba4a261751a
parentf0edddf0ad9cddfb4229b7915fa79d5f70149691 (diff)
downloadorg.eclipse.linuxtools-6c7ad8886d30f36f38c2b86bca4e9cbddc3d3782.zip
org.eclipse.linuxtools-6c7ad8886d30f36f38c2b86bca4e9cbddc3d3782.tar.gz
org.eclipse.linuxtools-6c7ad8886d30f36f38c2b86bca4e9cbddc3d3782.tar.bz2
Creating a project property page to change the PATH (bug #353056)
The project property page let's user change the PATH to be used by tools.launch.core to run commands.
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java5
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/.classpath7
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/.project28
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/META-INF/MANIFEST.MF15
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/about.html28
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/build.properties6
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.properties12
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.xml14
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/pom.xml44
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/schema/LinuxtoolsPathOptions.exsd106
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Activator.java63
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Messages.java28
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/messages.properties6
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java225
-rw-r--r--profiling/pom.xml1
16 files changed, 596 insertions, 0 deletions
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java
index 335cbf5..f12ecad 100644
--- a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java
@@ -18,6 +18,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class LinuxtoolsPathProperty {
public static final String LINUXTOOLS_PATH_NAME = Activator.PLUGIN_ID + ".LinuxtoolsPath"; //$NON-NLS-1$
+ public static final String LINUXTOOLS_PATH_SYSTEM_NAME = Activator.PLUGIN_ID + ".LinuxtoolsSystemEnvPath"; //$NON-NLS-1$
public static final String LINUXTOOLS_PATH_DEFAULT = ""; //$NON-NLS-1$
public static String getLinuxtoolsPath(IProject project) {
if (project == null)
@@ -26,6 +27,10 @@ public class LinuxtoolsPathProperty {
ScopedPreferenceStore store = new ScopedPreferenceStore(
new ProjectScope(project),
Activator.PLUGIN_ID);
+ boolean systemPathSelected = store.getBoolean(LINUXTOOLS_PATH_SYSTEM_NAME);
+ if (systemPathSelected)
+ return LINUXTOOLS_PATH_DEFAULT;
+
String path = store.getString(LINUXTOOLS_PATH_NAME);
if (path == null || path.equals(""))
return LINUXTOOLS_PATH_DEFAULT;
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/.classpath b/profiling/org.eclipse.linuxtools.tools.launch.ui/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/.project b/profiling/org.eclipse.linuxtools.tools.launch.ui/.project
new file mode 100644
index 0000000..d691b03
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.tools.launch.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/.settings/org.eclipse.jdt.core.prefs b/profiling/org.eclipse.linuxtools.tools.launch.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8a94dd7
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Sep 26 15:13:28 BRT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.tools.launch.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f281bcd
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.tools.launch.ui;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: %provider
+Bundle-Activator: org.eclipse.linuxtools.tools.launch.ui.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.linuxtools.tools.launch.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.linuxtools.tools.launch.ui.properties
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/about.html b/profiling/org.eclipse.linuxtools.tools.launch.ui/about.html
new file mode 100644
index 0000000..c258ef5
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/build.properties b/profiling/org.eclipse.linuxtools.tools.launch.ui/build.properties
new file mode 100644
index 0000000..d324832
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml, \
+ plugin.properties \ No newline at end of file
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.properties b/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.properties
new file mode 100644
index 0000000..4a00f70
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2011 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:
+# Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+#################################################################################
+bundleName=Tools Launcher UI (Incubation)
+provider=Eclipse Linux Tools
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.xml b/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.xml
new file mode 100644
index 0000000..c848f4b
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="LinuxtoolsPathOptions" name="LinuxtoolsPathOptions" schema="schema/LinuxtoolsPathOptions.exsd"/>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.eclipse.linuxtools.tools.launch.ui.properties.LinuxtoolsPathPropertyPage"
+ id="org.eclipse.linuxtools.tools.launch.ui.LinuxtoolsPage"
+ name="Linux Tools Path">
+ </page>
+ </extension>
+
+</plugin>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/pom.xml b/profiling/org.eclipse.linuxtools.tools.launch.ui/pom.xml
new file mode 100644
index 0000000..706b55c
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>linuxtools-profiling-parent</artifactId>
+ <groupId>org.eclipse.linuxtools.profiling</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.linuxtools.tools.launch.ui</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <name>Linux Tools Tools Launcher UI Plug-in</name>
+
+ <build>
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/schema/LinuxtoolsPathOptions.exsd b/profiling/org.eclipse.linuxtools.tools.launch.ui/schema/LinuxtoolsPathOptions.exsd
new file mode 100644
index 0000000..4052a63
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/schema/LinuxtoolsPathOptions.exsd
@@ -0,0 +1,106 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.linuxtools.tools.launch.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.linuxtools.tools.launch.ui" id="org.eclipse.linuxtools.tools.launch.ui.LinuxtoolsPathOptions" name="LinuxtoolsPathOptions"/>
+ </appinfo>
+ <documentation>
+ Use this Extension Point to add new options to the combobox in Linuxtools Path property page.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="option"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="option">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="path" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Activator.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Activator.java
new file mode 100644
index 0000000..dec6160
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Activator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.tools.launch.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Messages.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Messages.java
new file mode 100644
index 0000000..cc8687e
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/Messages.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = Activator.PLUGIN_ID + ".messages";
+ public static String LINUXTOOLS_PATH;
+ public static String LINUXTOOLS_PATH_COMBO;
+ public static String LINUXTOOLS_PATH_TOOLTIP;
+ public static String LINUXTOOLS_PATH_SYSTEM_ENV;
+ public static String LINUXTOOLS_PATH_CUSTOM;
+ public static String LINUXTOOLS_PATH_CUSTOM_TOOLTIP;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/messages.properties b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/messages.properties
new file mode 100644
index 0000000..2e0d34e
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/messages.properties
@@ -0,0 +1,6 @@
+LINUXTOOLS_PATH_COMBO=Options:
+LINUXTOOLS_PATH=
+LINUXTOOLS_PATH_TOOLTIP=Use ':' as Path separator
+LINUXTOOLS_PATH_SYSTEM_ENV=Use the System Environment PATH
+LINUXTOOLS_PATH_CUSTOM=Prepend string to PATH
+LINUXTOOLS_PATH_CUSTOM_TOOLTIP=Append the selected string to the beginning of the current system Path
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java
new file mode 100644
index 0000000..690da3f
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.ui.properties;
+
+import java.util.LinkedList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.linuxtools.tools.launch.core.properties.LinuxtoolsPathProperty;
+import org.eclipse.linuxtools.tools.launch.ui.Activator;
+import org.eclipse.linuxtools.tools.launch.ui.Messages;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+public class LinuxtoolsPathPropertyPage extends PropertyPage {
+ private static final String CORE_PLUGIN_ID = "org.eclipse.linuxtools.tools.launch.core"; //$NON-NLS-1$
+ public static final String LINUXTOOLS_PATH_COMBO_NAME = CORE_PLUGIN_ID + ".LinuxtoolsPathCombo"; //$NON-NLS-1$
+ private static final String LINUXTOOLS_PATH_EXT_POINT = "LinuxtoolsPathOptions"; //$NON-NLS-1$
+ private static final String LINUXTOOLS_PATH_OPTION = "option"; //$NON-NLS-1$
+ private static final String LINUXTOOLS_PATH_OPTION_NAME = "name"; //$NON-NLS-1$
+ private static final String LINUXTOOLS_PATH_OPTION_PATH = "path"; //$NON-NLS-1$
+ private static final boolean LINUXTOOLS_PATH_SYSTEM_DEFAULT = true;
+
+ private static final String[][] DEFAULT_PATHS= {
+ {"Custom", ""},
+ };
+ private StringFieldEditor linuxtoolsPath;
+ private ComboFieldEditor linuxtoolsPathCombo;
+ private IAdaptable element = null;
+ private Composite result;
+ private Button systemEnvButton, customButton;
+ private boolean customSelected;
+
+ private String [][]fillPaths() {
+ LinkedList<String[]> list = new LinkedList<String[]>();
+ for (String[] t : DEFAULT_PATHS)
+ list.add(t);
+
+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, LINUXTOOLS_PATH_EXT_POINT);
+ IConfigurationElement[] configs = extPoint.getConfigurationElements();
+ for (IConfigurationElement config : configs)
+ if (config.getName().equals(LINUXTOOLS_PATH_OPTION)) {
+ String path = config.getAttribute(LINUXTOOLS_PATH_OPTION_PATH);
+ String name = config.getAttribute(LINUXTOOLS_PATH_OPTION_NAME);
+ list.add(new String[]{name, path});
+ }
+
+ return list.toArray(new String[0][0]);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ initializeDialogUnits(parent);
+
+ result= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth= 0;
+ layout.numColumns= 1;
+ result.setLayout(layout);
+ String paths[][] = fillPaths();
+
+ //defaults
+ getPreferenceStore().setDefault(LinuxtoolsPathProperty.LINUXTOOLS_PATH_SYSTEM_NAME, LINUXTOOLS_PATH_SYSTEM_DEFAULT);
+ getPreferenceStore().setDefault(LINUXTOOLS_PATH_COMBO_NAME, paths[0][1]);
+
+ // Add radio buttons
+ Composite radios = new Composite(result, SWT.NONE);
+ GridLayout layoutRadios= new GridLayout();
+ layoutRadios.marginWidth= 0;
+ layoutRadios.numColumns= 1;
+ radios.setLayout(layoutRadios);
+ Composite space = new Composite(result, SWT.NONE);
+
+ boolean systemPathSelected = getPreferenceStore().getBoolean(LinuxtoolsPathProperty.LINUXTOOLS_PATH_SYSTEM_NAME);
+ systemEnvButton = new Button(radios, SWT.RADIO);
+ systemEnvButton.setText(Messages.LINUXTOOLS_PATH_SYSTEM_ENV);
+ systemEnvButton.setSelection(systemPathSelected);
+ systemEnvButton.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateOptionsEnable();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ customButton = new Button(radios, SWT.RADIO);
+ customButton.setText(Messages.LINUXTOOLS_PATH_CUSTOM);
+ customButton.setToolTipText(Messages.LINUXTOOLS_PATH_CUSTOM_TOOLTIP);
+ customButton.setSelection(!systemPathSelected);
+
+ //Add combo box
+ linuxtoolsPathCombo = new ComboFieldEditor(
+ LINUXTOOLS_PATH_COMBO_NAME,
+ Messages.LINUXTOOLS_PATH_COMBO,
+ paths,
+ result);
+ linuxtoolsPathCombo.setPage(this);
+ linuxtoolsPathCombo.setPreferenceStore(getPreferenceStore());
+ linuxtoolsPathCombo.load();
+ linuxtoolsPathCombo.setPropertyChangeListener(new IPropertyChangeListener (){
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ customSelected = event.getNewValue().toString().equals("");
+ if (!customSelected)
+ linuxtoolsPath.setStringValue(event.getNewValue().toString());
+ updateOptionsEnable();
+ }
+ });
+
+ //Add textbox
+ linuxtoolsPath = new StringFieldEditor(
+ LinuxtoolsPathProperty.LINUXTOOLS_PATH_NAME,
+ Messages.LINUXTOOLS_PATH,
+ result);
+
+ linuxtoolsPath.setPage(this);
+ linuxtoolsPath.setPreferenceStore(getPreferenceStore());
+ linuxtoolsPath.getTextControl(result).setToolTipText(Messages.LINUXTOOLS_PATH_TOOLTIP);
+
+ String selected = getPreferenceStore().getString(LINUXTOOLS_PATH_COMBO_NAME);
+ customSelected = selected.equals("");
+ getPreferenceStore().setDefault(LinuxtoolsPathProperty.LINUXTOOLS_PATH_NAME, LinuxtoolsPathProperty.LINUXTOOLS_PATH_DEFAULT);
+ linuxtoolsPath.load();
+
+ Dialog.applyDialogFont(result);
+ updateOptionsEnable();
+ return result;
+ }
+
+ private void updateOptionsEnable() {
+ if (systemEnvButton.getSelection()) {
+ linuxtoolsPath.setEnabled(false, result);
+ linuxtoolsPathCombo.setEnabled(false, result);
+ } else {
+ linuxtoolsPath.setEnabled(customSelected, result);
+ linuxtoolsPathCombo.setEnabled(true, result);
+ }
+ }
+
+ @Override
+ protected void performDefaults() {
+ linuxtoolsPath.loadDefault();
+ linuxtoolsPathCombo.loadDefault();
+ customButton.setSelection(!LINUXTOOLS_PATH_SYSTEM_DEFAULT);
+ systemEnvButton.setSelection(LINUXTOOLS_PATH_SYSTEM_DEFAULT);
+ updateOptionsEnable();
+ }
+
+ @Override
+ public boolean performOk() {
+ linuxtoolsPath.store();
+ linuxtoolsPathCombo.store();
+ getPreferenceStore().setValue(LinuxtoolsPathProperty.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ return super.performOk();
+ }
+
+ @Override
+ protected void performApply() {
+ linuxtoolsPath.store();
+ linuxtoolsPathCombo.store();
+ getPreferenceStore().setValue(LinuxtoolsPathProperty.LINUXTOOLS_PATH_SYSTEM_NAME, systemEnvButton.getSelection());
+ super.performApply();
+ }
+
+ /**
+ * Receives the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ IAdaptable e = getElement();
+ if (e != null) {
+ setPreferenceStore(new ScopedPreferenceStore(
+ new ProjectScope((IProject) e),
+ CORE_PLUGIN_ID));
+ }
+ }
+
+ /**
+ * Delivers the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ @Override
+ public IAdaptable getElement() {
+ if (element == null)
+ return element;
+ if (!(element instanceof IProject))
+ return (IAdaptable) element.getAdapter(IProject.class);
+ return element;
+ }
+
+}
diff --git a/profiling/pom.xml b/profiling/pom.xml
index 1d8c5fb..6e5aae4 100644
--- a/profiling/pom.xml
+++ b/profiling/pom.xml
@@ -59,6 +59,7 @@
<modules>
<module>org.eclipse.linuxtools.tools.launch.core</module>
+ <module>org.eclipse.linuxtools.tools.launch.ui</module>
<module>org.eclipse.linuxtools.binutils</module>
<module>org.eclipse.linuxtools.dataviewers</module>
<module>org.eclipse.linuxtools.dataviewers.charts</module>