Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Herrmann2008-11-04 22:12:13 +0000
committerRĂ¼diger Herrmann2008-11-04 22:12:13 +0000
commit8a4ab05a27102bb45ac34e2b33d8244a530aadd6 (patch)
treeb74defe22638458dae1c3436eee0443833c33d2d /bundles/org.eclipse.rap.ui.views
parent158d5a8e228f842e265004d40e9808116b92a4c9 (diff)
downloadorg.eclipse.rap-8a4ab05a27102bb45ac34e2b33d8244a530aadd6.tar.gz
org.eclipse.rap-8a4ab05a27102bb45ac34e2b33d8244a530aadd6.tar.xz
org.eclipse.rap-8a4ab05a27102bb45ac34e2b33d8244a530aadd6.zip
RESOLVED 253164: Enable Cell Editors for Property Sheets
Diffstat (limited to 'bundles/org.eclipse.rap.ui.views')
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java22
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java8
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java6
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java6
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java14
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java19
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java210
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java34
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java218
-rw-r--r--bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java20
10 files changed, 303 insertions, 254 deletions
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
index a04ec62d78..c3e8eb822a 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
@@ -10,7 +10,11 @@
*******************************************************************************/
package org.eclipse.ui.views.properties;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
/**
* Descriptor for a property that has a value which should be edited
@@ -62,16 +66,16 @@ public class ComboBoxPropertyDescriptor extends PropertyDescriptor {
* <p>
* The editor is configured with the current validator if there is one.
* </p>
+ * @since 1.2
*/
-// RAP [fappel]: CellEditor not supported
-// public CellEditor createPropertyEditor(Composite parent) {
-// CellEditor editor = new ComboBoxCellEditor(parent, labels,
-// SWT.READ_ONLY);
-// if (getValidator() != null) {
-// editor.setValidator(getValidator());
-// }
-// return editor;
-// }
+ public CellEditor createPropertyEditor(Composite parent) {
+ CellEditor editor = new ComboBoxCellEditor(parent, labels,
+ SWT.READ_ONLY);
+ if (getValidator() != null) {
+ editor.setValidator(getValidator());
+ }
+ return editor;
+ }
/**
* The <code>ComboBoxPropertyDescriptor</code> implementation of this
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
index de0b789499..03ce9c8338 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.views.properties;
+import org.eclipse.jface.viewers.CellEditor;
+
/**
* A listener which is notified when a cell editor is
@@ -21,14 +23,12 @@ package org.eclipse.ui.views.properties;
*
* @param cellEditor the cell editor which has been activated
*/
-// RAP [fappel]: CellEditor not supported
-// public void cellEditorActivated(CellEditor cellEditor);
+ public void cellEditorActivated(CellEditor cellEditor);
/**
* Notifies that the cell editor has been deactivated
*
* @param cellEditor the cell editor which has been deactivated
*/
-// RAP [fappel]: CellEditor not supported
-// public void cellEditorDeactivated(CellEditor cellEditor);
+ public void cellEditorDeactivated(CellEditor cellEditor);
}
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
index cc61152e52..f945eab8cf 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.views.properties;
+import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.widgets.Composite;
/**
* A descriptor for a property to be presented by a standard property sheet page
@@ -55,9 +57,9 @@ public interface IPropertyDescriptor {
* @param parent the parent widget for the cell editor
* @return the cell editor for this property, or <code>null</code> if this
* property cannot be edited
+ * @since 1.2
*/
-// RAP [fappel]: CellEditor not supported
-// public CellEditor createPropertyEditor(Composite parent);
+ public CellEditor createPropertyEditor(Composite parent);
/**
* Returns the name of the category to which this property belongs. Properties
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
index 69ea775432..9cc3d7d29e 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.ui.views.properties;
+import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
/**
* <code>IPropertySheetEntry</code> describes the model interface for the
@@ -80,9 +82,9 @@ public interface IPropertySheetEntry {
* @param parent
* the parent widget for the editor
* @return the <code>CellEditor</code> used to edit the property
+ * @since 1.2
*/
-// RAP [fappel]: CellEditor not supported
-// CellEditor getEditor(Composite parent);
+ CellEditor getEditor(Composite parent);
/**
* Returns the error text to display if the value is invalid.
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
index 385e085517..85692e2d38 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
@@ -11,7 +11,11 @@
package org.eclipse.ui.views.properties;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Composite;
/**
* Standard implementation for property descriptors.
@@ -110,11 +114,11 @@ public class PropertyDescriptor implements IPropertyDescriptor {
* <p>
* Since no cell editor is returned, the property is read only.
* </p>
+ * @since 1.2
*/
-// RAP [fappel]: CellEditor not supported
-// public CellEditor createPropertyEditor(Composite parent) {
-// return null;
-// }
+ public CellEditor createPropertyEditor(Composite parent) {
+ return null;
+ }
/**
* Returns <code>true</code> if this property descriptor is to be always
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java
index 1f0aabbbc3..92a5ac843d 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java
@@ -11,7 +11,12 @@
package org.eclipse.ui.views.properties;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Composite;
/**
* A concrete subclass of {@link EditingSupport} that implements cell editing
@@ -61,6 +66,18 @@ public class PropertyEditingSupport extends EditingSupport {
}
protected CellEditor getCellEditor(Object object) {
+ IPropertySource propertySource = propertySourceProvider
+ .getPropertySource(object);
+ IPropertyDescriptor[] propertyDescriptors = propertySource
+ .getPropertyDescriptors();
+ for (int i = 0; i < propertyDescriptors.length; i++) {
+ IPropertyDescriptor propertyDescriptor = propertyDescriptors[i];
+ if (propertyID.equals(propertyDescriptor.getId())) {
+ return propertyDescriptor
+ .createPropertyEditor((Composite) getViewer()
+ .getControl());
+ }
+ }
return null;
}
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
index a24a1c3068..330cca6ca0 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
@@ -12,11 +12,18 @@
package org.eclipse.ui.views.properties;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.eclipse.core.commands.common.EventManager;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellEditorListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.internal.views.ViewsPlugin;
/**
@@ -66,8 +73,7 @@ public class PropertySheetEntry extends EventManager implements
private IPropertyDescriptor descriptor;
-// RAP [fappel]: CellEditor not supported
-// private CellEditor editor;
+ private CellEditor editor;
private String errorText;
@@ -77,27 +83,26 @@ public class PropertySheetEntry extends EventManager implements
* Create the CellEditorListener for this entry. It listens for value
* changes in the CellEditor, and cancel and finish requests.
*/
-// RAP [fappel]: CellEditor not supported
-// private ICellEditorListener cellEditorListener = new ICellEditorListener() {
-// public void editorValueChanged(boolean oldValidState,
-// boolean newValidState) {
-// if (!newValidState) {
-// // currently not valid so show an error message
-// setErrorText(editor.getErrorMessage());
-// } else {
-// // currently valid
-// setErrorText(null);
-// }
-// }
-//
-// public void cancelEditor() {
-// setErrorText(null);
-// }
-//
-// public void applyEditorValue() {
-// PropertySheetEntry.this.applyEditorValue();
-// }
-// };
+ private ICellEditorListener cellEditorListener = new ICellEditorListener() {
+ public void editorValueChanged(boolean oldValidState,
+ boolean newValidState) {
+ if (!newValidState) {
+ // currently not valid so show an error message
+ setErrorText(editor.getErrorMessage());
+ } else {
+ // currently valid
+ setErrorText(null);
+ }
+ }
+
+ public void cancelEditor() {
+ setErrorText(null);
+ }
+
+ public void applyEditorValue() {
+ PropertySheetEntry.this.applyEditorValue();
+ }
+ };
/*
* (non-Javadoc) Method declared on IPropertySheetEntry.
@@ -111,36 +116,35 @@ public class PropertySheetEntry extends EventManager implements
* (non-Javadoc) Method declared on IPropertySheetEntry.
*/
public void applyEditorValue() {
-// RAP [fappel]: CellEditor not supported
-// if (editor == null) {
-// return;
-// }
-//
-// // Check if editor has a valid value
-// if (!editor.isValueValid()) {
-// setErrorText(editor.getErrorMessage());
-// return;
-// }
-//
-// setErrorText(null);
-//
-// // See if the value changed and if so update
-// Object newValue = editor.getValue();
-// boolean changed = false;
-// if (values.length > 1) {
-// changed = true;
-// } else if (editValue == null) {
-// if (newValue != null) {
-// changed = true;
-// }
-// } else if (!editValue.equals(newValue)) {
-// changed = true;
-// }
-//
-// // Set the editor value
-// if (changed) {
-// setValue(newValue);
-// }
+ if (editor == null) {
+ return;
+ }
+
+ // Check if editor has a valid value
+ if (!editor.isValueValid()) {
+ setErrorText(editor.getErrorMessage());
+ return;
+ }
+
+ setErrorText(null);
+
+ // See if the value changed and if so update
+ Object newValue = editor.getValue();
+ boolean changed = false;
+ if (values.length > 1) {
+ changed = true;
+ } else if (editValue == null) {
+ if (newValue != null) {
+ changed = true;
+ }
+ } else if (!editValue.equals(newValue)) {
+ changed = true;
+ }
+
+ // Set the editor value
+ if (changed) {
+ setValue(newValue);
+ }
}
/**
@@ -266,11 +270,10 @@ public class PropertySheetEntry extends EventManager implements
* (non-Javadoc) Method declared on IPropertySheetEntry.
*/
public void dispose() {
-// RAP [fappel]: CellEditor not supported
-// if (editor != null) {
-// editor.dispose();
-// editor = null;
-// }
+ if (editor != null) {
+ editor.dispose();
+ editor = null;
+ }
// recursive call to dispose children
PropertySheetEntry[] entriesToDispose = childEntries;
childEntries = null;
@@ -302,14 +305,13 @@ public class PropertySheetEntry extends EventManager implements
* The error message of this entry has changed. Notify all listeners of the
* change.
*/
-// RAP [fappel] CellEditor not supported
-// private void fireErrorMessageChanged() {
-// Object[] array = getListeners();
-// for (int i = 0; i < array.length; i++) {
-// IPropertySheetEntryListener listener = (IPropertySheetEntryListener) array[i];
-// listener.errorMessageChanged(this);
-// }
-// }
+ private void fireErrorMessageChanged() {
+ Object[] array = getListeners();
+ for (int i = 0; i < array.length; i++) {
+ IPropertySheetEntryListener listener = (IPropertySheetEntryListener) array[i];
+ listener.errorMessageChanged(this);
+ }
+ }
/**
* The values of this entry have changed. Notify all listeners of the
@@ -368,21 +370,20 @@ public class PropertySheetEntry extends EventManager implements
*
* @see org.eclipse.ui.views.properties.IPropertySheetEntry#getEditor(org.eclipse.swt.widgets.Composite)
*/
-// RAP [fappel]: CellEditor not supported
-// public CellEditor getEditor(Composite parent) {
-//
-// if (editor == null) {
-// editor = descriptor.createPropertyEditor(parent);
-// if (editor != null) {
-// editor.addListener(cellEditorListener);
-// }
-// }
-// if (editor != null) {
-// editor.setValue(editValue);
-// setErrorText(editor.getErrorMessage());
-// }
-// return editor;
-// }
+ public CellEditor getEditor(Composite parent) {
+
+ if (editor == null) {
+ editor = descriptor.createPropertyEditor(parent);
+ if (editor != null) {
+ editor.addListener(cellEditorListener);
+ }
+ }
+ if (editor != null) {
+ editor.setValue(editValue);
+ setErrorText(editor.getErrorMessage());
+ }
+ return editor;
+ }
/**
* Returns the edit value for the object at the given index.
@@ -656,11 +657,10 @@ public class PropertySheetEntry extends EventManager implements
private void setDescriptor(IPropertyDescriptor newDescriptor) {
// if our descriptor is changing, we have to get rid
// of our current editor if there is one
-// RAP [fappel]: CellEditor not supported
-// if (descriptor != newDescriptor && editor != null) {
-// editor.dispose();
-// editor = null;
-// }
+ if (descriptor != newDescriptor && editor != null) {
+ editor.dispose();
+ editor = null;
+ }
descriptor = newDescriptor;
}
@@ -668,12 +668,11 @@ public class PropertySheetEntry extends EventManager implements
* Set the error text. This should be set to null when the current value is
* valid, otherwise it should be set to a error string
*/
-// RAP [fappel]: CellEditor not supported
-// private void setErrorText(String newErrorText) {
-// errorText = newErrorText;
-// // inform listeners
-// fireErrorMessageChanged();
-// }
+ private void setErrorText(String newErrorText) {
+ errorText = newErrorText;
+ // inform listeners
+ fireErrorMessageChanged();
+ }
/**
* Sets the parent of the entry to be propertySheetEntry.
@@ -707,19 +706,18 @@ public class PropertySheetEntry extends EventManager implements
* @param newValue
* the new value
*/
-// RAP [fappel]: CellEditor not supported
-// private void setValue(Object newValue) {
-// // Set the value
-// for (int i = 0; i < values.length; i++) {
-// values[i] = newValue;
-// }
-//
-// // Inform our parent
-// parent.valueChanged(this);
-//
-// // Refresh the model
-// refreshFromRoot();
-// }
+ private void setValue(Object newValue) {
+ // Set the value
+ for (int i = 0; i < values.length; i++) {
+ values[i] = newValue;
+ }
+
+ // Inform our parent
+ parent.valueChanged(this);
+
+ // Refresh the model
+ refreshFromRoot();
+ }
/**
* The <code>PropertySheetEntry</code> implmentation of this method
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
index 1edaf4a267..d8211aae78 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
@@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.ui.*;
import org.eclipse.ui.internal.views.ViewsPlugin;
import org.eclipse.ui.internal.views.properties.PropertiesMessages;
+import org.eclipse.ui.part.CellEditorActionHandler;
import org.eclipse.ui.part.Page;
/**
@@ -76,8 +77,7 @@ public class PropertySheetPage extends Page implements IPropertySheetPage, IAdap
private ICellEditorActivationListener cellEditorActivationListener;
-// RAP [fappel]: CellEditor not supported
-// private CellEditorActionHandler cellEditorActionHandler;
+ private CellEditorActionHandler cellEditorActionHandler;
// RAP [fappel]: Clipboard not supported
// private Clipboard clipboard;
@@ -263,18 +263,17 @@ public class PropertySheetPage extends Page implements IPropertySheetPage, IAdap
private ICellEditorActivationListener getCellEditorActivationListener() {
if (cellEditorActivationListener == null) {
cellEditorActivationListener = new ICellEditorActivationListener() {
-// RAP [fappel]: CellEditor not supported
-// public void cellEditorActivated(CellEditor cellEditor) {
-// if (cellEditorActionHandler != null) {
-// cellEditorActionHandler.addCellEditor(cellEditor);
-// }
-// }
-//
-// public void cellEditorDeactivated(CellEditor cellEditor) {
-// if (cellEditorActionHandler != null) {
-// cellEditorActionHandler.removeCellEditor(cellEditor);
-// }
-// }
+ public void cellEditorActivated(CellEditor cellEditor) {
+ if (cellEditorActionHandler != null) {
+ cellEditorActionHandler.addCellEditor(cellEditor);
+ }
+ }
+
+ public void cellEditorDeactivated(CellEditor cellEditor) {
+ if (cellEditorActionHandler != null) {
+ cellEditorActionHandler.removeCellEditor(cellEditor);
+ }
+ }
};
}
return cellEditorActivationListener;
@@ -302,9 +301,8 @@ public class PropertySheetPage extends Page implements IPropertySheetPage, IAdap
return;
}
// see if item is editable
-// RAP [fappel]: CellEditor not supported
-// boolean editable = viewer.getActiveCellEditor() != null;
-// defaultsAction.setEnabled(editable);
+ boolean editable = viewer.getActiveCellEditor() != null;
+ defaultsAction.setEnabled(editable);
}
}
@@ -480,7 +478,7 @@ public class PropertySheetPage extends Page implements IPropertySheetPage, IAdap
*/
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
-// RAP [fappel]: CellEditors not supported
+// RAP [rh] Clipboard not supported
// cellEditorActionHandler = new CellEditorActionHandler(actionBars);
// cellEditorActionHandler.setCopyAction(copyAction);
}
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
index 77ca5f312f..fa9ceabd97 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
@@ -12,19 +12,45 @@
package org.eclipse.ui.views.properties;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
-
-import javax.swing.CellEditor;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TreeEditor;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TreeEvent;
+import org.eclipse.swt.events.TreeListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.internal.views.properties.PropertiesMessages;
/**
@@ -77,8 +103,7 @@ class PropertySheetViewer extends Viewer {
private IPropertySheetEntryListener entryListener;
-// RAP [fappel]: CellEditor not supported
-// private ICellEditorListener editorListener;
+ private ICellEditorListener editorListener;
// Flag to indicate if categories (if any) should be shown
private boolean isShowingCategories = true;
@@ -132,53 +157,52 @@ class PropertySheetViewer extends Viewer {
* @param item
* the selected tree item
*/
-// RAP [fappel]: CellEditor not supported
-// private void activateCellEditor(TreeItem item) {
-// // ensure the cell editor is visible
-// tree.showSelection();
-//
-// // Get the entry for this item
-// IPropertySheetEntry activeEntry = (IPropertySheetEntry) item.getData();
-//
-// // Get the cell editor for the entry.
-// // Note that the editor parent must be the Tree control
-// cellEditor = activeEntry.getEditor(tree);
-//
-// if (cellEditor == null) {
-// // unable to create the editor
-// return;
-// }
-//
-// // activate the cell editor
-// cellEditor.activate();
-//
-// // if the cell editor has no control we can stop now
-// Control control = cellEditor.getControl();
-// if (control == null) {
-// cellEditor.deactivate();
-// cellEditor = null;
-// return;
-// }
-//
-// // add our editor listener
-// cellEditor.addListener(editorListener);
-//
-// // set the layout of the tree editor to match the cell editor
-// CellEditor.LayoutData layout = cellEditor.getLayoutData();
-// treeEditor.horizontalAlignment = layout.horizontalAlignment;
-// treeEditor.grabHorizontal = layout.grabHorizontal;
-// treeEditor.minimumWidth = layout.minimumWidth;
-// treeEditor.setEditor(control, item, columnToEdit);
-//
-// // set the error text from the cel editor
-// setErrorMessage(cellEditor.getErrorMessage());
-//
-// // give focus to the cell editor
-// cellEditor.setFocus();
-//
-// // notify of activation
-// fireCellEditorActivated(cellEditor);
-// }
+ private void activateCellEditor(TreeItem item) {
+ // ensure the cell editor is visible
+ tree.showSelection();
+
+ // Get the entry for this item
+ IPropertySheetEntry activeEntry = (IPropertySheetEntry) item.getData();
+
+ // Get the cell editor for the entry.
+ // Note that the editor parent must be the Tree control
+ cellEditor = activeEntry.getEditor(tree);
+
+ if (cellEditor == null) {
+ // unable to create the editor
+ return;
+ }
+
+ // activate the cell editor
+ cellEditor.activate();
+
+ // if the cell editor has no control we can stop now
+ Control control = cellEditor.getControl();
+ if (control == null) {
+ cellEditor.deactivate();
+ cellEditor = null;
+ return;
+ }
+
+ // add our editor listener
+ cellEditor.addListener(editorListener);
+
+ // set the layout of the tree editor to match the cell editor
+ CellEditor.LayoutData layout = cellEditor.getLayoutData();
+ treeEditor.horizontalAlignment = layout.horizontalAlignment;
+ treeEditor.grabHorizontal = layout.grabHorizontal;
+ treeEditor.minimumWidth = layout.minimumWidth;
+ treeEditor.setEditor(control, item, columnToEdit);
+
+ // set the error text from the cel editor
+ setErrorMessage(cellEditor.getErrorMessage());
+
+ // give focus to the cell editor
+ cellEditor.setFocus();
+
+ // notify of activation
+ fireCellEditorActivated(cellEditor);
+ }
/**
* Adds a cell editor activation listener. Has no effect if an identical
@@ -277,21 +301,20 @@ class PropertySheetViewer extends Viewer {
* Creates a new cell editor listener.
*/
private void createEditorListener() {
-// RAP [fappel]: CellEditor not supported
-// editorListener = new ICellEditorListener() {
-// public void cancelEditor() {
-// deactivateCellEditor();
-// }
-//
-// public void editorValueChanged(boolean oldValidState,
-// boolean newValidState) {
-// //Do nothing
-// }
-//
-// public void applyEditorValue() {
-// //Do nothing
-// }
-// };
+ editorListener = new ICellEditorListener() {
+ public void cancelEditor() {
+ deactivateCellEditor();
+ }
+
+ public void editorValueChanged(boolean oldValidState,
+ boolean newValidState) {
+ //Do nothing
+ }
+
+ public void applyEditorValue() {
+ //Do nothing
+ }
+ };
}
/**
@@ -383,11 +406,10 @@ class PropertySheetViewer extends Viewer {
void deactivateCellEditor() {
treeEditor.setEditor(null, null, columnToEdit);
if (cellEditor != null) {
-// RAP [fappel]: CellEditor not supported
-// cellEditor.deactivate();
-// fireCellEditorDeactivated(cellEditor);
-// cellEditor.removeListener(editorListener);
-// cellEditor = null;
+ cellEditor.deactivate();
+ fireCellEditorDeactivated(cellEditor);
+ cellEditor.removeListener(editorListener);
+ cellEditor = null;
}
// clear any error message from the editor
setErrorMessage(null);
@@ -468,14 +490,13 @@ class PropertySheetViewer extends Viewer {
* @param activatedCellEditor
* the activated cell editor
*/
-// RAP [fappel]: CellEditor not supported
-// private void fireCellEditorActivated(CellEditor activatedCellEditor) {
-// Object[] listeners = activationListeners.getListeners();
-// for (int i = 0; i < listeners.length; ++i) {
-// ((ICellEditorActivationListener) listeners[i])
-// .cellEditorActivated(activatedCellEditor);
-// }
-// }
+ private void fireCellEditorActivated(CellEditor activatedCellEditor) {
+ Object[] listeners = activationListeners.getListeners();
+ for (int i = 0; i < listeners.length; ++i) {
+ ((ICellEditorActivationListener) listeners[i])
+ .cellEditorActivated(activatedCellEditor);
+ }
+ }
/**
* Notifies all registered cell editor activation listeners of a cell editor
@@ -484,14 +505,13 @@ class PropertySheetViewer extends Viewer {
* @param activatedCellEditor
* the deactivated cell editor
*/
-// RAP [fappel]: CellEditor not supported
-// private void fireCellEditorDeactivated(CellEditor activatedCellEditor) {
-// Object[] listeners = activationListeners.getListeners();
-// for (int i = 0; i < listeners.length; ++i) {
-// ((ICellEditorActivationListener) listeners[i])
-// .cellEditorDeactivated(activatedCellEditor);
-// }
-// }
+ private void fireCellEditorDeactivated(CellEditor activatedCellEditor) {
+ Object[] listeners = activationListeners.getListeners();
+ for (int i = 0; i < listeners.length; ++i) {
+ ((ICellEditorActivationListener) listeners[i])
+ .cellEditorDeactivated(activatedCellEditor);
+ }
+ }
/**
* Returns the active cell editor of this property sheet viewer or
@@ -712,8 +732,7 @@ class PropertySheetViewer extends Viewer {
setMessage(activeEntry.getDescription());
// activate a cell editor on the selection
-// RAP [fappel]: CellEditor not supported
-// activateCellEditor(sel[0]);
+ activateCellEditor(sel[0]);
}
}
entrySelectionChanged();
@@ -782,10 +801,9 @@ class PropertySheetViewer extends Viewer {
public void widgetSelected(SelectionEvent e) {
// The viewer only owns the status line when there is
// no 'active' cell editor
-// RAP [fappel]: CellEditor not supported
-// if (cellEditor == null || !cellEditor.isActivated()) {
-// updateStatusLine(e.item);
-// }
+ if (cellEditor == null || !cellEditor.isActivated()) {
+ updateStatusLine(e.item);
+ }
}
/* (non-Javadoc)
@@ -797,7 +815,9 @@ class PropertySheetViewer extends Viewer {
});
// Part2: handle single click activation of cell editor
tree.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
+// RAP XXX [rh] Tree widget does not send mouseDown events
+// public void mouseDown(MouseEvent event) {
+ public void mouseUp(MouseEvent event) {
// only activate if there is a cell editor
Point pt = new Point(event.x, event.y);
TreeItem item = tree.getItem(pt);
diff --git a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
index 7244f62233..0f26f7b090 100644
--- a/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
+++ b/bundles/org.eclipse.rap.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
@@ -10,6 +10,10 @@
*******************************************************************************/
package org.eclipse.ui.views.properties;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.widgets.Composite;
+
/**
* Descriptor for a property that has a value which should be edited with a
@@ -43,13 +47,13 @@ public class TextPropertyDescriptor extends PropertyDescriptor {
* <p>
* The editor is configured with the current validator if there is one.
* </p>
+ * @since 1.2
*/
-// RAP [fappel]: CellEditor not supported
-// public CellEditor createPropertyEditor(Composite parent) {
-// CellEditor editor = new TextCellEditor(parent);
-// if (getValidator() != null) {
-// editor.setValidator(getValidator());
-// }
-// return editor;
-// }
+ public CellEditor createPropertyEditor(Composite parent) {
+ CellEditor editor = new TextCellEditor(parent);
+ if (getValidator() != null) {
+ editor.setValidator(getValidator());
+ }
+ return editor;
+ }
}

Back to the top