aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Peria de Sene2013-07-01 13:25:33 (EDT)
committerRafael Medeiros Teixeira2013-07-01 18:09:28 (EDT)
commit47eeed4670e96cd506b2ba1860758d7c23bbd025 (patch)
treeadbd17abd3a03906de1a04ecaf024ef689295bee
parentade649c3f4715546e48120ad2a965f6d24c0c5c8 (diff)
downloadorg.eclipse.linuxtools-47eeed4670e96cd506b2ba1860758d7c23bbd025.zip
org.eclipse.linuxtools-47eeed4670e96cd506b2ba1860758d7c23bbd025.tar.gz
org.eclipse.linuxtools-47eeed4670e96cd506b2ba1860758d7c23bbd025.tar.bz2
[linuxtools settings | bug 412003] - This commit includes the capability to change the ComboFieldEditor according the selected pathrefs/changes/71/14171/2
I have read and agree to abide term by the terms of the Eclipse Foundation Commiter Guidelines Change-Id: Ia09fffaec2e9fda5f3b152caf0ecb876e047793f Signed-off-by: Rafael Peria de Sene <rpsene@linux.vnet.ibm.com> Reviewed-on: https://git.eclipse.org/r/14171 Tested-by: Hudson CI Reviewed-by: Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com> Reviewed-by: Rafael Medeiros Teixeira <rafaelmt@linux.vnet.ibm.com> IP-Clean: Rafael Medeiros Teixeira <rafaelmt@linux.vnet.ibm.com> Tested-by: Rafael Medeiros Teixeira <rafaelmt@linux.vnet.ibm.com>
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/CustomComboFieldEditor.java38
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/LinuxtoolsPathPropertyPage.java16
2 files changed, 47 insertions, 7 deletions
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/CustomComboFieldEditor.java b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/CustomComboFieldEditor.java
new file mode 100644
index 0000000..c369500
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.ui/src/org/eclipse/linuxtools/tools/launch/ui/properties/CustomComboFieldEditor.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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:
+ * Rafael Peria de Sene <rpsene@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.ui.properties;
+
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Extends the class ComboFieldEditor including the capability to set and get
+ * the selected value from a ComboFieldEditor.
+ *
+ */
+public class CustomComboFieldEditor extends ComboFieldEditor {
+
+ public CustomComboFieldEditor(String name, String labelText,
+ String[][] entryNamesAndValues, Composite parent) {
+ super(name, labelText, entryNamesAndValues, parent);
+ }
+
+ public String getSelectedValue() {
+ doStore();
+ return getPreferenceStore().getString(getPreferenceName());
+ }
+
+ public void setSelectedValue(String newValue) {
+ getPreferenceStore().setValue(getPreferenceName(), newValue);
+ doLoad();
+ }
+} \ No newline at end of file
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
index a83fe70..bb999ae 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation
+ * Copyright (c) 2011,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
@@ -7,6 +7,7 @@
*
* Contributors:
* Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ * Rafael Peria de Sene <rpsene@br.ibm.com>
*******************************************************************************/
package org.eclipse.linuxtools.tools.launch.ui.properties;
@@ -21,7 +22,6 @@ 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;
@@ -63,7 +63,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
{"Custom", ""}, //$NON-NLS-1$ //$NON-NLS-2$
};
private StringFieldEditor linuxtoolsPath;
- private ComboFieldEditor linuxtoolsPathCombo;
+ private CustomComboFieldEditor linuxtoolsPathCombo;
private IAdaptable element = null;
private Composite result;
private Button systemEnvButton, customButton;
@@ -107,6 +107,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
layoutRadios.marginWidth= 0;
layoutRadios.numColumns= 1;
radios.setLayout(layoutRadios);
+
Composite space = new Composite(result, SWT.NONE);
boolean systemPathSelected = getPreferenceStore().getBoolean(LaunchCoreConstants.LINUXTOOLS_PATH_SYSTEM_NAME);
@@ -126,7 +127,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
customButton.setSelection(!systemPathSelected);
//Add combo box
- linuxtoolsPathCombo = new ComboFieldEditor(
+ linuxtoolsPathCombo = new CustomComboFieldEditor(
LINUXTOOLS_PATH_COMBO_NAME,
Messages.LINUXTOOLS_PATH_COMBO,
paths,
@@ -138,8 +139,9 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
@Override
public void propertyChange(PropertyChangeEvent event) {
customSelected = event.getNewValue().toString().equals(""); //$NON-NLS-1$
- if (!customSelected)
+ if (!customSelected){
linuxtoolsPath.setStringValue(event.getNewValue().toString());
+ }
updateOptionsEnable();
}
});
@@ -157,7 +159,7 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
customSelected = selected.equals(""); //$NON-NLS-1$
getPreferenceStore().setDefault(LaunchCoreConstants.LINUXTOOLS_PATH_NAME, LinuxtoolsPathProperty.getInstance().getLinuxtoolsPathDefault());
linuxtoolsPath.load();
-
+ linuxtoolsPathCombo.setSelectedValue(linuxtoolsPath.getStringValue());
Dialog.applyDialogFont(result);
updateOptionsEnable();
return result;
@@ -228,4 +230,4 @@ public class LinuxtoolsPathPropertyPage extends PropertyPage {
return element;
}
-}
+} \ No newline at end of file