X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FdiagramEditor%2FSheetViewer.java;h=22a1b59e4ec9a22d9d466b986c1bee0d9afa9631;hb=b4374193caf61635d382af556ec913bf278d53a8;hp=fbe48fbe2ec4aebcde60801b4be7acd5a867f05f;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java index fbe48fbe2..22a1b59e4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/SheetViewer.java @@ -30,6 +30,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.part.EditorPart; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -194,7 +195,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected String getPopupId() { - return "#ModelingDiagramPopup"; + return "#ModelingDiagramPopup"; //$NON-NLS-1$ } protected void getPreferences() { @@ -202,7 +203,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected void initSession() { - sessionContextProvider = SimanticsUI.getSessionContextProvider(); + sessionContextProvider = Simantics.getSessionContextProvider(); sessionContext = sessionContextProvider.getSessionContext(); } @@ -226,7 +227,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { swt = SWTThread.getThreadAccess(parent.getDisplay()); statusLineManager = getEditorSite().getActionBars().getStatusLineManager(); - Object task = BEGIN("DV.initSession"); + Object task = BEGIN("DV.initSession"); //$NON-NLS-1$ initSession(); END(task); @@ -234,7 +235,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { readNames(); getPreferences(); - task = BEGIN("DV.createChassis"); + task = BEGIN("DV.createChassis"); //$NON-NLS-1$ createChassis(parent); END(task); @@ -245,9 +246,9 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected void initializeCanvas() { - Object canvasInit = BEGIN("DV.canvasInitialization"); + Object canvasInit = BEGIN("DV.canvasInitialization"); //$NON-NLS-1$ - Object task = BEGIN("DV.createViewerCanvas"); + Object task = BEGIN("DV.createViewerCanvas"); //$NON-NLS-1$ // ThreadUtils.syncExec(AWTThread.getThreadAccess(), new Runnable() { // @Override // public void run() { @@ -258,17 +259,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { //FullscreenUtils.addFullScreenHandler(canvasContext, s, canvasProvider); - task = BEGIN("DV.setCanvasContext"); + task = BEGIN("DV.setCanvasContext"); //$NON-NLS-1$ setCanvasContext(canvasContext); END(task); try { - task = BEGIN("DV.loadDiagram"); + task = BEGIN("DV.loadDiagram"); //$NON-NLS-1$ sourceDiagram = loadDiagram(diagramResource); END(task); // Zoom to fit - task = BEGIN("DV.scheduleZoomToFit"); + task = BEGIN("DV.scheduleZoomToFit"); //$NON-NLS-1$ // canvasContext.getDefaultHintContext().setHint(Hints.KEY_CANVAS_TRANSFORM, new AffineTransform()); // canvasContext.getContentContext().setDirty(); @@ -278,15 +279,15 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { // Start an activation for the input resource. // This will activate mapping if necessary. - task = BEGIN("DV.performActivation"); + task = BEGIN("DV.performActivation"); //$NON-NLS-1$ performActivation(); END(task); - task = BEGIN("DV.activate context"); + task = BEGIN("DV.activate context"); //$NON-NLS-1$ contextUtil.activate(DiagramViewer.DIAGRAMMING_CONTEXT); END(task); - task = BEGIN("DV.onCreated"); + task = BEGIN("DV.onCreated"); //$NON-NLS-1$ onCreated(); END(task); @@ -312,7 +313,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { protected void scheduleZoomToFit() { if (sourceDiagram == null) - throw new IllegalStateException("source diagram is null"); + throw new IllegalStateException("source diagram is null"); //$NON-NLS-1$ sourceDiagram.setHint(Hints.KEY_DISABLE_PAINTING, Boolean.TRUE); sourceDiagram.setHint(DiagramHints.KEY_INITIAL_ZOOM_TO_FIT, Boolean.TRUE); @@ -352,7 +353,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100); + SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100); try { dc.set( loadDiagram(mon.newChild(100), r) ); } catch (DatabaseException e) { @@ -374,17 +375,17 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected IDiagram loadDiagram(IProgressMonitor monitor, Resource r) throws DatabaseException { - SubMonitor mon = SubMonitor.convert(monitor, "Loading Diagram", 100); + SubMonitor mon = SubMonitor.convert(monitor, Messages.SheetViewer_MonitorLoadingDiagram, 100); - Object task = BEGIN("DV.DiagramLoadQuery"); + Object task = BEGIN("DV.DiagramLoadQuery"); //$NON-NLS-1$ IDiagram d = sessionContext.getSession().syncRequest(DiagramRequests.loadDiagram(mon.newChild(100), getResourceInput2().getModel(null), r, null, structuralPath, synchronizer, null)); END(task); - task = BEGIN("DV.setDiagramHint"); + task = BEGIN("DV.setDiagramHint"); //$NON-NLS-1$ canvasContext.getDefaultHintContext().setHint(DiagramHints.KEY_DIAGRAM, d); END(task); - task = BEGIN("DV.set other hints"); + task = BEGIN("DV.set other hints"); //$NON-NLS-1$ // Setup a copy advisor for the synchronizer //d.setHint(SynchronizationHints.COPY_ADVISOR, new MappedElementCopyAdvisor(new ComponentCopyAdvisor())); d.setHint(DiagramHints.KEY_USE_CONNECTION_FLAGS, Boolean.FALSE); @@ -406,7 +407,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } }); } catch (DatabaseException e) { - throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); + throw new UnsupportedOperationException("Failed to initialize data model synchronizer", e); //$NON-NLS-1$ } } @@ -427,7 +428,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { CanvasContext ctx = new CanvasContext(thread); IHintContext h = ctx.getDefaultHintContext(); - Object task = BEGIN("createSynchronizer"); + Object task = BEGIN("createSynchronizer"); //$NON-NLS-1$ this.synchronizer = createSynchronizer(ctx, sessionContext); END(task); @@ -618,7 +619,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { if (!(input instanceof IResourceEditorInput)) - throw new PartInitException("Invalid input: must be IResourceEditorInput"); + throw new PartInitException("Invalid input: must be IResourceEditorInput"); //$NON-NLS-1$ setSite(site); setInput(input); support = new ResourceEditorSupport(this); @@ -626,7 +627,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { // Set initial part name according to the name given by IEditorInput setPartName(getEditorInput().getName()); - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session != null) { Supplier disposedCallback = () -> disposed; session.asyncRequest(