import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchSite;
import org.simantics.Simantics;
+import org.simantics.browsing.ui.common.ErrorLogger;
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;
import org.simantics.db.ReadGraph;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.common.request.WriteResultRequest;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.exception.ServiceNotFoundException;
+import org.simantics.db.exception.RuntimeDatabaseException;
import org.simantics.db.layer0.util.RemoverUtil;
import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.management.ISessionContext;
import org.simantics.scenegraph.ontology.ScenegraphResources;
import org.simantics.scl.runtime.function.Function1;
import org.simantics.ui.workbench.IPropertyPage;
-import org.simantics.utils.ui.ErrorLogger;
-import org.simantics.utils.ui.jface.BasePostSelectionProvider;
+import org.simantics.utils.ui.jface.ActiveSelectionProvider;
import org.simantics.views.swt.client.base.SWTRoot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
protected ModelledSupport support;
- private BasePostSelectionProvider selectionProvider = new BasePostSelectionProvider() {
+ ActiveSelectionProvider selectionProvider = new ActiveSelectionProvider() {
@Override
public void setSelection(ISelection selection) {
- super.setAndFireNonEqualSelection(selection);
- super.firePostSelection(selection);
+ super.setSelection(selection);
}
};
@Override
protected WidgetSupportImpl createSupport() {
+
try {
runtime = Simantics.getSession().sync(
new WriteResultRequest<Resource>(Simantics.getSession().getService(VirtualGraph.class)) {
return runtime;
}
});
- } catch (ServiceNotFoundException | DatabaseException e) {
- LOGGER.error("Failed to initialize modelled view database runtime support structures", e);
+ } catch (RuntimeDatabaseException | DatabaseException e) {
+ LOGGER.error("Failed to initialize modelled widget support runtime scenegraph", e);
}
support = new ModelledSupport(this);
return support;
+
}
public void fireInput() {
}
if (load) {
+
try {
+
loader = new SWTViewLoaderProcess(this, getSite(), getClass().getSimpleName());
viewVariable = loader.getVariable(Simantics.getSession(), configurationURI(), runtime);
body.layout(true);
+ getSite().setSelectionProvider(selectionProvider);
+
} catch (DatabaseException e) {
- LOGGER.error("Failed to create modelled SWT view controls", e);
+
+ LOGGER.error("Failed to create modelled controls", e);
+
}
+
}
+
}
@Override
// Only create controls if the part is TRULY visible.
// Fast view parts seem to cause calls to createPartControl even
// when the part is hidden in reality
+ boolean visible = site.getPage().isPartVisible(this);
if (DEBUG)
System.out.println(this + ": createControls( visible=" + site.getPage().isPartVisible(this) + " )");
doCreateControls(true);
getSite().setSelectionProvider(selectionProvider);
getSite().getPage().addPartListener(this);
+
}
protected void inputChanged(IWorkbenchPart provider, Object input) {
RemoverUtil.remove(graph, rt);
}
});
- } catch (ServiceNotFoundException | DatabaseException e) {
- LOGGER.error("Failed to dispose of modelled view database runtime support structures", e);
+ } catch (RuntimeDatabaseException | DatabaseException e) {
+ LOGGER.error("Failed to dispose of the modelled widget support runtime scenegraph", e);
}
}
}
}
}
-
+
// Can be used to cancel already scheduled dispose
volatile boolean reallyClearExisting = false;
-
+
Runnable clearExisting = new Runnable() {
@Override
protected IPropertyPage getPropertyPage() {
return null;
}
-
+
}