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


Java LookupListener类代码示例

本文整理汇总了Java中org.openide.util.LookupListener的典型用法代码示例。如果您正苦于以下问题:Java LookupListener类的具体用法?Java LookupListener怎么用?Java LookupListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testDontCallMeUnderLock

import org.openide.util.LookupListener; //导入依赖的package包/类
public void testDontCallMeUnderLock() throws Exception {
    final Lookup l = getTestedLookup(c2);
    ProxyLookup pl = new ProxyLookup(l) {
        @Override
        void beforeLookup(boolean call, Template<?> template) {
            super.beforeLookup(call, template);
            assertFalse("Don't hold MetaInfServicesLookup lock", Thread.holdsLock(l));
        }
    };
    Class<?> xface = c1.loadClass("org.foo.Interface");
    Result<?> res = pl.lookupResult(Object.class);
    res.addLookupListener(new LookupListener() {
        @Override
        public void resultChanged(LookupEvent ev) {
        }
    });
    assertTrue("Empty now", res.allItems().isEmpty());
    
    Object first = l.lookup(xface);
    assertEquals(first, l.lookupAll(xface).iterator().next());
    Object second = pl.lookup(xface);
    assertEquals(first, second);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:MetaInfServicesLookupTest.java

示例2: getColoring

import org.openide.util.LookupListener; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
        specificAttrs = attr;
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(
                    attr, 
                    fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:CodeFoldingSideBar.java

示例3: ColoringMap

import org.openide.util.LookupListener; //导入依赖的package包/类
private ColoringMap(
    List<String> legacyNonTokenColoringNames,
    Language<?> lexerLanguage, 
    List<? extends TokenContext> syntaxLanguages, 
    Lookup.Result<FontColorSettings> lookupResult
) {
    this.legacyNonTokenColoringNames = legacyNonTokenColoringNames;
    this.lexerLanguage = lexerLanguage;
    this.syntaxLanguages = syntaxLanguages;
    this.lookupResult = lookupResult;
    
    this.map = loadTheMap(
        legacyNonTokenColoringNames, 
        lexerLanguage, 
        syntaxLanguages, 
        lookupResult.allInstances()
    );
    
    this.lookupResult.addLookupListener(WeakListeners.create(LookupListener.class, lookupListener, this.lookupResult));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ColoringMap.java

示例4: getColoring

import org.openide.util.LookupListener; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(getComponent()))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_COLORING);
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CollapsedView.java

示例5: getColoring

import org.openide.util.LookupListener; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CodeFoldingSideBar.java

示例6: ComponentBreakpointActionProvider

import org.openide.util.LookupListener; //导入依赖的package包/类
public ComponentBreakpointActionProvider() {
    final Result<Node> nodeLookupResult = Utilities.actionsGlobalContext().lookupResult(Node.class);
    LookupListener ll = new LookupListener() {
        @Override
        public void resultChanged(LookupEvent ev) {
            Collection<? extends Node> nodeInstances = nodeLookupResult.allInstances();
            for (Node n : nodeInstances) {
                JavaComponentInfo ci = n.getLookup().lookup(JavaComponentInfo.class);
                if (ci != null) {
                    setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, true);
                    return ;
                }
            }
            setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, false);
        }
    };
    nodeLookupResult.addLookupListener(ll);
    ll.resultChanged(null); // To initialize
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ComponentBreakpointActionProvider.java

示例7: JavaSourceTaskFactoryManager

import org.openide.util.LookupListener; //导入依赖的package包/类
/** Creates a new instance of JavaSourceTaskFactoryManager */
private JavaSourceTaskFactoryManager() {
    final RequestProcessor.Task updateTask = new RequestProcessor("JavaSourceTaskFactoryManager Worker", 1).create(new Runnable() {
        public void run() {
            update();
        }
    });
    
    factories = Lookup.getDefault().lookupResult(JavaSourceTaskFactory.class);
    factories.addLookupListener(new LookupListener() {
        public void resultChanged(LookupEvent ev) {
            updateTask.schedule(0);
        }
    });
    
    update();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JavaSourceTaskFactoryManager.java

示例8: init

import org.openide.util.LookupListener; //导入依赖的package包/类
/** Called when there may be a need for initialization.
 *
 * @return true if subclasses shall initialize themselves
 */
protected boolean init () { 
    synchronized (RESULTS_LOCK) {//synchronized == issue 215335
    if (initialized) {
        return false;
    }
    this.results = new Lookup.Result[watch.length];
    // Needs to listen on changes in results
    for ( int i = 0; i < watch.length; i++ ) {
        results[i] = lookup.lookupResult(watch[i]);
        results[i].allItems();
        LookupListener resultListener = WeakListeners.create(LookupListener.class, this, results[i]);
        results[i].addLookupListener( resultListener );
    }
    initialized = true;
    return true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LookupSensitiveAction.java

示例9: getHelpSets

import org.openide.util.LookupListener; //导入依赖的package包/类
/** Get all available help sets.
 * Pay attention to {@link #helpSetsChanged} to see
 * when this set will change.
 * @return a collection of HelpSet
 */    
protected final Collection<? extends HelpSet> getHelpSets() {
    if (helpsets == null) {
        Installer.log.fine("searching for instances of HelpSet...");
        helpsets = Lookup.getDefault().lookupResult(HelpSet.class);
        helpsets.addLookupListener(new LookupListener() {
            public void resultChanged(LookupEvent ev) {
                helpSetsChanged();
            }
        });
        fireChangeEvent(); // since someone may be listening to whether they are ready
    }
    Collection<? extends HelpSet> c = helpsets.allInstances();
    if (Installer.log.isLoggable(Level.FINE)) {
        List<String> l = new ArrayList<String>(Math.min(1, c.size()));
        for (HelpSet hs: c) {
            l.add(hs.getTitle());
        }
        Installer.log.fine("listing helpsets: " + l);
    }
    return c;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AbstractHelp.java

示例10: getImplementations

import org.openide.util.LookupListener; //导入依赖的package包/类
private static synchronized List<Selenium2SupportImpl> getImplementations() {
    if (implementations == null) {
        implementations = Lookup.getDefault().lookupResult(Selenium2SupportImpl.class);
        implementations.addLookupListener(new LookupListener() {
            @Override
            public void resultChanged(LookupEvent ev) {
                synchronized (Selenium2Support.class) {
                    cache = null;
                }
            }
        });
    }
    if (cache == null) {
        cache = new ArrayList<Selenium2SupportImpl>(implementations.allInstances());
    }
    return Collections.unmodifiableList(cache);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Selenium2Support.java

示例11: ensureTaskListLoaded

import org.openide.util.LookupListener; //导入依赖的package包/类
private synchronized void ensureTaskListLoaded () throws CoreException {
    if (!taskListInitialized) {
        if (result == null) {
            LookupListener lookupListener = new LookupListener() {
                @Override
                public void resultChanged (LookupEvent ev) {
                    registerConnectors();
                }
            };
            result = Lookup.getDefault().lookupResult(RepositoryConnectorProvider.class);
            result.addLookupListener(lookupListener);
        }
        registerConnectors();
        try {
            if (taskListStorageFile.length() > 0) {
                taskListWriter.readTaskList(taskList, taskListStorageFile);
            }
        } catch (CoreException ex) {
            LOG.log(Level.INFO, null, ex);
            throw new CoreException(new Status(ex.getStatus().getSeverity(), ex.getStatus().getPlugin(), "Cannot deserialize tasklist"));
        } finally {
            taskListInitialized = true;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:MylynSupport.java

示例12: prepareSettings

import org.openide.util.LookupListener; //导入依赖的package包/类
/** Prepares settings. */
private void prepareSettings() {
    if (prepared) return;
    prepared = true;

    // Set listening on changes of settings.
    fontsColors = MimeLookup.getLookup(PropertiesKit.PROPERTIES_MIME_TYPE).lookupResult(FontColorSettings.class);
    fontsColors.addLookupListener(WeakListeners.create(LookupListener.class, fontsColorsTracker, fontsColors));
    
    keybindings = MimeLookup.getLookup(PropertiesKit.PROPERTIES_MIME_TYPE).lookupResult(KeyBindingSettings.class);
    keybindings.addLookupListener(WeakListeners.create(LookupListener.class, keybindingsTracker, keybindings));
    
    // Init settings.                            
    updateColors();
    updateKeyStrokes();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:EditorSettingsCopy.java

示例13: initCategories

import org.openide.util.LookupListener; //导入依赖的package包/类
private void initCategories() {
    synchronized (this) {
        if (null == name2category) {
            if (null == lookupRes) {
                lookupRes = initLookup();
                lookupRes.addLookupListener(new LookupListener() {
                    @Override
                    public void resultChanged(LookupEvent ev) {
                        synchronized (NotificationCategoryFactory.this) {
                            name2category = null;
                            categories = null;
                        }
                    }
                });
            }
            int index = 0;
            categories = new ArrayList<Category>(Category.getDefaultCategories());
            categories.addAll(lookupRes.allInstances());
            name2category = new HashMap<String, Category>(categories.size());
            for (Category c : categories) {
                name2category.put(c.getName(), c);
                c.setIndex(index++);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NotificationCategoryFactory.java

示例14: getModulesResult

import org.openide.util.LookupListener; //导入依赖的package包/类
private Lookup.Result<ModuleInfo> getModulesResult() {
    synchronized (this) {
        if (modulesResult == null) {
            Lookup lookup = getModuleLookup();
            modulesResult = lookup.
                lookup(new Lookup.Template<ModuleInfo>(ModuleInfo.class));
            modulesResult.addLookupListener(new LookupListener() {
                public void resultChanged(LookupEvent ev) {
                    Collection<? extends ModuleInfo> l = getModulesResult().allInstances();
                    XMLSettingsSupport.err.fine("Modules changed: " + l); // NOI18N
                    List reloaded;
                    synchronized (this) {
                        fillModules(l);
                        reloaded = replaceReloadedModules();
                        XMLSettingsSupport.err.fine("Reloaded modules: " + reloaded); // NOI18N
                    }
                    notifyReloads(reloaded);
                }
            });
        }
        return modulesResult;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ModuleInfoManager.java

示例15: initGroups

import org.openide.util.LookupListener; //导入依赖的package包/类
private void initGroups() {
    synchronized( this ) {
        if( null == name2group ) {
            if( null == lookupRes ) {
                lookupRes = initLookup();
                lookupRes.addLookupListener( new LookupListener() {
                    public void resultChanged(LookupEvent ev) {
                        synchronized( TaskGroupFactory.this ) {
                            name2group = null;
                            groups = null;
                        }
                    }
                });
            }
            int index = 0;
            groups = new ArrayList<TaskGroup>( lookupRes.allInstances() );
            name2group = new HashMap<String,TaskGroup>(groups.size());
            for( TaskGroup tg : groups) {
                name2group.put( tg.getName(), tg );
                tg.setIndex( index++ );
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TaskGroupFactory.java


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