Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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