Author: scabanovich
Date: 2008-10-07 06:45:32 -0400 (Tue, 07 Oct 2008)
New Revision: 10704
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java
Log:
Tree selection synchronized to text selection on changing tab to Tree.
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-07
08:46:38 UTC (rev 10703)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java 2008-10-07
10:45:32 UTC (rev 10704)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.editors.multipage;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.jboss.tools.common.model.ui.texteditors.*;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.editor.*;
@@ -93,6 +95,12 @@
} 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);
}
}
}
Show replies by date