Java Code Examples for org.openide.util.lookup.Lookups#singleton()
The following examples show how to use
org.openide.util.lookup.Lookups#singleton() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiffFinderTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testFindDiff3() throws Exception { String FILE1 = "diff/PurchaseOrder.xsd"; Document d1 = Util.getResourceAsDocument(FILE1); Lookup lookup = Lookups.singleton(d1); ModelSource ms = new ModelSource(lookup, true); XDMModel m1 = new XDMModel(ms); m1.sync(); String FILE2 = "diff/PurchaseOrderSyncTest.xsd"; Document d2 = Util.getResourceAsDocument(FILE2); lookup = Lookups.singleton(d2); ms = new ModelSource(lookup, true); XDMModel m2 = new XDMModel(ms); m2.sync(); //establish DOM element identities DefaultElementIdentity eID = new DefaultElementIdentity(); eID.addIdentifier( "id" ); eID.addIdentifier( "name" ); eID.addIdentifier( "ref" ); // long startTime=System.currentTimeMillis(); DiffFinder dv = new DiffFinder( eID ); List<Difference> deList = dv.findDiff(m1.getDocument(), m2.getDocument()); // long endTime=System.currentTimeMillis(); // System.out.println("\n\n::::::::::::::::::::::::::::::::::::::::::::\n" + // "Total time to compare PurchaseOrder. "+(endTime-startTime)+"ms"); // System.out.println("::::::::::::::::::::::::::::::::::::::::::::"); // DiffFinder.printDeList( deList ); assertEquals(deList.toString(), 11, deList.size() ); }
Example 2
Source File: PropertiesEditorSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Lookup getLookup() { Lookup currentLookup = super.getLookup(); if (currentLookup != originalLookup || null == peLookup) { originalLookup = currentLookup; if(peLookup == null) { peLookup = new PropertiesEditorLookup(Lookups.singleton(PropertiesEditor.this)); } peLookup.updateLookups(originalLookup); } return peLookup; }
Example 3
Source File: SceneRequest.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * returns the lookup of the root node * @return */ public Lookup getLookup() { if (jmeNode != null) { return jmeNode.getLookup(); } else { return Lookups.singleton(new Object()); } }
Example 4
Source File: LibraryChooserGUI.java From netbeans with Apache License 2.0 | 5 votes |
LibraryNode (@NonNull final Library lib) { super(Children.LEAF, Lookups.singleton(lib)); setName(lib.getName()); setDisplayName(lib.getDisplayName()); setShortDescription(lib.getDescription()); setIconBaseWithExtension("org/netbeans/modules/project/libraries/resources/libraries.gif"); // NOI18N }
Example 5
Source File: TextmateTokenId.java From netbeans with Apache License 2.0 | 5 votes |
private static Lookup updateMimeType(String path) { String scope; scope = LanguageHierarchyImpl.mimeType2Scope.get(path); Lookup nested = Lookup.EMPTY; if (scope != null) { try { nested = Lookups.singleton(new LanguageHierarchyImpl(path, scope).language()); } catch (Exception ex) { LOG.log(Level.FINE, null, ex); } } return nested; }
Example 6
Source File: VariablesPanel.java From netbeans with Apache License 2.0 | 5 votes |
protected Node[] createNodes(Variable var) { Children ch = Children.LEAF; AbstractNode n = new AbstractNode(ch, Lookups.singleton(var)) { @Override public Image getIcon(int type) { return iconDelegate.getIcon(type); } }; n.setName(var.getName()); n.setDisplayName(var.getName() + "("+var.getValue().getPath()+")"); // NOI18N n.setShortDescription(var.getName() + "("+var.getValue().getPath()+")"); // NOI18N return new Node[] {n}; }
Example 7
Source File: TemplateChooserPanelGUITest.java From netbeans with Apache License 2.0 | 5 votes |
public @Override Lookup getLookup() { return Lookups.singleton(new RecommendedTemplates() { public @Override String[] getRecommendedTypes() { return new String[] {"main", "misc"}; } }); }
Example 8
Source File: WhereUsedQueryUI.java From netbeans with Apache License 2.0 | 5 votes |
private WhereUsedQueryUI(TreePathHandle handle, Element el, List<Pair<Pair<String, Icon>, TreePathHandle>> classes) { this.query = new WhereUsedQuery(Lookups.singleton(handle)); this.element = handle; if (UIUtilities.allowedElementKinds.contains(el.getKind())) { elementHandle = ElementHandle.create(el); } kind = el.getKind(); if(kind == ElementKind.CONSTRUCTOR) { name = el.getEnclosingElement().getSimpleName().toString(); } else { name = el.getSimpleName().toString(); } this.classes = classes; }
Example 9
Source File: Line.java From netbeans with Apache License 2.0 | 5 votes |
/** * Create a new line object based on a given data object. * This implementation is abstract, so the specific line number is not used here. Subclasses should somehow specify the position. * @param source the object that is producing the Line */ public Line(Object source) { this((source instanceof Lookup) ? (Lookup) source : Lookups.singleton(source)); if (source == null) { throw new NullPointerException(); } }
Example 10
Source File: HudsonMavenModuleBuildNode.java From netbeans with Apache License 2.0 | 5 votes |
public HudsonMavenModuleBuildNode(HudsonMavenModuleBuild module) { super(makeChildren(module), Lookups.singleton(module)); this.module = module; setName(module.getName()); setDisplayName(module.getDisplayName()); try { htmlDisplayName = module.getColor().colorizeDisplayName(XMLUtil.toElementContent(getDisplayName())); } catch (CharConversionException x) { htmlDisplayName = null; } setIconBaseWithExtension(module.getColor().iconBase()); }
Example 11
Source File: XDMModelTest.java From netbeans with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { um = new UndoManager(); sd = Util.getResourceAsDocument("test.xml"); Lookup lookup = Lookups.singleton(sd); ModelSource ms = new ModelSource(lookup, true); model = new XDMModel(ms); model.sync(); }
Example 12
Source File: WhereUsedElement.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Lookup getLookup() { Object composite = parentFile; return Lookups.singleton(composite); }
Example 13
Source File: HudsonJobNode.java From netbeans with Apache License 2.0 | 4 votes |
public HudsonJobNode(HudsonJob job) { super(makeChildren(job), Lookups.singleton(job)); setName(job.getName()); setHudsonJob(job); setWatchedListener(); }
Example 14
Source File: AttributeChildFactory.java From jeddict with Apache License 2.0 | 4 votes |
@Override protected Node createNodeForKey(final ColumnDef columnDef) { AbstractNode node = new PropertyNode(columnDef.getAttributeWidget().getModelerScene(), Children.LEAF, Lookups.singleton(columnDef)) { @Override public void createPropertySet(ElementPropertySet set) { if (columnDef.getAttributeWidget().getBaseElementSpec() instanceof PersistenceBaseAttribute) { PersistenceBaseAttribute persistenceBaseAttribute = (PersistenceBaseAttribute) columnDef.getAttributeWidget().getBaseElementSpec(); if (persistenceBaseAttribute.getColumn() == null) { persistenceBaseAttribute.setColumn(new Column()); } set.createPropertySet(columnDef.getAttributeWidget(), persistenceBaseAttribute.getColumn(), columnDef.getAttributeWidget().getPropertyChangeListeners(), columnDef.getAttributeWidget().getPropertyVisibilityHandlers()); } } @Override public Action[] getActions(boolean context) { Action[] result = new Action[]{ SystemAction.get(DeleteAction.class), SystemAction.get(PropertiesAction.class) }; return result; } @Override public boolean canDestroy() { Entity customer = this.getLookup().lookup(Entity.class); return customer != null; } @Override public void destroy() throws IOException { // if (deleteEntity(this.getLookup().lookup(Entity.class).getEntityId())) { // super.destroy(); // EntityTopComponent.refreshNode(); // } } }; node.setDisplayName(columnDef.getFlowTitle() + " -> " + columnDef.getColumnName()); node.setShortDescription(columnDef.getColumnName()); AttributeWidget attributeWidget = columnDef.getAttributeWidget(); node.setIconBaseWithExtension(attributeWidget.getIconPath()); return node; }
Example 15
Source File: FolderNodeFactory.java From netbeans with Apache License 2.0 | 4 votes |
public SubprojectNode(Project p, String label) { super(Children.LEAF, Lookups.singleton(p)); this.p = p; this.label = label; info = ProjectUtils.getInformation(p); }
Example 16
Source File: DataShadowBrokenAreNotQueriedTest.java From netbeans with Apache License 2.0 | 4 votes |
public Lkp() { super(new Lookup[] { Lookups.singleton(new UM()), Lookups.metaInfServices(Lkp.class.getClassLoader()), }); }
Example 17
Source File: InstantRefactoringUIImpl.java From netbeans with Apache License 2.0 | 4 votes |
private InstantRefactoringUIImpl(Set<MutablePositionRegion> usages, Set<MutablePositionRegion> comments, String oldName, FileObject file, TreePathHandle tph) throws BadLocationException { this(usages, comments, oldName, file != null? new RenameRefactoring(Lookups.fixed(tph, file)) : new RenameRefactoring(Lookups.singleton(tph)), tph, null); }
Example 18
Source File: PropertiesEditorSupport.java From netbeans with Apache License 2.0 | 4 votes |
/** Constructor. */ public PropertiesEditorSupport(PropertiesFileEntry entry) { super(new Environment(entry), new ProxyLookup(Lookups.singleton(entry.getDataObject()), entry.getDataObject().getLookup())); this.myEntry = entry; }
Example 19
Source File: PersistenceXmlRefactoring.java From netbeans with Apache License 2.0 | 4 votes |
public final Lookup getLookup() { return Lookups.singleton(parentFile); }
Example 20
Source File: ReplaceConstructorWithBuilderRefactoring.java From netbeans with Apache License 2.0 | 2 votes |
/** * Constructor accepts TreePathHandles representing constructor * @param constructor */ public ReplaceConstructorWithBuilderRefactoring(@NonNull TreePathHandle constructor) { super(Lookups.singleton(constructor)); }