@Override public synchronized Lookup getLookup() { try { init(); } catch (IOException e) { return Lookups.fixed(); } if (remoteFile == null || !isPrimary()) return Lookups.fixed(); FileObject remoteFo = FileUtil.toFileObject(remoteFile); if (remoteFo == null) return Lookups.fixed(); return Lookups.fixed(remoteFo); }
@Nonnull public static Lookup createLookupWith (final @Nonnull Lookup lookup, final @Nonnull Object ... objects) { return new ProxyLookup(Lookups.fixed(objects), lookup); }
@Override public Lookup getLookup() { if(lookup == null) { lookup = Lookups.fixed(new ImplementGeographical()); } return lookup; }
@Override public void actionPerformed(ActionEvent e) { na.createContextAwareInstance(Lookups.fixed(node)).actionPerformed(e); } }
@Override protected Node[] createNodes(Shape shape) { return new Node[]{new AbstractNode(Children.LEAF, Lookups.fixed(shape))}; } }
@Override public Lookup getLookup() { // XXX cache it? Lookup projectLookup = phpProject.getLookup(); return Lookups.fixed( projectLookup.lookup(CustomizerProvider2.class), projectLookup.lookup(org.netbeans.modules.php.api.queries.PhpVisibilityQuery.class), new PhpModulePropertiesFactory(phpProject) ); }
private Lookup getLookup () { Node[] nodes = TopComponent.getRegistry ().getActivatedNodes (); int i, k = nodes.length; ArrayList l = new ArrayList (); for (i = 0; i < k; i++) { Object o = nodes [i].getCookie (DataObject.class); if (o != null) l.add (o); } return Lookups.fixed (l.toArray (new DataObject [l.size ()])); }
private static Lookup createLookup( NbMavenProject project ) { DataFolder rootFolder = DataFolder.findFolder( project.getProjectDirectory() ); // XXX Remove root folder after FindAction rewrite return Lookups.fixed( new Object[] { project, rootFolder } ); }
public IsobusCommonNode(Children children, Object data, String iconBase,String displayName) { super(children, Lookups.fixed(data)); setIconBaseWithExtension(iconBase); setDisplayName(displayName); }
public ProjectNode(final CsmProject project, Children.Array key) { super(key, Lookups.fixed(project)); this.project = project; isLibrary = project.isArtificial(); init(project); }
private static Lookup createLookup( SourceGroup group ) { // XXX Remove DataFolder when paste, find and refresh are reimplemented FileObject rootFolder = group.getRootFolder(); DataFolder dataFolder = DataFolder.findFolder( rootFolder ); return Lookups.fixed(dataFolder, new PathFinder(group)); }
/** * Creates a new {@code RuleNode}. * * @param rule rule represented by the node. * @param ruleOrigin origin of the rule. */ RuleNode(Rule rule, Resource ruleOrigin) { super(Children.LEAF, Lookups.fixed(rule, ruleOrigin)); setDisplayName(rule.getSelector()); setIconBaseWithExtension(ICON_BASE); }
public ExternalFilesNode(Folder folder, MakeLogicalViewProvider provider) { super(new ExternalFilesChildren(folder, provider), Lookups.fixed(new Object[]{provider.getProject(), new FolderSearchInfo(folder)})); setName(folder.getName()); setDisplayName(folder.getDisplayName()); setShortDescription(NbBundle.getBundle(getClass()).getString("ONLY_REFERENCE_TXT")); this.folder = folder; this.provider = provider; }
@org.netbeans.api.annotations.common.SuppressWarnings("SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS") // since CategoryChildren is nonstatic CategoryNode(LibraryTypeProvider provider, LibraryStorageArea area) { super(new CategoryChildren(provider, area), Lookups.fixed(provider, area)); this.provider = provider; this.iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate(); }
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(), }); }
@Test public void shouldCallLoadDataAtInitialization() { Injector.getDefault().inject(fixture, Lookups.fixed(dataLoader)); verify(dataLoader).loadData(); verifyNoMoreInteractions(dataLoader); } }
public RevisionNode(RepositoryRevision.Event revision, SearchHistoryPanel master) { super(Children.LEAF, Lookups.fixed(master, revision)); this.path = revision.getChangedPath().getPath(); this.event = revision; setName(revision.getName()); setShortDescription(path); initProperties(); }
@Test public void shouldCallLoadDataAtNotifyShowingAndOnlyOnce() { Injector.getDefault().inject(fixture, Lookups.fixed(dataLoader)); verifyZeroInteractions(dataLoader); // TODO: would be nice to test that all other methods do nothing fixture.notifyShowing(); verify(dataLoader).loadData(); fixture.notifyShowing(); verifyNoMoreInteractions(dataLoader); } }
@Before public void setup() { topComponent = new TopComponent(); topComponent.setName("name1"); windowManager = mock(EnhancedWindowManager.class); fixture = new TitleActivator(); Injector.getDefault().inject(fixture, Lookups.fixed(topComponent, windowManager)); verifyZeroInteractions(windowManager); }
@Test public void testPostConstructWithValidProvider() throws Exception { fixture.lookup = Lookups.fixed(provider1); callPostConstruct(); assertThat(fixture.geoViewProviders.size(), is(1)); assertThat(fixture.selectedGeoViewProvider, is(sameInstance(provider1))); }