The primary component provider for the GraphCutPlugin
| 80 | * The primary component provider for the GraphCutPlugin |
| 81 | */ |
| 82 | public class GraphCutProvider |
| 83 | extends VisualGraphComponentProvider<GraphCutVertex, GraphCutEdge, GraphCutGraph> { |
| 84 | |
| 85 | private static final ImageIcon ICON = ResourceManager.loadImage("images/function_graph.png"); |
| 86 | |
| 87 | // A limit for displayed references |
| 88 | public static final int MAX_REFERENCES = 100; |
| 89 | |
| 90 | private static final String TOOLBAR_GROUP_A = "A"; |
| 91 | private static final String TOOLBAR_GROUP_B = "B"; |
| 92 | |
| 93 | private static final String MENU_GROUP_EXPAND = "A"; |
| 94 | private static final String MENU_GROUP_GRAPH = "B"; |
| 95 | |
| 96 | private static final String NAME = "CodeCut Graph"; |
| 97 | |
| 98 | private JComponent component; |
| 99 | private CodeCutGUIPlugin plugin; |
| 100 | |
| 101 | private GraphCutView view; |
| 102 | private LayoutProvider<GraphCutVertex, GraphCutEdge, GraphCutGraph> defaultLayoutProvider = new GraphCutLayoutProvider(); |
| 103 | private LayoutProvider<GraphCutVertex, GraphCutEdge, GraphCutGraph> layoutProvider; |
| 104 | private Set<LayoutProvider<GraphCutVertex, GraphCutEdge, GraphCutGraph>> layouts = new HashSet<>(); |
| 105 | |
| 106 | private GraphCutDataFactory dataFactory; |
| 107 | private GraphCutData graphData; |
| 108 | |
| 109 | private GraphCutExpansionListener expansionListener = new ExpansionListener(); |
| 110 | |
| 111 | private Predicate<GraphCutEdge> unfiltered = v -> true; |
| 112 | private Predicate<GraphCutEdge> edgeNotInGraphFilter = e -> !graphData.getGraph().containsEdge(e); |
| 113 | private Predicate<GraphCutVertex> vertexInGraphFilter = v -> graphData.getGraph().containsVertex(v); |
| 114 | |
| 115 | private ToggleDockingAction navigateIncomingToggleAction; |
| 116 | |
| 117 | public HashMap<Namespace, ArrayList<Function>> functionsByNamespace = new HashMap<>(); |
| 118 | public Set<Namespace> FilterWhitelist = new HashSet<>(); |
| 119 | |
| 120 | public GraphCutProvider(Tool tool, CodeCutGUIPlugin plugin) { |
| 121 | super(tool, NAME, plugin.getName()); |
| 122 | this.plugin = plugin; |
| 123 | |
| 124 | |
| 125 | dataFactory = new GraphCutDataFactory(this::graphDataCacheRemoved); |
| 126 | graphData = dataFactory.create(null); |
| 127 | |
| 128 | buildComponent(); |
| 129 | |
| 130 | // If you want icon in toolbar and key shortcut |
| 131 | //setIcon(ICON); |
| 132 | //addToToolbar(); |
| 133 | //setKeyBinding(new KeyBindingData(KeyEvent.VK_G, DockingUtils.CONTROL_KEY_MODIFIER_MASK)); |
| 134 | |
| 135 | setWindowMenuGroup(CodeCutGUIPlugin.GRAPH_NAME); |
| 136 | setWindowGroup(CodeCutGUIPlugin.GRAPH_NAME); |
| 137 | setDefaultWindowPosition(WindowPosition.WINDOW); |
| 138 | |
| 139 | setHelpLocation(CodeCutGUIPlugin.DEFAULT_HELP); |