/** * Initialize overview. */ protected void initializeOverview() { LightweightSystem lws = new J2DLightweightSystem(overview); RootEditPart rep = editor.getGraphicalViewer().getRootEditPart(); if (rep instanceof MainDesignerRootEditPart) { ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) rep; thumbnail = new JSSScrollableThumbnail((Viewport) root.getFigure(), (MRoot)getViewer().getContents().getModel()); thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS)); lws.setContents(thumbnail); disposeListener = new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (thumbnail != null) { thumbnail.deactivate(); thumbnail = null; } } }; editor.getEditor().addDisposeListener(disposeListener); } lws.setControl(overview); }
/** * Initialize the graphical overview. * */ protected void initializeOverview() { if (multieditor.getCurrentPage() == null) { overview.setVisible(false); thumbnail.deactivate(); thumbnail = null; return; } RootEditPart rep = multieditor.getCurrentPage().getGraphicalViewer().getRootEditPart(); if (rep instanceof ScalableFreeformRootEditPart) { refreshThumbnail((ScalableFreeformRootEditPart) rep); disposeListener = new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (thumbnail != null) { thumbnail.deactivate(); thumbnail = null; } } }; ((FigureCanvas) multieditor.getCurrentPage().getGraphicalViewer().getControl()).addDisposeListener(disposeListener); } }
/** * Refresh the overview thumbnail when the map changes. */ public void pageChanged() { if (multieditor.getCurrentPage() == null) { overview.setVisible(false); thumbnail.deactivate(); thumbnail = null; return; } RootEditPart rep = multieditor.getCurrentPage().getGraphicalViewer().getRootEditPart(); if (rep instanceof ScalableFreeformRootEditPart) { refreshThumbnail((ScalableFreeformRootEditPart) rep); } refreshDefinitions(false); }
public EditPartViewer getViewer() { RootEditPart root = getRoot(); if (root == null) { return null; } return root.getViewer(); }
protected OverviewOutlinePage getOverviewOutlinePage() { if(null == overviewOutlinePage && null != getGraphicalViewer()) { RootEditPart rootEditPart = getGraphicalViewer().getRootEditPart(); if(rootEditPart instanceof ScalableRootEditPart) { overviewOutlinePage = new OverviewOutlinePage( (ScalableRootEditPart) rootEditPart); } } return overviewOutlinePage; }
/** * * platformUi에서 다이어그램 EditPart를 가져온다. * * @return EditPart */ public static EditPart getDiagramEditPart() { IWorkbench workbench = PlatformUI.getWorkbench(); if (!checkNull(workbench)) { return null; } IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); if (!checkNull(workbenchWindow)) { return null; } IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); if (!checkNull(workbenchPage)) { return null; } IEditorPart editorPart = workbenchPage.getActiveEditor(); if (!checkNull(editorPart)) { return null; } if (!(editorPart instanceof AbstractDiagramEditor)) { return null; } GraphicalViewer graphicalViewer = ((AbstractDiagramEditor) editorPart).getDiagramGraphicalViewer(); if (!checkNull(graphicalViewer)) { return null; } RootEditPart rootEditPart = graphicalViewer.getRootEditPart(); if (!checkNull(rootEditPart)) { return null; } EditPart editPart = rootEditPart.getContents(); if (!checkNull(editPart)) { return null; } return editPart; }
/** * @see org.eclipse.gef.editparts.AbstractEditPart#getRoot() */ @Override public RootEditPart getRoot() { if (getParent() != null && getParent().getParent() != null) { return super.getRoot(); } else { return ((AbstractDiagramEditor) PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .getActiveEditor()).getDiagramGraphicalViewer().getRootEditPart(); } // return super.getRoot(); }
/** * @see org.eclipse.gef.editparts.AbstractEditPart#getRoot() */ @Override public RootEditPart getRoot() { if (getParent() != null && getParent().getParent() != null) { return super.getRoot(); } else { return ((AbstractDiagramEditor) PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .getActiveEditor()).getDiagramGraphicalViewer().getRootEditPart(); } }
protected IMapMode getMapMode() { RootEditPart root = getHost().getRoot(); if (root instanceof DiagramRootEditPart) { DiagramRootEditPart dgrmRoot = (DiagramRootEditPart) root; return dgrmRoot.getMapMode(); } return MapModeUtil.getMapMode(); }
/** * @see org.eclipse.gef.EditPartViewer#appendSelection(org.eclipse.gef.EditPart) */ public void appendSelection(EditPart editpart) { if (editpart instanceof RootEditPart) editpart = ((RootEditPart) editpart).getContents(); setFocus(editpart); super.appendSelection(editpart); }
/** * Creates and installs pertinent EditPolicies. */ @Override protected void createEditPolicies() { super.createEditPolicies(); installEditPolicy(EditPolicy.CONTAINER_ROLE, new JDContainerEditPolicy()); installEditPolicy(EditPolicy.TREE_CONTAINER_ROLE, new JDTreeContainerEditPolicy()); //Overwrite the policy that handle the delete, so i have a custom delete command to close the subeditor installEditPolicy(EditPolicy.COMPONENT_ROLE, new CloseSubeditorDeletePolicy()); // If this editpart is the contents of the viewer, then it is not deletable! if (getParent() instanceof RootEditPart) installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); }
/** * Creates and installs pertinent EditPolicies. */ @Override protected void createEditPolicies() { super.createEditPolicies(); installEditPolicy(EditPolicy.CONTAINER_ROLE, new JDContainerEditPolicy()); installEditPolicy(EditPolicy.TREE_CONTAINER_ROLE, new JDTreeContainerEditPolicy()); // If this editpart is the contents of the viewer, then it is not deletable! if (getParent() instanceof RootEditPart) installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); }
/** * Creates and installs pertinent EditPolicies. */ protected void createEditPolicies() { super.createEditPolicies(); installEditPolicy(EditPolicy.CONTAINER_ROLE, new JDStyleContainerEditPolicy()); installEditPolicy(EditPolicy.TREE_CONTAINER_ROLE, new JDStyleTreeContainerEditPolicy()); // If this editpart is the contents of the viewer, then it is not deletable! if (getParent() instanceof RootEditPart) installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); }
@Override protected boolean handleMove() { try { EditPartViewer viewer = getCurrentViewer(); if (viewer instanceof TimelineViewer) { TimelineViewer timelineViewer = (TimelineViewer) viewer; RootEditPart rootEditPart = timelineViewer.getRootEditPart(); List children = rootEditPart.getChildren(); if ((children.size() != 1) || !(children.get(0) instanceof SplitScroller)) { // Don't update the cursor time while in the horizontal scroller. // Scrolling and updating the cursor time together interact very poorly. // The effect seen was that the scrollbar would follow the cursor until // the mouse was released at which point the scrollbar would snap to the // right, hiding what the user had revealed. TimelineUtils.updateCursorTime(timelineViewer, this); } } String tooltipPreference = TimelineConstants.TIMELINE_PREFERENCES.getString(TimelinePreferencePage.P_TOOLTIP_SPEED); Tooltip value = Tooltip.valueOf(tooltipPreference); if (value == Tooltip.FAST) { handleHover(); } } catch (Exception e) { LogUtil.error("handleMove", e); } return super.handleMove(); }
@Override public RootEditPart getRoot() { if (getParent() == null) { return null; } return super.getRoot(); }
/** * Convenience method to retrieve the casted viewer. */ @Override public TimelineViewer getViewer() { RootEditPart root = getRoot(); if (root == null) { return null; } return (TimelineViewer) root.getViewer(); }
/** * @see org.eclipse.gef.EditPart#getRoot() */ public RootEditPart getRoot() { if (getParent() == null) { return null; } return getParent().getRoot(); }
/** * @see org.eclipse.gef.EditPart#getViewer() */ public EditPartViewer getViewer() { RootEditPart root = getRoot(); if (root == null) { return null; } return root.getViewer(); }
/** * @see EditPartViewer#setRootEditPart(RootEditPart) */ public void setRootEditPart(RootEditPart editpart) { if (rootEditPart != null) { if (rootEditPart.isActive()) rootEditPart.deactivate(); rootEditPart.setViewer(null); } rootEditPart = editpart; rootEditPart.setViewer(this); if (getControl() != null) rootEditPart.activate(); }
/** * @see org.eclipse.gef.EditPartViewer#appendSelection(org.eclipse.gef.EditPart) */ public void appendSelection( EditPart editpart ) { if ( editpart instanceof RootEditPart ) editpart = ( (RootEditPart) editpart ).getContents( ); setFocus( editpart ); super.appendSelection( editpart ); }
/** * @see org.eclipse.gef.EditPart#getRoot() */ public RootEditPart getRoot() { if (getParent() == null) return null; else return getParent().getRoot(); }
/** * Returns the zoom manager of the specified viewer. * * @param viewer * the viewer to get the zoom manager from * @return the zoom manager */ protected ZoomManager getZoomManager(GraphicalViewer viewer) { // get zoom manager from root edit part RootEditPart rootEditPart = viewer.getRootEditPart(); ZoomManager zoomManager = null; if (rootEditPart instanceof ScalableFreeformRootEditPart) { zoomManager = ((ScalableFreeformRootEditPart) rootEditPart).getZoomManager(); } else if (rootEditPart instanceof ScalableRootEditPart) { zoomManager = ((ScalableRootEditPart) rootEditPart).getZoomManager(); } return zoomManager; }
protected void createEditPolicies() { // If this editpart is the root content of the viewer, then disallow // removal if (getParent() instanceof RootEditPart) { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); } }
public DiagramOutlinePage2(GUIEditor editor,EditPartViewer viewer, Diagram diagram, RootEditPart rep){ super(viewer); this.rep = rep; this.diagram = diagram; this.editor = editor; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } }); // PolygonDecoration polygonDecoreation = new PolygonDecoration(); // polygonDecoreation.setScale(10,5); // connection.setTargetDecoration(polygonDecoreation); // connection.setLineStyle(SWT.LINE_DOT); // connection.addRoutingListener(RoutingAnimator.getDefault()); // connection.setConnectionRouter(new BendpointConnectionRouter()); connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); PolygonDecoration polygonDecoreation = new PolygonDecoration(); polygonDecoreation.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); polygonDecoreation.setScale(10, 5); connection.setLineStyle(SWT.LINE_DOT); connection.setTargetDecoration(polygonDecoreation); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.setLineStyle(Graphics.LINE_DOT); ArrowDecoration arrow = new ArrowDecoration(); connection.setTargetDecoration(arrow); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } }); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { settingLineCondition(); PolylineConnection polylineConnection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; polylineConnection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) { if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } } }); return drawDecoration(polylineConnection); }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); PolygonDecoration polygonDecoreation = new PolygonDecoration(); connection.setTargetDecoration(polygonDecoreation); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } }); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) { if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } } }); connection.setTargetDecoration(new ArrowDecoration()); connection.setLineStyle(Graphics.LINE_DOT); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
public RootEditPart createRootEditPart(Diagram diagram) { return new SCTRenderedDiagramRootEditPart(diagram.getMeasurementUnit()); }
/** * @see EditPart#getRoot() */ public RootEditPart getRoot() { return this; }
/** * @see org.eclipse.gef.EditPartViewer#setRootEditPart(org.eclipse.gef.RootEditPart) */ public void setRootEditPart(RootEditPart editpart) { super.setRootEditPart(editpart); setRootFigure(((GraphicalEditPart) editpart).getFigure()); }
/** * @see EditPartViewer#getRootEditPart() */ public RootEditPart getRootEditPart() { return rootEditPart; }