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;
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);
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;
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;
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;
String recentPathsPref = store.getString(Preferences.RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS);
Deque<String> recentImportPaths = Preferences.decodePaths(recentPathsPref);
- ISessionContext ctx = SimanticsUI.getSessionContext();
+ ISessionContext ctx = Simantics.getSessionContext();
if (ctx == null)
return false;
IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT);
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;
// desirable.
// site.setSelectionProvider(null);
- contextProvider = SimanticsUI.getSessionContextProvider();
+ contextProvider = Simantics.getSessionContextProvider();
if (!bootstrapOnly) {
site.getPage().addSelectionListener(immediateSelectionListener);
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;
// desirable.
site.setSelectionProvider(null);
- contextProvider = SimanticsUI.getSessionContextProvider();
+ contextProvider = Simantics.getSessionContextProvider();
if (!bootstrapOnly) {
site.getPage().addSelectionListener(immediateSelectionListener);
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;
// Try the doubleClick-extensions
final String perspectiveId = WorkbenchUtils.getCurrentPerspectiveId();
- SimanticsUI.getSession().asyncRequest(new ChooseActionRequest(tree.getShell(), ge, selection, perspectiveId), new ProcedureAdapter<Object>() {
+ Simantics.getSession().asyncRequest(new ChooseActionRequest(tree.getShell(), ge, selection, perspectiveId), new ProcedureAdapter<Object>() {
@Override
public void exception(Throwable t) {
ErrorLogger.defaultLogError(ChooseActionRequest.class.getName() + " failed, see exception for details.", t);
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;
if(site != null)
return SimanticsUI.getSessionContextProvider(site.getWorkbenchWindow());
else
- return SimanticsUI.getSessionContextProvider();
+ return Simantics.getSessionContextProvider();
}
public GraphExplorer getExplorer() {
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;
@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));
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
@Override
public void run() {
final Shell shell = control.getShell();
- SimanticsUI.getSession().asyncRequest(new Read<Object>() {
+ Simantics.getSession().asyncRequest(new Read<Object>() {
@Override
public Object perform(ReadGraph graph) throws DatabaseException {
ChartResource CHART = ChartResource.getInstance(graph);
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;
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);
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;
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 {
ISelection selection = HandlerUtil.getCurrentSelection(event);
List<Resource> 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<Object>() {
@Override
});
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;
asyncRequest(request, (Procedure<T>)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<Throwable> 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());
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() {
@Override
public void createPartControl(Composite parent) {
// System.out.println("koss: " + getViewSite().getSecondaryId());
- session = SimanticsUI.getSession();
+ session = Simantics.getSession();
// Initialize input
String sid = getViewSite().getSecondaryId();
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;
@Override
public void createPartControl(Composite parent) {
- session = SimanticsUI.getSession();
+ session = Simantics.getSession();
// Initialize input
String sid = getViewSite().getSecondaryId();
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;
@Override
public void createPartControl(Composite parent) {
// System.out.println("koss: " + getViewSite().getSecondaryId());
- session = SimanticsUI.getSession();
+ session = Simantics.getSession();
// Initialize input
String sid = getViewSite().getSecondaryId();
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;
if (resource == null)
return false;
- Session session = SimanticsUI.peekSession();
+ Session session = Simantics.peekSession();
if (session == null)
return false;
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;
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.
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 {
if (resources.length < 3)
return;
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
* <code>false</code> 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();
* 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();
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;
if (resource == null)
return false;
- Session session = SimanticsUI.peekSession();
+ Session session = Simantics.peekSession();
if (session == null)
return false;
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;
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";
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)){
// 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);
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);
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;
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;
/**
resources.add((Resource) o);
}
try {
- return SimanticsUI.getSession().syncRequest(new Read<Resource[]>() {
+ return Simantics.getSession().syncRequest(new Read<Resource[]>() {
@Override
public Resource[] perform(ReadGraph graph) throws DatabaseException {
List<Resource> result = getSelection(graph, resources);
*******************************************************************************/
package org.simantics.diagram.symbolcontribution;
+import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
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;
@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 {
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;
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;
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) {
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;
/**
// desirable.
site.setSelectionProvider(null);
- contextProvider = SimanticsUI.getSessionContextProvider();
+ contextProvider = Simantics.getSessionContextProvider();
}
@Override
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;
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{
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
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{
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
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;
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new ReadRequest() {
+ Simantics.getSession().asyncRequest(new ReadRequest() {
@Override
public void run(ReadGraph graph) throws DatabaseException {
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;
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;
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new ReadRequest() {
+ Simantics.getSession().asyncRequest(new ReadRequest() {
@Override
public void run(ReadGraph graph) throws DatabaseException {
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;
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 {
}
private void attachDND() {
- SimanticsUI.getSession().asyncRequest(new ReadRequest() {
+ Simantics.getSession().asyncRequest(new ReadRequest() {
@Override
public void run(ReadGraph graph) throws DatabaseException {
ArrayList<Resource> browseContexts = new ArrayList<Resource>();
if (target == null)
return;
- SimanticsUI.getSession().asyncRequest(new Read<Runnable>() {
+ Simantics.getSession().asyncRequest(new Read<Runnable>() {
@Override
public Runnable perform(ReadGraph graph) throws DatabaseException {
if (dndBrowseContext == null)
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;
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 {
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
import java.util.Collection;
+import org.simantics.Simantics;
import org.simantics.annotation.ontology.AnnotationResource;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
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)
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)){
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() {
if (res == null)
return;
try {
- final Resource selected = SimanticsUI.getSession().syncRequest(new Read<Resource>() {
+ final Resource selected = Simantics.getSession().syncRequest(new Read<Resource>() {
@Override
public Resource perform(ReadGraph graph) throws DatabaseException {
try {
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
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")
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;
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() {
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;
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;
/**
@Override
public void run() {
try {
- String name = SimanticsUI.getSession().syncRequest(new Read<String>() {
+ String name = Simantics.getSession().syncRequest(new Read<String>() {
public String perform(ReadGraph graph) throws DatabaseException {
DocumentResource doc = DocumentResource.getInstance(graph);
GraphFileResource gf = GraphFileResource.getInstance(graph);
import java.util.List;
+import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
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 {
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
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;
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 {
import java.io.IOException;
+import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
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;
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 {
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;
@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 {
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
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();
});
try {
- SimanticsUI.getSession().syncRequest(new ReadRequest() {
+ Simantics.getSession().syncRequest(new ReadRequest() {
@Override
public void run(ReadGraph g) {
EquationResources.initialize(g);
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;
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;
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();
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;
if (files.isEmpty())
return;
- SimanticsUI.getSession().markUndoPoint();
- SimanticsUI.getSession().asyncRequest( new CreateImages(container, files) );
+ Simantics.getSession().markUndoPoint();
+ Simantics.getSession().asyncRequest( new CreateImages(container, files) );
}
};
}
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;
/**
if (files.isEmpty())
return null;
- SimanticsUI.getSession().asyncRequest( new CreateImages(container, files) );
+ Simantics.getSession().asyncRequest( new CreateImages(container, files) );
return null;
}
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;
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;
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);
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
Session s;
public ResourceReferenceSerializer() {
- this.s = SimanticsUI.getSession();
+ this.s = Simantics.getSession();
}
public ResourceReferenceSerializer(Session s) {
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;
@Override
public void doPerform(Resource r) {
- Session session = SimanticsUI.peekSession();
+ Session session = Simantics.peekSession();
if (session == null) {
// FIXME: not stdout.
System.out.println("ResourceSchemeHandler: no session");
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.simantics.Simantics;
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.message.DetailStatus;
import org.simantics.message.ReferenceSerializationException;
import org.simantics.message.ui.Activator;
import org.simantics.message.util.MessageUtil;
-import org.simantics.ui.SimanticsUI;
import org.simantics.ui.utils.ResourceAdaptionUtils;
/**
Resource[] rs = ResourceAdaptionUtils.toResources(HandlerUtil.getCurrentSelection(event));
ILogger log = MessageService.getDefault();
- Session s = SimanticsUI.peekSession();
+ Session s = Simantics.peekSession();
if (s == null)
return null;
*******************************************************************************/
package org.simantics.modeling.template2d.ui.actions;
+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.adapter.ActionFactory;
import org.simantics.modeling.template2d.ontology.Template2dResource;
-import org.simantics.ui.SimanticsUI;
public class ChangePageOrientation 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();
*******************************************************************************/
package org.simantics.modeling.template2d.ui.actions;
+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.layer0.adapter.ActionFactory;
import org.simantics.layer0.Layer0;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class MoveDown 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();
*******************************************************************************/
package org.simantics.modeling.template2d.ui.actions;
+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.layer0.adapter.ActionFactory;
import org.simantics.layer0.Layer0;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class MoveUp 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();
*******************************************************************************/
package org.simantics.modeling.template2d.ui.actions;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.diagram.stubs.G2DResource;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
-import org.simantics.ui.SimanticsUI;
public class NewDrawingTemplate 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();
import java.util.ArrayList;
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
/**
* @author Teemu Matasniemi
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();
import java.util.ArrayList;
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
/**
* @author Teemu Matasniemi
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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.datatypes.DatatypeResource;
import org.simantics.datatypes.literal.Font;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
/**
* @author Teemu Matasniemi
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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.datatypes.DatatypeResource;
import org.simantics.datatypes.literal.Font;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class NewFlagTableColumnHeader 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();
import java.util.ArrayList;
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
/**
* @author Teemu Matasniemi
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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class NewFlagTypeVisualFilter 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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.datatypes.DatatypeResource;
import org.simantics.datatypes.literal.Font;
import org.simantics.diagram.stubs.G2DResource;
import org.simantics.layer0.Layer0;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class NewMonitor 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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class NewSVGImage 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();
import java.util.Arrays;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.datatypes.DatatypeResource;
import org.simantics.datatypes.literal.Font;
import org.simantics.diagram.stubs.G2DResource;
import org.simantics.layer0.Layer0;
import org.simantics.scenegraph.ontology.ScenegraphResources;
-import org.simantics.ui.SimanticsUI;
public class NewText 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();
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.WriteGraph;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.diagram.G2DUtils;
import org.simantics.diagram.stubs.G2DResource;
import org.simantics.modeling.template2d.ontology.Template2dResource;
-import org.simantics.ui.SimanticsUI;
public class SetBorderColor implements ActionFactory {
return;
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph g) throws DatabaseException {
g.markUndoPoint();
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.diagram.stubs.DiagramResource;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.template2d.ontology.Template2dResource;
-import org.simantics.ui.SimanticsUI;
import org.simantics.ui.utils.ResourceAdaptionUtils;
import org.simantics.utils.ui.dialogs.ShowError;
if (flag == null)
return false;
- session = SimanticsUI.getSession();
+ session = Simantics.getSession();
if (session == null)
return false;
try {
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.template2d.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;
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);
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.simantics.Simantics;
import org.simantics.db.Resource;
import org.simantics.db.management.ISessionContext;
import org.simantics.modeling.template2d.DiagramTemplates;
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;
String recentPathsPref = store.getString(Preferences.RECENT_DRAWING_TEMPLATE_IMPORT_LOCATIONS);
Deque<String> recentImportPaths = Preferences.decodePaths(recentPathsPref);
- ISessionContext ctx = SimanticsUI.getSessionContext();
+ ISessionContext ctx = Simantics.getSessionContext();
if (ctx == null)
return false;
IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT);
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;
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;
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);
final ResourceArray ra = in.getResourceArray();
ResourceArray symbolEditorInput;
try {
- symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read<ResourceArray>() {
+ symbolEditorInput = Simantics.getSession().syncRequest(new Read<ResourceArray>() {
@Override
public ResourceArray perform(ReadGraph graph) throws DatabaseException {
StructuralResource2 sr = StructuralResource2.getInstance(graph);
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;
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;
final ResourceArray ra = in.getResourceArray();
ResourceArray symbolEditorInput;
try {
- symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read<ResourceArray>() {
+ symbolEditorInput = Simantics.getSession().syncRequest(new Read<ResourceArray>() {
@Override
public ResourceArray perform(ReadGraph graph) throws DatabaseException {
StructuralResource2 sr = StructuralResource2.getInstance(graph);
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 {
*******************************************************************************/
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;
/**
@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() };
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;
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 {
@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();
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;
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 {
@Override
public void run() {
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
graph.markUndoPoint();
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();
import java.util.UUID;
+import org.simantics.Simantics;
import org.simantics.db.Resource;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.CommentMetadata;
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
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();
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;
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;
final ResourceArray ra = in.getResourceArray();
ResourceArray symbolEditorInput;
try {
- symbolEditorInput = SimanticsUI.getSession().syncRequest(new Read<ResourceArray>() {
+ symbolEditorInput = Simantics.getSession().syncRequest(new Read<ResourceArray>() {
@Override
public ResourceArray perform(ReadGraph graph) throws DatabaseException {
StructuralResource2 sr = StructuralResource2.getInstance(graph);
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 {
if (resources.length == 0)
return;
- SimanticsUI.getSession().asyncRequest(new ReadRequest() {
+ Simantics.getSession().asyncRequest(new ReadRequest() {
@Override
public void run(ReadGraph graph) throws DatabaseException {
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;
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;
/**
public PageSettingsDialog(Resource diagramResource, Shell parentShell) {
super(parentShell);
- this.session = SimanticsUI.getSession();
+ this.session = Simantics.getSession();
this.diagramResource = diagramResource;
}
protected Set<String> 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;
}
protected void initSession() {
- sessionContextProvider = SimanticsUI.getSessionContextProvider();
+ sessionContextProvider = Simantics.getSessionContextProvider();
sessionContext = sessionContextProvider.getSessionContext();
}
// 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<Boolean> disposedCallback = () -> disposed;
session.asyncRequest(
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;
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;
@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 {
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;
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;
@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());
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;
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;
@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);
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;
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;
@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 {
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;
}
protected void initSession() {
- sessionContextProvider = SimanticsUI.getSessionContextProvider();
+ sessionContextProvider = Simantics.getSessionContextProvider();
sessionContext = sessionContextProvider.getSessionContext();
}
// 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<Boolean> disposedCallback = () -> disposed;
session.asyncRequest(
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;
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;
}
private void createMessage(TerminalInfo terminal, final Consumer<String> callback) {
- SimanticsUI.getSession().asyncRequest(new TerminalInfoMessage(terminal, terminalNamingStrategy), new ProcedureAdapter<String>() {
+ Simantics.getSession().asyncRequest(new TerminalInfoMessage(terminal, terminalNamingStrategy), new ProcedureAdapter<String>() {
@Override
public void exception(Throwable t) {
ErrorLogger.defaultLogError(t);
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;
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;
this.layer = layer;
this.structuralPath = structuralPath;
- sessionContextProvider = SimanticsUI.getSessionContextProvider();
+ sessionContextProvider = Simantics.getSessionContextProvider();
sessionContext = sessionContextProvider.getSessionContext();
canvasContext = createViewerCanvas();
protected Set<String> 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;
}
protected void initSession() {
- sessionContextProvider = SimanticsUI.getSessionContextProvider();
+ sessionContextProvider = Simantics.getSessionContextProvider();
sessionContext = sessionContextProvider.getSessionContext();
}
// 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<Boolean> disposedCallback = () -> disposed;
Display display = part.getContext().get(Shell.class).getDisplay();
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;
/**
if (resources.length < 2)
return null;
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
/**
if (resources.length < 2)
return null;
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
/**
@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();
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;
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;
/**
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 {
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;
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;
@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);
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;
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;
@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
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;
/**
return null;
final Set<Resource> flagSet = new HashSet<Resource>(flags);
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph g) throws DatabaseException {
for (Resource flag : flagSet)
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.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 {
if (element == null)
return null;
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
@Override
public void perform(WriteGraph graph) throws DatabaseException {
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;
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;
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);
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.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;
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);
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;
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);
}
// 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");
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;
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 {
@Override
public void drop(Object data) {
if (data instanceof ISelection) {
- handleDrop(SimanticsUI.getSession(), (ISelection) data);
+ handleDrop(Simantics.getSession(), (ISelection) data);
}
}
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;
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);
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;
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;
/**
final List<PropertyVariables> vars = ISelectionUtils.filterSelection((ISelection) data, PropertyVariables.class);
if (!vars.isEmpty()) {
// try {
-// List<VariableReference> references = SimanticsUI.getSession().syncRequest(VariableReferences.toReferences(vars));
+// List<VariableReference> references = Simantics.getSession().syncRequest(VariableReferences.toReferences(vars));
// addPlots(references);
// } catch (DatabaseException e) {
// ErrorLogger.defaultLogError(e);
}
// private void addPlots(List<VariableReference> references) {
-// SimanticsUI.getSession().asyncRequest(new AddChartItem(resource, references), new Callback<DatabaseException>() {
+// Simantics.getSession().asyncRequest(new AddChartItem(resource, references), new Callback<DatabaseException>() {
// @Override
// public void run(DatabaseException e) {
// if (e != null)
@Override
public Modifier getModifier(String columnId) {
- Session s = SimanticsUI.getSession();
+ Session s = Simantics.getSession();
return new LabelModifier(s, resource);
}
*******************************************************************************/
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
@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);
}
}
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) {
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;
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;
if (!vars.isEmpty()) {
List<VariableReference> references;
try {
- references = SimanticsUI.getSession().syncRequest(VariableReferences.toReferences(vars));
+ references = Simantics.getSession().syncRequest(VariableReferences.toReferences(vars));
addSubscriptions(references);
} catch (DatabaseException e) {
ErrorLogger.defaultLogError(e);
}
private void addSubscriptions(List<VariableReference> references) {
- SimanticsUI.getSession().asyncRequest(new AddSubscriptionItems(resource, references), e -> {
+ Simantics.getSession().asyncRequest(new AddSubscriptionItems(resource, references), e -> {
if (e != null)
ErrorLogger.defaultLogError(e);
});
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) {
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);
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;
if (resource == null)
return false;
- Session session = SimanticsUI.peekSession();
+ Session session = Simantics.peekSession();
if (session == null)
return false;
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;
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;
// 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;
try {
// FIXME: I have no idea if this works or not..
- diagram = SimanticsUI.getSession().syncRequest(new Read<IDiagram>() {
+ diagram = Simantics.getSession().syncRequest(new Read<IDiagram>() {
@Override
public IDiagram perform(ReadGraph graph) throws DatabaseException {
IDiagram d = synchronizer.loadDiagram(new NullProgressMonitor(), graph, null, structuralPath.resources[0], null, structuralPath.removeFromBeginning(0), hints);
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;
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);
String recentPathsPref = store.getString(Preferences.RECENT_SHARED_LIBRARY_IMPORT_LOCATIONS);
Deque<String> recentImportPaths = Preferences.decodePaths(recentPathsPref);
- ISessionContext ctx = SimanticsUI.getSessionContext();
+ ISessionContext ctx = Simantics.getSessionContext();
if (ctx == null)
return false;
IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT);
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;
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);
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;
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;
String recentPathsPref = store.getString(Preferences.RECENT_SHARED_LIBRARY_IMPORT_LOCATIONS);
Deque<String> recentImportPaths = Preferences.decodePaths(recentPathsPref);
- ISessionContext ctx = SimanticsUI.getSessionContext();
+ ISessionContext ctx = Simantics.getSessionContext();
if (ctx == null)
return false;
IProject project = ctx.getHint(ProjectKeys.KEY_PROJECT);
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);
*******************************************************************************/
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;
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;
return;
if (g.isInstanceOf(experiment, SimulationResource.getInstance(g).Experiment)) {
- final IProject project = SimanticsUI.getProject();
+ final IProject project = Simantics.getProject();
if (project == null)
return;
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;
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;
if (experiment == null)
return null;
- final IProject project = SimanticsUI.peekProject();
+ final IProject project = Simantics.peekProject();
if (project == null)
return null;
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)
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);
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;
@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);
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;
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
@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);
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;
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;
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;
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;
@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);
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;
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;
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;
/**
@PostConstruct
public void createControls(Composite parent, MToolControl toolControl) {
- IProject project = SimanticsUI.peekProject();
+ IProject project = Simantics.peekProject();
if (project == null)
return;
*******************************************************************************/
package org.simantics.spreadsheet.graph;
+import org.simantics.Simantics;
import org.simantics.db.AsyncReadGraph;
import org.simantics.db.ReadGraph;
import org.simantics.db.RequestProcessor;
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 {
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() {
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 {
}
private void readGraph() {
- SimanticsUI.getSession().asyncRequest(new CreateCompositeGraph(
+ Simantics.getSession().asyncRequest(new CreateCompositeGraph(
getResourceInput().getResource()),
new Listener<Graph>() {
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;
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;
protected static Set<String> loadBrowseContexts(final Set<String> 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;
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;
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ö
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<Resource> browseContexts = new ArrayList<Resource>();
if (target == null)
return;
- SimanticsUI.getSession().asyncRequest(new Read<Runnable>() {
+ Simantics.getSession().asyncRequest(new Read<Runnable>() {
@Override
public Runnable perform(ReadGraph graph) throws DatabaseException {
if (dndBrowseContext == null)
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;
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;
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);
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
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
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) {
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;
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) {
// 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);
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;
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) {
// 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) {
// 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.");
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;
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;
/**
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) {
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 {
}
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))
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;
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 {
// 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 {
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() {
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());
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 {
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");
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() {
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");
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() {
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");
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;
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;
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())
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;
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);
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 {
// 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))
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;
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;
// 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);
// 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
* done.
*/
public static synchronized ISessionContext setSessionContext(ISessionContext ctx) {
- return getSessionContextProvider().setSessionContext(ctx);
+ return Simantics.getSessionContextProvider().setSessionContext(ctx);
}
/**
return null;
}
- /**
- * Returns the database Session bound to the currently active workbench
- * window.
- *
- * <p>
- * 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.
- * </p>
- *
- * <p>
- * The method always returns a non-null Session or produces an
- * IllegalStateException if a Session was not attainable.
- * </p>
- *
- * @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
- * <code>null</code> if there is no current Session available.
- *
- * <p>
- * 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.
- * </p>
- *
- * @return the Session bound to the currently active workbench window or
- * <code>null</code>
- */
- @Deprecated
- public static Session peekSession() {
- return Simantics.peekSession();
- }
-
- /**
- * @return the currently open and active project as an IProject or
- * <code>null</code> 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 <code>null</code> if there is no current project
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
*
if(resource == null) return null;
try {
- return getSession().syncRequest(new Adapter<T>(resource, assignableFrom));
+ return Simantics.getSession().syncRequest(new Adapter<T>(resource, assignableFrom));
} catch (DatabaseException e) {
Logger.defaultLogError(e);
return null;
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) + " )");
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;
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;
}
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);
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
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) {
// throws DatabaseException, IOException
// {
// if(!forceReload) {
-// ISessionContext newCtx = SimanticsUI.getSessionContext();
+// ISessionContext newCtx = Simantics.getSessionContext();
// if (newCtx != null && address.equals(newCtx.getAddress()))
// return newCtx;
//
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)
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;
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
}
protected void initializeSession() {
- sessionContext = SimanticsUI.getSessionContext();
+ sessionContext = Simantics.getSessionContext();
if (sessionContext == null)
throw new IllegalStateException("no active session context");
session = sessionContext.getSession();
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
// 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<Boolean> disposedCallback = () -> disposed;
session.asyncRequest(
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;
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;
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");
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
// 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()),
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
// 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()),
*******************************************************************************/
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
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)
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;
if (window != null)
shell = window.getShell();
}
- SimanticsUI.getSession().asyncRequest(
+ Simantics.getSession().asyncRequest(
new ChooseActionRequest(shell, control, input, perspectiveId),
new ProcedureAdapter<Object>() {
@Override
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<T> extends FilteredItemsSelectionDialog {
@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;
}
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();
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<T> extends FilteredItemsSelectionDialog {
@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;
}
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();
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;
@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;
}
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();
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;
}
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);
}
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)
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;
}
public static boolean hasUnsavedChanges() {
- Session session = SimanticsUI.peekSession();
+ Session session = Simantics.peekSession();
if (session == null)
return false;
}
if (perspectiveId == null) {
- IProject project = SimanticsUI.peekProject();
+ IProject project = Simantics.peekProject();
if (project != null)
perspectiveId = project.getHint(ProjectKeys.DEFAULT_PERSPECTIVE);
}
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;
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());
}