Package com.intellij.openapi.graph.builder

Examples of com.intellij.openapi.graph.builder.GraphBuilder


public class DeleteSelectionAction extends AbstractGraphAction {

  protected void actionPerformed(final AnActionEvent e, final Graph2D graph) {
    final DeleteProvider deleteProvider = getDeleteProvider(e);
    final GraphBuilder graphBuilder = getGraphBuilder(e);

    if (deleteProvider == null || graphBuilder == null) return;

    final List<Node> nodesToBeDeleted = getNodesToBeDeleted(graph, graphBuilder, deleteProvider);
    final List<Edge> edgesToBeDeleted = getEdgesToBeDeleted(graph, graphBuilder, deleteProvider);

    if (nodesToBeDeleted.size() > 0 || edgesToBeDeleted.size() > 0) {
      final String messageText = GraphBundle.message("graph.delete.message") + "?";
      final String messageCaption = GraphBundle.message("graph.delete.message.caption");
      if (DialogWrapper.OK_EXIT_CODE ==
          Messages.showOkCancelDialog(messageText, messageCaption, Messages.getQuestionIcon())) {

        for (Node node : nodesToBeDeleted) {
          final Object nodeObject = graphBuilder.getNodeObject(node);

          if (nodeObject != null) deleteProvider.deleteNode(nodeObject);
        }
        for (Edge edge : edgesToBeDeleted) {
          final Object edgeObject = graphBuilder.getEdgeObject(edge);

          if (edgeObject != null) deleteProvider.deleteEdge(edgeObject);
        }
      }

      graphBuilder.updateGraph();
    }
  }
View Full Code Here


    }
  }

  protected void update(final AnActionEvent e, final Graph2D graph) {
    final DeleteProvider deleteProvider = getDeleteProvider(e);
    final GraphBuilder graphBuilder = getGraphBuilder(e);

    boolean enabled = false;
    if (deleteProvider == null || graphBuilder == null) {
      e.getPresentation().setVisible(false);
    }
View Full Code Here

    super(null);
  }

  public void update(final AnActionEvent e) {
    super.update(e);
    final GraphBuilder builder = getGraphBuilder(e);

    e.getPresentation().setVisible(builder != null && builder.getGraphPresentationModel() instanceof BasicGraphPresentationModel);
  }
View Full Code Here

    e.getPresentation().setVisible(builder != null && builder.getGraphPresentationModel() instanceof BasicGraphPresentationModel);
  }

  protected boolean isSelected(Graph2D graph, final Project project, final AnActionEvent event) {
    final GraphBuilder builder = getGraphBuilder(event);

    if (builder != null) {
      final GraphPresentationModel graphPresentationModel = builder.getGraphPresentationModel();
      if (graphPresentationModel instanceof BasicGraphPresentationModel) {
        return ((BasicGraphPresentationModel)graphPresentationModel).isShowEdgeLabels();
      }
    }
    return false;
View Full Code Here

    }
    return false;
  }

  protected void setSelected(Graph2D graph, boolean state, final Project project, final AnActionEvent e) {
    final GraphBuilder builder = getGraphBuilder(e);

    if (builder != null) {
      final GraphPresentationModel graphPresentationModel = builder.getGraphPresentationModel();
      if (graphPresentationModel instanceof BasicGraphPresentationModel) {
        ((BasicGraphPresentationModel)graphPresentationModel).setShowEdgeLabels(state);
        builder.updateGraph();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.graph.builder.GraphBuilder

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.