@Override
  protected void configureGraphicalViewer() {
    super.configureGraphicalViewer();
    ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();

    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setRootEditPart(rootEditPart);
    getGraphicalViewer().setEditPartFactory(new WorkDesignerEditPartFactory(getParentEditor()));
    configureEditPartViewer(viewer);
    ((FigureCanvas) viewer.getControl()).setScrollBarVisibility(FigureCanvas.ALWAYS);
    getActionRegistry().registerAction(new ToggleGridAction(getGraphicalViewer()));
    getActionRegistry().registerAction(new ToggleSnapToGeometryAction(getGraphicalViewer()));
  }
  @Override
  public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    try {
      IFile file = ((IFileEditorInput) input).getFile();
      this.model = create(file);
      if (this.model == null) {
        throw new PartInitException("The specified input is not a valid network.");
      }
    } catch (CoreException e) {
      throw new PartInitException(e.getStatus());
    } catch (ClassCastException e) {
      throw new PartInitException("The specified input is not a valid network.", e);
    }

    setSite(site);
    setInput(input);
  }
 public void selectionChanged(IWorkbenchPart part, ISelection selection) {
   if (part.getSite().getWorkbenchWindow().getActivePage() == null) {
     return;
   }
   super.selectionChanged(part, selection);
 }
 public void commandStackChanged(EventObject event) {
   firePropertyChange(IEditorPart.PROP_DIRTY);
   super.commandStackChanged(event);
 }