Package org.eclipse.gef

Examples of org.eclipse.gef.EditPart


        EditPart source = (EditPart) selectedObject;
        select((GraphElement) source.getModel());
    }
   
    public void select(GraphElement element) {
        EditPart target = (EditPart) getViewer().getEditPartRegistry().get(element);
        if (target != null) {
            getViewer().select(target);
        }
    }
View Full Code Here


        private boolean firstTime = true;

        public EditPart createEditPart(EditPart context, Object model) {
            if (firstTime && model instanceof ProcessDefinition) {
                firstTime = false;
                EditPart rootEditPart = new OutlineRootTreeEditPart();
                rootEditPart.setModel(model);
                return rootEditPart;
            }
            GraphElement element = (GraphElement) model;
            if (element instanceof Variable) {
                return new VariableTreeEditPart((Variable) element);
View Full Code Here

    @Override
    protected Command getCreateCommand(CreateRequest request) {
        if (request.getNewObject() instanceof Action) {
            AddActionCommand command = new AddActionCommand();
            command.setTarget((Active) getHost().getModel());
            EditPart after = getInsertionReference(request);
            int newIndex = getHost().getChildren().indexOf(after);
            command.setActionIndex(newIndex);
            return command;
        }
        return null;
View Full Code Here

        int index = getFeedbackIndexFor(request);
        if (index != -1) {
            List<EditPart> selection = getHost().getViewer().getSelectedEditParts();
            do {
                EditPart editpart = children.get(index);
                if (!selection.contains(editpart))
                    return editpart;
            } while (++index < children.size());
        }
        return null; //Not found, add at the end.
View Full Code Here

        element.setTypeName(name);
        return (T) element;
    }

    private EditPart createEditPart(String propertyName, GraphElement element) {
        EditPart editPart = createExecutableExtension(propertyName);
        if (editPart != null) {
            editPart.setModel(element);
        }
        return editPart;
    }
View Full Code Here

            }
            this.selection = structuredSelection;
            if (structuredSelection.size() > 1) {
                return;
            }
            EditPart source = (EditPart) selected;
            GraphicalEditPart target = (GraphicalEditPart) getGraphicalViewer().getEditPartRegistry().get((GraphElement) source.getModel());
            if (target != null && target.getFigure().isVisible()) {
                getGraphicalViewer().select(target);
            }
        }
    }
View Full Code Here

        getGraphicalViewer().setEditPartFactory(new EditPartFactory() {
            public EditPart createEditPart(EditPart context, Object object) {
                if (!(object instanceof GraphElement))
                    return null;
                GraphElement element = (GraphElement) object;
                EditPart editPart = element.getTypeDefinition().createGraphicalEditPart(element);
                return editPart;
            }
        });

        KeyHandler keyHandler = new GraphicalViewerKeyHandler(getGraphicalViewer());
View Full Code Here

* to shortcut an access restriction
*/
public class OpenUMLClassDiagramJavaEditPolicy extends OpenEditPolicy {

  protected Command getOpenCommand(Request request) {
    EditPart targetEditPart = getTargetEditPart(request);
    if (false == targetEditPart.getModel() instanceof View) {
      return null;
    }
    View view = (View) targetEditPart.getModel();
    Style link = view.getStyle(NotationPackage.eINSTANCE
        .getHintedDiagramLinkStyle());
    if (false == link instanceof HintedDiagramLinkStyle) {
      return null;
    }
View Full Code Here

   * Custom implementation that uses a newly created object from the request's
   * creation factory to provide a custom shape feedback
   */
  @Override
  protected IFigure createSizeOnDropFeedback(CreateRequest createRequest) {
    EditPart part = getHost().getViewer().getEditPartFactory()
        .createEditPart(getHost(), createRequest.getNewObject());
    if (part instanceof AbstractGraphicalEditPart) {
      IFigure figure = ((AbstractGraphicalEditPart) part).getFigure();
      if (figure instanceof Shape) {
        FigureUtilities.makeGhostShape((Shape) figure);
View Full Code Here

    Iterator it = selectedObjects.iterator();
    while (it.hasNext()) {
      o = it.next();
      if (!(o instanceof EditPart))
        continue;
      EditPart ep = (EditPart) o;
      LayoutElementRecord node = (LayoutElementRecord) ep.getModel();
      if (!cmd.isCopyableNode(node)) // TODO only copy others?
        return null;
      cmd.addElement(node);
    }
    return cmd;
View Full Code Here

TOP

Related Classes of org.eclipse.gef.EditPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.