當前位置: 首頁>>代碼示例>>Java>>正文


Java Lookup.getDefault方法代碼示例

本文整理匯總了Java中org.openide.util.Lookup.getDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java Lookup.getDefault方法的具體用法?Java Lookup.getDefault怎麽用?Java Lookup.getDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.util.Lookup的用法示例。


在下文中一共展示了Lookup.getDefault方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: suite

import org.openide.util.Lookup; //導入方法依賴的package包/類
/** Executes the execution compatibility kit tests on the provided instance
 * of execution engine.
 */
public static Test suite(ExecutionEngine engine) {
    System.setProperty("org.openide.util.Lookup", ExecutionCompatibilityTest.class.getName() + "$Lkp");
    Object o = Lookup.getDefault();
    if (!(o instanceof Lkp)) {
        Assert.fail("Wrong lookup object: " + o);
    }
    
    Lkp l = (Lkp)o;
    l.assignExecutionEngine(engine);
    
    if (engine != null) {
        Assert.assertEquals("Same engine found", engine, ExecutionEngine.getDefault());
    } else {
        o = ExecutionEngine.getDefault();
        Assert.assertNotNull("Engine found", o);
        Assert.assertEquals(ExecutionEngine.Trivial.class, o.getClass());
    }
    
    TestSuite ts = new TestSuite();
    ts.addTestSuite(ExecutionEngineHid.class);
    
    return ts;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:ExecutionCompatibilityTest.java

示例2: getImpls

import org.openide.util.Lookup; //導入方法依賴的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

示例3: add

import org.openide.util.Lookup; //導入方法依賴的package包/類
public static void add(Processor proc, Option... options) {
    Lookup l = Lookup.getDefault();
    Assert.assertEquals("Our class", org.netbeans.api.sendopts.Provider.class, l.getClass());
    
    org.netbeans.api.sendopts.Provider p = (org.netbeans.api.sendopts.Provider)l;
    p.ic.add(new DefProvider(options, proc));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:Provider.java

示例4: findImplementation

import org.openide.util.Lookup; //導入方法依賴的package包/類
static RepositoryIndexerImplementation findImplementation(RepositoryInfo repo) {
    Lookup l = Lookup.getDefault();
    Collection<? extends RepositoryIndexQueryProvider> queryProviders = l.lookupAll(RepositoryIndexQueryProvider.class);
    for (RepositoryIndexQueryProvider queryProvider : queryProviders) {
        if(!(queryProvider instanceof NexusRepositoryIndexerImpl) && queryProvider.handlesRepository(repo)) {
            // skip if 
            return null;
        }
    }
    return l.lookup(RepositoryIndexerImplementation.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:RepositoryIndexer.java

示例5: modulesClassPathInitialized

import org.openide.util.Lookup; //導入方法依賴的package包/類
static final void modulesClassPathInitialized(Lookup services) {
    // replace the lookup by new one
    Lookup lookup = Lookup.getDefault ();
    StartLog.logProgress ("Got Lookup"); // NOI18N

    ((MainLookup)lookup).doInitializeLookup(services);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:MainLookup.java

示例6: clearAll

import org.openide.util.Lookup; //導入方法依賴的package包/類
public static void clearAll() {
    Lookup l = Lookup.getDefault();
    Assert.assertEquals("Our class", org.netbeans.api.sendopts.Provider.class, l.getClass());
    
    org.netbeans.api.sendopts.Provider p = (org.netbeans.api.sendopts.Provider)l;
    p.ic.set(Collections.emptyList(), null);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:Provider.java

示例7: setUp

import org.openide.util.Lookup; //導入方法依賴的package包/類
protected void setUp() throws Exception {
System.setProperty("org.openide.util.Lookup", RefusesInvalidationTest.class.getName() + "$Lkp");

      super.setUp();

Lookup l = Lookup.getDefault();
if (!(l instanceof Lkp)) {
	fail("Wrong lookup: " + l);
}

clearWorkDir();
  }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:RefusesInvalidationTest.java

示例8: setUp

import org.openide.util.Lookup; //導入方法依賴的package包/類
protected void setUp() throws Exception {
    System.setProperty("org.openide.util.Lookup", Deadlock60917Test.class.getName() + "$Lkp");
    
    super.setUp();
    
    Lookup l = Lookup.getDefault();
    if (!(l instanceof Lkp)) {
        fail("Wrong lookup: " + l);
    }
    
    clearWorkDir();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:Deadlock60917Test.java

示例9: run

import org.openide.util.Lookup; //導入方法依賴的package包/類
@Override
public void run(TestResult result) {
    Lookup l = Lookup.getDefault();
    assertEquals("We can run only with our Lookup", Lkp.class, l.getClass());
    Lkp lkp = (Lkp)l;
    lkp.reset();
    
    super.run(result);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:LoggingTestCaseHid.java

示例10: tearDown

import org.openide.util.Lookup; //導入方法依賴的package包/類
@Override
protected void tearDown() throws Exception {
    Lookup l = Lookup.getDefault();
    assertEquals(Lkp.class, l.getClass());
    Lkp lkp = (Lkp)l;
    // clear the lookup
    lkp.ic.set(Collections.emptyList(), null);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:StreamingTest.java

示例11: getContextLookup

import org.openide.util.Lookup; //導入方法依賴的package包/類
@Override
public Lookup getContextLookup() {
    return Lookup.getDefault();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:TestEnvironmentFactory.java

示例12: ResultsManager

import org.openide.util.Lookup; //導入方法依賴的package包/類
private ResultsManager() {
    Lookup l = Lookup.getDefault();
    snapshotListeners = l.lookupResult(SnapshotsListener.class);
    resultsListeners = l.lookupResult(ResultsListener.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:ResultsManager.java

示例13: setUp

import org.openide.util.Lookup; //導入方法依賴的package包/類
protected @Override void setUp() throws Exception {
    lookup = (MIMESupportLoggingTest.TestLookup)Lookup.getDefault();
    lookup.init();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:MIMESupportLoggingTest.java

示例14: getLookup

import org.openide.util.Lookup; //導入方法依賴的package包/類
/** Lookup that serves providers. */
public Lookup getLookup() {
    return Lookup.getDefault();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:Turbo.java

示例15: lookup

import org.openide.util.Lookup; //導入方法依賴的package包/類
/** A lookup to work on.
 * @return a lookup.
 */
protected Lookup lookup () {
    Lookup l = lookup;
    return l == null ? Lookup.getDefault () : l;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:ObjectEditor.java


注:本文中的org.openide.util.Lookup.getDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。