boolean isExplorerTreeNode = node instanceof ExplorerTreeNode;
if (node instanceof CommandTreeNode) {
CommandTreeNode commandTreeNode = (CommandTreeNode) node;
commandTreeNode.getCommand().execute();
} else if (isExplorerTreeNode) {
ExplorerTreeNode explorerTreeNode = (ExplorerTreeNode) node;
PanelFactory factory = explorerTreeNode.getFactory();
if (factory != null) {
Canvas panel = factory.create();
panel.setDisabled(disabledModeCB.getValueAsBoolean());
String sampleName = explorerTreeNode.getName();
String icon = explorerTreeNode.getIcon();
if (icon == null) {
icon = "silk/plugin.png";
}
final Window window = new Window();
window.setKeepInParentRect(true);
window.setHeaderIcon(icon, 16, 16);
window.setTitle(sampleName);
window.setWidth100();
window.setHeight100();
window.setShowMinimizeButton(false);
window.setShowCloseButton(true);
window.setCanDragReposition(false);
window.setCanDragResize(false);
window.setShowShadow(false);
window.addItem(panel);
window.setParentElement(parentPanel);
String nodeID = explorerTreeNode.getNodeID();
String historyToken = nodeID.substring(0, nodeID.indexOf(idSuffix));
History.newItem(historyToken, false);
window.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(CloseClientEvent event) {
History.newItem("", false);