/** * Create selection handles in the style as predefined in DeltaEcore * @see DEGraphicalEditorTheme */ @Override protected List<Object> createSelectionHandles() { List<Object> list = new ArrayList<Object>(); MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost()); moveHandle.setDragTracker(getDragTracker()); if (isDragAllowed()) { moveHandle.setCursor(Cursors.SIZEALL); } else { moveHandle.setCursor(SharedCursors.ARROW); } // set line style to meet the predefined theme DEGraphicalEditorTheme theme = DEGraphicalEditor.getTheme(); LineBorder border = new LineBorder(); border.setColor(theme.getSelectionSecondaryColor()); border.setWidth(theme.getLineWidth()); moveHandle.setBorder(border); list.add(moveHandle); return list; }
protected Rectangle getFigureConstraint(){ GraphicalEditPart parent = (GraphicalEditPart)getParent(); Rectangle parentVisibleBounds = parent.getFigure().getClientArea().getCopy(); Rectangle bounds; if(parentVisibleBounds.width < 0 || parentVisibleBounds.height < 0) { bounds = new Rectangle(0, 0, 300, -1); }else{ Date date = featureModel.getSelectedDate(); DwEnumContainerWrapped model = (DwEnumContainerWrapped)getModel(); DwTemporalPosition position = model.getPosition(date); Point desiredDefaultPosition = new Point(editor.getEditorGraphicalDimension().width-20-320, 20); if(position == null || !position.getPosition().equals(desiredDefaultPosition) && model.getAlignment() == EditorAlignment.RightTop){ model.addPosition(desiredDefaultPosition, date, false); } bounds = new Rectangle(model.getPosition(date).getPosition(), new Dimension(300, -1)); } return bounds; }
private Command createCommand(final List objects, final RGB rgb) { if (objects.isEmpty()) { return null; } if (!(objects.get(0) instanceof GraphicalEditPart)) { return null; } final CompoundCommand command = new CompoundCommand(); for (int i = 0; i < objects.size(); i++) { final GraphicalEditPart part = (GraphicalEditPart) objects.get(i); final Object modelObject = part.getModel(); if (modelObject instanceof ViewableModel) { command.add(new ChangeBackgroundColorCommand((ViewableModel) modelObject, rgb.red, rgb.green, rgb.blue)); } else if (modelObject instanceof ConnectionElement) { command.add(new ChangeConnectionColorCommand((ConnectionElement) modelObject, rgb.red, rgb.green, rgb.blue)); } } return command; }
@SuppressWarnings("unchecked") public static void addHandles(final GraphicalEditPart part, final List handles) { handles.add(new ERDiagramMoveHandle(part)); handles.add(createHandle(part, PositionConstants.EAST)); handles.add(createHandle(part, PositionConstants.SOUTH_EAST)); handles.add(createHandle(part, PositionConstants.SOUTH)); handles.add(createHandle(part, PositionConstants.SOUTH_WEST)); handles.add(createHandle(part, PositionConstants.WEST)); handles.add(createHandle(part, PositionConstants.NORTH_WEST)); handles.add(createHandle(part, PositionConstants.NORTH)); handles.add(createHandle(part, PositionConstants.NORTH_EAST)); }
/** * {@inheritDoc} */ @Override protected boolean calculateEnabled() { List objects = this.getSelectedObjects(); if (objects.isEmpty()) { return false; } if (!(objects.get(0) instanceof GraphicalEditPart)) { return false; } return true; }
@Override protected void refreshChildren() { super.refreshChildren(); List<?> children = getChildren(); for (int i = 0; i < children.size(); i++) { EditPart editPart = (EditPart) children.get(i); editPart.refresh(); } if (getSelection() >= 0){ GraphicalEditPart colEP = (GraphicalEditPart) children.get(0); Rectangle r1 = colEP.getFigure().getBounds(); int rowHeinght = getOneRowHeight(); getFigure().getSelection().setBounds(new Rectangle( r1.x, r1.y + getSelection()*rowHeinght, getExpandedBounds().width - r1.x*2, rowHeinght )); } else { getFigure().getSelection().setBounds(new Rectangle()); } }
/** * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org.eclipse.gef.EditPart, int) */ @Override protected void addChildVisual(EditPart childEditPart, int index) { super.addChildVisual(childEditPart, index); if (!isCreated()) { if (((AbstractNode) childEditPart.getModel()).getUmlModel().equals(getAdded())) { DirectEditorManager dem = new DirectEditorManager((GraphicalEditPart) childEditPart, TextCellEditor.class, new DirectEditCellEditorLocator(((GraphicalEditPart) childEditPart).getFigure())); dem.show(); setCreated(true); } } }
/** * * void */ private void getChildFigure(EditPart currentEditPart) { List<EditPart> childrenEditPart = currentEditPart.getChildren(); for( EditPart child : childrenEditPart ) { if( child instanceof NotationNameEditPart ) { if( ((NotationNameEditPart)child).getFigure() instanceof org.eclipse.draw2d.Label ) { GraphicalEditPart gEdit = (GraphicalEditPart) child; setDirectManager(new DirectEditorManager((GraphicalEditPart) child, TextCellEditor.class, new DirectEditCellEditorLocator(gEdit.getFigure()))); directManager.show(); break; } else { getChildFigure(child); } } } }
@Override protected boolean handleKeyDown(KeyEvent e) { if (isInState(STATE_INITIAL) && UIUtil.isArrowKey(e.keyCode)) { EditPartViewer viewer = getCurrentViewer(); if (viewer instanceof GraphicalViewer) { JSSCompoundCommand ccmd = new JSSCompoundCommand(null); for(Object selectedEditPart : getCurrentViewer().getSelectedEditParts()) { if (selectedEditPart instanceof GraphicalEditPart) { Object modelObj = ((EditPart) selectedEditPart).getModel(); if(modelObj instanceof MGraphicElement) { MGraphicElement node = (MGraphicElement) modelObj; ccmd.add(getNewXYCommand(e.keyCode,node)); } } } if(!ccmd.isEmpty()) { getDomain().getCommandStack().execute(ccmd); return true; } } } return super.handleKeyDown(e); }
/** * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals() */ @Override protected void refreshVisuals() { try { super.refreshVisuals(); NotationNode notationNode = (NotationNode) getModel(); Polyline line = (Polyline) this.getFigure(); line.removeAllPoints(); line.addPoint(new Point(notationNode.getX(), notationNode.getY())); line.addPoint(new Point(notationNode.getX(), notationNode.getY() + notationNode.getHeight())); Rectangle bounds = new Rectangle(notationNode.getX(), notationNode.getY(), notationNode.getWidth(), notationNode.getHeight()); ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds); } catch (Exception e) { Log.error(UMLMessage.MESSAGE_INTERACTION_USE_EDIT_PART_REFRESH_VISUALS_ERROR + e); } }
@Override protected void refreshVisuals() { GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = SWT.FILL; gridData.verticalAlignment = SWT.FILL; GraphicalEditPart parent = (GraphicalEditPart) getParent(); parent.setLayoutConstraint(this, figure, gridData); GridLayout layoutManager = (GridLayout) getFigure().getLayoutManager(); layoutManager.numColumns = ((ChartSet) parent.getModel()).getOrientation() == Orientation.HORIZONTAL ? getModelChildren().size() : 1; layoutManager.invalidate(); }
@Override protected List<AbstractHandle> createSelectionHandles() { List<AbstractHandle> list = new ArrayList<AbstractHandle>(); MoveHandle handle = new MoveHandle((GraphicalEditPart) getHost()); handle.setBorder(new MarginBorder(5)); list.add(handle); // BandButtonPadHandle buttonPadHandle=new BandButtonPadHandle((GraphicalEditPart)getHost()); // buttonPadHandle.setBorder(null); // list.add(buttonPadHandle); // NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), list); // list.add(new CellResizeHandle2((GraphicalEditPart) getHost(), PositionConstants.SOUTH)); // // if (hasNorth) // list.add(new CellResizeHandle2((GraphicalEditPart) getHost(), PositionConstants.NORTH)); return list; }
/** * The list of element is based on the father of first selected item */ @Override @SuppressWarnings({ "unchecked", "rawtypes" }) protected List generateSnapPartsList(List exclusions) { // Don't snap to any figure that is being dragged List children = new ArrayList(); if (exclusions.size()>0){ EditPart selectedItem = (EditPart)exclusions.get(0); children.addAll(selectedItem.getParent().getChildren()); children.removeAll(exclusions); // Don't snap to hidden figures List hiddenChildren = new ArrayList(); for (Iterator iter = children.iterator(); iter.hasNext();) { GraphicalEditPart child = (GraphicalEditPart) iter.next(); if (!child.getFigure().isVisible()) hiddenChildren.add(child); } children.removeAll(hiddenChildren); } return children; }
/** * @see org.eclipse.gef.editpolicies.BendpointEditPolicy#showCreateBendpointFeedback(org.eclipse.gef.requests.BendpointRequest) */ @Override protected void showCreateBendpointFeedback(BendpointRequest request) { IFigure feedback = getDragSourceFeedbackFigure(); Rectangle bounds = new Rectangle(getInitialFeedbackBounds().getCopy()); PrecisionRectangle rect = new PrecisionRectangle(bounds); getHostFigure().translateToAbsolute(rect); Point movePoint = request.getLocation(); movePoint.x = ((GraphicalEditPart) getHost()).getFigure().getBounds().x;//movePoint.x - rect.getSize().width / 2; rect.setLocation(movePoint); feedback.translateToRelative(rect); feedback.setBounds(rect); }
@Override protected void refreshVisuals() { boolean horizontal = ((AxisLandingPad) getModel()).chart.getParent() .getOrientation() == Orientation.HORIZONTAL; nameLabel.setVertical(!horizontal); if (horizontal) { ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, new GridData(GridData.FILL, GridData.CENTER, true, false)); } else { ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, new GridData(GridData.CENTER, GridData.FILL, false, true)); } figure.invalidate(); }
@Override public boolean keyPressed(KeyEvent event) { if (UIUtil.isArrowKey(event.keyCode)) { EditPartViewer viewer = getViewer(); if (viewer instanceof GraphicalViewer) { JSSCompoundCommand ccmd = new JSSCompoundCommand(null); for(Object selectedEditPart : getViewer().getSelectedEditParts()) { if (selectedEditPart instanceof GraphicalEditPart) { Object modelObj = ((EditPart) selectedEditPart).getModel(); if(modelObj instanceof MGraphicElement) { MGraphicElement node = (MGraphicElement) modelObj; ccmd.add(getNewXYCommand(event.keyCode,node)); } } } if(!ccmd.isEmpty()) { getViewer().getEditDomain().getCommandStack().execute(ccmd); return true; } } } return super.keyPressed(event); }
@Override protected Command getResizeCommand(final ChangeBoundsRequest request) { GraphicalEditPart editPart = (IGraphicalEditPart) getHost(); Rectangle locationAndSize = new PrecisionRectangle(editPart.getFigure() .getBounds()); editPart.getFigure().translateToAbsolute(locationAndSize); final Rectangle origRequestedBounds = request .getTransformedRectangle(locationAndSize); final Rectangle modified = origRequestedBounds.getCopy(); checkAndPrepareConstraint(request, modified); // final Dimension sizeDelta = request.getSizeDelta(); Dimension newDelta = new Dimension(modified.width - locationAndSize.width, modified.height - locationAndSize.height); // ((IGraphicalEditPart) getHost()).getFigure() // .translateToAbsolute(newDelta); request.setSizeDelta(newDelta); final Point moveDelta = request.getMoveDelta(); request.setMoveDelta(new Point(moveDelta.x - origRequestedBounds.x + modified.x, moveDelta.y - origRequestedBounds.y + modified.y)); return super.getResizeCommand(request); }
@Override protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { if (request instanceof AlignmentRequest) { return super.getConstraintFor(request, child); } final Rectangle rect = (Rectangle) super.getConstraintFor(request, child); final Rectangle cons = getCurrentConstraintFor(child); final int newTreePosition = TreeLayoutUtil.getNewTreeNodePosition( request.getLocation(), TreeLayoutUtil.getSiblings((IGraphicalEditPart) child)); if (cons instanceof TreeLayoutConstraint) { final TreeLayoutConstraint treeLayoutConstraint = (TreeLayoutConstraint) cons; return new TreeLayoutConstraint(rect, treeLayoutConstraint.isRoot(), newTreePosition); } return new TreeLayoutConstraint(rect, false, newTreePosition); }
/** * Responsible of calculating those edit parts that should be regarded as directly affected by the current marquee * selection. By default, the method calculates which edit parts are potential candidates based on the current marquee * behavior and delegates to {@link #isMarqueeSelectable(GraphicalEditPart)} and * {@link #isPrimaryMarqueeSelectedEditPart(GraphicalEditPart)} to decide whether the candidate is to be included in * the marquee selection. * * @return A {@link Collection} containing all {@link EditPart}s that should be regarded as being directly affected by * the current marquee selection. */ @SuppressWarnings("unchecked") protected Collection<EditPart> calculatePrimaryMarqueeSelectedEditParts() { Collection<EditPart> editPartsToProcess = new HashSet<EditPart>(); editPartsToProcess.addAll(EditPartUtilities.getAllChildren((GraphicalEditPart) getCurrentViewer().getRootEditPart())); Collection<EditPart> marqueeSelectedEditParts = new ArrayList<EditPart>(); for (Iterator<EditPart> iterator = editPartsToProcess.iterator(); iterator.hasNext();) { GraphicalEditPart editPart = (GraphicalEditPart) iterator.next(); //The page and the bands are not valid selectable items, so the isMarqueeSelectable retrun false for every element that it isn't an //MGraphical element if (isMarqueeSelectable(editPart) && isPrimaryMarqueeSelectedEditPart(editPart)) { marqueeSelectedEditParts.add(editPart); } } return marqueeSelectedEditParts; }
/** * Responsible of calculating those edit parts that should be regarded as being indirectly affected by the marquee * selection. By default, the method calculates which edit parts are potential candidates based on the current marquee * behavior and delegates to {@link #isMarqueeSelectable(GraphicalEditPart)} and * {@link #isSecondaryMarqueeSelectedEditPart(Collection, EditPart)} to decide whether the candidate is to be included * in the marquee selection. * * @param directlyMarqueeSelectedEditParts * A collection containing those {@link EditPart}s that were already identified as being directly affected by * the marquee selection * @return A {@link Collection} containing all {@link EditPart}s that are indirectly affected by the current marquee * selection */ @SuppressWarnings("unchecked") protected Collection<EditPart> calculateSecondaryMarqueeSelectedEditParts(Collection<EditPart> directlyMarqueeSelectedEditParts) { Collection<EditPart> editPartsToProcess = new HashSet<EditPart>(); for (Iterator<?> iterator = directlyMarqueeSelectedEditParts.iterator(); iterator.hasNext();) { GraphicalEditPart marqueeSelectedEditPart = (GraphicalEditPart) iterator.next(); editPartsToProcess.addAll(marqueeSelectedEditPart.getSourceConnections()); editPartsToProcess.addAll(marqueeSelectedEditPart.getTargetConnections()); } Collection<EditPart> secondaryMarqueeSelectedEditParts = new HashSet<EditPart>(); for (Iterator<?> iterator = editPartsToProcess.iterator(); iterator.hasNext();) { GraphicalEditPart editPart = (GraphicalEditPart) iterator.next(); if (isMarqueeSelectable(editPart)) { secondaryMarqueeSelectedEditParts.add(editPart); } } return secondaryMarqueeSelectedEditParts; }
public void activate() { super.activate(); ScalableRootEditPart root = (ScalableRootEditPart) getViewer().getRootEditPart(); ConnectionLayer connLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER); GraphicalEditPart contentEditPart = (GraphicalEditPart) root.getContents(); FanRouter router = new FanRouter(); router.setSeparation(100); ShortestPathConnectionRouter spRouter = new ShortestPathConnectionRouter(contentEditPart.getFigure()); router.setNextRouter(spRouter); connLayer.setConnectionRouter(router); GraphSelectionManager.ME.selectionPartChanged(this); }
@Override public void propertyChange(PropertyChangeEvent evt) { String prop = evt.getPropertyName(); if (StringUtils.equalsIgnoreCase(prop, LABEL_CONTENTS)) { refreshVisuals(); } else if (StringUtils.equalsIgnoreCase(prop, SIZE) || StringUtils.equalsIgnoreCase(prop, LOCATION)) { Point loc = getLabel().getLocation(); Dimension size = getLabel().getSize(); Rectangle r = new Rectangle(loc, size); ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), r); refreshVisuals(); } }
/** * Creates the figure used for feedback. * @return the new feedback figure */ protected IFigure createDragSourceFeedbackFigure(){ IFigure figure = createFigure((GraphicalEditPart)getHost(), null); figure.setBounds(getInitialFeedbackBounds()); addFeedback(figure); return figure; }
private void callHookRootFigure() { if (getFigureCanvas() == null) return; if (((GraphicalEditPart) getRootEditPart()).getFigure() instanceof Viewport) { getFigureCanvas().setViewport((Viewport) ((GraphicalEditPart) getRootEditPart()).getFigure()); } else { getFigureCanvas().setContents(((GraphicalEditPart) getRootEditPart()).getFigure()); } }
/** * @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart#refreshVisuals() */ @Override protected void refreshVisuals() { super.refreshVisuals(); WorkspaceImageFigure shape = this.getPrimaryShape(); EObject element = this.resolveSemanticElement(); if (element instanceof WorkspaceImage) { WorkspaceImage bundledImage = (WorkspaceImage) element; shape.refreshFigure(bundledImage); if (switchImageListener != null) switchImageListener.updateImage(); ((GraphicalEditPart) this.getParent()).setLayoutConstraint(this, this.getFigure(), new Rectangle(0, 0, shape.getPreferredSize().width, shape.getPreferredSize().height)); } }
@Override protected void refreshVisuals() { AbstractNodeElement node = getModel(); Rectangle bounds = new Rectangle(node.getX(), node.getY(), node.getWidth(), node.getHeight()); ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds); super.refreshVisuals(); }
@SuppressWarnings("unchecked") @Override protected List<Figure> createSelectionHandles() { List<Figure> list=super.createSelectionHandles(); List<IFigure> figures=this.getHostFigure().getChildren(); for(IFigure figure:figures){ if(figure instanceof Label){ list.add(new MoveHandle((GraphicalEditPart)this.getHost(),new MoveHandleLocator(figure))); } } return list; }
@Override protected Command getMoveCommand(ChangeBoundsRequest request) { TransitionLabel transitionLabel=(TransitionLabel)(this.getHost().getModel()); Point p=request.getMoveDelta(); IFigure parentFigure=((GraphicalEditPart)this.getHost().getParent()).getFigure(); return new MoveTransitionLabelCommand(transitionLabel,parentFigure,p); }
@Override public void refreshVisuals(){ GraphicalEditPart parent = (GraphicalEditPart)getParent(); if(parent != null){ int validEnums = HyEvolutionUtil.getValidTemporalElements(featureModel.getModel().getEnums(), featureModel.getSelectedDate()).size(); figure.setVisible(validEnums != 0); parent.setLayoutConstraint(this, figure, getFigureConstraint()); } }
/** * {@inheritDoc} */ @Override protected boolean calculateEnabled() { final List objects = getSelectedObjects(); if (objects.isEmpty()) { return false; } if (!(objects.get(0) instanceof GraphicalEditPart)) { return false; } return true; }
/** * Returns the alignment rectangle to which all selected parts should be * aligned. * * @param request * the alignment Request * @return the alignment rectangle */ protected Rectangle calculateAlignmentRectangle(final Request request) { final List editparts = getOperationSet(request); if (editparts == null || editparts.isEmpty()) return null; final GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts.size() - 1); final Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds()); part.getFigure().translateToAbsolute(rect); return rect; }
/** * Returns the list of editparts which will participate in alignment. * * @param request * the alignment request * @return the list of parts which will be aligned */ @SuppressWarnings("unchecked") protected List getOperationSet(final Request request) { if (operationSet != null) return operationSet; List editparts = new ArrayList(getSelectedObjects()); for (final Iterator iter = editparts.iterator(); iter.hasNext();) { if (iter.next() instanceof NormalColumnEditPart) { iter.remove(); } } if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) return Collections.EMPTY_LIST; final Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) return Collections.EMPTY_LIST; final EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { final EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) return Collections.EMPTY_LIST; } return editparts; }
private Command createCommand(List objects, RGB rgb) { if (objects.isEmpty()) { return null; } if (!(objects.get(0) instanceof GraphicalEditPart)) { return null; } CompoundCommand command = new CompoundCommand(); for (int i = 0; i < objects.size(); i++) { GraphicalEditPart part = (GraphicalEditPart) objects.get(i); Object modelObject = part.getModel(); if (modelObject instanceof ViewableModel) { command.add(new ChangeBackgroundColorCommand( (ViewableModel) modelObject, rgb.red, rgb.green, rgb.blue)); } else if (modelObject instanceof ConnectionElement) { command.add(new ChangeConnectionColorCommand( (ConnectionElement) modelObject, rgb.red, rgb.green, rgb.blue)); } } return command; }
/** * Returns the alignment rectangle to which all selected parts should be * aligned. * * @param request * the alignment Request * @return the alignment rectangle */ protected Rectangle calculateAlignmentRectangle(Request request) { List editparts = getOperationSet(request); if (editparts == null || editparts.isEmpty()) return null; GraphicalEditPart part = (GraphicalEditPart) editparts.get(editparts .size() - 1); Rectangle rect = new PrecisionRectangle(part.getFigure().getBounds()); part.getFigure().translateToAbsolute(rect); return rect; }
/** * Returns the list of editparts which will participate in alignment. * * @param request * the alignment request * @return the list of parts which will be aligned */ @SuppressWarnings("unchecked") protected List getOperationSet(Request request) { if (operationSet != null) return operationSet; List editparts = new ArrayList(getSelectedObjects()); for (Iterator iter = editparts.iterator(); iter.hasNext();) { if (iter.next() instanceof NormalColumnEditPart) { iter.remove(); } } if (editparts.isEmpty() || !(editparts.get(0) instanceof GraphicalEditPart)) return Collections.EMPTY_LIST; Object primary = editparts.get(editparts.size() - 1); editparts = ToolUtilities.getSelectionWithoutDependants(editparts); ToolUtilities.filterEditPartsUnderstanding(editparts, request); if (editparts.size() < 2 || !editparts.contains(primary)) return Collections.EMPTY_LIST; EditPart parent = ((EditPart) editparts.get(0)).getParent(); for (int i = 1; i < editparts.size(); i++) { EditPart part = (EditPart) editparts.get(i); if (part.getParent() != parent) return Collections.EMPTY_LIST; } return editparts; }
@SuppressWarnings("unchecked") public static void addHandles(GraphicalEditPart part, List handles) { handles.add(new ERDiagramMoveHandle(part)); handles.add(createHandle(part, PositionConstants.EAST)); handles.add(createHandle(part, PositionConstants.SOUTH_EAST)); handles.add(createHandle(part, PositionConstants.SOUTH)); handles.add(createHandle(part, PositionConstants.SOUTH_WEST)); handles.add(createHandle(part, PositionConstants.WEST)); handles.add(createHandle(part, PositionConstants.NORTH_WEST)); handles.add(createHandle(part, PositionConstants.NORTH)); handles.add(createHandle(part, PositionConstants.NORTH_EAST)); }
protected IFigure createDragSourceFeedbackFigure() { IFigure figure = createFigure((GraphicalEditPart) getHost(), null); figure.setBounds(getInitialFeedbackBounds()); addFeedback(figure); return figure; }
@Override protected Object getConstraintFor(CreateRequest request) { Rectangle r = (Rectangle) super.getConstraintFor(request); if (request.getNewObject() instanceof Element) { if(getHost() instanceof PopoverEditPart){ Rectangle rect = new Rectangle(getHostFigure().getBounds()); rect.x = 0; rect.y = 0; rect.crop(PopoverFigure.INSETS); return rect; }else if (ComponentValidator.isFullScreenView(request.getNewObject())){ return null;//set all to null } else if (/*request.getNewObject() instanceof ProgressBar || request.getNewObject() instanceof Slider ||*/ request.getNewObject() instanceof SearchBar || request.getNewObject() instanceof ToolBar || request.getNewObject() instanceof ButtonBar || request.getNewObject() instanceof TabbedBar){ r.x = 0; } //necessary for titlebar delta if (getHost() instanceof WindowEditPart){ r.y -= ((WindowFigure)((GraphicalEditPart) getHost()).getFigure()).getTitleBarHeight(); } Element e = (Element) getHost().getModel(); return e.getSupport().viewToModel(r); } return r; }