use of com.cburch.logisim.gui.generic.ProjectExplorerLibraryNode in project logisim-evolution by reds-heig.
the class ToolboxManip method menuRequested.
public JPopupMenu menuRequested(ProjectExplorerEvent event) {
Object clicked = event.getTarget();
if (clicked instanceof ProjectExplorerToolNode) {
Tool baseTool = ((ProjectExplorerToolNode) clicked).getValue();
if (baseTool instanceof AddTool) {
AddTool tool = (AddTool) baseTool;
ComponentFactory source = tool.getFactory();
if (source instanceof SubcircuitFactory) {
Circuit circ = ((SubcircuitFactory) source).getSubcircuit();
return Popups.forCircuit(proj, tool, circ);
} else {
return null;
}
} else {
return null;
}
} else if (clicked instanceof ProjectExplorerLibraryNode) {
Library lib = ((ProjectExplorerLibraryNode) clicked).getValue();
if (lib == proj.getLogisimFile()) {
return Popups.forProject(proj);
} else {
boolean is_top = event.getTreePath().getPathCount() <= 2;
return Popups.forLibrary(proj, lib, is_top);
}
} else {
return null;
}
}
use of com.cburch.logisim.gui.generic.ProjectExplorerLibraryNode in project logisim-evolution by reds-heig.
the class ToolboxManip method deleteRequested.
public void deleteRequested(ProjectExplorerEvent event) {
Object request = event.getTarget();
if (request instanceof ProjectExplorerLibraryNode) {
Library lib = ((ProjectExplorerLibraryNode) request).getValue();
ProjectLibraryActions.doUnloadLibrary(proj, lib);
} else if (request instanceof ProjectExplorerToolNode) {
Tool tool = ((ProjectExplorerToolNode) request).getValue();
if (tool instanceof AddTool) {
ComponentFactory factory = ((AddTool) tool).getFactory();
if (factory instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) factory;
ProjectCircuitActions.doRemoveCircuit(proj, circFact.getSubcircuit());
}
}
}
}
Aggregations