@Override public javax.swing.Action getPreferredAction() { javax.swing.Action retValue; if (overridesAMethod("getDefaultAction")) { // NOI18N retValue = super.getPreferredAction(); } else { retValue = original.getPreferredAction(); } return retValue; }
public javax.swing.Action getPreferredAction() { javax.swing.Action retValue; if (overridesAMethod ("getDefaultAction", new Class[0])) { // NOI18N retValue = super.getPreferredAction(); } else { retValue = original.getPreferredAction(); } return retValue; }
public javax.swing.Action getPreferredAction() { javax.swing.Action retValue; if (overridesAMethod ("getDefaultAction", new Class[0])) { // NOI18N retValue = super.getPreferredAction(); } else { retValue = original.getPreferredAction(); } return retValue; }
public boolean acceptNodes(Node[] nodes) { // don't allow multiple selections if ((nodes == null) || (nodes.length != 1)) { return false; } Node n = nodes[0]; Action a = n.getPreferredAction(); if ((a != null) && a.isEnabled()) { a.actionPerformed(new ActionEvent(n, 0, "")); // NOI18N return true; } return false; } };
public boolean acceptNodes (Node[] nodes) { // don't allow multiple selections if ((nodes == null) || (nodes.length != 1)) { return false; } Node n = nodes[0]; Action a = n.getPreferredAction(); if (a != null && a.isEnabled()) { a.actionPerformed(new ActionEvent(n, 0, "")); // NOI18N return true; } return false; } };
public boolean acceptNodes (Node[] nodes) { // don't allow multiple selections if ((nodes == null) || (nodes.length != 1)) { return false; } Node n = nodes[0]; Action a = n.getPreferredAction(); if (a != null && a.isEnabled()) { a.actionPerformed(new ActionEvent(n, 0, "")); // NOI18N return true; } return false; } };
public void actionPerformed(ActionEvent evt) { Node[] nodes = manager.getSelectedNodes(); if (nodes.length == 1) { Action a = nodes[0].getPreferredAction(); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(nodes[0], ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } } }
public void actionPerformed(ActionEvent evt) { Node[] nodes = manager.getSelectedNodes(); if (nodes.length == 1) { Action a = nodes[0].getPreferredAction(); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(nodes[0], ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } } }
static void performPreferredActionOnNodes(Node[] nodes) { if (nodes.length > 0) { Action a = nodes[0].getPreferredAction(); if (a == null) { return; } for (int i=1; i<nodes.length; i++) { Action ai = nodes[i].getPreferredAction(); if (ai == null || !ai.equals(a)) { return; } } // switch to replacement action if there is some a = takeAction(a, nodes); if (a != null && a.isEnabled()) { a.actionPerformed(new ActionEvent( nodes.length == 1 ? nodes[0] : nodes, ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } }
@Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == '\n') { // NOI18N int row = table.getSelectedRow(); if (row != -1) { row = sorter.modelIndex(row); Action action = tableModel.getNodes()[row].getPreferredAction(); if (action.isEnabled()) { action.actionPerformed(new ActionEvent(this, 0, "")); // NOI18N } } } }
/** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { if (treeTable.getSelectedColumn() != ((TreeTable)treeTable).getTreeColumnIndex()) return; Node[] nodes = manager.getSelectedNodes(); if (nodes.length == 1) { Action a = nodes[0].getPreferredAction(); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(nodes[0], ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } } }
/** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { if (treeTable.getSelectedColumn() != ((TreeTable)treeTable).getTreeColumnIndex()) return; Node[] nodes = manager.getSelectedNodes(); if (nodes.length == 1) { Action a = nodes[0].getPreferredAction(); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(nodes[0], ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } } }
/** * Invoked when an action occurs. */ @Override public void actionPerformed(ActionEvent e) { if (treeTable.getSelectedColumn() != ((TreeTable) treeTable).getTreeColumnIndex()) { return; } Node[] nodes = manager.getSelectedNodes(); if (nodes.length == 1) { Action a = nodes[0].getPreferredAction(); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(nodes[0], ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } } } } }
@Override public void run() { try { FileObject fo = FileUtil.toFileObject(new File(itemPath).getAbsoluteFile()); DataObject newDo = DataObject.find(fo); final Node node = newDo.getNodeDelegate(); Action a = node.getPreferredAction(); if (a instanceof ContextAwareAction) { a = ((ContextAwareAction) a).createContextAwareInstance(node.getLookup()); } if (a != null) { a.actionPerformed(new ActionEvent(node, ActionEvent.ACTION_PERFORMED, "")); // NOI18N } } catch (Exception ex) { // } } });
@Override public void mouseClicked(MouseEvent e) { tree.stopEditing(); int selRow = tree.getRowForLocation(e.getX(), e.getY()); if ((selRow != -1) && SwingUtilities.isLeftMouseButton(e) && MouseUtils.isDoubleClick(e)) { // Default action. if (defaultActionEnabled) { TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); Node node = Visualizer.findNode(selPath.getLastPathComponent()); Action a = takeAction(node.getPreferredAction(), node); if (a != null) { if (a.isEnabled()) { a.actionPerformed(new ActionEvent(node, ActionEvent.ACTION_PERFORMED, "")); // NOI18N } else { Toolkit.getDefaultToolkit().beep(); } e.consume(); return; } } if (tree.isExpanded(selRow)) { tree.collapseRow(selRow); } else { tree.expandRow(selRow); } } }
Node node = Visualizer.findNode (selPath.getLastPathComponent()); Action a = node.getPreferredAction(); if (a != null) {
Node node = Visualizer.findNode (selPath.getLastPathComponent()); Action a = node.getPreferredAction(); if (a != null) {
Action a = node.getPreferredAction(); if (a != null && (modifiers & java.awt.event.InputEvent.CTRL_MASK) == 0) { if (a instanceof ContextAwareAction) {
@Override public Action[] getActions(boolean arg0) { Action[] nodeActions = new Action[6]; nodeActions[0] = new OpenStockDetailsAction(); nodeActions[1] = CommonProjectActions.copyProjectAction(); nodeActions[2] = CommonProjectActions.deleteProjectAction(); nodeActions[4] = CommonProjectActions.closeProjectAction(); nodeActions[5] = getOriginal().getPreferredAction(); return nodeActions; }
/** Instantiates the template using informations provided by * the wizard. * * @param wiz the wizard * @return set of data objects that has been created (should contain * at least one) * @exception IOException if the instantiation fails */ public java.util.Set instantiate(TemplateWizard wiz) throws IOException { String n = wiz.getTargetName (); DataFolder folder = wiz.getTargetFolder (); DataObject template = wiz.getTemplate (); DataObject obj = n == null ? template.createFromTemplate (folder) : template.createFromTemplate (folder, n); // run default action (hopefully should be here) final Node node = obj.getNodeDelegate (); final Action a = node.getPreferredAction(); if (a != null) { SwingUtilities.invokeLater(new Runnable() { public void run() { a.actionPerformed(new ActionEvent(node, ActionEvent.ACTION_PERFORMED, "")); // NOI18N } }); } return java.util.Collections.singleton(obj); }