/** * Computes a common popup menu for the specified nodes. * Provides only those actions supplied by all nodes in the list. * <p>Component action maps are not taken into consideration. * {@link Utilities#actionsToPopup(Action[], Component)} is a better choice * if you want to use actions such as "Paste" which look at action maps. * @param nodes the nodes * @return the menu for all nodes */ public static JPopupMenu findContextMenu(Node[] nodes) { Action[] arr = findActions(nodes); // prepare lookup representing all the selected nodes List<Lookup> allLookups = new ArrayList<Lookup>(); for (Node n : nodes) { allLookups.add(n.getLookup()); } Lookup lookup = new ProxyLookup(allLookups.toArray(new Lookup[allLookups.size()])); return Utilities.actionsToPopup(arr, lookup); }
@Nonnull public static Lookup cloned (final @Nonnull Lookup lookup) { return new ProxyLookup(lookup); } //@bluebook-end sugar
@Nonnull public static Lookup createLookupWith (final @Nonnull Lookup lookup, final @Nonnull Object ... objects) { return new ProxyLookup(Lookups.fixed(objects), lookup); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public void injectLookup (final @Nonnull Object role, final @Nonnull Lookup injectedLookup) { injectLookup(role, role.getClass(), new ProxyLookup(injectedLookup, Lookup.getDefault())); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override @Nonnull protected Lookup createLookup() { return new ProxyLookup(Lookups.singleton(taxon), super.createLookup()); }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override @Nonnull protected Lookup createLookup() { final SimpleComposite<Document> composite = new DefaultSimpleComposite<Document>(messageFinder); return new ProxyLookup(Lookups.fixed(composite), super.createLookup()); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public EnhancedTopComponent (@CheckForNull final String id) { this.id = id; lookup = new ProxyLookup(roleSet.getLookup(), Lookups.fixed(this), // needed by roles super.getLookup()); setLayout(new BorderLayout()); }
public StockProjectNode(Node node, StockProject project) throws DataObjectNotFoundException { super(node, NodeFactorySupport.createCompositeChildren(project, STOCK_SUBNODE_FACTORY),//new FilterNode.Children(node), new ProxyLookup(new Lookup[]{Lookups.singleton(project), node.getLookup() })); this.project = project; }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public HViewNode (final @Nonnull HView hView) { super(hView, Children.create(new HChildFactory(hView), true), new ProxyLookup(hView.getLookup(), Lookups.fixed(hView))); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public HViewManagerNode (final @Nonnull HViewManager hViewManager) { super(hViewManager, Children.create(new HChildFactory(hViewManager), true), new ProxyLookup(hViewManager.getLookup(), Lookups.fixed(hViewManager))); } }
public DocumentTopComponent(D document) { if (document == null) { throw new NullPointerException("document"); } this.document = document; this.dynamicContent = new InstanceContent(); associateLookup(new ProxyLookup(Lookups.fixed(document), new AbstractLookup(dynamicContent))); }
public EditorTopComponent(DataObjectContext context, Lookup lookup, JComponent view) { this.view = view; setLayout(new BorderLayout()); setFocusable(true); add(view, BorderLayout.CENTER); // ic = new InstanceContent(); if (view instanceof TopComponent) this.lookup = new ProxyLookup (((TopComponent) view).getLookup (), lookup, /*new AbstractLookup(ic),*/ Lookups.singleton(getActionMap())); else this.lookup = new ProxyLookup (lookup, /*new AbstractLookup(ic),*/ Lookups.singleton(getActionMap())); getActionMap ().remove ("cloneWindow"); // NOI18N }
public UnoccupiedPartFieldsNode(Node node) throws DataObjectNotFoundException { super(node // the origional node , new FilterNode.Children(node) // children , new ProxyLookup(node.getLookup() // lookup from the origional node , Lookups.singleton(new SimpleLayer(node.getDisplayName()))) // lookup with layer ); }
private static Lookup createLookup( Project p, SourceGroup group, DataFolder dataFolder ) { return new ProxyLookup(new Lookup[] { dataFolder.getNodeDelegate().getLookup(), Lookups.fixed( new Object[] { p, new PathFinder( group ) } ), p.getLookup(), }); }
private TreeRootNode (Node originalNode, SourceGroup g) { super(originalNode, new PackageFilterChildren(originalNode), new ProxyLookup( originalNode.getLookup(), Lookups.singleton(new PathFinder(g)) // no need for explicit search info )); this.g = g; g.addPropertyChangeListener(WeakListeners.propertyChange(this, g)); }
public ShapeDataObjectNode(Node original, String name) { super(Children.create(new ShapeChildFactory(), true), new ProxyLookup(original.getLookup(), Lookups.singleton(new SimpleLayer(name)))); this.origional = original; setIconBaseWithExtension("nl/cloudfarming/client/shape/file_extension_shp.png"); setDisplayName(name); }
public ShapeDataObjectNode(Node original, String name) { super(Children.create(new ShapeChildFactory(), true), new ProxyLookup(original.getLookup(), Lookups.singleton(new SimpleLayer(name)))); this.origional = original; setIconBaseWithExtension("nl/cloudfarming/client/shapetype/file_extension_shp.png"); setDisplayName(name); }
public HelpLinesNode(Node original) { super(original, new FilterNode.Children(original), new ProxyLookup(original.getLookup(), Lookups.singleton(new SimpleLayer(Bundle.HelpLinesNode_name())))); disableDelegation(DELEGATE_SET_NAME); setName(Bundle.HelpLinesNode_name()); disableDelegation(DELEGATE_GET_ACTIONS); }
public GridsNode(Node original, Project project) { super(original, new GridChildren(original), new ProxyLookup(original.getLookup(), Lookups.fixed(new SimpleLayer(Bundle.Grids_node_name())))); this.project = project; disableDelegation(DELEGATE_SET_NAME); setName(Bundle.Grids_node_name()); setDisplayName(Bundle.Grids_node_name()); }
private TreeRootNode (Node originalNode, DataFolder folder, SourceGroup g, boolean reduced) { super(originalNode, reduced ? Children.create(new ReducedChildren(folder, new GroupDataFilter(g), g), true) : new PackageFilterChildren(originalNode), new ProxyLookup( originalNode.getLookup(), Lookups.singleton(new PathFinder(g, reduced)) // no need for explicit search info )); this.g = g; g.addPropertyChangeListener(WeakListeners.propertyChange(this, g)); }