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


Java ModuleInfo.addPropertyChangeListener方法代码示例

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


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

示例1: getProblems

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@Messages({
    "HpiPluginWarning_problem_displayName=Missing Hudson/Jenkins plugin support",
    "HpiPluginWarning_problem_description=Hudson/Jenkins plugin development support was removed from NetBeans 7.3. Install https://github.com/stapler/netbeans-stapler-plugin (available from Plugin Portal).",
    "HpiPluginWarning_unresolved=Automated installation from Plugin Portal not yet implemented; install the “Jenkins Plugin Support” and “Stapler Support” plugins."
})
@Override public Collection<? extends ProjectProblem> getProblems() {
    for (ModuleInfo mi : modules.allInstances()) {
        if (mi.getCodeNameBase().equals("org.kohsuke.stapler.netbeans.jenkinsdev")) {
            if (mi.isEnabled()) {
                return Collections.emptySet();
            } else {
                mi.addPropertyChangeListener(WeakListeners.propertyChange(this, mi));
                // XXX better to display a specialized warning
                continue;
            }
        }
    }
    return Collections.singleton(ProjectProblem.createWarning(HpiPluginWarning_problem_displayName(), HpiPluginWarning_problem_description(), new ProjectProblemResolverImpl()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:HpiPluginWarning.java

示例2: listenOn

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private void listenOn(ClassLoader cl) {
    boolean doesNotContainCl = false;
    synchronized(moduleChangeListeners) {
        if (!moduleChangeListeners.containsKey(cl)) {
            doesNotContainCl = true;
        }
    }
    if (doesNotContainCl) {
        Collection<? extends ModuleInfo> allInstances = moduleLookupResult.allInstances();
        synchronized (moduleChangeListeners) {
            if (!moduleChangeListeners.containsKey(cl)) { // Still does not contain
                for (ModuleInfo mi : allInstances) {
                    if (mi.isEnabled() && mi.getClassLoader() == cl) {
                        ModuleChangeListener l = new ModuleChangeListener(cl);
                        mi.addPropertyChangeListener(WeakListeners.propertyChange(l, mi));
                        moduleChangeListeners.put(cl, l);
                    }
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Lookup.java

示例3: resultChanged

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@Override
public void resultChanged(LookupEvent ev) {
    for (ModuleInfo m : result.allInstances()) {
        m.removePropertyChangeListener(this);
        m.addPropertyChangeListener(this);
    }
    Map<String,ModuleInfo> tmp = new HashMap<String,ModuleInfo>();
    for (ModuleInfo mi : result.allInstances()) {
        tmp.put(mi.getCodeNameBase(), mi);
    }
    infos = tmp;
    if (ev != null) {
        fireChange();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ModuleCache.java

示例4: setModuleInfo

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
/** replace an old module info with a new one */
void setModuleInfo(ModuleInfo mi) {
    this.mi.removePropertyChangeListener(this);
    aModuleHasBeenChanged = true;
    this.mi = mi;
    mi.addPropertyChangeListener(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ModuleInfoManager.java

示例5: listenOnDisabledModules

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private void listenOnDisabledModules() {
    Collection<? extends ModuleInfo> allInstances = moduleLookupResult.allInstances();
    synchronized (moduleChangeListeners) {
        for (ModuleInfo mi : allInstances) {
            if (!mi.isEnabled() && !disabledModuleChangeListeners.containsKey(mi)) {
                ModuleChangeListener l = new ModuleChangeListener(null);
                mi.addPropertyChangeListener(WeakListeners.propertyChange(l, mi));
                disabledModuleChangeListeners.put(mi, l);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Lookup.java

示例6: switchModule

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
/**
     * Enbles <code>enable = true</code>  or disables <code>enable = false</code> the module.
     */
    public static void switchModule(String codeName, boolean enable) throws Exception {
        String statusFile = "Modules/" + codeName.replace('.', '-') + ".xml";
        ModuleInfo mi = getModuleInfo(codeName);
/*
        FileObject fo = findFileObject(statusFile);
        Document document = XMLUtil.parse(new InputSource(fo.getInputStream()), false, false, null, EntityCatalog.getDefault());
        //Document document = XMLUtil.parse(new InputSource(data.getPrimaryFile().getInputStream()), false, false, null, EntityCatalog.getDefault());
        NodeList list = document.getElementsByTagName("param");
 
        for (int i = 0; i < list.getLength(); i++) {
            Element ele = (Element) list.item(i);
            if (ele.getAttribute("name").equals("enabled")) {
                ele.getFirstChild().setNodeValue(enable ? "true" : "false");
                break;
            }
        }
 
        FileLock lock = fo.lock();
        OutputStream os = fo.getOutputStream(lock);
        XMLUtil.write(document, os, "UTF-8");
        lock.releaseLock();
        os.close();
 */
        
        // module is switched
        if (mi.isEnabled() == enable) {
            return;
        }
        
        DataObject data = findDataObject(statusFile);
        EditorCookie ec = (EditorCookie) data.getCookie(EditorCookie.class);
        StyledDocument doc = ec.openDocument();
        
        // Change parametr enabled
        String stag = "<param name=\"enabled\">";
        String etag = "</param>";
        String enabled = enable ? "true" : "false";
        String result;
        
        String str = doc.getText(0,doc.getLength());
        int sindex = str.indexOf(stag);
        int eindex = str.indexOf(etag, sindex);
        if (sindex > -1 && eindex > sindex) {
            result = str.substring(0, sindex + stag.length()) + enabled + str.substring(eindex);
            //System.err.println(result);
        } else {
            //throw new IllegalStateException("Invalid format of: " + statusFile + ", missing parametr 'enabled'");
            // Probably autoload module
            return;
        }
        
        // prepare synchronization and register listener
        final Waiter waiter = new Waiter();
        final PropertyChangeListener pcl = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("enabled")) {
                    waiter.notifyFinished();
                }
            }
        };
        mi.addPropertyChangeListener(pcl);
        
        // save document
        doc.remove(0,doc.getLength());
        doc.insertString(0,result,null);
        ec.saveDocument();
        
        // wait for enabled propety change and remove listener
        waiter.waitFinished();
        mi.removePropertyChangeListener(pcl);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:75,代码来源:AbstractTestUtil.java

示例7: PCL

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public PCL(ModuleInfo mi) {
    this.mi = mi;
    wasModuleEnabled = mi.isEnabled();
    mi.addPropertyChangeListener(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ModuleInfoManager.java


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