Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2017-07-18 11:46:34 -0400
committerAnsgar Radermacher2017-08-01 04:41:49 -0400
commitbb30ad4f8e8a27d005fd4775a539d836e2cb4084 (patch)
treef27d0b7cdb7d2ad2e98c56321ee3e2069bd50c50 /plugins
parent978c492e71a07f6359e0e671d9c4c31d8db92f63 (diff)
downloadorg.eclipse.papyrus-bb30ad4f8e8a27d005fd4775a539d836e2cb4084.tar.gz
org.eclipse.papyrus-bb30ad4f8e8a27d005fd4775a539d836e2cb4084.tar.xz
org.eclipse.papyrus-bb30ad4f8e8a27d005fd4775a539d836e2cb4084.zip
Bug 519107 - [All diagrams] model opening is slow, if multiple diagrams are open
- Delay diagram initialization until diagram gets focus, show busy cursor while diagram is initialized Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java
index df76d78fa31..72d7d380169 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java
@@ -29,7 +29,9 @@ import org.eclipse.papyrus.infra.internationalization.common.editor.IInternation
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils;
import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.contexts.IContextService;
/**
@@ -58,6 +60,13 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor implemen
private ServicesRegistry servicesRegistry;
/**
+ * boolean indicating whether the viewer has already been initialized.
+ * Used for lazy initialization (wait, until set Focus is called) to reduce opening time
+ * of Papyrus editor.
+ */
+ protected boolean viewerInitialized = false;
+
+ /**
* Constructor.
*
* @param servicesRegistry
@@ -80,6 +89,42 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor implemen
// account.
ISaveAndDirtyService saveAndDirtyService = servicesRegistry.getService(ISaveAndDirtyService.class);
saveAndDirtyService.registerIsaveablePart(this);
+ viewerInitialized = false;
+ }
+
+ /**
+ * Override to initialize viewer, if it gets in focus
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ if (!viewerInitialized) {
+ BusyIndicator.showWhile(Display.getDefault(), new Runnable(){
+
+ public void run(){
+ doInitializeGraphicalViewer();
+ viewerInitialized = true;
+ }
+ });
+ }
+ super.setFocus();
+ }
+
+ /**
+ * Initialize the graphical viewer (calls superclass)
+ */
+ protected void doInitializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeGraphicalViewer() {
+ // do nothing to enable a lazy initialization.
+ // initialization is done, if setFocus is called.
}
/**

Back to the top