当前位置: 首页>>代码示例>>Java>>正文


Java Lookups.singleton方法代码示例

本文整理汇总了Java中org.openide.util.lookup.Lookups.singleton方法的典型用法代码示例。如果您正苦于以下问题:Java Lookups.singleton方法的具体用法?Java Lookups.singleton怎么用?Java Lookups.singleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.util.lookup.Lookups的用法示例。


在下文中一共展示了Lookups.singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TreeNode

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public TreeNode(CompilationInfo info, TreePath tree, List<Node> nodes) {
    super(nodes.isEmpty() ? Children.LEAF: new NodeChilren(nodes), Lookups.singleton(tree.getLeaf()));
    this.tree = tree;
    this.info = info;
    this.synthetic = info.getTreeUtilities().isSynthetic(tree);
    int start = (int) info.getTrees().getSourcePositions().getStartPosition(tree.getCompilationUnit(), tree.getLeaf());
    int end   = (int) info.getTrees().getSourcePositions().getEndPosition(tree.getCompilationUnit(), tree.getLeaf());
    String text;

    if (start >= 0 && end >= 0 && end > start) {
        text = info.getText().substring(start, end);
    } else {
        text = tree.getLeaf().toString();
    }

    setDisplayName(tree.getLeaf().getKind().toString() + ":" + text); //NOI18N
    setIconBaseWithExtension("org/netbeans/modules/java/debug/resources/tree.png"); //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TreeNode.java

示例2: setUp

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
   
    clearWorkDir();
    
    DerbyDatabasesTest.SampleDatabaseLocator sdl = new DerbyDatabasesTest.SampleDatabaseLocator();
    sampleDBLookup = new ProxyLookup(Lookup.getDefault(), Lookups.singleton(sdl));
    
    Lookups.executeWith(sampleDBLookup, new Runnable() {
        @Override
        public void run() {
            // Force initialization of JDBCDrivers
            JDBCDriverManager jdm = JDBCDriverManager.getDefault();
            JDBCDriver[] registeredDrivers = jdm.getDrivers();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TestBase.java

示例3: node

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public Node node(final SourceGroup key) {
    try {
        Node nodeDelegate = DataObject.find(key.getRootFolder()).getNodeDelegate();
        return new FilterNode(nodeDelegate,
                null, new ProxyLookup(nodeDelegate.getLookup(), Lookups.singleton(new PathFinder(key)))) {
            @Override
            public String getName() {
                return key.getName();
            }
            @Override
            public String getDisplayName() {
                return key.getDisplayName();
            }
        };
    } catch (DataObjectNotFoundException ex) {
        throw new AssertionError(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TestDataDirsNodeFactory.java

示例4: testCreateMenu

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public void testCreateMenu() throws Exception {
        TestFS fs = new TestFS();
        FileObject fo = fs.getRoot();
     
        // create menu for a lookup containg a node
        Lookup lkp = Lookups.singleton(DataFolder.findFolder(fo).getNodeDelegate());
        Method m = FileSystemAction.class.getDeclaredMethod("createMenu",
                Boolean.TYPE, Lookup.class);
        m.setAccessible(true);
        JMenuItem[] item = (JMenuItem[])m.invoke(null, true, lkp);
        assertTrue(item.length > 0);
        
        // create menu for a lookup containg a DataObject
        lkp = Lookups.singleton(DataFolder.findFolder(fo));
        item = (JMenuItem[])m.invoke(null, true, lkp);
        assertTrue(item.length > 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:FileSystemActionTest.java

示例5: IntroduceLocalExtensionRefactoring

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/**
 * Create a new instance of IntroduceLocalExtensionRefactoring.
 * Equality will be {@code DELEGATE}.
 *
 * @param handle Path to the type to refactor.
 */
public IntroduceLocalExtensionRefactoring(@NonNull TreePathHandle handle) {
    super(Lookups.singleton(handle));
    this.equality = Equality.DELEGATE;
    this.wrap = false;
    this.replace = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:IntroduceLocalExtensionRefactoring.java

示例6: getEnvironment

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public Lookup getEnvironment(DataObject obj) {
    if (obj == ComplexPair.obj) {
        howManyTimesWeHandledRequestForEnvironmentOfOurObject++;
        return Lookups.singleton(this);
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:FileEntityResolverDeadlock54971Test.java

示例7: DefaultEMLookup

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
/** Creates the lookup.
 * @param tc component to work on
 * @param map action map to add to the lookup
*/
public DefaultEMLookup(ExplorerManager tc, javax.swing.ActionMap map) {
    super();

    this.tc = tc;
    this.listener = WeakListeners.create(LookupListener.class, this, null);
    this.actionMap = Lookups.singleton(map);

    tc.addPropertyChangeListener(WeakListeners.propertyChange(this, tc));

    updateLookups(tc.getSelectedNodes());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:DefaultEMLookup.java

示例8: LibraryNode

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LibraryChooserGUI.java

示例9: HudsonInstanceNode

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public HudsonInstanceNode(final HudsonInstance instance) {
    super(new InstanceNodeChildren(instance), Lookups.singleton(instance));
    
    setName(instance.getUrl());
    setDisplayName(instance.getName());
    setShortDescription(instance.getUrl());
    setIconBaseWithExtension(ICON_BASE);
    setValue("customDelete", true); // NOI18N
    
    this.instance = instance;
    
    instance.addHudsonChangeListener(new HudsonChangeListener() {
        @Override public void stateChanged() {
            refreshState();
        }
        @Override public void contentChanged() {
            refreshContent();
        }
    });
    instance.prefs().addPreferenceChangeListener(new PreferenceChangeListener() {
        @Override public void preferenceChange(PreferenceChangeEvent evt) {
            refreshContent();
        }
    });
    
    // Refresh
    refreshState();
    refreshContent();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:HudsonInstanceNode.java

示例10: SimpleObject

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public SimpleObject(SimpleLoader l,
                    FileObject fo,
                    boolean useSpecialEncoding)
                                      throws DataObjectExistsException {
    super(fo, l);
    lookup = useSpecialEncoding
             ? Lookups.fixed(this, new TestEncoding())
             : Lookups.singleton(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Bug138973Test.java

示例11: getImpls

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@NonNull
private static Iterable<? extends ContextProvider> getImpls() {
    Lookup.Result<ContextProvider> res = impls.get();
    if (res == null) {
        final Lookup lkp = new ProxyLookup(
            Lookup.getDefault(),
            Lookups.singleton(new DefaultContextProvider()));
        res = lkp.lookupResult(ContextProvider.class);
        if (!impls.compareAndSet(null, res)) {
            res = impls.get();
        }
    }
    return res.allInstances();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ContextProvider.java

示例12: HudsonJobNode

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public HudsonJobNode(HudsonJob job) {
    super(makeChildren(job), Lookups.singleton(job));
    setName(job.getName());
    setHudsonJob(job);
    setWatchedListener();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:HudsonJobNode.java

示例13: InstantRefactoringUIImpl

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
private InstantRefactoringUIImpl(Set<MutablePositionRegion> usages, Set<MutablePositionRegion> comments, String oldName, DocTreePathHandle dtph) throws BadLocationException {
    this(usages, comments, oldName, new RenameRefactoring(Lookups.singleton(dtph)), null, dtph);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:InstantRefactoringUIImpl.java

示例14: YearNode

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
public YearNode(int year) {
    super(Children.create(new MonthNodeFactory(year), true), Lookups.singleton(year));
    setName("" + year);
    setDisplayName("" + year);
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:6,代码来源:YearNode.java

示例15: createCloneableEditor

import org.openide.util.lookup.Lookups; //导入方法依赖的package包/类
@Override
public CloneableEditor createCloneableEditor() {
    return new SQLCloneableEditor(Lookups.singleton(this));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:SQLEditorSupportConsoleTest.java


注:本文中的org.openide.util.lookup.Lookups.singleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。