/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action getPreferredAction() { try { return find(object, ActionProvider).getPreferredAction(); } catch (NotFoundException e) { return null; } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action[] getActions (final boolean context) { try { return find(object, ActionProvider).getActions().toArray(new Action[0]); } catch (NotFoundException e) { return new Action[0]; } }
@Override public void propertyChange (final @Nonnull PropertyChangeEvent event) { if (ExplorerManager.PROP_SELECTED_NODES.equals(event.getPropertyName())) { final Node[] selectedNodes = (Node[])event.getNewValue(); for (final Node selectedNode : selectedNodes) { final ActionProvider actionProvider = selectedNode.getLookup().lookup(ActionProvider.class); if (actionProvider != null) { try { // FIXME: introduce a new specific getSelectionAction()? actionProvider.getPreferredAction().actionPerformed(null);// FIXME: null } catch (NotFoundException e) { // ok, no selection action } } } } } };
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action[] getActions (final boolean context) { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using an ActionProvider, thus it is directly // providing its own actions. It could even have an ActionProvider in its Lookup as it could be a FilterNode; for // this reason there's this explicit check. // if (!(delegate instanceof NodePresentationModel) && !(delegate instanceof GenericFilterNode)) { return super.getActions(); } final ActionProvider actionProvider = getLookup().lookup(ActionProvider); return (actionProvider != null) ? actionProvider.getActions().toArray(new Action[0]) : super.getActions(); }
@Override public void propertyChange (final @Nonnull PropertyChangeEvent event) { if (ExplorerManager.PROP_SELECTED_NODES.equals(event.getPropertyName())) { final Node[] selectedNodes = (Node[])event.getNewValue(); for (final Node selectedNode : selectedNodes) { final ActionProvider actionProvider = selectedNode.getLookup().lookup(ActionProvider.class); if (actionProvider != null) { try { // FIXME: introduce a new specific getSelectionAction()? actionProvider.getPreferredAction().actionPerformed(null);// FIXME: null } catch (NotFoundException e) { // ok, no selection action } } } } } };
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @CheckForNull public Action getPreferredAction() { final Node delegate = getOriginal(); // // If the delegate is not a NodePresentationModel, it is not using an ActionProvider, thus it is directly // providing its own actions. It could even have an ActionProvider in its Lookup as it could be a FilterNode; for // this reason there's this explicit check. // if (!(delegate instanceof NodePresentationModel) && !(delegate instanceof GenericFilterNode)) { return super.getPreferredAction(); } try { final ActionProvider actionProvider = getLookup().lookup(ActionProvider); return (actionProvider != null) ? actionProvider.getPreferredAction() : super.getPreferredAction(); } catch (NotFoundException e) { return super.getPreferredAction(); } }