Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-09-15 02:09:55 -0400
committerTobias Schwarz2014-09-15 02:09:55 -0400
commitacda32b53e3a90ecd21207dae9fb87c60f862f25 (patch)
tree410f0dd0066bf036b7529e4b6c0391a5c1b7276b
parent4c5546d03863b23448e6d207a9b0711ac0201b45 (diff)
downloadorg.eclipse.tcf-acda32b53e3a90ecd21207dae9fb87c60f862f25.tar.gz
org.eclipse.tcf-acda32b53e3a90ecd21207dae9fb87c60f862f25.tar.xz
org.eclipse.tcf-acda32b53e3a90ecd21207dae9fb87c60f862f25.zip
Target Explorer: extend interface
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/DirectorySelectionControl.java42
1 files changed, 41 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/DirectorySelectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/DirectorySelectionControl.java
index 1543c1ae5..70eafc626 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/DirectorySelectionControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/DirectorySelectionControl.java
@@ -10,15 +10,20 @@
package org.eclipse.tcf.te.ui.controls.file;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.ui.controls.BaseDialogSelectionControl;
import org.eclipse.tcf.te.ui.controls.nls.Messages;
import org.eclipse.tcf.te.ui.controls.validator.DirectoryNameValidator;
import org.eclipse.tcf.te.ui.controls.validator.Validator;
+import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
import org.osgi.framework.Bundle;
@@ -28,7 +33,7 @@ import org.osgi.framework.Bundle;
* The control supports direct editing by the user or browsing for the directory. By
* default, the control has a history of recently selected directories.
*/
-public class DirectorySelectionControl extends BaseDialogSelectionControl {
+public class DirectorySelectionControl extends BaseDialogSelectionControl implements IDataExchangeNode {
private String dialogMessage = ""; //$NON-NLS-1$
/**
@@ -153,4 +158,39 @@ public class DirectorySelectionControl extends BaseDialogSelectionControl {
return null;
}
+
+ protected String getDataKey() {
+ return "Directory"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void setupData(IPropertiesContainer data) {
+ String dir = data.getStringProperty(getDataKey());
+ IPath path = dir != null ? new Path(dir) : null;
+ setEditFieldControlText(path != null ? path.toOSString() : ""); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public void extractData(IPropertiesContainer data) {
+ String dir = doGetSelectedDirectory();
+ IPath path = dir.trim().length() > 0 ? new Path(dir) : null;
+ data.setProperty(getDataKey(), path != null ? path.toPortableString() : null);
+ }
+
+ public boolean checkDataChanged(IPropertiesContainer data) {
+ IPropertiesContainer newData = new PropertiesContainer();
+ extractData(newData);
+ String newValue = newData.getStringProperty(getDataKey());
+ String oldValue = data.getStringProperty(getDataKey());
+ if (oldValue == null) {
+ return newValue != null;
+ }
+ return newValue == null || !oldValue.equals(newValue);
+ }
}

Back to the top