本文整理汇总了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()));
}
示例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);
}
}
}
}
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
示例7: PCL
import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public PCL(ModuleInfo mi) {
this.mi = mi;
wasModuleEnabled = mi.isEnabled();
mi.addPropertyChangeListener(this);
}