Author: scabanovich
Date: 2008-10-15 09:53:29 -0400 (Wed, 15 Oct 2008)
New Revision: 10852
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java
Log:
Selection improved
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2008-10-15
13:42:13 UTC (rev 10851)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2008-10-15
13:53:29 UTC (rev 10852)
@@ -848,9 +848,15 @@
if(postponedTextSelection.selected != null) {
Display.getDefault().asyncExec(postponedTextSelection);
}
+ if(newPageIndex != getSourcePageIndex()) {
+ synchronizeSelectionWithText();
+ }
activateSite();
}
-
+
+ protected void synchronizeSelectionWithText() {
+ }
+
protected void updateSelectionProvider() {
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2008-10-15
13:42:13 UTC (rev 10851)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java 2008-10-15
13:53:29 UTC (rev 10852)
@@ -270,6 +270,10 @@
PropertyChangeEvent event = new PropertyChangeEvent(this, IPropertyEditor.VALUE,
oldValue, stringValue);
valueChangeListener.valueChange(event);
revalidateValue();
+ if(this.valueProvider == null) {
+ //disposed already
+ return;
+ }
this.valueProvider.addValueChangeListener(this);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java 2008-10-15
13:42:13 UTC (rev 10851)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringFieldEditor.java 2008-10-15
13:53:29 UTC (rev 10852)
@@ -70,7 +70,10 @@
protected boolean validate() {
boolean result = false;
if (emptyStringAllowed) result = true;
- if (textField == null) result = false;
+ if (textField == null) {
+ result = false;
+ return result;
+ }
String txt = textField.getText();
if (txt == null) {
result = false;
@@ -308,7 +311,11 @@
if (isValid != oldState)
fireStateChanged(IS_VALID, oldState, isValid);
-
+
+ if(textField == null) {
+ //disposed
+ return;
+ }
String newValue = textField.getText();
if (!newValue.equals(oldValue)) {
fireValueChanged(VALUE, oldValue, newValue);
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java 2008-10-15
13:42:13 UTC (rev 10851)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java 2008-10-15
13:53:29 UTC (rev 10852)
@@ -95,14 +95,17 @@
} else {
if (treeFormPage != null) {
selectionProvider.setHost(treeFormPage.getSelectionProvider());
- if(getTextSelectionProvider() == null) return;
- ISelection s = getTextSelectionProvider().getSelection();
- if(s == null || s.isEmpty() || !(s instanceof IStructuredSelection)) return;
- Object o = ((IStructuredSelection)s).getFirstElement();
- if(!(o instanceof XModelObject) || o == getModelObject()) return;
- treeFormPage.getSelectionProvider().setSelection(s);
}
}
}
+
+ protected void synchronizeSelectionWithText() {
+ if(getTextSelectionProvider() == null || treeFormPage == null) return;
+ ISelection s = getTextSelectionProvider().getSelection();
+ if(s == null || s.isEmpty() || !(s instanceof IStructuredSelection)) return;
+ Object o = ((IStructuredSelection)s).getFirstElement();
+ if(!(o instanceof XModelObject) || o == getModelObject()) return;
+ treeFormPage.getSelectionProvider().setSelection(s);
+ }
}
Show replies by date