@Override public void run() { performAction(new Node[] { (Node) s }); } });
public JMenuItem getMenuPresenter() { if (isMethodOverridden(delegate, "getMenuPresenter")) { // NOI18N return delegate.getMenuPresenter(); } else { return new Actions.MenuItem(this, true); } }
Boolean b = null; synchronized (getLock()) { b = (Boolean) getProperty(PROP_ENABLED); ns = listener.getActivatedNodes(surviveFocusChange()); Reference r = (Reference) getProperty(PROP_LAST_NODES); b = (Boolean) getProperty(PROP_LAST_ENABLED); if (((Boolean) getProperty(PROP_HAS_LISTENERS)).booleanValue()) { putProperty(PROP_ENABLED, b); b = (((ns != null) && enable(ns)) ? Boolean.TRUE : Boolean.FALSE); synchronized (getLock()) { putProperty(PROP_LAST_NODES, new WeakReference<Node[]>(ns)); putProperty(PROP_LAST_ENABLED, b); if (((Boolean) getProperty(PROP_HAS_LISTENERS)).booleanValue()) { putProperty(PROP_ENABLED, b);
/** Performs the action. * In the default implementation, calls {@link #performAction(Node[])}. * @deprecated Do not call this programmatically. * Use {@link #createContextAwareInstance} to pass in a node selection. * Do not override this method. */ @Deprecated public void performAction() { performAction(getActivatedNodes()); }
@Override public void setEnabled(boolean e) { putProperty(PROP_LAST_ENABLED, null); putProperty(PROP_LAST_NODES, null); Boolean propHasListener = (Boolean) getProperty(PROP_HAS_LISTENERS); if (propHasListener != null && propHasListener.booleanValue()) { // Just set it; the next time selection chamges, we will recompute. super.setEnabled(e); } else { // Problematic. If we just set PROP_ENABLED then the next time isEnabled() // is called, even if the node selection is now different, we will be // in trouble; it will not bother to call enable() again. putProperty(PROP_ENABLED, null, true); } }
/** Fire PROP_ENABLE if the value is currently known (and clear that value). */ void maybeFireEnabledChange() { boolean fire = false; synchronized (getLock()) { if (getProperty(PROP_ENABLED) != null) { putProperty(PROP_ENABLED, null); fire = true; } } if (fire) { try { firePropertyChange(PROP_ENABLED, null, null); } catch (NullPointerException e) { // Probably because of a JDK bug that AbstractButton$ButtonActionPropertyChangeListener.propertyChange does not grok null values for "enabled" prop: Exceptions.attachMessage(e, "You cannot add " + getClass().getName() + " directly to a JMenu etc.; use org.openide.awt.Actions.connect instead"); // NOI18N Logger.getLogger(NodeAction.class.getName()).log(Level.WARNING, null, e); } } }
@Override public Action createContextAwareInstance(Lookup actionContext) { contextFileObject = actionContext.lookup(FileObject.class); return super.createContextAwareInstance(actionContext); }
@Override protected void initialize() { super.initialize(); // see org.openide.util.actions.SystemAction.iconResource() javadoc for more details putValue("noIconInMenu", Boolean.TRUE); // NOI18N }
public void actionPerformed(ActionEvent evt) { //Remove the AddDataProviderMode property as it is not needed any more. System.getProperties().remove("AddDataProviderMode"); Object o = evt.getSource(); Object[] option = dlg.getOptions(); if (o == option[1]) { // cancel button or escape } else if (o == option[0]) { // Add the Data Provider Node[] nodes = dataProviderExplorerPanel.getExplorerManager().getSelectedNodes(); tc.requestActive(); tc.setActivatedNodes(nodes); Action[] actions = nodes[0].getActions(true); for(int i=0; i< actions.length; i++){ if(actions[i] instanceof NodeAction){ final NodeAction nodeAction = (NodeAction)actions[i]; if (nodeAction.getName().equals(NbBundle.getMessage(AddDataProviderDialog.class, "Add_to_Form"))){ nodeAction.performAction(); result = true; break; } } } dialog.dispose() ; } } };
public void resultChanged(LookupEvent ev) { boolean old = enabled; enabled = delegate.enable(nodes()); support.firePropertyChange(PROP_ENABLED, old, enabled); }
public JMenuItem getPopupPresenter() { if (isMethodOverridden(delegate, "getPopupPresenter")) { // NOI18N return delegate.getPopupPresenter(); } else { return new Actions.MenuItem(this, false); } }
/** Fire PROP_ENABLE if the value is currently known (and clear that value). */ void maybeFireEnabledChange() { boolean fire = false; synchronized (getLock()) { if (getProperty(PROP_ENABLED) != null) { putProperty(PROP_ENABLED, null); fire = true; } } if (fire) { firePropertyChange(PROP_ENABLED, null, null); } }
@Override public void actionPerformed(ActionEvent e) { na.createContextAwareInstance(Lookups.fixed(node)).actionPerformed(e); } }
@Override protected void initialize() { super.initialize(); putValue("noIconInMenu", Boolean.TRUE); }
/** Performs the action. * In the default implementation, calls {@link #performAction(Node[])}. * In general you need not override this. */ public void performAction() { performAction (getActivatedNodes ()); }
public void setEnabled(boolean e) { putProperty(PROP_LAST_ENABLED, null); putProperty(PROP_LAST_NODES, null); if (((Boolean)getProperty(PROP_HAS_LISTENERS)).booleanValue()) { // Just set it; the next time selection chamges, we will recompute. super.setEnabled(e); } else { // Problematic. If we just set PROP_ENABLED then the next time isEnabled() // is called, even if the node selection is now different, we will be // in trouble; it will not bother to call enable() again. putProperty(PROP_ENABLED, null, true); } }
public void resultChanged(org.openide.util.LookupEvent ev) { boolean newEnabled = delegate.enable(nodes ()); if (newEnabled != enabled) { support.firePropertyChange (PROP_ENABLED, enabled, newEnabled); enabled = newEnabled; } }
public javax.swing.JMenuItem getPopupPresenter() { if (isMethodOverriden (delegate, "getPopupPresenter")) { // NOI18N return delegate.getPopupPresenter (); } else { return new Actions.MenuItem(this, false); } }
Node[] ns = null; Boolean b = null; synchronized (getLock()) { b = (Boolean)getProperty(PROP_ENABLED); NodesL listener = NodeAction.l; if (b == null && listener != null) { ns = listener.getActivatedNodes(surviveFocusChange()); Reference r = (Reference)getProperty(PROP_LAST_NODES); if (r != null && java.util.Arrays.equals ((Node[])r.get(), ns)) { b = (Boolean)getProperty(PROP_LAST_ENABLED); if (((Boolean)getProperty(PROP_HAS_LISTENERS)).booleanValue()) { putProperty(PROP_ENABLED, b); b = ((ns != null && enable(ns)) ? Boolean.TRUE : Boolean.FALSE); synchronized (getLock()) { putProperty(PROP_LAST_NODES, new WeakReference(ns)); putProperty(PROP_LAST_ENABLED, b); if (((Boolean)getProperty(PROP_HAS_LISTENERS)).booleanValue()) { putProperty(PROP_ENABLED, b);
/** Fire PROP_ENABLE if the value is currently known (and clear that value). */ void maybeFireEnabledChange() { boolean fire = false; synchronized (getLock()) { if (getProperty(PROP_ENABLED) != null) { putProperty(PROP_ENABLED, null); fire = true; } } if (fire) { firePropertyChange(PROP_ENABLED, null, null); } }