Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2015-07-23 08:22:33 +0000
committerMaxime Porhel2015-08-03 15:11:15 +0000
commit10506d12ada09a5177f746a02b902e7b80970499 (patch)
tree2c2ce5d300b514356d3b7e6026bda5866653a6bc
parenta3942fa1db17baa075ac165e02612a6f88511a33 (diff)
downloadorg.eclipse.sirius-10506d12ada09a5177f746a02b902e7b80970499.tar.gz
org.eclipse.sirius-10506d12ada09a5177f746a02b902e7b80970499.tar.xz
org.eclipse.sirius-10506d12ada09a5177f746a02b902e7b80970499.zip
[473263] 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: 473263 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 5bdd9c23ca..3dc75548f0 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;
@@ -115,7 +116,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;
@@ -450,6 +451,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 5b502b1a4a..a6e590daed 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
@@ -291,6 +291,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