本文整理汇总了Java中org.openide.util.WeakListeners.propertyChange方法的典型用法代码示例。如果您正苦于以下问题:Java WeakListeners.propertyChange方法的具体用法?Java WeakListeners.propertyChange怎么用?Java WeakListeners.propertyChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.WeakListeners
的用法示例。
在下文中一共展示了WeakListeners.propertyChange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCandidates
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private synchronized boolean updateCandidates() {
boolean affected = false;
final JavaPlatform[] newPlatforms = jpm.getInstalledPlatforms();
final Map<JavaPlatform, PropertyChangeListener> oldPlatforms = new HashMap<>(platforms);
final Map<JavaPlatform, PropertyChangeListener> newState = new LinkedHashMap<>(newPlatforms.length);
for (JavaPlatform jp : newPlatforms) {
PropertyChangeListener l;
if ((l=oldPlatforms.remove(jp))!=null) {
newState.put(jp,l);
} else if (contains(jp,artifact)) {
affected = true;
l = WeakListeners.propertyChange(this, this.jpm);
jp.addPropertyChangeListener(l);
newState.put(jp,l);
}
}
for (Map.Entry<JavaPlatform,PropertyChangeListener> e : oldPlatforms.entrySet()) {
affected = true;
e.getKey().removePropertyChangeListener(e.getValue());
}
platforms = newState;
return affected;
}
示例2: attach
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
/**
* Creates attachment between a schema reference and the corresponding model.
* All required activities are made synchronized:
* - new weak listener is created and subscribtion is adde to listen
* changes of the referenced model.
* - the model and the listener is added to cache
*/
private synchronized void attach(SchemaModelReference ref,
SchemaModelImpl referencedModel) {
//
lazySelfListenerInit();
//
if (mPropertyExtListener == null) {
initExtListener();
}
PropertyChangeListener weakListener = WeakListeners.propertyChange(
mPropertySelfListener, referencedModel);
//
referencedModel.addPropertyChangeListener(weakListener);
//
refModelCache.put(ref, new SmAttachment(referencedModel, weakListener));
}
示例3: stateChanged
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
Object source = e.getSource();
if (source instanceof Collection) {
FileObject bfo = this.fo;
if (bfo == null) {
return ;
}
for (Object obj : ((Collection) source)) {
DataObject dobj = (DataObject) obj;
FileObject primary = dobj.getPrimaryFile();
if (bfo.equals(primary)) {
synchronized (this) {
dobjRef = new WeakReference<DataObject>(dobj);
dobjwl = WeakListeners.propertyChange(this, dobj);
dobj.addPropertyChangeListener(dobjwl);
if (registryListener != null) {
DataObject.getRegistry().removeChangeListener(registryListener);
registryListener = null;
}
}
break;
}
}
}
}
示例4: initializeWithRootContext
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
/** Initialize this top component properly with information
* obtained from specified root context node */
private void initializeWithRootContext (Node rc) {
// update TC's attributes
setToolTipText(rc.getDisplayName());
setName(rc.getDisplayName());
updateTitle();
// attach listener
if (weakRcL == null) {
weakRcL = WeakListeners.propertyChange(
rcListener(), rc
);
}
rc.addPropertyChangeListener(weakRcL);
if (weakNRcL == null) {
weakNRcL = NodeOp.weakNodeListener (
rcListener(), rc
);
}
rc.addNodeListener(weakNRcL);
}
示例5: getValueFor
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
@Override
public Object getValueFor(Object node, int column) {
Node n = Visualizer.findNode(node);
if (n == null) {
throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + node + " of class " + node.getClass().getName());
}
PropertyChangeListener cacheEntry = nodesListenersCache.get (n);
if (cacheEntry == null) {
PropertyChangeListener p = WeakListeners.propertyChange(pcl, n);
nodesListenersCache.put(n, p);
n.addPropertyChangeListener(p);
NodeListener l = WeakListeners.create(NodeListener.class, nl, n);
n.addNodeListener(l);
}
Node.Property theRealProperty = getPropertyFor(n, prop[column]);
return theRealProperty;
}
示例6: addListener
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void addListener(PropertiesDataObject dataObj) {
PropertyChangeListener l =weakEnvPropListeners.get(dataObj);
VetoableChangeListener v = weakEnvVetoListeners.get(dataObj);
if (l != null) {
dataObj.removePropertyChangeListener(l);
} else {
l = WeakListeners.propertyChange(this, dataObj);
weakEnvPropListeners.put(dataObj, l);
}
if (v != null) {
dataObj.removeVetoableChangeListener(v);
} else {
v = WeakListeners.vetoableChange(this, dataObj);
weakEnvVetoListeners.put(dataObj, v);
}
dataObj.addPropertyChangeListener(l);
dataObj.addVetoableChangeListener(v);
}
示例7: setLine
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void setLine(Line line) {
dispose();
int oldLineNumber = getLineNumber();
this.line = line;
lineChangesWeak = WeakListeners.propertyChange(lineChangeslistener, line);
line.addPropertyChangeListener(lineChangesWeak);
pchs.firePropertyChange(PROP_LINE_NUMBER, oldLineNumber, getLineNumber());
}
示例8: setLineHandler
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void setLineHandler(EditorLineHandler line) {
dispose();
EditorLineHandler oldLine = this.line;
this.line = line;
lineChangesWeak = WeakListeners.propertyChange(lineChangeslistener, line);
line.addPropertyChangeListener(lineChangesWeak);
FileObject fileObject = line.getFileObject();
if (fileObject != null) {
myWeakListener = WeakListeners.create(
FileChangeListener.class, myListener, fileObject);
fileObject.addFileChangeListener(myWeakListener);
}
firePropertyChange(PROP_FILE, oldLine.getFileObject(), line.getFileObject());
firePropertyChange(PROP_LINE_NUMBER, oldLine.getLineNumber(), line.getLineNumber());
}
示例9: DiffResultsView
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public DiffResultsView(SearchHistoryPanel parent, List<RepositoryRevision> results) {
this.parent = parent;
this.results = results;
treeView = new DiffTreeTable(parent);
treeView.setResults(results);
treeView.addAncestorListener(this);
diffView = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
diffView.setTopComponent(treeView);
setBottomComponent(new NoContentPanel(NbBundle.getMessage(DiffResultsView.class, "MSG_DiffPanel_NoRevisions"))); // NOI18N
list = WeakListeners.propertyChange(this, null);
}
示例10: setSelector
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void setSelector(CodeCompletionOptionsSelector selector) {
if (this.selector != null) {
this.selector.removePropertyChangeListener(weakListener);
}
this.selector = selector;
if (this.selector != null) {
this.weakListener = WeakListeners.propertyChange(this, this.selector);
this.selector.addPropertyChangeListener(weakListener);
// Languages combobox model
DefaultComboBoxModel model = new DefaultComboBoxModel();
ArrayList<String> mimeTypes = new ArrayList<String>();
mimeTypes.addAll(selector.getMimeTypes());
Collections.sort(mimeTypes, new LanguagesComparator());
for (String mimeType : mimeTypes) {
model.addElement(mimeType);
}
cbLanguage.setModel(model);
if (lastSelectedItem != null) {
cbLanguage.setSelectedItem(lastSelectedItem);
} else {
cbLanguage.setSelectedIndex(0);
}
} else {
if (cbLanguage.getSelectedItem() != null) {
lastSelectedItem = cbLanguage.getSelectedItem();
}
cbLanguage.setModel(new DefaultComboBoxModel());
}
}
示例11: BaseDelAction
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
/** Constructs new action that is bound to given context and
* listens for changes of <code>ActionMap</code> in order to delegate
* to right action.
*/
protected BaseDelAction(Map map, Object key, Lookup actionContext, Action fallback, boolean surviveFocusChange, boolean async) {
this.map = map;
this.key = key;
this.fallback = fallback;
this.global = GlobalManager.findManager(actionContext, surviveFocusChange);
this.weakL = WeakListeners.propertyChange(this, fallback);
this.async = async;
if (fallback != null) {
fallback.addPropertyChangeListener(weakL);
}
}
示例12: InplaceEditorFactory
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
InplaceEditorFactory(boolean tableUI, ReusablePropertyEnv env) {
this.tableUI = tableUI;
this.reusableEnv = env;
//reset editors when windows theme is changing (classic <-> xp)
PropertyChangeListener weakListener = WeakListeners.propertyChange(this, Toolkit.getDefaultToolkit());
Toolkit.getDefaultToolkit().addPropertyChangeListener( "win.xpstyle.themeActive", weakListener ); //NOI18N
}
示例13: DiffResultsView
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public DiffResultsView (SearchHistoryPanel parent, List<RepositoryRevision> results) {
this.parent = parent;
this.results = results;
treeView = new DiffTreeTable(parent);
treeView.setResults(results);
treeView.addAncestorListener(this);
diffView = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
diffView.setTopComponent(treeView);
setBottomComponent(new NoContentPanel(NbBundle.getMessage(DiffResultsView.class, "MSG_DiffPanel_NoRevisions"))); // NOI18N
list = WeakListeners.propertyChange(this, null);
}
示例14: DataObjectListener
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
/**
* @param fo The file object to listen upon at DataObject level
* @param fcl The FileChangeListener to be called when the DataObject has been invalidated
*
* @throws org.openide.loaders.DataObjectNotFoundException
*/
public DataObjectListener(FileObject fo, FileChangeListener fcl) throws DataObjectNotFoundException {
this.fobj = fo;
this.flisten = fcl;
this.dobj = DataObject.find(fo);
wlistener = WeakListeners.propertyChange(this, dobj);
this.dobj.addPropertyChangeListener(wlistener);
}
示例15: getDelegate
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
@NonNull
private FileBuiltQueryImplementation getDelegate() {
FileBuiltQueryImplementation res;
synchronized (this) {
res = delegate;
}
if (res == null) {
final List<String> from = new ArrayList<>();
final List<String> to = new ArrayList<>();
final Set<ClassPath> classpaths = Collections.newSetFromMap(new IdentityHashMap<>());
collectRoots(sourceModules, ProjectProperties.BUILD_MODULES_DIR, from, to, classpaths);
collectRoots(testModules, ProjectProperties.BUILD_TEST_MODULES_DIR, from, to, classpaths);
res = helper.createGlobFileBuiltQuery(
eval,
from.toArray(new String[from.size()]),
to.toArray(new String[to.size()]));
synchronized (this) {
if (delegate == null) {
for (Pair<ClassPath,PropertyChangeListener> cplp : currentPaths) {
cplp.first().removePropertyChangeListener(cplp.second());
}
currentPaths.clear();
for (ClassPath scp : classpaths) {
final PropertyChangeListener l = WeakListeners.propertyChange(this, scp);
scp.addPropertyChangeListener(l);
currentPaths.add(Pair.of(scp, l));
}
delegate = res;
} else {
res = delegate;
}
}
}
return res;
}