From: jsimomaa Date: Thu, 30 Aug 2018 08:11:29 +0000 (+0300) Subject: Remove usage of deprecated SimanticsUI-methods X-Git-Tag: v1.43.0~136^2~391 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e88be95edf1f80781646cfdf717ec1b663264179;p=simantics%2Fplatform.git Remove usage of deprecated SimanticsUI-methods gitlab #95 Change-Id: Ia5a4dfc13d4a9ecce0b3182ee1b38f63fb67731d --- diff --git a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeExportWizard.java b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeExportWizard.java index 95b416aef..72318b3f4 100644 --- a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeExportWizard.java +++ b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeExportWizard.java @@ -26,12 +26,12 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IExportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.annotation.ui.Activator; import org.simantics.db.management.ISessionContext; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -78,7 +78,7 @@ public class AnnotationTypeExportWizard extends Wizard implements IExportWizard public void init(IWorkbench workbench, IStructuredSelection selection) { readPreferences(); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeImportWizard.java b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeImportWizard.java index e51ab092c..ce3d8c1da 100644 --- a/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeImportWizard.java +++ b/bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/AnnotationTypeImportWizard.java @@ -28,6 +28,7 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IImportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.annotation.ui.Activator; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.container.DataContainer; @@ -35,7 +36,6 @@ import org.simantics.databoard.container.DataContainers; import org.simantics.databoard.container.DataFormatException; import org.simantics.databoard.container.FormatHandler; import org.simantics.databoard.serialization.SerializationException; -import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; @@ -46,7 +46,6 @@ import org.simantics.graph.representation.TransferableGraph1; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -66,7 +65,7 @@ public class AnnotationTypeImportWizard extends Wizard implements IImportWizard String recentPathsPref = store.getString(Preferences.RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS); Deque recentImportPaths = Preferences.decodePaths(recentPathsPref); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return false; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/PropertyPageView.java b/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/PropertyPageView.java index 4376ae370..0d4fc055b 100644 --- a/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/PropertyPageView.java +++ b/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/PropertyPageView.java @@ -44,9 +44,9 @@ import org.eclipse.ui.part.IContributedContentsView; import org.eclipse.ui.part.IPage; import org.eclipse.ui.part.IPageBookViewPage; import org.eclipse.ui.part.PageBook; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContextProvider; import org.simantics.selectionview.PropertyPage; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IPropertyPage; import org.simantics.ui.workbench.ResourceInput; import org.simantics.utils.threads.SWTThread; @@ -213,7 +213,7 @@ public class PropertyPageView extends PageBookView implements ISelectionListener // desirable. // site.setSelectionProvider(null); - contextProvider = SimanticsUI.getSessionContextProvider(); + contextProvider = Simantics.getSessionContextProvider(); if (!bootstrapOnly) { site.getPage().addSelectionListener(immediateSelectionListener); diff --git a/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/VariablesPageView.java b/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/VariablesPageView.java index cfa988b88..d0e904e3a 100644 --- a/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/VariablesPageView.java +++ b/bundles/org.simantics.browsing.ui.platform/src/org/simantics/browsing/ui/platform/VariablesPageView.java @@ -32,10 +32,10 @@ import org.eclipse.ui.part.IContributedContentsView; import org.eclipse.ui.part.IPage; import org.eclipse.ui.part.PageBook; import org.eclipse.ui.part.PageBookView; +import org.simantics.Simantics; import org.simantics.browsing.ui.swt.IVariablesPage; import org.simantics.db.management.ISessionContextProvider; import org.simantics.selectionview.PropertyPage; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IPropertyPage; import org.simantics.ui.workbench.ResourceInput; import org.simantics.utils.ui.BundleUtils; @@ -188,7 +188,7 @@ public class VariablesPageView extends PageBookView implements ISelectionListene // desirable. site.setSelectionProvider(null); - contextProvider = SimanticsUI.getSessionContextProvider(); + contextProvider = Simantics.getSessionContextProvider(); if (!bootstrapOnly) { site.getPage().addSelectionListener(immediateSelectionListener); diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultMouseListener.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultMouseListener.java index 58d9703ec..6731b396a 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultMouseListener.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/DefaultMouseListener.java @@ -13,10 +13,10 @@ package org.simantics.browsing.ui.swt; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Control; +import org.simantics.Simantics; import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.common.node.IDoubleClickableNode; import org.simantics.db.common.procedure.adapter.ProcedureAdapter; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.action.ChooseActionRequest; import org.simantics.utils.ui.AdaptionUtils; import org.simantics.utils.ui.ErrorLogger; @@ -55,7 +55,7 @@ public class DefaultMouseListener extends GraphExplorerMouseAdapter { // Try the doubleClick-extensions final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId(); - SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(tree.getShell(), ge, selection, perspectiveId), new ProcedureAdapter() { + Simantics.getSession().asyncRequest(new ChooseActionRequest(tree.getShell(), ge, selection, perspectiveId), new ProcedureAdapter() { @Override public void exception(Throwable t) { ErrorLogger.defaultLogError(ChooseActionRequest.class.getName() + " failed, see exception for details.", t); diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java index 0ee36b365..42ee2bdf8 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java @@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.contexts.IContextService; +import org.simantics.Simantics; import org.simantics.browsing.ui.BuiltinKeys; import org.simantics.browsing.ui.Column; import org.simantics.browsing.ui.ExplorerState; @@ -409,7 +410,7 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta if(site != null) return SimanticsUI.getSessionContextProvider(site.getWorkbenchWindow()); else - return SimanticsUI.getSessionContextProvider(); + return Simantics.getSessionContextProvider(); } public GraphExplorer getExplorer() { diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartEditorAdapter.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartEditorAdapter.java index 45c96b664..7e9e3eaf8 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartEditorAdapter.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartEditorAdapter.java @@ -12,13 +12,13 @@ package org.simantics.charts.editor; import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.Simantics; import org.simantics.charts.Activator; import org.simantics.charts.ontology.ChartResource; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.Queries; import org.simantics.db.exception.DatabaseException; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.ui.workbench.ResourceEditorInput; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; @@ -49,7 +49,7 @@ public class ChartEditorAdapter extends AbstractResourceEditorAdapter { @Override public void openEditor(Resource input) throws Exception { - if (!SimanticsUI.getSession().syncRequest(Queries.isInstanceOf(input, ChartResource.URIs.TimeSeriesChart))) + if (!Simantics.getSession().syncRequest(Queries.isInstanceOf(input, ChartResource.URIs.TimeSeriesChart))) return; //E4WorkbenchUtils.openEditor(TimeSeriesEditor.ID, TimeSeriesEditor.CONTRIBUTION_URI, null, input); openEditorWithId(TimeSeriesEditor.ID, new ResourceEditorInput(TimeSeriesEditor.ID, input)); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/PropertiesAction.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/PropertiesAction.java index 2ec342f36..ec6376729 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/PropertiesAction.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/PropertiesAction.java @@ -3,13 +3,13 @@ package org.simantics.charts.editor; import org.eclipse.jface.action.Action; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; +import org.simantics.Simantics; import org.simantics.charts.ontology.ChartResource; import org.simantics.charts.ui.ChartDoubleClickHandler; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -28,7 +28,7 @@ public class PropertiesAction extends Action { @Override public void run() { final Shell shell = control.getShell(); - SimanticsUI.getSession().asyncRequest(new Read() { + Simantics.getSession().asyncRequest(new Read() { @Override public Object perform(ReadGraph graph) throws DatabaseException { ChartResource CHART = ChartResource.getInstance(graph); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/ui/CSVExportWizard.java b/bundles/org.simantics.charts/src/org/simantics/charts/ui/CSVExportWizard.java index f23db80b2..4632d2696 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/ui/CSVExportWizard.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/ui/CSVExportWizard.java @@ -26,12 +26,12 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IExportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContext; import org.simantics.modeling.ui.Activator; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -76,7 +76,7 @@ public class CSVExportWizard extends Wizard implements IExportWizard { public void init(IWorkbench workbench, IStructuredSelection selection) { readPreferences(); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/ui/PropertiesHandler.java b/bundles/org.simantics.charts/src/org/simantics/charts/ui/PropertiesHandler.java index 327e5ba45..af053dc57 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/ui/PropertiesHandler.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/ui/PropertiesHandler.java @@ -19,6 +19,7 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.charts.ontology.ChartResource; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -26,7 +27,6 @@ import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.SelectionHints; import org.simantics.db.request.Read; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ISelectionUtils; public class PropertiesHandler extends AbstractHandler { @@ -36,7 +36,7 @@ public class PropertiesHandler extends AbstractHandler { ISelection selection = HandlerUtil.getCurrentSelection(event); List list = ISelectionUtils.getPossibleKeys(selection, SelectionHints.KEY_MAIN, Resource.class); final Shell shell = HandlerUtil.getActiveShell(event); - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); for ( final Resource item : list ) { session.asyncRequest(new Read() { @Override diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java index a08011fed..62b7e3825 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java @@ -3179,9 +3179,11 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule }); Throwable t = exception.get(); - if(t != null) { - if(t instanceof DatabaseException) throw (DatabaseException)t; - else throw new DatabaseException("Unexpected exception in ReadGraph.syncRequest(Read)", t); + if (t != null) { + if (t instanceof DatabaseException) + throw (DatabaseException) t; + else + throw new DatabaseException("Unexpected exception in ReadGraph.syncRequest(Read)", t); } return result; @@ -3387,28 +3389,6 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule asyncRequest(request, (Procedure)procedure); } - - - void check(Throwable t) throws DatabaseException { - if(t != null) { - if(t instanceof DatabaseException) throw (DatabaseException)t; - else throw new DatabaseException("Unexpected exception", t); - } - } - - void check(DataContainer container) throws DatabaseException { - Throwable t = container.get(); - if(t != null) { - if(t instanceof DatabaseException) throw (DatabaseException)t; - else throw new DatabaseException("Unexpected exception", t); - } - } - - - - - - boolean sameProvider(Write request) { if(writeState.getGraph().provider != null) { return writeState.getGraph().provider.equals(request.getProvider()); @@ -3425,9 +3405,11 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule public static final ThreadGroup SessionThreadGroup = new ThreadGroup("Session Thread Group"); + private void assertNotSession() throws DatabaseException { Thread current = Thread.currentThread(); - if(sessionThreads.contains(current)) throw new DatabaseException("Caller is already inside a transaction."); + if (sessionThreads.contains(current)) + throw new ServiceException("Caller is already inside a transaction."); } void assertAlive() { diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java index 1840d2e62..7d9d67b2a 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebuggerView.java @@ -60,7 +60,7 @@ public class GraphDebuggerView extends ViewPart { @Override public void createPartControl(Composite parent) { // System.out.println("koss: " + getViewSite().getSecondaryId()); - session = SimanticsUI.getSession(); + session = Simantics.getSession(); // Initialize input String sid = getViewSite().getSecondaryId(); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java index 567366701..6edd79ad2 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebuggerView.java @@ -20,6 +20,7 @@ import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.uri.ResourceToPossibleURI; @@ -50,7 +51,7 @@ public class VariableDebuggerView extends ViewPart { @Override public void createPartControl(Composite parent) { - session = SimanticsUI.getSession(); + session = Simantics.getSession(); // Initialize input String sid = getViewSite().getSecondaryId(); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java index ca2089a39..1c17001f0 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/graph/GraphicalDebuggerView.java @@ -20,6 +20,7 @@ import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.ViewPart; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; @@ -52,7 +53,7 @@ public class GraphicalDebuggerView extends ViewPart { @Override public void createPartControl(Composite parent) { // System.out.println("koss: " + getViewSite().getSecondaryId()); - session = SimanticsUI.getSession(); + session = Simantics.getSession(); // Initialize input String sid = getViewSite().getSecondaryId(); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementPropertyTester.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementPropertyTester.java index 4e4cea2c0..0db036320 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementPropertyTester.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementPropertyTester.java @@ -13,6 +13,7 @@ package org.simantics.diagram.elements; import org.eclipse.core.expressions.PropertyTester; import org.simantics.DatabaseJob; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -42,7 +43,7 @@ public class ElementPropertyTester extends PropertyTester { if (resource == null) return false; - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session == null) return false; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementTransforms.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementTransforms.java index 51d37b99a..916c27488 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementTransforms.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/ElementTransforms.java @@ -9,6 +9,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.UndoContext; @@ -34,7 +35,6 @@ import org.simantics.g2d.element.impl.Element; import org.simantics.g2d.utils.GeometryUtils; import org.simantics.scl.commands.Command; import org.simantics.scl.commands.Commands; -import org.simantics.ui.SimanticsUI; /** * Tools to align, rotate, and flip diagram elements. @@ -66,7 +66,7 @@ public final class ElementTransforms { if (side == SIDE.HORIZ_BTW || side == SIDE.VERT_BTW ) return; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { @@ -182,7 +182,7 @@ public final class ElementTransforms { if (resources.length < 3) return; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { @@ -412,7 +412,7 @@ public final class ElementTransforms { * false to rotate 90 degrees counter-clockwise */ public static void rotate(final Resource resources[], final boolean clockwise) { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); @@ -496,7 +496,7 @@ public final class ElementTransforms { * for y-axis */ public static void flip(final Resource resources[], final boolean xAxis) { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagPropertyTester.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagPropertyTester.java index ade5987ab..84f8ecc80 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagPropertyTester.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/FlagPropertyTester.java @@ -13,6 +13,7 @@ package org.simantics.diagram.flag; import org.eclipse.core.expressions.PropertyTester; import org.simantics.DatabaseJob; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -58,7 +59,7 @@ public class FlagPropertyTester extends PropertyTester { if (resource == null) return false; - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session == null) return false; diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/PredefinedVariables.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/PredefinedVariables.java index db47b9904..fcd10ae9c 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/function/PredefinedVariables.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/function/PredefinedVariables.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; +import org.simantics.Simantics; import org.simantics.annotation.ontology.AnnotationResource; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -17,7 +18,6 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.template2d.ontology.Template2dResource; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; public class PredefinedVariables { public static final String root = "root"; @@ -239,7 +239,7 @@ public class PredefinedVariables { if (id.equals(root)) predefined = graph.getRootLibrary(); else if (id.equals(project)) - predefined = SimanticsUI.getProject().get(); + predefined = Simantics.getProject().get(); else if (id.equals(model)) predefined = Variables.getPossibleModel(graph, selection); else if (id.equals(template)){ diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/ConnectionCommandHandler.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/ConnectionCommandHandler.java index ec2bc6a6f..ad3d510de 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/ConnectionCommandHandler.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/ConnectionCommandHandler.java @@ -133,7 +133,7 @@ public class ConnectionCommandHandler extends AbstractDiagramParticipant { // Rotate branch points. try { - SimanticsUI.getSession().syncRequest(new WriteRequest() { + Simantics.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { DiagramResource DIA = DiagramResource.getInstance(graph); @@ -186,7 +186,7 @@ public class ConnectionCommandHandler extends AbstractDiagramParticipant { final AffineTransform splitPos = AffineTransform.getTranslateInstance(mousePos.getX(), mousePos.getY()); try { - SimanticsUI.getSession().syncRequest(new WriteRequest() { + Simantics.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { DiagramResource DIA = DiagramResource.getInstance(graph); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/SimpleElementTransformHandler.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/SimpleElementTransformHandler.java index 6d55112c2..6e720f4a7 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/SimpleElementTransformHandler.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/handler/SimpleElementTransformHandler.java @@ -17,6 +17,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -36,7 +37,6 @@ import org.simantics.g2d.participant.MouseUtil.MouseInfo; import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler; import org.simantics.scenegraph.g2d.events.command.CommandEvent; import org.simantics.scenegraph.g2d.events.command.Commands; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; /** @@ -145,7 +145,7 @@ public class SimpleElementTransformHandler extends AbstractDiagramParticipant { resources.add((Resource) o); } try { - return SimanticsUI.getSession().syncRequest(new Read() { + return Simantics.getSession().syncRequest(new Read() { @Override public Resource[] perform(ReadGraph graph) throws DatabaseException { List result = getSelection(graph, resources); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/ElementSymbolItem.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/ElementSymbolItem.java index 8a8a796f5..9800fb720 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/ElementSymbolItem.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbolcontribution/ElementSymbolItem.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.simantics.diagram.symbolcontribution; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; @@ -24,7 +25,6 @@ import org.simantics.diagram.symbollibrary.ISymbolItem; import org.simantics.diagram.synchronization.graph.BasicResources; import org.simantics.g2d.element.ElementClass; import org.simantics.g2d.element.handler.StaticSymbol; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.cache.ProvisionException; import org.simantics.utils.datastructures.hints.IHintObservable; @@ -65,7 +65,7 @@ public class ElementSymbolItem extends SymbolItem { @Override public ElementClass getElementClass(IHintObservable hints) { Resource item = adapt(Resource.class); - RequestProcessor sgrp = SimanticsUI.peekSession(); + RequestProcessor sgrp = Simantics.peekSession(); if (sgrp == null) throw new ProvisionException("No RequestProcessor available for querying an ElementClass for resource " + item); try { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java index 4ec3258a7..af58be479 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java @@ -78,6 +78,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Widget; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.procedure.adapter.ListenerAdapter; @@ -128,7 +129,6 @@ import org.simantics.scenegraph.g2d.events.MouseEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDoubleClickedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDragBegin; import org.simantics.scl.runtime.tuple.Tuple2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.dnd.LocalObjectTransfer; import org.simantics.ui.dnd.LocalObjectTransferable; import org.simantics.ui.dnd.MultiTransferable; @@ -290,7 +290,7 @@ public class SymbolLibraryComposite extends Composite { public SymbolLibraryComposite(final Composite parent, int style, SymbolProviderFactory symbolProvider) { super(parent, style); init(parent, style); - SimanticsUI.getSession().asyncRequest(new CreateSymbolProvider(symbolProvider), new SymbolProviderListener()); + Simantics.getSession().asyncRequest(new CreateSymbolProvider(symbolProvider), new SymbolProviderListener()); addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolPageView.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolPageView.java index 5724cbcfe..e47487377 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolPageView.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolPageView.java @@ -24,10 +24,10 @@ import org.eclipse.ui.part.IPage; import org.eclipse.ui.part.Page; import org.eclipse.ui.part.PageBook; import org.eclipse.ui.part.PageBookView; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContextProvider; import org.simantics.diagram.symbolcontribution.EmptySymbolProviderFactory; import org.simantics.diagram.symbolcontribution.SymbolProviderFactory; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.BijectionMap; /** @@ -124,7 +124,7 @@ public class SymbolPageView extends PageBookView { // desirable. site.setSelectionProvider(null); - contextProvider = SimanticsUI.getSessionContextProvider(); + contextProvider = Simantics.getSessionContextProvider(); } @Override diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/RemoveSourceAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/RemoveSourceAction.java index b4bb6acc2..b797bacf8 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/RemoveSourceAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/RemoveSourceAction.java @@ -1,5 +1,6 @@ package org.simantics.document.linking.ge; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -7,7 +8,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.document.linking.ontology.DocumentLink; -import org.simantics.ui.SimanticsUI; public class RemoveSourceAction implements ActionFactory{ @@ -23,7 +23,7 @@ public class RemoveSourceAction implements ActionFactory{ @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ReplaceWithLatestAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ReplaceWithLatestAction.java index 98f1cbd27..2b2f23728 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ReplaceWithLatestAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ReplaceWithLatestAction.java @@ -1,5 +1,6 @@ package org.simantics.document.linking.ge; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -7,7 +8,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.document.linking.utils.SourceLinkUtil; -import org.simantics.ui.SimanticsUI; public class ReplaceWithLatestAction implements ActionFactory{ @@ -24,7 +24,7 @@ public class ReplaceWithLatestAction implements ActionFactory{ @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java index 4ba2cc914..47d59bc60 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentAction.java @@ -1,6 +1,7 @@ package org.simantics.document.linking.ge; import org.eclipse.swt.widgets.Display; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -9,7 +10,6 @@ import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.document.linking.ontology.DocumentLink; import org.simantics.document.linking.utils.SourceLinkUtil; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.editor.EditorAdapter; import org.simantics.ui.workbench.editor.EditorRegistry; import org.simantics.utils.ui.ExceptionUtils; @@ -28,7 +28,7 @@ public class ShowDocumentAction implements ActionFactory{ @Override public void run() { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java index 3b272910d..be2d5e33e 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/ShowDocumentWithAction.java @@ -12,6 +12,7 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.dialogs.ListDialog; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -20,7 +21,6 @@ import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.variable.Variable; import org.simantics.document.linking.ontology.DocumentLink; import org.simantics.document.linking.utils.SourceLinkUtil; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.editor.EditorAdapter; import org.simantics.ui.workbench.editor.EditorRegistry; import org.simantics.utils.ui.ExceptionUtils; @@ -39,7 +39,7 @@ public class ShowDocumentWithAction implements ActionFactory{ @Override public void run() { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceLinkExplorerComposite.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceLinkExplorerComposite.java index 8fbd0494e..22b00517b 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceLinkExplorerComposite.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceLinkExplorerComposite.java @@ -6,6 +6,7 @@ import java.util.Map; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbenchSite; +import org.simantics.Simantics; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.common.ErrorLogger; import org.simantics.browsing.ui.model.InvalidContribution; @@ -19,7 +20,6 @@ import org.simantics.db.common.request.ReadRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.Procedure; import org.simantics.db.request.Read; -import org.simantics.ui.SimanticsUI; public class SourceLinkExplorerComposite extends GraphExplorerComposite { @@ -44,7 +44,7 @@ public class SourceLinkExplorerComposite extends GraphExplorerComposite { } private void attachDND() { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { ArrayList browseContexts = new ArrayList(); @@ -67,7 +67,7 @@ public class SourceLinkExplorerComposite extends GraphExplorerComposite { if (target == null) return; - SimanticsUI.getSession().asyncRequest(new Read() { + Simantics.getSession().asyncRequest(new Read() { @Override public Runnable perform(ReadGraph graph) throws DatabaseException { if (dndBrowseContext == null) diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java index 663e630f7..ec2da54a1 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/ge/SourceObjectDropAction.java @@ -2,6 +2,7 @@ package org.simantics.document.linking.ge; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Display; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -13,7 +14,6 @@ import org.simantics.db.layer0.variable.Variable; import org.simantics.document.linking.ontology.DocumentLink; import org.simantics.document.linking.utils.SourceLinkUtil; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.AdaptionUtils; public class SourceObjectDropAction implements DropActionFactory { @@ -44,7 +44,7 @@ public class SourceObjectDropAction implements DropActionFactory { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java index 577f48e46..86afc31b8 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/evaluator/PredefinedVariables.java @@ -2,6 +2,7 @@ package org.simantics.document.linking.report.evaluator; import java.util.Collection; +import org.simantics.Simantics; import org.simantics.annotation.ontology.AnnotationResource; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -9,7 +10,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; /** * Copy-paste from org.simantics.diagram.function.PredefinedVariables (removed diagram specific stuff) @@ -63,7 +63,7 @@ public class PredefinedVariables { if (id.equals(root)) predefined = graph.getRootLibrary(); else if (id.equals(project)) - predefined = SimanticsUI.getProject().get(); + predefined = Simantics.getProject().get(); else if (id.equals(model)) predefined = Variables.getModel(graph, selection); else if (id.equals(template)){ diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java index 68c2b0045..e3b1c55d3 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/views/SourceView.java @@ -147,11 +147,11 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis browseComposite.setLayout(new GridLayout(2,false)); modelCombo = new CCombo(browseComposite, SWT.BORDER|SWT.READ_ONLY); final WidgetSupport support = new WidgetSupportImpl(); - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { - Resource project = SimanticsUI.getProject().get(); + Resource project = Simantics.getProject().get(); modelToComboListener = new ModelToComboListener(modelCombo) { @Override public Resource getCurrentModel() { @@ -317,7 +317,7 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis if (res == null) return; try { - final Resource selected = SimanticsUI.getSession().syncRequest(new Read() { + final Resource selected = Simantics.getSession().syncRequest(new Read() { @Override public Resource perform(ReadGraph graph) throws DatabaseException { try { @@ -335,8 +335,8 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis return; } ISelection realSelection = new StructuredSelection(selected); - objectExplorer.setInput(SimanticsUI.getSessionContext(), realSelection); - propertyExplorer.setInput(SimanticsUI.getSessionContext(), realSelection); + objectExplorer.setInput(Simantics.getSessionContext(), realSelection); + propertyExplorer.setInput(Simantics.getSessionContext(), realSelection); Simantics.getSession().asyncRequest(new ReadRequest() { @Override @@ -453,13 +453,13 @@ public class SourceView extends ViewPart implements ISelectionListener, IPartLis if (model.equals(r)) { modelCombo.select(i); ISelection realSelection = new StructuredSelection(currentModel); - browseExplorer.setInput(SimanticsUI.getSessionContext(), realSelection); + browseExplorer.setInput(Simantics.getSessionContext(), realSelection); return; } } modelCombo.select(-1); ISelection realSelection = new StructuredSelection(); - browseExplorer.setInput(SimanticsUI.getSessionContext(), realSelection); + browseExplorer.setInput(Simantics.getSessionContext(), realSelection); } @SuppressWarnings("rawtypes") diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java index da8ff028a..93423fc41 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/wizard/ReportSelectionPage.java @@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -125,11 +126,11 @@ public class ReportSelectionPage extends WizardPage{ reportSelectionButtons.add(b); } - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { - Resource project = SimanticsUI.getProject().get(); + Resource project = Simantics.getProject().get(); modelToComboListener = new ModelToComboListener(modelCombo) { @Override public Resource getCurrentModel() { diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java index 4a0283726..652476d90 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/ExportDocumentFile.java @@ -16,6 +16,7 @@ import java.io.File; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.FileDialog; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -25,7 +26,6 @@ import org.simantics.document.DocumentResource; import org.simantics.graphfile.ontology.GraphFileResource; import org.simantics.graphfile.util.GraphFileUtil; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; /** @@ -49,7 +49,7 @@ public class ExportDocumentFile implements ActionFactory { @Override public void run() { try { - String name = SimanticsUI.getSession().syncRequest(new Read() { + String name = Simantics.getSession().syncRequest(new Read() { public String perform(ReadGraph graph) throws DatabaseException { DocumentResource doc = DocumentResource.getInstance(graph); GraphFileResource gf = GraphFileResource.getInstance(graph); diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/FolderDropAction.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/FolderDropAction.java index e5eef2e4a..7991f328f 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/FolderDropAction.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/FolderDropAction.java @@ -2,6 +2,7 @@ package org.simantics.document.ui.actions; import java.util.List; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -10,7 +11,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.SelectionHints; import org.simantics.db.layer0.adapter.DropActionFactory; import org.simantics.document.DocumentResource; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ISelectionUtils; public class FolderDropAction implements DropActionFactory { @@ -48,7 +48,7 @@ public class FolderDropAction implements DropActionFactory { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java index f30cf6a14..2feadfdcb 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewDocumentFolder.java @@ -1,5 +1,6 @@ package org.simantics.document.ui.actions; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -8,7 +9,6 @@ import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; public class NewDocumentFolder implements ActionFactory { Resource folderType; @@ -30,7 +30,7 @@ public class NewDocumentFolder implements ActionFactory { return new Runnable() { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewFileDocument.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewFileDocument.java index fa34f241f..0ab824e91 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewFileDocument.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/actions/NewFileDocument.java @@ -2,6 +2,7 @@ package org.simantics.document.ui.actions; import java.io.IOException; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -12,7 +13,6 @@ import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.document.DocumentResource; import org.simantics.graphfile.util.GraphFileUtil; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; public class NewFileDocument implements ActionFactory { Resource relation; @@ -34,7 +34,7 @@ public class NewFileDocument implements ActionFactory { return new Runnable() { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java index ef6452955..15e4d6e74 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/graphfile/UrlEditorAdapter.java @@ -8,13 +8,13 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.document.DocumentResource; import org.simantics.document.ui.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.ui.workbench.editor.EditorAdapter; import org.simantics.utils.ui.ExceptionUtils; @@ -37,7 +37,7 @@ public class UrlEditorAdapter extends AbstractResourceEditorAdapter implements E @Override protected void openEditor(final Resource input) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java b/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java index 3b5d47997..e47b5a461 100644 --- a/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java +++ b/bundles/org.simantics.equation/src/org/simantics/equation/Activator.java @@ -13,12 +13,12 @@ package org.simantics.equation; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.management.ISessionContext; import org.simantics.db.management.ISessionContextChangedListener; import org.simantics.db.management.SessionContextChangedEvent; -import org.simantics.ui.SimanticsUI; /** * The activator class controls the plug-in life cycle @@ -45,7 +45,7 @@ public class Activator extends AbstractUIPlugin { super.start(context); plugin = this; - SimanticsUI.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() { + Simantics.getSessionContextProvider().addContextChangedListener(new ISessionContextChangedListener() { @Override public void sessionContextChanged(SessionContextChangedEvent event) { ISessionContext ctx = event.getNewValue(); @@ -63,7 +63,7 @@ public class Activator extends AbstractUIPlugin { }); try { - SimanticsUI.getSession().syncRequest(new ReadRequest() { + Simantics.getSession().syncRequest(new ReadRequest() { @Override public void run(ReadGraph g) { EquationResources.initialize(g); diff --git a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java index 708bb8669..ea2cb05dc 100644 --- a/bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java +++ b/bundles/org.simantics.export.ui/src/org/simantics/export/ui/ExportCoreWizard.java @@ -14,6 +14,7 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IExportWizard; import org.eclipse.ui.IWorkbench; import org.osgi.service.prefs.BackingStoreException; +import org.simantics.Simantics; import org.simantics.db.exception.DatabaseException; import org.simantics.export.core.ExportContext; import org.simantics.export.core.Exports; @@ -22,7 +23,6 @@ import org.simantics.export.core.manager.ExportManager; import org.simantics.export.core.manager.ExportPlan; import org.simantics.export.core.manager.ExportWizardResult; import org.simantics.export.core.util.ExporterUtils; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.collections.CollectionUtils; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -43,7 +43,7 @@ public class ExportCoreWizard extends Wizard implements IExportWizard { public void init(IWorkbench workbench, final IStructuredSelection selection) { try { // Create export context - ctx = ExportContext.create( SimanticsUI.getSessionContext(), selection ); + ctx = ExportContext.create( Simantics.getSessionContext(), selection ); // Create extension point registry ctx.eep = Exports.createExtensionPoint(); diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java index a0e966f98..d9286b004 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/ImportImagesActionFactory.java @@ -22,9 +22,9 @@ import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.layer0.adapter.ActionFactory; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.FileUtils; import org.simantics.utils.ui.AdaptionUtils; @@ -49,8 +49,8 @@ public class ImportImagesActionFactory implements ActionFactory { if (files.isEmpty()) return; - SimanticsUI.getSession().markUndoPoint(); - SimanticsUI.getSession().asyncRequest( new CreateImages(container, files) ); + Simantics.getSession().markUndoPoint(); + Simantics.getSession().asyncRequest( new CreateImages(container, files) ); } }; } diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/handlers/ImportImageHandler.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/handlers/ImportImageHandler.java index d95498cbc..6d8885ed1 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/handlers/ImportImageHandler.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/modelBrowser/handlers/ImportImageHandler.java @@ -20,11 +20,11 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.image.ui.CreateImages; import org.simantics.image.ui.ImportImagesActionFactory; import org.simantics.image.ui.modelBrowser.ImagesNode; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.AdaptionUtils; /** @@ -46,7 +46,7 @@ public class ImportImageHandler extends AbstractHandler { if (files.isEmpty()) return null; - SimanticsUI.getSession().asyncRequest( new CreateImages(container, files) ); + Simantics.getSession().asyncRequest( new CreateImages(container, files) ); return null; } diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java index 958a3b063..9a40b3577 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/All.java @@ -2,6 +2,7 @@ package org.simantics.issues.ui; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.TreeItem; +import org.simantics.Simantics; import org.simantics.browsing.ui.NodeContext; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -15,7 +16,6 @@ import org.simantics.issues.ontology.IssueResource; import org.simantics.scenegraph.loader.ScenegraphLoaderUtils; import org.simantics.scl.reflection.annotations.SCLValue; import org.simantics.scl.runtime.function.FunctionImpl1; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.utils.ui.ErrorLogger; @@ -40,8 +40,8 @@ public class All { final boolean checked = item.getChecked(); final Resource issueSource = ResourceAdaptionUtils.toSingleResource(context); try { - VirtualGraphSupport support = SimanticsUI.getSession().getService(VirtualGraphSupport.class); - SimanticsUI.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) { + VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class); + Simantics.getSession().syncRequest(new WriteRequest(support.getWorkspacePersistent("preferences")) { @Override public void perform(WriteGraph graph) throws DatabaseException { IssueResource ISSUE = IssueResource.getInstance(graph); diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceReferenceSerializer.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceReferenceSerializer.java index 52a04c911..aaef79028 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceReferenceSerializer.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceReferenceSerializer.java @@ -13,12 +13,12 @@ package org.simantics.message.ui.scheme; import java.net.URI; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.message.IReferenceSerializer; import org.simantics.message.ReferenceSerializationException; import org.simantics.message.util.ResourceSerializerUtil; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -28,7 +28,7 @@ public class ResourceReferenceSerializer implements IReferenceSerializer { Session s; public ResourceReferenceSerializer() { - this.s = SimanticsUI.getSession(); + this.s = Simantics.getSession(); } public ResourceReferenceSerializer(Session s) { diff --git a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java index 2f536eb6f..1d400dcfc 100644 --- a/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java +++ b/bundles/org.simantics.message.ui/src/org/simantics/message/ui/scheme/ResourceSchemeHandler.java @@ -13,10 +13,10 @@ package org.simantics.message.ui.scheme; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.message.AbstractMessageSchemeHandler; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.action.ChooseActionRequest; import org.simantics.utils.ui.workbench.WorkbenchUtils; @@ -31,7 +31,7 @@ public class ResourceSchemeHandler extends AbstractMessageSchemeHandler recentImportPaths = Preferences.decodePaths(recentPathsPref); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return false; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java index 75c702bed..b7803a77b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/CreateShapeHandler.java @@ -9,6 +9,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.part.MultiPageEditorPart; +import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -28,7 +29,6 @@ import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IResourceEditorInput; import org.simantics.ui.workbench.ResourceEditorInput; @@ -43,7 +43,7 @@ public abstract class CreateShapeHandler extends AbstractHandler { public Object addElement(final double mposX, final double mposY, final Resource composite) { final String data = getDefaultElementData(); - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { Layer0 L0 = Layer0.getInstance(g); @@ -75,7 +75,7 @@ public abstract class CreateShapeHandler extends AbstractHandler { final ResourceArray ra = in.getResourceArray(); ResourceArray symbolEditorInput; try { - symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read() { + symbolEditorInput = Simantics.getSession().syncRequest(new Read() { @Override public ResourceArray perform(ReadGraph graph) throws DatabaseException { StructuralResource2 sr = StructuralResource2.getInstance(graph); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java index f3a1b4403..ed41bc132 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ImportSVG.java @@ -26,6 +26,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.part.MultiPageEditorPart; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -40,7 +41,6 @@ import org.simantics.g2d.participant.MouseUtil.MouseInfo; import org.simantics.modeling.ModelingResources; import org.simantics.scl.commands.Commands; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IResourceEditorInput; import org.simantics.ui.workbench.ResourceEditorInput; import org.simantics.utils.FileUtils; @@ -58,7 +58,7 @@ public class ImportSVG extends AbstractHandler { final ResourceArray ra = in.getResourceArray(); ResourceArray symbolEditorInput; try { - symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read() { + symbolEditorInput = Simantics.getSession().syncRequest(new Read() { @Override public ResourceArray perform(ReadGraph graph) throws DatabaseException { StructuralResource2 sr = StructuralResource2.getInstance(graph); @@ -116,7 +116,7 @@ public class ImportSVG extends AbstractHandler { try { final byte[] data = FileUtils.readFile(file); - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModelingProjectOperationsContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModelingProjectOperationsContribution.java index 2c52834d5..eca9620d5 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModelingProjectOperationsContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModelingProjectOperationsContribution.java @@ -11,11 +11,11 @@ *******************************************************************************/ package org.simantics.modeling.ui.actions; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.modeling.ModelingResources; import org.simantics.project.IProject; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.contribution.OperationsMenuContribution; /** @@ -26,7 +26,7 @@ public class ModelingProjectOperationsContribution extends OperationsMenuContrib @Override protected Object[] getSelectedObjects() { // Force the evaluated selection to be the currently active project. - IProject project = SimanticsUI.peekProject(); + IProject project = Simantics.peekProject(); if (project == null) return Resource.NONE; return new Resource[] { project.get() }; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java index 1acbf5391..fafaa7e51 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewComponentTypeAction.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.simantics.DatabaseJob; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -23,7 +24,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.modeling.NewComponentType; import org.simantics.modeling.ui.Activator; -import org.simantics.ui.SimanticsUI; public class NewComponentTypeAction implements ActionFactory { @@ -39,7 +39,7 @@ public class NewComponentTypeAction implements ActionFactory { @Override protected IStatus run(IProgressMonitor monitor) { try { - SimanticsUI.getSession().syncRequest(new WriteRequest() { + Simantics.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java index 7953818ba..0efcc5b8c 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewDocument.java @@ -1,5 +1,6 @@ package org.simantics.modeling.ui.actions; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -8,7 +9,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.document.DocumentResource; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; public class NewDocument implements ActionFactory { @@ -21,7 +21,7 @@ public class NewDocument implements ActionFactory { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java index a187fa625..d6205ea5f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewLibrary.java @@ -23,7 +23,7 @@ public class NewLibrary implements ActionFactory { return new Runnable() { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java index d187053df..2e8a8fcb8 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/NewSubscription.java @@ -2,6 +2,7 @@ package org.simantics.modeling.ui.actions; import java.util.UUID; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.CommentMetadata; @@ -12,7 +13,6 @@ import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -28,7 +28,7 @@ public class NewSubscription implements ActionFactory { return new Runnable() { @Override public void run() { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { g.markUndoPoint(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java index b864c4bcf..84eab0eb7 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/e4/ImportSVGPNG.java @@ -28,6 +28,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor; import org.eclipse.ui.part.MultiPageEditorPart; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -47,7 +48,6 @@ import org.simantics.g2d.participant.MouseUtil.MouseInfo; import org.simantics.modeling.ModelingResources; import org.simantics.scl.commands.Commands; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IResourceEditorInput; import org.simantics.ui.workbench.ResourceEditorInput; import org.simantics.utils.FileUtils; @@ -78,7 +78,7 @@ public class ImportSVGPNG { final ResourceArray ra = in.getResourceArray(); ResourceArray symbolEditorInput; try { - symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read() { + symbolEditorInput = Simantics.getSession().syncRequest(new Read() { @Override public ResourceArray perform(ReadGraph graph) throws DatabaseException { StructuralResource2 sr = StructuralResource2.getInstance(graph); @@ -138,7 +138,7 @@ public class ImportSVGPNG { try { final byte[] data = FileUtils.readFile(file); - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java index 62a0c470e..9db3a2401 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/style/EditStyle.java @@ -62,7 +62,7 @@ public class EditStyle { if (resources.length == 0) return; - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java index 0509329f3..94c03494b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/PageSettingsDialog.java @@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -38,7 +39,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; import org.simantics.modeling.ui.preferences.DiagramPreferences; import org.simantics.scl.commands.Commands; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.page.PageDesc; /** @@ -65,7 +65,7 @@ public class PageSettingsDialog extends Dialog { public PageSettingsDialog(Resource diagramResource, Shell parentShell) { super(parentShell); - this.session = SimanticsUI.getSession(); + this.session = Simantics.getSession(); this.diagramResource = diagramResource; } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java index 1762dea7f..92d46e160 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java @@ -346,7 +346,7 @@ public class DiagramViewer protected Set getPropertyPageContexts() { try { - return BrowseContext.getBrowseContextClosure(SimanticsUI.getSession(), defaultPropertyBrowseContexts); + return BrowseContext.getBrowseContextClosure(Simantics.getSession(), defaultPropertyBrowseContexts); } catch (DatabaseException e) { ExceptionUtils.logAndShowError("Failed to load modeled browse contexts for property page, see exception for details.", e); return defaultPropertyBrowseContexts; @@ -366,7 +366,7 @@ public class DiagramViewer } protected void initSession() { - sessionContextProvider = SimanticsUI.getSessionContextProvider(); + sessionContextProvider = Simantics.getSessionContextProvider(); sessionContext = sessionContextProvider.getSessionContext(); } @@ -960,7 +960,7 @@ public class DiagramViewer // Set initial part name according to the name given by IEditorInput host.doSetPartName(getEditorInput().getName()); - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session != null) { Supplier disposedCallback = () -> disposed; session.asyncRequest( diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java index fd1e63605..fb3716f98 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramAdapter.java @@ -13,6 +13,7 @@ package org.simantics.modeling.ui.diagramEditor; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -21,7 +22,6 @@ import org.simantics.db.layer0.request.PossibleModel; import org.simantics.db.layer0.variable.RVI; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.modeling.ui.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.ResourceEditorInput2; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.utils.ui.ErrorLogger; @@ -50,7 +50,7 @@ public class OpenDiagramAdapter extends AbstractResourceEditorAdapter { @Override public void openEditor(final Resource r) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph g) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java index 2394c490b..978d1f895 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromConfigurationAdapter.java @@ -15,6 +15,7 @@ import java.util.Collection; import java.util.Collections; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.PossibleIndexRoot; @@ -32,7 +33,6 @@ import org.simantics.modeling.ComponentUtils; import org.simantics.modeling.actions.NavigateToTarget; import org.simantics.modeling.ui.Activator; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.threads.ThreadUtils; @@ -75,7 +75,7 @@ public class OpenDiagramFromConfigurationAdapter extends AbstractResourceEditorA @Override public void openEditor(final Resource r) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph g) throws DatabaseException { openEditor(g, r, getEditorId()); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java index bfe0b7a74..8739f904f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenDiagramFromSymbolAdapter.java @@ -15,6 +15,7 @@ import java.util.Collection; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.PossibleIndexRoot; @@ -25,7 +26,6 @@ import org.simantics.diagram.stubs.DiagramResource; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ui.Activator; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.ResourceEditorInput2; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.utils.ui.ErrorLogger; @@ -58,7 +58,7 @@ public class OpenDiagramFromSymbolAdapter extends AbstractResourceEditorAdapter @Override public void openEditor(final Resource r) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph g) throws DatabaseException { StructuralResource2 sr = StructuralResource2.getInstance(g); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java index 0152a1c19..ae88498dc 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/OpenSheetAdapter.java @@ -13,6 +13,7 @@ package org.simantics.modeling.ui.diagramEditor; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.PossibleIndexRoot; @@ -23,7 +24,6 @@ import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.modeling.ui.Activator; import org.simantics.spreadsheet.resource.SpreadsheetResource; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.ResourceEditorInput2; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.utils.ui.workbench.WorkbenchUtils; @@ -50,7 +50,7 @@ public class OpenSheetAdapter extends AbstractResourceEditorAdapter { @Override public void openEditor(final Resource r) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph g) throws DatabaseException { 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..2838892c4 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; @@ -202,7 +203,7 @@ public class SheetViewer extends EditorPart implements IResourceEditorPart2 { } protected void initSession() { - sessionContextProvider = SimanticsUI.getSessionContextProvider(); + sessionContextProvider = Simantics.getSessionContextProvider(); sessionContext = sessionContextProvider.getSessionContext(); } @@ -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( diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/TerminalInformer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/TerminalInformer.java index 8a4944200..c646d7692 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/TerminalInformer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/TerminalInformer.java @@ -23,6 +23,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchPart; +import org.simantics.Simantics; import org.simantics.databoard.util.ObjectUtils; import org.simantics.db.ReadGraph; import org.simantics.db.common.procedure.adapter.ProcedureAdapter; @@ -40,7 +41,6 @@ import org.simantics.scenegraph.g2d.events.KeyEvent; import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.hints.IHintContext.Key; import org.simantics.utils.datastructures.hints.IHintContext.KeyOf; import org.simantics.utils.ui.ErrorLogger; @@ -159,7 +159,7 @@ public class TerminalInformer extends AbstractDiagramParticipant { } private void createMessage(TerminalInfo terminal, final Consumer callback) { - SimanticsUI.getSession().asyncRequest(new TerminalInfoMessage(terminal, terminalNamingStrategy), new ProcedureAdapter() { + Simantics.getSession().asyncRequest(new TerminalInfoMessage(terminal, terminalNamingStrategy), new ProcedureAdapter() { @Override public void exception(Throwable t) { ErrorLogger.defaultLogError(t); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java index d6c4f6932..d067ba344 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/WikiDiagramViewer.java @@ -26,6 +26,7 @@ import org.eclipse.ui.contexts.IContextActivation; 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.Session; import org.simantics.db.common.ResourceArray; @@ -83,7 +84,6 @@ import org.simantics.modeling.mapping.ModelingSynchronizationHints; import org.simantics.scenegraph.g2d.events.command.CommandKeyBinding; import org.simantics.scenegraph.g2d.events.command.Commands; import org.simantics.simulation.experiment.IExperiment; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.dnd.ResourceTransferData; import org.simantics.ui.dnd.ResourceTransferUtils; import org.simantics.ui.workbench.IResourceEditorInput; @@ -138,7 +138,7 @@ public class WikiDiagramViewer extends EditorPart implements IResourceEditorPart this.layer = layer; this.structuralPath = structuralPath; - sessionContextProvider = SimanticsUI.getSessionContextProvider(); + sessionContextProvider = Simantics.getSessionContextProvider(); sessionContext = sessionContextProvider.getSessionContext(); canvasContext = createViewerCanvas(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramViewer.java index 0b3afd8a5..d0bf18b83 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/e4/DiagramViewer.java @@ -339,7 +339,7 @@ public class DiagramViewer protected Set getPropertyPageContexts() { try { - return BrowseContext.getBrowseContextClosure(SimanticsUI.getSession(), defaultPropertyBrowseContexts); + return BrowseContext.getBrowseContextClosure(Simantics.getSession(), defaultPropertyBrowseContexts); } catch (DatabaseException e) { ExceptionUtils.logAndShowError("Failed to load modeled browse contexts for property page, see exception for details.", e); return defaultPropertyBrowseContexts; @@ -361,7 +361,7 @@ public class DiagramViewer } protected void initSession() { - sessionContextProvider = SimanticsUI.getSessionContextProvider(); + sessionContextProvider = Simantics.getSessionContextProvider(); sessionContext = sessionContextProvider.getSessionContext(); } @@ -957,7 +957,7 @@ public class DiagramViewer // Set initial part name according to the name given by IEditorInput host.doSetPartName(getResourceEditorInput().getName()); - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session != null) { Supplier disposedCallback = () -> disposed; Display display = part.getContext().get(Shell.class).getDisplay(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignHorizontalHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignHorizontalHandler.java index 94877d0b9..d8eaf0357 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignHorizontalHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignHorizontalHandler.java @@ -19,12 +19,12 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.stubs.DiagramResource; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; /** @@ -43,7 +43,7 @@ public class AlignHorizontalHandler extends AbstractHandler { if (resources.length < 2) return null; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignVerticalHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignVerticalHandler.java index 87da411da..93359dd73 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignVerticalHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/AlignVerticalHandler.java @@ -19,12 +19,12 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.stubs.DiagramResource; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; /** @@ -43,7 +43,7 @@ public class AlignVerticalHandler extends AbstractHandler { if (resources.length < 2) return null; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/DisconnectFlagHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/DisconnectFlagHandler.java index 04d1bf2ba..261c2232f 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/DisconnectFlagHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/handlers/DisconnectFlagHandler.java @@ -24,13 +24,13 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; import org.simantics.DatabaseJob; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.modeling.actions.DisconnectFlag; import org.simantics.modeling.ui.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ISelectionUtils; /** @@ -49,7 +49,7 @@ public class DisconnectFlagHandler extends AbstractHandler { @Override protected IStatus run(IProgressMonitor monitor) { try { - SimanticsUI.getSession().syncRequest(new WriteRequest() { + Simantics.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.markUndoPoint(); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/tools/AlignTools.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/tools/AlignTools.java index 61eb73c17..9167942b6 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/tools/AlignTools.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/tools/AlignTools.java @@ -25,6 +25,7 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.widgets.FormToolkit; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -33,7 +34,6 @@ import org.simantics.diagram.elements.ElementTransforms; import org.simantics.diagram.elements.ElementTransforms.SIDE; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.modeling.ui.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; /** @@ -332,7 +332,7 @@ public class AlignTools implements DiagramTools { public void setSelection(ISelection s) { this.selection = ResourceAdaptionUtils.toResources(s); try { - SimanticsUI.getSession().syncRequest(new ReadRequest() { + Simantics.getSession().syncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/documents/OpenPlainTextDocumentAdapter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/documents/OpenPlainTextDocumentAdapter.java index 6adb8d140..d8a80f2e9 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/documents/OpenPlainTextDocumentAdapter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/documents/OpenPlainTextDocumentAdapter.java @@ -12,6 +12,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.ide.IDE; +import org.simantics.Simantics; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; @@ -22,7 +23,6 @@ import org.simantics.document.DocumentResource; import org.simantics.layer0.Layer0; import org.simantics.modeling.ui.Activator; import org.simantics.simulation.ontology.SimulationResource; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter; import org.simantics.utils.FileUtils; import org.simantics.utils.ui.ErrorLogger; @@ -44,7 +44,7 @@ public class OpenPlainTextDocumentAdapter extends AbstractResourceEditorAdapter @Override public void openEditor(final Resource r) throws Exception { - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph g) throws DatabaseException { Layer0 L0 = Layer0.getInstance(g); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/ModelEvaluators.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/ModelEvaluators.java index 25e57286f..b1872c92b 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/ModelEvaluators.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/ModelEvaluators.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.function.Supplier; import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.Simantics; import org.simantics.browsing.ui.BuiltinKeys; import org.simantics.browsing.ui.BuiltinKeys.ImagerKey; import org.simantics.browsing.ui.BuiltinKeys.LabelerKey; @@ -56,7 +57,6 @@ import org.simantics.modeling.ui.modelBrowser.model.IDisposable; import org.simantics.modeling.ui.modelBrowser.model.INode; import org.simantics.modeling.ui.modelBrowser.model.INode2; import org.simantics.modeling.ui.modelBrowser.model.IUpdateable; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.UnaryFunction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -425,7 +425,7 @@ class NodeLabelerFactory implements LabelerFactory { @Override public Modifier getModifier(ModificationContext sourcePart, String key) { - return ((INode) context.getConstant(BuiltinKeys.INPUT)).getModifier(SimanticsUI.getSession(), key); + return ((INode) context.getConstant(BuiltinKeys.INPUT)).getModifier(Simantics.getSession(), key); } @Override diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateConnectionPoint.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateConnectionPoint.java index 43f854fd4..4cc595310 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateConnectionPoint.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateConnectionPoint.java @@ -20,13 +20,13 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.SelectionHints; import org.simantics.modeling.flags.LiftFlag; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ISelectionUtils; /** @@ -48,7 +48,7 @@ public class CreateConnectionPoint extends AbstractHandler { return null; final Set flagSet = new HashSet(flags); - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { for (Resource flag : flagSet) diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateIssue.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateIssue.java index 76ea9607b..d9634dc9d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateIssue.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/CreateIssue.java @@ -18,6 +18,7 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -25,7 +26,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.issues.common.IssueUtils; import org.simantics.issues.ontology.IssueResource; import org.simantics.modeling.ModelingResources; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.AdaptionUtils; public class CreateIssue extends AbstractHandler { @@ -42,7 +42,7 @@ public class CreateIssue extends AbstractHandler { if (element == null) return null; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/DeleteNodeHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/DeleteNodeHandler.java index 3067cf01f..9e690f064 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/DeleteNodeHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/DeleteNodeHandler.java @@ -25,6 +25,7 @@ import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.common.node.DeleteException; import org.simantics.browsing.ui.common.node.IDeletable; @@ -38,7 +39,6 @@ import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.modeling.ui.Activator; import org.simantics.modeling.ui.modelBrowser.model.INode; import org.simantics.modeling.ui.modelBrowser.model.INode2; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.logging.TimeLogger; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ISelectionUtils; @@ -147,7 +147,7 @@ public class DeleteNodeHandler extends AbstractHandler { final INode node = (INode) ctx.getAdapter(INode.class); if (node != null) { - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { node.handleDelete(graph); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSpreadsheetHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSpreadsheetHandler.java index ab695a726..03cfa31f7 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSpreadsheetHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/NewSpreadsheetHandler.java @@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -24,7 +25,6 @@ import org.simantics.db.layer0.SelectionHints; import org.simantics.db.layer0.adapter.InstanceFactory; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.spreadsheet.resource.SpreadsheetResource; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.ArrayMap; import org.simantics.utils.ui.ISelectionUtils; @@ -37,7 +37,7 @@ public class NewSpreadsheetHandler extends AbstractHandler { if (container == null) return null; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { SimulationResource SIMU = SimulationResource.getInstance(graph); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ToggleExternalFlag.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ToggleExternalFlag.java index d03199d9c..11c6af8bc 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ToggleExternalFlag.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/handlers/ToggleExternalFlag.java @@ -26,6 +26,7 @@ import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.commands.IElementUpdater; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.menus.UIElement; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -53,7 +54,7 @@ public class ToggleExternalFlag extends AbstractHandler implements IElementUpdat if (resource == null) return null; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph g) throws DatabaseException { DiagramResource dr = DiagramResource.getInstance(g); @@ -82,7 +83,7 @@ public class ToggleExternalFlag extends AbstractHandler implements IElementUpdat } // Get the current value for the State object - Session s = SimanticsUI.peekSession(); + Session s = Simantics.peekSession(); if (s != null) { Boolean value = Boolean.TRUE; IWorkbenchSite site = (IWorkbenchSite) parameters.get("org.eclipse.ui.part.IWorkbenchPartSite"); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Node.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Node.java index 10eb340f7..bd218ba69 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Node.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser/model/Node.java @@ -16,6 +16,7 @@ import java.util.Collections; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ISelection; +import org.simantics.Simantics; import org.simantics.browsing.ui.common.node.IDropTargetNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelerUtil; @@ -26,7 +27,6 @@ import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.layer0.Layer0; -import org.simantics.ui.SimanticsUI; @Deprecated public class Node implements INode, IDropTargetNode { @@ -103,7 +103,7 @@ public class Node implements INode, IDropTargetNode { @Override public void drop(Object data) { if (data instanceof ISelection) { - handleDrop(SimanticsUI.getSession(), (ISelection) data); + handleDrop(Simantics.getSession(), (ISelection) data); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/contributions/SetSubscriptionEnabledContribution.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/contributions/SetSubscriptionEnabledContribution.java index 4943ce352..c28035516 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/contributions/SetSubscriptionEnabledContribution.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/contributions/SetSubscriptionEnabledContribution.java @@ -13,6 +13,7 @@ import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -94,11 +95,11 @@ public class SetSubscriptionEnabledContribution extends DynamicMenuContribution new ActionContributionItem(new Action(name, image) { @Override public void run() { - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session == null) return; - SimanticsUI.getSession().asyncRequest(new WriteRequest() { + Simantics.getSession().asyncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { new SetSubscriptionEnabled(subscriptions, include).perform(graph); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/ChartNode.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/ChartNode.java index 99020c4b7..afdea65c0 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/ChartNode.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/ChartNode.java @@ -14,6 +14,7 @@ package org.simantics.modeling.ui.modelBrowser2.model; import java.util.List; import org.eclipse.jface.viewers.ISelection; +import org.simantics.Simantics; import org.simantics.browsing.ui.common.node.IDeletable; import org.simantics.browsing.ui.common.node.IDropTargetNode; import org.simantics.browsing.ui.common.node.IModifiableNode; @@ -23,7 +24,6 @@ import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.modeling.PropertyVariables; import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ISelectionUtils; /** @@ -43,7 +43,7 @@ public class ChartNode extends AbstractNode implements IDeletable, IDropTargetNo final List vars = ISelectionUtils.filterSelection((ISelection) data, PropertyVariables.class); if (!vars.isEmpty()) { // try { -// List references = SimanticsUI.getSession().syncRequest(VariableReferences.toReferences(vars)); +// List references = Simantics.getSession().syncRequest(VariableReferences.toReferences(vars)); // addPlots(references); // } catch (DatabaseException e) { // ErrorLogger.defaultLogError(e); @@ -59,7 +59,7 @@ public class ChartNode extends AbstractNode implements IDeletable, IDropTargetNo } // private void addPlots(List references) { -// SimanticsUI.getSession().asyncRequest(new AddChartItem(resource, references), new Callback() { +// Simantics.getSession().asyncRequest(new AddChartItem(resource, references), new Callback() { // @Override // public void run(DatabaseException e) { // if (e != null) @@ -70,7 +70,7 @@ public class ChartNode extends AbstractNode implements IDeletable, IDropTargetNo @Override public Modifier getModifier(String columnId) { - Session s = SimanticsUI.getSession(); + Session s = Simantics.getSession(); return new LabelModifier(s, resource); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/StateNode.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/StateNode.java index 0201aea84..abedde4af 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/StateNode.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/StateNode.java @@ -11,13 +11,13 @@ *******************************************************************************/ package org.simantics.modeling.ui.modelBrowser2.model; +import org.simantics.Simantics; import org.simantics.browsing.ui.common.node.IDeletable; import org.simantics.browsing.ui.common.node.IModifiableNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelModifier; import org.simantics.db.Resource; import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -31,7 +31,7 @@ public class StateNode extends AbstractNode implements IDeletable, IModifiableNo @Override public Modifier getModifier(String columnId) { // FIXME: the labeler contribution responsible for handling this node does not handle modifiers. - return new LabelModifier(SimanticsUI.getSession(), resource); + return new LabelModifier(Simantics.getSession(), resource); } } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionItemNode.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionItemNode.java index 5a1bef1d8..0031252ef 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionItemNode.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionItemNode.java @@ -29,7 +29,7 @@ public class SubscriptionItemNode extends AbstractNode implements IDeletable { public Object getAdapter(Class adapter) { // if (adapter == NodeReference.class) { // try { -// Variant nodeId = (Variant) SimanticsUI.getSession().syncRequest( +// Variant nodeId = (Variant) Simantics.getSession().syncRequest( // Queries.getRelatedValue(resource, ModelingResources.URIs.HasNodeId, Bindings.VARIANT)); // return new NodeReference(null, nodeId); // } catch (DatabaseException e) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionNode.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionNode.java index 1729db540..faf51168a 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionNode.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/SubscriptionNode.java @@ -14,6 +14,7 @@ package org.simantics.modeling.ui.modelBrowser2.model; import java.util.List; import org.eclipse.jface.viewers.ISelection; +import org.simantics.Simantics; import org.simantics.browsing.ui.common.node.IDeletable; import org.simantics.browsing.ui.common.node.IDropTargetNode; import org.simantics.db.Resource; @@ -23,7 +24,6 @@ import org.simantics.modeling.PropertyVariables; import org.simantics.modeling.subscription.AddSubscriptionItems; import org.simantics.modeling.utils.VariableReferences; import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ISelectionUtils; @@ -44,7 +44,7 @@ public class SubscriptionNode extends AbstractNode implements IDeletable, IDropT if (!vars.isEmpty()) { List references; try { - references = SimanticsUI.getSession().syncRequest(VariableReferences.toReferences(vars)); + references = Simantics.getSession().syncRequest(VariableReferences.toReferences(vars)); addSubscriptions(references); } catch (DatabaseException e) { ErrorLogger.defaultLogError(e); @@ -58,7 +58,7 @@ public class SubscriptionNode extends AbstractNode implements IDeletable, IDropT } private void addSubscriptions(List references) { - SimanticsUI.getSession().asyncRequest(new AddSubscriptionItems(resource, references), e -> { + Simantics.getSession().asyncRequest(new AddSubscriptionItems(resource, references), e -> { if (e != null) ErrorLogger.defaultLogError(e); }); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/TrendItemNode.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/TrendItemNode.java index 689d54328..0952ca5b1 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/TrendItemNode.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/modelBrowser2/model/TrendItemNode.java @@ -29,7 +29,7 @@ public class TrendItemNode extends AbstractNode implements IDeletable { public Object getAdapter(Class adapter) { // if (adapter==NodeReference.class) { // try { -// Variant nodeId = (Variant) SimanticsUI.getSession().syncRequest( +// Variant nodeId = (Variant) Simantics.getSession().syncRequest( // Queries.getRelatedValue(resource, ModelingResources.URIs.HasNodeId, Bindings.VARIANT)); // return new NodeReference(null, nodeId); // } catch (DatabaseException e) { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFDiagramExportWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFDiagramExportWizard.java index 461e98c10..9cb32a2a7 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFDiagramExportWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/pdf/PDFDiagramExportWizard.java @@ -153,7 +153,7 @@ public class PDFDiagramExportWizard extends Wizard implements IExportWizard { public void init(IWorkbench workbench, IStructuredSelection selection) { readPreferences(); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/ComponentTypePropertyTester.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/ComponentTypePropertyTester.java index 8185d7f6d..bbb3ca369 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/ComponentTypePropertyTester.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/ComponentTypePropertyTester.java @@ -13,6 +13,7 @@ package org.simantics.modeling.ui.property; import org.eclipse.core.expressions.PropertyTester; import org.simantics.DatabaseJob; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -54,7 +55,7 @@ public class ComponentTypePropertyTester extends PropertyTester { if (resource == null) return false; - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session == null) return false; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/RestoreDefaultValueHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/RestoreDefaultValueHandler.java index d19e6dbfb..179173ede 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/RestoreDefaultValueHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/RestoreDefaultValueHandler.java @@ -21,6 +21,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.part.IPage; import org.eclipse.ui.part.PageBookView; +import org.simantics.Simantics; import org.simantics.browsing.ui.common.ErrorLogger; import org.simantics.browsing.ui.common.property.IProperty; import org.simantics.db.Resource; @@ -31,7 +32,6 @@ import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.management.ISessionContext; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.IPropertyPage; import org.simantics.utils.ui.ISelectionUtils; @@ -54,7 +54,7 @@ public class RestoreDefaultValueHandler extends AbstractHandler { // Cannot use this, since the property view does not contribute a selection back to the workbench. //HandlerUtil.getCurrentSelection(event); - ISessionContext sc = SimanticsUI.getSessionContext(); + ISessionContext sc = Simantics.getSessionContext(); if (sc == null) return null; diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java index 97d23f05f..6574b31b6 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java @@ -431,7 +431,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi try { // FIXME: I have no idea if this works or not.. - diagram = SimanticsUI.getSession().syncRequest(new Read() { + diagram = Simantics.getSession().syncRequest(new Read() { @Override public IDiagram perform(ReadGraph graph) throws DatabaseException { IDiagram d = synchronizer.loadDiagram(new NullProgressMonitor(), graph, null, structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), hints); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelExportWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelExportWizard.java index 182c0f6fc..8a3bd6999 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelExportWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelExportWizard.java @@ -26,12 +26,12 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IExportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContext; import org.simantics.modeling.ui.Activator; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -81,7 +81,7 @@ public class ModelExportWizard extends Wizard implements IExportWizard { public void init(IWorkbench workbench, IStructuredSelection selection) { readPreferences(); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelImportWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelImportWizard.java index 011ce12ff..23d341984 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelImportWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/ModelImportWizard.java @@ -56,7 +56,7 @@ public class ModelImportWizard extends Wizard implements IImportWizard { String recentPathsPref = store.getString(Preferences.RECENT_SHARED_LIBRARY_IMPORT_LOCATIONS); Deque recentImportPaths = Preferences.decodePaths(recentPathsPref); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return false; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExportWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExportWizard.java index 067731312..e4accc8ce 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExportWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExportWizard.java @@ -26,12 +26,12 @@ import org.eclipse.jface.wizard.WizardPage; import org.eclipse.ui.IExportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContext; import org.simantics.modeling.ui.Activator; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -78,7 +78,7 @@ public class SharedOntologyExportWizard extends Wizard implements IExportWizard public void init(IWorkbench workbench, IStructuredSelection selection) { readPreferences(); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyImportWizard.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyImportWizard.java index 8345c229e..d2b296f91 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyImportWizard.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyImportWizard.java @@ -31,6 +31,7 @@ import org.eclipse.swt.SWT; import org.eclipse.ui.IImportWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.Simantics; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.mutable.Variant; import org.simantics.databoard.container.DataContainer; @@ -49,7 +50,6 @@ import org.simantics.modeling.ui.Activator; import org.simantics.modeling.ui.utils.NoProjectPage; import org.simantics.project.IProject; import org.simantics.project.ProjectKeys; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.utils.strings.EString; import org.simantics.utils.ui.ErrorLogger; @@ -71,7 +71,7 @@ public class SharedOntologyImportWizard extends Wizard implements IImportWizard String recentPathsPref = store.getString(Preferences.RECENT_SHARED_LIBRARY_IMPORT_LOCATIONS); Deque recentImportPaths = Preferences.decodePaths(recentPathsPref); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx == null) return false; IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalUtil.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalUtil.java index 3016311ff..a92d7b626 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalUtil.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalUtil.java @@ -260,7 +260,7 @@ public class TypicalUtil { if (excludedComponents != null && excludedComponents.contains(component)) continue; try { - String renamed = ComponentNamingUtil.findFreshInstanceName(graph, SimanticsUI.getProject(), configurationRoot, typicalCompositeInstance, component); + String renamed = ComponentNamingUtil.findFreshInstanceName(graph, Simantics.getProject(), configurationRoot, typicalCompositeInstance, component); if (DEBUG) System.out.println("Typicals: renamed " + entry.getKey() + " -> " + renamed); graph.claimLiteral(entry.getValue(), L0.HasName, L0.NameOf, renamed, Bindings.STRING); diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentAction.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentAction.java index d6fae16cc..eb942ffb0 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentAction.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentAction.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.simantics.simulation.ui.handlers; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -19,7 +20,6 @@ import org.simantics.simulation.ontology.SimulationResource; import org.simantics.simulation.project.IExperimentManager; import org.simantics.ui.DoubleClickEvent; import org.simantics.ui.IDoubleClickAction; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.utils.ui.action.PriorityAction; @@ -42,7 +42,7 @@ public class ActivateExperimentAction implements IDoubleClickAction { return; if (g.isInstanceOf(experiment, SimulationResource.getInstance(g).Experiment)) { - final IProject project = SimanticsUI.getProject(); + final IProject project = Simantics.getProject(); if (project == null) return; diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentHandler.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentHandler.java index 19da34f3b..82fe56550 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentHandler.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/ActivateExperimentHandler.java @@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -23,7 +24,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.project.IProject; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.simulation.project.IExperimentManager; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.utils.ui.ErrorLogger; @@ -45,7 +45,7 @@ public class ActivateExperimentHandler extends AbstractHandler { if (experiment == null) return null; - final IProject project = SimanticsUI.peekProject(); + final IProject project = Simantics.peekProject(); if (project == null) return null; diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Dispose.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Dispose.java index cd376cf54..872bf969d 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Dispose.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Dispose.java @@ -21,17 +21,17 @@ import org.eclipse.core.runtime.SubMonitor; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.project.IProject; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.project.IExperimentManager; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; public class Dispose extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - IProject project = SimanticsUI.getProject(); + IProject project = Simantics.getProject(); IExperimentManager manager = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); final IExperiment experiment = manager.getActiveExperiment(); if (experiment == null) diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Pause.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Pause.java index 5cd524665..b3324db8b 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Pause.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Pause.java @@ -14,17 +14,17 @@ package org.simantics.simulation.ui.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.simantics.Simantics; import org.simantics.simulation.experiment.IDynamicExperiment; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.project.IExperimentManager; -import org.simantics.ui.SimanticsUI; public class Pause extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { IExperimentManager manager = - SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); IExperiment experiment = manager.getActiveExperiment(); if(experiment instanceof IDynamicExperiment) ((IDynamicExperiment)experiment).simulate(false); diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Reload.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Reload.java index b49d0c047..335023b8f 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Reload.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Reload.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.simantics.ObjectIdentitySchedulingRule; +import org.simantics.Simantics; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.project.IExperimentManager; import org.simantics.simulation.ui.Activator; @@ -29,7 +30,7 @@ public class Reload extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { IExperimentManager manager = - SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); IExperiment experiment = manager.getActiveExperiment(); if (experiment != null) { Job j = new RefreshJob(experiment); @@ -51,7 +52,7 @@ public class Reload extends AbstractHandler { protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); - experiment.refresh(SimanticsUI.getSession()); + experiment.refresh(Simantics.getSession()); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/SaveState.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/SaveState.java index 343858a06..1f1c384c8 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/SaveState.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/SaveState.java @@ -19,11 +19,11 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.simantics.ObjectIdentitySchedulingRule; +import org.simantics.Simantics; import org.simantics.simulation.experiment.IDynamicExperiment; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.project.IExperimentManager; import org.simantics.simulation.ui.Activator; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -32,7 +32,7 @@ public class SaveState extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - IExperimentManager manager = SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + IExperimentManager manager = Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); IExperiment experiment = manager.getActiveExperiment(); if (experiment instanceof IDynamicExperiment) { Job j = new SaveStateJob((IDynamicExperiment) experiment); diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/TimerContribution.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/TimerContribution.java index e37348762..91d97b88d 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/TimerContribution.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/TimerContribution.java @@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.CompoundContributionItem; +import org.simantics.Simantics; import org.simantics.project.IProject; import org.simantics.simulation.experiment.ExperimentState; import org.simantics.simulation.experiment.IDynamicExperiment; @@ -39,7 +40,6 @@ import org.simantics.simulation.experiment.IExperimentListener; import org.simantics.simulation.experiment.SimulationTimeUtil; import org.simantics.simulation.project.IExperimentManager; import org.simantics.simulation.project.IExperimentManagerListener; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.threads.ThreadUtils; @@ -93,7 +93,7 @@ public class TimerContribution extends CompoundContributionItem { public void fill(final ToolBar parent, final int index) { //System.out.println(this + "(" + System.identityHashCode(this) + ") FILL"); - IProject project = SimanticsUI.peekProject(); + IProject project = Simantics.peekProject(); if (project == null) return; diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/Reload.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/Reload.java index e884a773d..db2064c13 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/Reload.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/Reload.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.e4.core.di.annotations.Execute; import org.simantics.ObjectIdentitySchedulingRule; +import org.simantics.Simantics; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.project.IExperimentManager; import org.simantics.simulation.ui.Activator; @@ -27,7 +28,7 @@ public class Reload { @Execute public void execute() { IExperimentManager manager = - SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); IExperiment experiment = manager.getActiveExperiment(); if (experiment != null) { Job j = new RefreshJob(experiment); @@ -49,7 +50,7 @@ public class Reload { protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); - experiment.refresh(SimanticsUI.getSession()); + experiment.refresh(Simantics.getSession()); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; diff --git a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/TimerContribution.java b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/TimerContribution.java index a5f3fa951..a7756282f 100644 --- a/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/TimerContribution.java +++ b/bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/TimerContribution.java @@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Text; +import org.simantics.Simantics; import org.simantics.databoard.util.ObjectUtils; import org.simantics.project.IProject; import org.simantics.simulation.experiment.ExperimentState; @@ -46,7 +47,6 @@ import org.simantics.simulation.experiment.IExperimentListener; import org.simantics.simulation.experiment.SimulationTimeUtil; import org.simantics.simulation.project.IExperimentManager; import org.simantics.simulation.project.IExperimentManagerListener; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.threads.ThreadUtils; /** @@ -144,7 +144,7 @@ public class TimerContribution { @PostConstruct public void createControls(Composite parent, MToolControl toolControl) { - IProject project = SimanticsUI.peekProject(); + IProject project = Simantics.peekProject(); if (project == null) return; diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphBackend.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphBackend.java index d817ca1fa..f57142b84 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphBackend.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphBackend.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.simantics.spreadsheet.graph; +import org.simantics.Simantics; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; import org.simantics.db.RequestProcessor; @@ -25,7 +26,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.spreadsheet.Adaptable; import org.simantics.spreadsheet.CellEditor; -import org.simantics.ui.SimanticsUI; public class GraphBackend implements Adaptable, ListenerSupport, AsyncListenerSupport, SyncListenerSupport { @@ -46,8 +46,8 @@ public class GraphBackend implements Adaptable, ListenerSupport, AsyncListenerSu public GraphBackend(RequestProcessor processor, VirtualGraph virtualGraph) { this.processor = processor; this.virtualGraph = virtualGraph; - delayedMerger = new MergingDelayedWriteProcessor(SimanticsUI.getSessionContext().getSession(), 5); - writeOnlyMerger = new MergingWriteOnlyProcessor(SimanticsUI.getSessionContext().getSession(), virtualGraph, 5); + delayedMerger = new MergingDelayedWriteProcessor(Simantics.getSessionContext().getSession(), 5); + writeOnlyMerger = new MergingWriteOnlyProcessor(Simantics.getSessionContext().getSession(), virtualGraph, 5); } public RequestProcessor getModifier() { diff --git a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/compositeViewer/CompositeViewer.java b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/compositeViewer/CompositeViewer.java index ef5d78481..17ed94c77 100644 --- a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/compositeViewer/CompositeViewer.java +++ b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/compositeViewer/CompositeViewer.java @@ -16,10 +16,10 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.widgets.Composite; +import org.simantics.Simantics; import org.simantics.db.procedure.Listener; import org.simantics.graphviz.Graph; import org.simantics.graphviz.ui.GraphvizComponent; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.ResourceEditorPart; public class CompositeViewer extends ResourceEditorPart { @@ -35,7 +35,7 @@ public class CompositeViewer extends ResourceEditorPart { } private void readGraph() { - SimanticsUI.getSession().asyncRequest(new CreateCompositeGraph( + Simantics.getSession().asyncRequest(new CreateCompositeGraph( getResourceInput().getResource()), new Listener() { diff --git a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser.java b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser.java index d1649ad50..7ccfd7099 100644 --- a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser.java +++ b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser.java @@ -21,6 +21,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.browsing.ui.model.browsecontexts.BrowseContext; import org.simantics.browsing.ui.platform.GraphExplorerView; import org.simantics.browsing.ui.swt.ViewArgumentUtils; @@ -28,7 +29,6 @@ import org.simantics.db.UndoContext; import org.simantics.db.common.UndoContextEx; import org.simantics.db.exception.DatabaseException; import org.simantics.structural.ui.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; import org.simantics.utils.ui.workbench.WorkbenchUtils; @@ -95,7 +95,7 @@ public class ModelBrowser extends GraphExplorerView { protected static Set loadBrowseContexts(final Set browseContexts) { try { - return BrowseContext.getBrowseContextClosure(SimanticsUI.getSession(), browseContexts); + return BrowseContext.getBrowseContextClosure(Simantics.getSession(), browseContexts); } catch (DatabaseException e) { ExceptionUtils.logAndShowError("Failed to load modeled browse contexts for property page, see exception for details.", e); return browseContexts; diff --git a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser2.java b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser2.java index 09cb31c86..ef194024f 100644 --- a/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser2.java +++ b/bundles/org.simantics.structural.ui/src/org/simantics/structural/ui/modelBrowser/ModelBrowser2.java @@ -16,6 +16,7 @@ import java.util.Collections; import java.util.Set; import org.eclipse.swt.widgets.Composite; +import org.simantics.Simantics; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.common.ErrorLogger; import org.simantics.browsing.ui.model.InvalidContribution; @@ -27,7 +28,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.Procedure; import org.simantics.db.request.Read; import org.simantics.project.ontology.ProjectResource; -import org.simantics.ui.SimanticsUI; /** * @author Hannu Niemistö @@ -42,7 +42,7 @@ public class ModelBrowser2 extends ModelBrowser { this.hideComparatorSelector = true; this.hideViewpointSelector = true; - SimanticsUI.getSession().asyncRequest(new ReadRequest() { + Simantics.getSession().asyncRequest(new ReadRequest() { @Override public void run(ReadGraph graph) throws DatabaseException { ArrayList browseContexts = new ArrayList(); @@ -76,7 +76,7 @@ public class ModelBrowser2 extends ModelBrowser { if (target == null) return; - SimanticsUI.getSession().asyncRequest(new Read() { + Simantics.getSession().asyncRequest(new Read() { @Override public Runnable perform(ReadGraph graph) throws DatabaseException { if (dndBrowseContext == null) diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/HistoryView.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/HistoryView.java index 2feac0c5d..2efb28bd0 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/HistoryView.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/HistoryView.java @@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ChangeSetIdentifier; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -50,7 +51,6 @@ import org.simantics.layer0.Layer0; import org.simantics.team.Activator; import org.simantics.team.internal.DebugPolicy; import org.simantics.team.internal.Images; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; import org.simantics.utils.ui.dialogs.ShowError; @@ -109,7 +109,7 @@ public class HistoryView extends TreeView { commentColumn.getColumn().setWidth(20); ad.setColumnData(commentColumn.getColumn(), new ColumnWeightData(50, 50)); - final HistoryContentProvider contentProvider = new HistoryContentProvider(SimanticsUI.getSession()); + final HistoryContentProvider contentProvider = new HistoryContentProvider(Simantics.getSession()); treeViewer.setContentProvider(contentProvider); //viewer.setSorter(new ViewerSorter()); treeViewer.setInput(this); @@ -136,7 +136,7 @@ public class HistoryView extends TreeView { getViewSite().getActionBars().getToolBarManager().add(new Action("Debug", Activator.DEBUG_ICON) { @Override public void run() { - Session s = SimanticsUI.getSession(); + Session s = Simantics.getSession(); try { s.sync(new WriteRequest() { @Override diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/RedoView.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/RedoView.java index dcbafcb35..2be1a2381 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/RedoView.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/RedoView.java @@ -20,8 +20,8 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; +import org.simantics.Simantics; import org.simantics.team.Activator; -import org.simantics.ui.SimanticsUI; /** * @author Kalle Kondelin @@ -57,7 +57,7 @@ public class RedoView extends TreeView { commentColumn.getColumn().setWidth(20); ad.setColumnData(commentColumn.getColumn(), new ColumnWeightData(50, 50)); - final RedoContentProvider contentProvider = new RedoContentProvider(SimanticsUI.getSession()); + final RedoContentProvider contentProvider = new RedoContentProvider(Simantics.getSession()); treeViewer.setContentProvider(contentProvider); treeViewer.setInput(this); getViewSite().getActionBars().getToolBarManager().add(new Action("Remove All", Activator.REMOVE_ALL_ICON) { diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/StagingView.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/StagingView.java index 6435d7557..2283d97d5 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/StagingView.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/StagingView.java @@ -43,6 +43,7 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart; +import org.simantics.Simantics; import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.graph.impl.SessionContextInputSource; import org.simantics.browsing.ui.swt.DefaultSelectionDataResolver; @@ -396,7 +397,7 @@ public class StagingView extends ViewPart { protected void createControls(final Composite parent) { parent.setLayout(LayoutUtils.createNoBorderGridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(treeViewer.getTree()); - treeViewer.setContentProvider(new CommentContentProvider(SimanticsUI.getSession())); + treeViewer.setContentProvider(new CommentContentProvider(Simantics.getSession())); treeViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { @@ -427,7 +428,7 @@ public class StagingView extends ViewPart { // getViewSite().getActionBars().getToolBarManager().add(new Action("GetIncoming", Activator.DOOR_IN_ICON) { // @Override // public void run() { -// treeViewer.setContentProvider(new IncomingContentProvider(SimanticsUI.getSession(), parent.getShell())); +// treeViewer.setContentProvider(new IncomingContentProvider(Simantics.getSession(), parent.getShell())); // } // }); new ItemDetailToolTip(treeViewer, treeViewer.getTree(), null); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/SynchroniseView.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/SynchroniseView.java index bae349680..9298b48c5 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/SynchroniseView.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/SynchroniseView.java @@ -47,6 +47,7 @@ import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.IPageSite; import org.eclipse.ui.part.ViewPart; +import org.simantics.Simantics; import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.graph.impl.SessionContextInputSource; import org.simantics.browsing.ui.swt.DefaultSelectionDataResolver; @@ -429,7 +430,7 @@ public class SynchroniseView extends ViewPart { protected void createControls(final Composite parent) { parent.setLayout(LayoutUtils.createNoBorderGridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(treeViewer.getTree()); - treeViewer.setContentProvider(new UndoContentProvider(SimanticsUI.getSession())); + treeViewer.setContentProvider(new UndoContentProvider(Simantics.getSession())); treeViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { @@ -479,7 +480,7 @@ public class SynchroniseView extends ViewPart { // getViewSite().getActionBars().getToolBarManager().add(new Action("GetUndoHistory", desc) { // @Override // public void run() { -// treeViewer.setContentProvider(new UndoContentProvider(SimanticsUI.getSession())); +// treeViewer.setContentProvider(new UndoContentProvider(Simantics.getSession())); // } // }); // getViewSite().getActionBars().getToolBarManager().add(new Action("DumpSelectedRevision", Activator.BIN_CLOSED_ICON) { @@ -490,7 +491,7 @@ public class SynchroniseView extends ViewPart { // if (o instanceof ChangeSetElement) { // ChangeSetElement ce = (ChangeSetElement)o; // long csid = ce.getChangeSetIdentifier().getId(); -// ManagementSupport ms = SimanticsUI.getSession().getService(ManagementSupport.class); +// ManagementSupport ms = Simantics.getSession().getService(ManagementSupport.class); // try { // ms.dumpRevision(csid); // ShowMessage.showInformation("DumpSelectedRevision", "Operation was successful."); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/UndoView.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/UndoView.java index 28fadd0f8..751658a1c 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/UndoView.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/UndoView.java @@ -21,6 +21,7 @@ import org.eclipse.jface.viewers.TreeViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.simantics.Simantics; import org.simantics.db.Operation; import org.simantics.db.Session; import org.simantics.db.UndoContext; @@ -30,7 +31,6 @@ import org.simantics.db.service.UndoRedoSupport; import org.simantics.db.service.UndoRedoSupport.ChangeListener; import org.simantics.team.Activator; import org.simantics.team.internal.Images; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.dialogs.ShowError; /** @@ -68,7 +68,7 @@ public class UndoView extends TreeView { commentColumn.getColumn().setWidth(20); ad.setColumnData(commentColumn.getColumn(), new ColumnWeightData(50, 50)); - final UndoContentProvider contentProvider = new UndoContentProvider(SimanticsUI.getSession()); + final UndoContentProvider contentProvider = new UndoContentProvider(Simantics.getSession()); treeViewer.setContentProvider(contentProvider); treeViewer.setInput(this); getViewSite().getActionBars().getToolBarManager().add(new Action("Remove All", Activator.REMOVE_ALL_ICON) { diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/CommitAllHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/CommitAllHandler.java index e047a3e56..83d136a8b 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/CommitAllHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/CommitAllHandler.java @@ -15,13 +15,13 @@ import java.io.File; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; import org.simantics.db.service.TeamSupport; import org.simantics.team.Activator; import org.simantics.team.Utils; import org.simantics.team.ui.CommentDialog; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; public class CommitAllHandler extends AbstractPreferenceHandler { @@ -46,7 +46,7 @@ public class CommitAllHandler extends AbstractPreferenceHandler { } static CommentDialog.Data commitAll(File teamFolder, boolean init) throws DatabaseException { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); TeamSupport ts = session.getService(TeamSupport.class); final CommentDialog.Data data = new CommentDialog.Data("Commit Comment"); if (CommentDialog.openCommentDialog(data)) diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DebugHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DebugHandler.java index 5d8ec323f..9fc1d4ee5 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DebugHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DebugHandler.java @@ -13,6 +13,7 @@ package org.simantics.team.ui.handlers; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.WriteGraph; @@ -21,7 +22,6 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.service.XSupport; import org.simantics.team.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; public class DebugHandler extends AbstractPreferenceHandler { @@ -35,7 +35,7 @@ public class DebugHandler extends AbstractPreferenceHandler { // if (sel instanceof IStructuredSelection) // ss = (IStructuredSelection) sel; try { - Session s = SimanticsUI.getSession(); + Session s = Simantics.getSession(); s.sync(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DumpToSelectedRevisionHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DumpToSelectedRevisionHandler.java index 2b8c677be..3b1b8e7f3 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DumpToSelectedRevisionHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/DumpToSelectedRevisionHandler.java @@ -20,13 +20,13 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.ChangeSetIdentifier; import org.simantics.db.Session; import org.simantics.db.common.utils.Logger; import org.simantics.db.service.ManagementSupport; import org.simantics.db.service.TeamSupport; import org.simantics.team.ui.Command; -import org.simantics.ui.SimanticsUI; public class DumpToSelectedRevisionHandler extends AbstractHandler { public DumpToSelectedRevisionHandler() { @@ -45,7 +45,7 @@ public class DumpToSelectedRevisionHandler extends AbstractHandler { if (null == csi) return null; long csid = csi.getId(); - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); ManagementSupport ms = session.getService(ManagementSupport.class); ms.dumpRevision(csid); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/GetOutgoingHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/GetOutgoingHandler.java index 5f84c49ae..c9afe4fc5 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/GetOutgoingHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/GetOutgoingHandler.java @@ -17,11 +17,11 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.db.service.LifecycleSupport; import org.simantics.db.service.TeamSupport; import org.simantics.team.Activator; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; public class GetOutgoingHandler extends AbstractPreferenceHandler { @@ -39,7 +39,7 @@ public class GetOutgoingHandler extends AbstractPreferenceHandler { ss = (IStructuredSelection) sel; try { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); TeamSupport ps = session.getService(TeamSupport.class); LifecycleSupport support = session.getService(LifecycleSupport.class); System.out.println("koss"); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandler.java index 8fcede7c4..45ec796d9 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandler.java @@ -20,12 +20,12 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.ChangeSetIdentifier; import org.simantics.db.Session; import org.simantics.db.common.utils.Logger; import org.simantics.db.service.TeamSupport; import org.simantics.team.ui.Command; -import org.simantics.ui.SimanticsUI; public class RevertToSelectedRevisionHandler extends AbstractHandler { public RevertToSelectedRevisionHandler() { @@ -44,7 +44,7 @@ public class RevertToSelectedRevisionHandler extends AbstractHandler { if (null == csi) return null; long csid = csi.getId(); - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); File frFolder = new File(wsFolder, "db"); File toFolder = new File(wsFolder, "Revert-ws"); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandlerStopOnError.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandlerStopOnError.java index 6405079c4..90ad6082d 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandlerStopOnError.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/RevertToSelectedRevisionHandlerStopOnError.java @@ -20,12 +20,12 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.Simantics; import org.simantics.db.ChangeSetIdentifier; import org.simantics.db.Session; import org.simantics.db.common.utils.Logger; import org.simantics.db.service.TeamSupport; import org.simantics.team.ui.Command; -import org.simantics.ui.SimanticsUI; public class RevertToSelectedRevisionHandlerStopOnError extends AbstractHandler { public RevertToSelectedRevisionHandlerStopOnError() { @@ -44,7 +44,7 @@ public class RevertToSelectedRevisionHandlerStopOnError extends AbstractHandler if (null == csi) return null; long csid = csi.getId(); - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); File frFolder = new File(wsFolder, "db"); File toFolder = new File(wsFolder, "Revert-ws"); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageEditHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageEditHandler.java index 3a8f02573..2d59e369d 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageEditHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageEditHandler.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.ServerReference; import org.simantics.db.Session; @@ -30,7 +31,6 @@ import org.simantics.team.Activator; import org.simantics.team.internal.StagingLauncher; import org.simantics.team.internal.StagingLauncher.Config; import org.simantics.team.internal.StagingLauncher.StagingResult; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; import org.simantics.utils.FileUtils; import org.simantics.utils.ui.ErrorLogger; @@ -49,7 +49,7 @@ public class StageEditHandler extends AbstractPreferenceHandler { public Object execute(ExecutionEvent event) throws ExecutionException { System.out.println("DEBUG: EditStageHandler"); try { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); File stFolder = new File(wsFolder, "staging"); if (!stFolder.isDirectory()) diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageInitHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageInitHandler.java index 09e8d6d2d..6afae9e3b 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageInitHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StageInitHandler.java @@ -16,11 +16,11 @@ import java.io.File; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.Platform; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.team.Activator; import org.simantics.team.ui.CommentDialog; import org.simantics.team.ui.StageInitWizard; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; import org.simantics.utils.ui.dialogs.ShowError; @@ -37,7 +37,7 @@ public class StageInitHandler extends AbstractPreferenceHandler { public Object execute(ExecutionEvent event) throws ExecutionException { System.out.println("DEBUG: " + this.getClass().getName()); try { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); File stFolder = new File(wsFolder, "staging"); final StageInitWizard.Data data = new StageInitWizard.Data(stFolder, null); diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StagingOutHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StagingOutHandler.java index 16acca6ed..97a0a8c08 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StagingOutHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/StagingOutHandler.java @@ -14,13 +14,13 @@ package org.simantics.team.ui.handlers; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; import org.simantics.db.service.TeamSupport; import org.simantics.team.Activator; import org.simantics.team.Utils; import org.simantics.team.ui.CommentDialog; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; public class StagingOutHandler extends AbstractPreferenceHandler { @@ -35,7 +35,7 @@ public class StagingOutHandler extends AbstractPreferenceHandler { // if (sel instanceof IStructuredSelection) // ss = (IStructuredSelection) sel; try { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); TeamSupport ts = session.getService(TeamSupport.class); final CommentDialog.Data data = new CommentDialog.Data("Staging Comment"); if (!CommentDialog.openCommentDialog(data)) diff --git a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/SynchroniseAllHandler.java b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/SynchroniseAllHandler.java index 6463ccbb2..d8be98c06 100644 --- a/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/SynchroniseAllHandler.java +++ b/bundles/org.simantics.team.ui/src/org/simantics/team/ui/handlers/SynchroniseAllHandler.java @@ -22,6 +22,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.ServerReference; import org.simantics.db.Session; @@ -34,7 +35,6 @@ import org.simantics.team.internal.StagingLauncher; import org.simantics.team.internal.StagingLauncher.Config; import org.simantics.team.internal.StagingLauncher.StagingResult; import org.simantics.team.ui.StageInitWizard; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.workbench.handler.AbstractPreferenceHandler; import org.simantics.utils.FileUtils; import org.simantics.utils.ui.ErrorLogger; @@ -53,7 +53,7 @@ public class SynchroniseAllHandler extends AbstractPreferenceHandler { // if (sel instanceof IStructuredSelection) // ss = (IStructuredSelection) sel; try { - Session session = SimanticsUI.getSession(); + Session session = Simantics.getSession(); File wsFolder = new File(Platform.getInstanceLocation().getURL().getFile()); File stFolder = new File(wsFolder, "staging"); File teamFolder = pullAll(session, Utils.getTeamFolder(), stFolder); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/SimanticsUI.java b/bundles/org.simantics.ui/src/org/simantics/ui/SimanticsUI.java index b90e48088..18019c9fd 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/SimanticsUI.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/SimanticsUI.java @@ -227,17 +227,6 @@ public class SimanticsUI { // return null; // } - /** - * Returns the session context provider of the curretly active workbench - * window. This method will always return a valid session context provider. - * - * @return a valid ISessionContextProvider - */ - @Deprecated - public static ISessionContextProvider getSessionContextProvider() { - return Simantics.getSessionContextProvider(); - } - /** * Returns the session context provider for the specified handle if one * exists. Workbench windows (IWorkbenchWindow) are currently used as @@ -307,7 +296,7 @@ public class SimanticsUI { * done. */ public static synchronized ISessionContext setSessionContext(ISessionContext ctx) { - return getSessionContextProvider().setSessionContext(ctx); + return Simantics.getSessionContextProvider().setSessionContext(ctx); } /** @@ -339,62 +328,6 @@ public class SimanticsUI { return null; } - /** - * Returns the database Session bound to the currently active workbench - * window. - * - *

- * This method should only be invoked in cases where it is certain that the - * correct workbench window has focus or it is the latest of all workbench - * windows to have had focus. Basically any invocation from the SWT UI - * thread is safe, since because in those cases the currently active - * workbench window is generally known. Instead invocations from any other - * thread should be carefully considered. The rule of thumb is that if you - * cannot be sure that the correct workbench window has focus, you should - * always get a hold of the Session to be used in some other manner. - *

- * - *

- * The method always returns a non-null Session or produces an - * IllegalStateException if a Session was not attainable. - *

- * - * @return the Session bound to the currently active workbench window - * @throws IllegalStateException if no Session was available - */ - @Deprecated - public static Session getSession() { - return Simantics.getSession(); - } - - /** - * Returns the database Session bound to the currently active workbench - * window. Differently from {@link #getSession()}, this method returns - * null if there is no current Session available. - * - *

- * This method should only be invoked from the SWT UI thread. Check the - * explanations given in {@link #getSession()}. The same applies to this - * method also. - *

- * - * @return the Session bound to the currently active workbench window or - * null - */ - @Deprecated - public static Session peekSession() { - return Simantics.peekSession(); - } - - /** - * @return the currently open and active project as an IProject or - * null if there is no active session or project - */ - @Deprecated - public static IProject peekProject() { - return Simantics.peekProject(); - } - /** * @return the currently open and active project for the specified database * session or null if there is no current project @@ -406,17 +339,6 @@ public class SimanticsUI { return ctx.getHint(ProjectKeys.KEY_PROJECT); } - /** - * @return the currently open and active project as an IProject - * @throws IllegalStateException if there is no currently active database - * session, which also means there is no active project at the - * moment - */ - @Deprecated - public static IProject getProject() { - return Simantics.getProject(); - } - /** * TODO: refactor this out of here * @@ -445,7 +367,7 @@ public class SimanticsUI { if(resource == null) return null; try { - return getSession().syncRequest(new Adapter(resource, assignableFrom)); + return Simantics.getSession().syncRequest(new Adapter(resource, assignableFrom)); } catch (DatabaseException e) { Logger.defaultLogError(e); return null; diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/DynamicMenuContribution.java b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/DynamicMenuContribution.java index 4830f525b..95bc5b423 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/DynamicMenuContribution.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/DynamicMenuContribution.java @@ -82,7 +82,7 @@ public abstract class DynamicMenuContribution extends CompoundContributionItem { protected final IContributionItem[] getContributionItems() { if (DatabaseJob.inProgress()) return NONE; - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx != null) { final Object[] selection = getSelectedObjects(); //System.out.println(getClass().getSimpleName() + "@" + System.identityHashCode(this) + "( " + System.identityHashCode(selection) + ": " + Arrays.toString(selection) + " )"); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OperationsMenuContribution.java b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OperationsMenuContribution.java index c4d8a72ce..9f7990d84 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OperationsMenuContribution.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/contribution/OperationsMenuContribution.java @@ -18,6 +18,7 @@ import java.util.Collection; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.resource.ImageDescriptor; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -26,7 +27,6 @@ import org.simantics.db.request.Read; import org.simantics.layer0.utils.collections.IContextualList; import org.simantics.layer0.utils.operations.IOperation; import org.simantics.project.IProject; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.icons.ImageUtil; import org.simantics.ui.selection.WorkbenchSelectionUtils; import org.simantics.ui.utils.ResourceAdaptionUtils; @@ -68,7 +68,7 @@ public abstract class OperationsMenuContribution extends DynamicMenuContribution } final ContextMap parameters = new ContextMap(); parameters.put(IOperation.SUBJECT, r); - IProject project = SimanticsUI.peekProject(); + IProject project = Simantics.peekProject(); if (project != null) parameters.put(IOperation.PROJECT, project.get()); assignParameters(parameters); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/dnd/ResourceReferenceTransfer.java b/bundles/org.simantics.ui/src/org/simantics/ui/dnd/ResourceReferenceTransfer.java index 98bca314d..6e9987a13 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/dnd/ResourceReferenceTransfer.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/dnd/ResourceReferenceTransfer.java @@ -15,12 +15,12 @@ import org.eclipse.swt.dnd.ByteArrayTransfer; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.TransferData; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.ResourceArray; import org.simantics.db.exception.DatabaseException; import org.simantics.db.service.SerialisationSupport; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -57,7 +57,7 @@ public class ResourceReferenceTransfer extends ByteArrayTransfer { private Session getSession() { // NOTE return SimanticsUI is a big HAXXX - return session == null ? SimanticsUI.getSession() : session; + return session == null ? Simantics.getSession() : session; } public void javaToNative(Object object, TransferData transferData) { diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/internal/SessionUtils.java b/bundles/org.simantics.ui/src/org/simantics/ui/internal/SessionUtils.java index 86ef49452..07b086644 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/internal/SessionUtils.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/internal/SessionUtils.java @@ -175,7 +175,7 @@ public final class SessionUtils { // throws DatabaseException, IOException // { // if(!forceReload) { -// ISessionContext newCtx = SimanticsUI.getSessionContext(); +// ISessionContext newCtx = Simantics.getSessionContext(); // if (newCtx != null && address.equals(newCtx.getAddress())) // return newCtx; // diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/tester/UndoPropertyTester.java b/bundles/org.simantics.ui/src/org/simantics/ui/tester/UndoPropertyTester.java index 1977d08df..3ea5293c3 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/tester/UndoPropertyTester.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/tester/UndoPropertyTester.java @@ -152,7 +152,7 @@ public class UndoPropertyTester extends PropertyTester implements UndoRedoSuppor int newUndo = oldUndo; int newRedo = oldRedo; try { - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (DEBUG) System.out.println("UndoPropertyTester: handle change, ctx=" + ctx); if (ctx == null) diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/GraphAccessViewPart.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/GraphAccessViewPart.java index 739796aae..2c703c41b 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/GraphAccessViewPart.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/GraphAccessViewPart.java @@ -18,6 +18,7 @@ import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Session; import org.simantics.db.common.request.ReadRequest; @@ -26,7 +27,6 @@ import org.simantics.db.event.ChangeListener; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; import org.simantics.db.service.GraphChangeListenerSupport; -import org.simantics.ui.SimanticsUI; /** * This class acts as a base class for ViewParts that to access the semantic @@ -170,7 +170,7 @@ public abstract class GraphAccessViewPart extends ViewPart { } protected void initializeSession() { - sessionContext = SimanticsUI.getSessionContext(); + sessionContext = Simantics.getSessionContext(); if (sessionContext == null) throw new IllegalStateException("no active session context"); session = sessionContext.getSession(); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorPart.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorPart.java index a81357532..1cd72de63 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorPart.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorPart.java @@ -22,11 +22,11 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.EditorPart; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.request.ParametrizedRead; import org.simantics.db.management.ISessionContext; -import org.simantics.ui.SimanticsUI; /** * ResourceEditorPart is a base implementation for editors that support @@ -79,7 +79,7 @@ public abstract class ResourceEditorPart extends EditorPart implements IResource // 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( diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java index 80e0393cf..3597804d8 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceEditorSupport.java @@ -17,6 +17,7 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Session; import org.simantics.db.common.procedure.adapter.ListenerAdapter; @@ -28,7 +29,6 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; import org.simantics.db.management.ISessionContextProvider; import org.simantics.db.service.GraphChangeListenerSupport; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.map.Tuple; import org.simantics.utils.ui.ExceptionUtils; import org.simantics.utils.ui.SWTUtils; @@ -91,7 +91,7 @@ public class ResourceEditorSupport implements IAdaptable, ChangeListener { private ISessionContext initSession() throws PartInitException { if (sessionContext == null) { - ISessionContextProvider provider = SimanticsUI.getSessionContextProvider(); + ISessionContextProvider provider = Simantics.getSessionContextProvider(); ISessionContext sc = provider.getSessionContext(); if (sc == null) throw new PartInitException("active database session context is null"); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceFormEditor.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceFormEditor.java index fe2a40acf..e018e9833 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceFormEditor.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ResourceFormEditor.java @@ -16,9 +16,9 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.forms.editor.FormEditor; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.db.management.ISessionContext; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -56,7 +56,7 @@ public abstract class ResourceFormEditor extends FormEditor implements IResource // 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) { session.asyncRequest( new TitleRequest(site.getId(), getResourceInput()), diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/SharedHeaderResourceFormEditor.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/SharedHeaderResourceFormEditor.java index 4032ee37c..4abb20787 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/SharedHeaderResourceFormEditor.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/SharedHeaderResourceFormEditor.java @@ -16,9 +16,9 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.forms.editor.SharedHeaderFormEditor; +import org.simantics.Simantics; import org.simantics.db.Session; import org.simantics.db.common.request.ParametrizedRead; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -54,7 +54,7 @@ public abstract class SharedHeaderResourceFormEditor extends SharedHeaderFormEdi // 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) { session.asyncRequest( new TitleRequest(site.getId(), getResourceInput()), diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ToolTipRequest.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ToolTipRequest.java index 2115b3c1d..93ec7ec6a 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ToolTipRequest.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/ToolTipRequest.java @@ -11,12 +11,12 @@ *******************************************************************************/ package org.simantics.ui.workbench; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; import org.simantics.project.IProject; -import org.simantics.ui.SimanticsUI; /** * @author Tuukka Lehtonen @@ -36,7 +36,7 @@ public class ToolTipRequest implements Read { public String perform(ReadGraph graph) throws DatabaseException { Resource r = input.getResource(); - IProject p = SimanticsUI.peekProject(); + IProject p = Simantics.peekProject(); if (p != null) { IEditorNamingService ems = EditorNaming.getNamingService(graph, r); if (ems instanceof IEditorNamingService2) diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java index 30af51d92..46facb59e 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/PerformDefaultAction.java @@ -19,8 +19,8 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.simantics.Simantics; import org.simantics.db.common.procedure.adapter.ProcedureAdapter; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.internal.Activator; import org.simantics.utils.ui.workbench.WorkbenchUtils; @@ -50,7 +50,7 @@ public class PerformDefaultAction extends Action { if (window != null) shell = window.getShell(); } - SimanticsUI.getSession().asyncRequest( + Simantics.getSession().asyncRequest( new ChooseActionRequest(shell, control, input, perspectiveId), new ProcedureAdapter() { @Override diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog.java index 5749ff5da..8633c8c9a 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog.java @@ -27,10 +27,10 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IMemento; import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog; import org.eclipse.ui.dialogs.SearchPattern; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.exception.InvalidResourceReferenceException; import org.simantics.db.service.SerialisationSupport; -import org.simantics.ui.SimanticsUI; public abstract class ResourceSelectionDialog extends FilteredItemsSelectionDialog { @@ -42,7 +42,7 @@ public abstract class ResourceSelectionDialog extends FilteredItemsSelectionD @Override protected Object restoreItemFromMemento(IMemento memento) { // FIXME: somehow create a collective transaction inside which the Graph.getRandomAccessReference should be invoked. -// Resource r = SimanticsUI.getSession().getRandomAccessReference(memento.getTextData()); +// Resource r = Simantics.getSession().getRandomAccessReference(memento.getTextData()); // return r; return null; } @@ -51,7 +51,7 @@ public abstract class ResourceSelectionDialog extends FilteredItemsSelectionD protected void storeItemToMemento(Object item, IMemento memento) { if(item instanceof Resource) { try { - SerialisationSupport support = SimanticsUI.getSession().getService(SerialisationSupport.class); + SerialisationSupport support = Simantics.getSession().getService(SerialisationSupport.class); memento.putTextData(support.getResourceSerializer().createRandomAccessId((Resource)item)); } catch (InvalidResourceReferenceException e) { e.printStackTrace(); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog2.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog2.java index 10142e404..6aca51a85 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog2.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog2.java @@ -28,10 +28,10 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IMemento; import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog; import org.eclipse.ui.dialogs.SearchPattern; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.exception.InvalidResourceReferenceException; import org.simantics.db.service.SerialisationSupport; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.datastructures.Pair; public abstract class ResourceSelectionDialog2 extends FilteredItemsSelectionDialog { @@ -44,7 +44,7 @@ public abstract class ResourceSelectionDialog2 extends FilteredItemsSelection @Override protected Object restoreItemFromMemento(IMemento memento) { // FIXME: somehow create a collective transaction inside which the Graph.getRandomAccessReference should be invoked. -// Resource r = SimanticsUI.getSession().getRandomAccessReference(memento.getTextData()); +// Resource r = Simantics.getSession().getRandomAccessReference(memento.getTextData()); // return r; return null; } @@ -53,7 +53,7 @@ public abstract class ResourceSelectionDialog2 extends FilteredItemsSelection protected void storeItemToMemento(Object item, IMemento memento) { if(item instanceof Resource) { try { - SerialisationSupport support = SimanticsUI.getSession().getService(SerialisationSupport.class); + SerialisationSupport support = Simantics.getSession().getService(SerialisationSupport.class); memento.putTextData(support.getResourceSerializer().createRandomAccessId((Resource)item)); } catch (InvalidResourceReferenceException e) { e.printStackTrace(); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog3.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog3.java index 801a2388b..dc492c746 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog3.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/dialogs/ResourceSelectionDialog3.java @@ -34,10 +34,10 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IMemento; import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog; import org.eclipse.ui.dialogs.SearchPattern; +import org.simantics.Simantics; import org.simantics.db.Resource; import org.simantics.db.exception.InvalidResourceReferenceException; import org.simantics.db.service.SerialisationSupport; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.internal.Activator; import org.simantics.utils.datastructures.Pair; @@ -52,7 +52,7 @@ public abstract class ResourceSelectionDialog3 extends FilteredItemsSelection @Override protected Object restoreItemFromMemento(IMemento memento) { // FIXME: somehow create a collective transaction inside which the Graph.getRandomAccessReference should be invoked. -// Resource r = SimanticsUI.getSession().getRandomAccessReference(memento.getTextData()); +// Resource r = Simantics.getSession().getRandomAccessReference(memento.getTextData()); // return r; return null; } @@ -61,7 +61,7 @@ public abstract class ResourceSelectionDialog3 extends FilteredItemsSelection protected void storeItemToMemento(Object item, IMemento memento) { if(item instanceof Resource) { try { - SerialisationSupport support = SimanticsUI.getSession().getService(SerialisationSupport.class); + SerialisationSupport support = Simantics.getSession().getService(SerialisationSupport.class); memento.putTextData(support.getResourceSerializer().createRandomAccessId((Resource)item)); } catch (InvalidResourceReferenceException e) { e.printStackTrace(); diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/AbstractResourceEditorAdapter.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/AbstractResourceEditorAdapter.java index 4f08c0181..e5b60a204 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/AbstractResourceEditorAdapter.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/AbstractResourceEditorAdapter.java @@ -14,11 +14,11 @@ package org.simantics.ui.workbench.editor; import org.eclipse.jface.action.IAction; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.WorkbenchException; +import org.simantics.Simantics; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.exception.DatabaseException; -import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; import org.simantics.ui.workbench.ResourceViewPartUtils; import org.simantics.ui.workbench.action.ResourceEditorAdapterAction; @@ -96,7 +96,7 @@ public abstract class AbstractResourceEditorAdapter extends AbstractEditorAdapte } protected void openViewWithId(String viewId, Resource id, String suffix) throws Exception { - Session ls = SimanticsUI.getSession(); + Session ls = Simantics.getSession(); ResourceViewPartUtils.activateViewForResource(viewId, ls, id, null); } diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/e4/UndoRedoTester.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/e4/UndoRedoTester.java index c1feefc26..ecf6c22ab 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/e4/UndoRedoTester.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/e4/UndoRedoTester.java @@ -47,7 +47,7 @@ public class UndoRedoTester { int newUndo = oldUndo; int newRedo = oldRedo; try { - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (DEBUG) System.out.println("UndoPropertyTester: handle change, ctx=" + ctx); if (ctx == null) diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/ApplicationUtil.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/ApplicationUtil.java index 372051cf3..2f246e897 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/ApplicationUtil.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/ApplicationUtil.java @@ -3,8 +3,8 @@ package org.simantics.workbench.internal; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jface.dialogs.MessageDialog; +import org.simantics.Simantics; import org.simantics.db.Session; -import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.dialogs.SafeMessageDialog; @@ -53,7 +53,7 @@ final class ApplicationUtil { } public static boolean hasUnsavedChanges() { - Session session = SimanticsUI.peekSession(); + Session session = Simantics.peekSession(); if (session == null) return false; diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java index 29ee52e61..80f2eee0a 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java @@ -867,7 +867,7 @@ public class SimanticsWorkbenchAdvisor extends WorkbenchAdvisor { } if (perspectiveId == null) { - IProject project = SimanticsUI.peekProject(); + IProject project = Simantics.peekProject(); if (project != null) perspectiveId = project.getHint(ProjectKeys.DEFAULT_PERSPECTIVE); } diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/GraphRequestStatusContribution.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/GraphRequestStatusContribution.java index 1d1279a06..29f61623f 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/GraphRequestStatusContribution.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/contributions/GraphRequestStatusContribution.java @@ -15,6 +15,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.menus.WorkbenchWindowControlContribution; +import org.simantics.Simantics; import org.simantics.db.management.ISessionContext; import org.simantics.db.management.ISessionContextChangedListener; import org.simantics.db.management.ISessionContextProvider; @@ -43,7 +44,7 @@ public class GraphRequestStatusContribution extends WorkbenchWindowControlContri contextProvider.addContextChangedListener(this); trim = new GraphRequestStatusTrim(parent, Activator.getDefault().getPreferenceStore()); - ISessionContext ctx = SimanticsUI.getSessionContext(); + ISessionContext ctx = Simantics.getSessionContext(); if (ctx != null) { trim.attachToSession(ctx.getSession()); }