Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2015-07-23 08:22:33 +0000
committerMaxime Porhel2015-08-03 15:14:58 +0000
commit814bb278e6aa174611e2f183643f80bf6f434890 (patch)
tree96c352c2357023cf28922a13be3baa53f417ca87
parent5154a54284971b7ed6a2811b34e54e772c9b8aa7 (diff)
downloadorg.eclipse.sirius-814bb278e6aa174611e2f183643f80bf6f434890.tar.gz
org.eclipse.sirius-814bb278e6aa174611e2f183643f80bf6f434890.tar.xz
org.eclipse.sirius-814bb278e6aa174611e2f183643f80bf6f434890.zip
[473943] Table/Tree editor are not able to resolve their proxy input
The tabe/tree opened editors reference a proxy model element after a reload of the aird. Bug: 473943 Change-Id: I777c551a1a41a375b55c903f359f2a1b1c3f2b9d Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/AbstractDTableEditor.java21
-rw-r--r--plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java39
2 files changed, 59 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/AbstractDTableEditor.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/AbstractDTableEditor.java
index 3cbfced484..1d6a87a064 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/AbstractDTableEditor.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/AbstractDTableEditor.java
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.ui.URIEditorInput;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -113,7 +114,7 @@ public abstract class AbstractDTableEditor extends AbstractDTreeEditor implement
*/
protected AdapterFactory adapterFactory;
- /** This is the one adapter factory used for providing views of the model */
+ /** This DTable model */
private DTable tableModel;
private IPartListener refreshAtOpeningActivator;
@@ -436,6 +437,24 @@ public abstract class AbstractDTableEditor extends AbstractDTreeEditor implement
public void setFocus() {
if (treeViewerManager != null) {
super.setFocus();
+
+ // Resolve proxy model after aird reload.
+ if (tableModel != null && tableModel.eIsProxy() && session != null) {
+ IEditorInput editorInput = getEditorInput();
+ if (editorInput instanceof URIEditorInput) {
+ URIEditorInput sessionEditorInput = (URIEditorInput) editorInput;
+ final URI uri = sessionEditorInput.getURI();
+ setTableModel(getDTable(uri, false));
+ IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
+ if (uiSession != null && tableModel != null) {
+ // Reinit dialect editor closer and other
+ // IEditingSession mechanisms.
+ uiSession.detachEditor(this);
+ uiSession.attachEditor(this);
+ }
+ }
+ }
+
checkSemanticAssociation();
}
}
diff --git a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java
index a4006a8791..a67e6cbbe2 100644
--- a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java
+++ b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/DTreeEditor.java
@@ -281,6 +281,45 @@ public class DTreeEditor extends AbstractDTreeEditor implements org.eclipse.siri
}
}
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFocus() {
+ if (treeViewerManager != null) {
+ super.setFocus();
+
+ // Resolve proxy model after aird reload.
+ if (treeModel != null && treeModel.eIsProxy() && session != null) {
+ IEditorInput editorInput = getEditorInput();
+ if (editorInput instanceof URIEditorInput) {
+ URIEditorInput sessionEditorInput = (URIEditorInput) editorInput;
+ final URI uri = sessionEditorInput.getURI();
+ setTreeModel(getDTree(uri, false));
+ IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
+ if (uiSession != null && treeModel != null) {
+ //Reinit dialect editor closer and other IEditingSession mechanisms.
+ uiSession.detachEditor(this);
+ uiSession.attachEditor(this);
+ }
+ }
+ }
+
+ checkSemanticAssociation();
+ }
+ }
+
+ private void checkSemanticAssociation() {
+ if (treeModel == null || treeModel.eResource() == null || treeModel.getTarget() == null || treeModel.getTarget().eResource() == null) {
+ /*
+ * The element has been deleted, we should close the editor
+ */
+ myDialogFactory.editorWillBeClosedInformationDialog(getSite().getShell());
+ DialectUIManager.INSTANCE.closeEditor(this, false);
+ }
+ }
+
private DTree getDTree(final URI uri, final boolean loadOnDemand) {
DTree result = null;
final Resource resource = getEditingDomain().getResourceSet().getResource(uri.trimFragment(), loadOnDemand);

Back to the top