partHidden/partVisible callbacks.
The important developer-visible changes are:
* Diagram editor should now use the class org.simantics.modeling.ui.diagramEditor.DiagramEditor as the editor class.
* DiagramEditor extension class attributes require a *viewer=clazz* argument after the *org.simantics.modeling.ui.diagramEditor.DiagramEditor:* class string, where clazz is something inherited from *org.simantics.modeling.ui.diagramEditor.DiagramViewer.
* DiagramViewer.getInputValidator() is now public
* Eclipse command handlers or any other code comparing EditorPart instances to *org.simantics.modeling.ui.diagramEditor.DiagramViewer* must be changed to compare to *org.simantics.modeling.ui.diagramEditor.DiagramEditor* and get the viewer through DiagramEditor.getViewer().
fixes #3213
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@24212
ac1ea38d-2e2b-0410-8846-
a27921b304fc
<extension\r
point="org.eclipse.ui.editors">\r
<editor\r
- class="org.simantics.sysdyn.ui.editor.DiagramViewer"\r
+ class="org.simantics.modeling.ui.diagramEditor.DiagramEditor:viewer=org.simantics.sysdyn.ui.editor.DiagramViewer"\r
default="false"\r
icon="platform:/plugin/com.famfamfam.silk/icons/plugin.png"\r
id="org.simantics.sysdyn.ui.diagramViewer"\r
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.ui.IEditorPart;\r
import org.eclipse.ui.PartInitException;\r
import org.eclipse.ui.PlatformUI;\r
import org.eclipse.ui.handlers.HandlerUtil;\r
import org.simantics.diagram.stubs.DiagramResource;\r
import org.simantics.modeling.ComponentUtils;\r
import org.simantics.modeling.ModelingResources;\r
+import org.simantics.modeling.ui.diagramEditor.DiagramEditor;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.editor.DiagramViewer;\r
\r
ISelection s = HandlerUtil.getCurrentSelectionChecked(event);\r
final Resource resources[] = ResourceAdaptionUtils.toResources(s);\r
- final DiagramViewer viewer = (DiagramViewer)HandlerUtil.getActiveEditor(event);\r
+ IEditorPart editor = (IEditorPart)HandlerUtil.getActiveEditor(event);\r
+ if (!(editor instanceof DiagramEditor))\r
+ return null;\r
+ final DiagramViewer viewer = (DiagramViewer) ((DiagramEditor) editor).getViewer();\r
+ if (viewer == null)\r
+ return null;\r
\r
SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
\r
import org.simantics.diagram.profile.Profiles;\r
import org.simantics.diagram.stubs.DiagramResource;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ui.diagramEditor.DiagramEditor;\r
import org.simantics.project.IProject;\r
import org.simantics.simulation.experiment.ExperimentState;\r
import org.simantics.simulation.experiment.IExperiment;\r
for(IWorkbenchPage page : pages) {\r
for(IEditorReference reference : page.getEditorReferences()) {\r
IEditorPart iep = reference.getEditor(false);\r
- if(iep instanceof DiagramViewer) {\r
- DiagramViewer viewer = (DiagramViewer) iep;\r
- Resource runtime = viewer.getRuntime();\r
- String modelUri = viewer.getResourceInput2().getModelURI();\r
- DiagramInfo info = new DiagramInfo();\r
- info.modelURI = modelUri;\r
- runtimeDiagramsAndModelUris.put(runtime, info);\r
+ if(iep instanceof DiagramEditor) {\r
+ DiagramEditor editor = (DiagramEditor) iep;\r
+ if (editor.getViewer() instanceof DiagramViewer) {\r
+ DiagramViewer viewer = (DiagramViewer) editor.getViewer();\r
+ Resource runtime = viewer.getRuntime();\r
+ String modelUri = viewer.getResourceInput2().getModelURI();\r
+ DiagramInfo info = new DiagramInfo();\r
+ info.modelURI = modelUri;\r
+ runtimeDiagramsAndModelUris.put(runtime, info);\r
+ }\r
}\r
}\r
}\r