public final <T> T lookup(Class<T> clazz) { beforeLookup(new Template<T>(clazz)); Lookup[] tmpLkps; synchronized (ProxyLookup.this) { tmpLkps = getData().getLookups(false); } for (int i = 0; i < tmpLkps.length; i++) { T o = tmpLkps[i].lookup(clazz); if (o != null) { return o; } } return null; }
assert newData != null; ImmutableInternalData previous = this.getData(); this.setData(newData); Set<Lookup> removed = identityHashSet(previous.getLookupsList()); Set<Lookup> currentSet = identityHashSet(Arrays.asList(current)); Set<Lookup> newL = identityHashSet(currentSet); if (r != null) { r.lookupChange(newData, current, previous, newL, removed, toAdd, toRemove); if (this.getData() != previous) { this.setData(newData); return arr;
public ViewerFilterNode (Node delegate, Object ... extraObjects) { super(delegate, Children.LEAF /*FIXME*/, new ProxyLookup(delegate.getLookup(), Lookups.fixed(extraObjects))); }
public CookieAdjustingFilter(Node n) { super(n, null, new org.openide.util.lookup.ProxyLookup (new org.openide.util.Lookup[] { n.getLookup (), org.openide.util.lookup.Lookups.singleton(InstanceDataObject.this) })); }
@Nonnull public static Lookup createLookupWith (final @Nonnull Lookup lookup, final @Nonnull Object ... objects) { return new ProxyLookup(Lookups.fixed(objects), lookup); }
private static Lookup getLookupFor(Node ... nodes) { if (nodes.length == 1) { Lookup contextLookup = nodes[0].getLookup (); Object o = contextLookup.lookup(nodes[0].getClass()); // #55826, don't added the node twice if (!nodes[0].equals (o)) { contextLookup = new ProxyLookup (new Lookup[] { Lookups.singleton (nodes[0]), contextLookup }); } return contextLookup; } else { Lookup[] lkps = new Lookup[nodes.length]; for (int i=0; i<nodes.length; i++) { lkps[i] = nodes[i].getLookup(); } Lookup contextLookup = new ProxyLookup(lkps); Set<Node> toAdd = new HashSet<Node>(Arrays.asList(nodes)); toAdd.removeAll(contextLookup.lookupAll(Node.class)); if (!toAdd.isEmpty()) { contextLookup = new ProxyLookup( contextLookup, Lookups.fixed((Object[])toAdd.toArray(new Node[toAdd.size()]))); } return contextLookup; } }
/** * 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); }
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 ); }
@Override public Lookup getLookup() { // FIXME why is the platform written in such strange way ? J2eePlatform platform = Deployment.getDefault().getJ2eePlatform(instance.getUrl()); if (platform == null) { // can happen when J2EE is activated and J2SE is not !?@# return Lookups.singleton(instance.getInstanceProperties()); } else { return new ProxyLookup(Lookups.fixed(platform, instance.getInstanceProperties()), Lookups.proxy(platform)); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override @Nonnull protected Lookup createLookup() { return new ProxyLookup(Lookups.singleton(taxon), super.createLookup()); }
private void init() { kind = view.getKind(); ArrayList<Object> lookupObjects = DataEditorViewLookupFactoryRegistry.getLookupObjects(context, view); ArrayList<Lookup> lookups = DataEditorViewLookupFactoryRegistry.getLookups(context, view); lookupObjects.add(view); if (view.getKind() == DataEditorView.Kind.MODEL) { lookups.add(Lookups.exclude(context.getDataObject().getLookup(), Node.class, SaveAsCapable.class)); } lookups.add(Lookups.fixed(lookupObjects.toArray())); lookup = new ProxyLookup(lookups.toArray(new Lookup[lookups.size()])); IOSupport.getDocumentSerializer(context.getDataObject()).startLoadingDocument(); }
@Nonnull public static Lookup cloned (final @Nonnull Lookup lookup) { return new ProxyLookup(lookup); } //@bluebook-end sugar
void beforeLookup(boolean call, Template<?> template) { if (call) { beforeLookup(template); } }
/** Getter for the delegates. * @return the array of lookups we delegate to * @since 1.19 */ protected final Lookup[] getLookups() { synchronized (ProxyLookup.this) { return getData().getLookups(true); } }
public FarmNode(Farm farm, Node projectFolderNode, FarmProject project) throws DataObjectNotFoundException { super(projectFolderNode, // new FilterNode.Children(projectFolderNode), NodeFactorySupport.createCompositeChildren(project, "Projects/nl-cloudfarming-client-farm/Nodes"), // //The projects system wants the project in the Node's lookup. // //NewAction and friends want the original Node's lookup. // //Make a merge of both new ProxyLookup(Lookups.fixed(project, farm), projectFolderNode.getLookup())); this.project = project; }
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; }
private static Lookup createLookup(PresentationModel model, Lookup lookup) { List content = new ArrayList(); content.add(model); Lookup internal = Lookups.fixed(content.toArray()); return lookup == null ? internal : new ProxyLookup(internal, lookup); }
public PackageNode(PhpProject project, final Node originalNode, boolean isTest) { super(originalNode, new FolderChildren(project, originalNode, isTest), new ProxyLookup(originalNode.getLookup())); this.project = project; this.isTest = isTest; ProjectPropertiesSupport.addWeakProjectPropertyChangeListener(project, propertyChangeListener); }
/** Creates a new instance of ProjectNode */ public ProjectNode(final Lookup.Provider project, ContainerNode root) { super(ProjectUtilities.getDisplayName(project), ProjectUtilities.getIcon(project), root, new ProxyLookup(project.getLookup(), Lookups.singleton(project))); // NOI18N this.project = project; }