本文整理汇总了Java中org.openide.util.WeakListeners.change方法的典型用法代码示例。如果您正苦于以下问题:Java WeakListeners.change方法的具体用法?Java WeakListeners.change怎么用?Java WeakListeners.change使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.WeakListeners
的用法示例。
在下文中一共展示了WeakListeners.change方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BinCacheLine
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
BinCacheLine(
@NonNull final URL artefact,
@NonNull final String modName,
@NullAllowed final CompilerOptionsQuery.Result cops,
@NullAllowed final BinaryForSourceQuery.Result res) {
super(artefact, modName);
this.cops = cops;
this.res = res;
if (this.cops != null) {
this.copsCl = WeakListeners.change(this, this.cops);
this.cops.addChangeListener(copsCl);
} else {
this.copsCl = null;
}
if (this.res != null) {
this.resCl = WeakListeners.change(this, this.res);
this.res.addChangeListener(resCl);
} else {
this.resCl = null;
}
}
示例2: init
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void init(final Task task) {
if (!initialized) {
ClasspathInfo _tmpInfo = null;
if (task instanceof ClasspathInfo.Provider &&
(_tmpInfo = ((ClasspathInfo.Provider)task).getClasspathInfo()) != null) {
if (cpInfo != null && weakCpListener != null) {
cpInfo.removeChangeListener(weakCpListener);
this.weakCpListener = null;
}
cpInfo = _tmpInfo;
this.weakCpListener = WeakListeners.change(cpInfoListener, cpInfo);
cpInfo.addChangeListener (this.weakCpListener);
root = Optional.ofNullable(cpInfo.getClassPath(PathKind.SOURCE))
.map((cp)-> {
FileObject[] roots = cp.getRoots();
return roots.length > 0 ? roots[0] : null;
})
.orElse(null);
} else {
throw new IllegalArgumentException("No classpath provided by task: " + task);
}
initialized = true;
}
}
示例3: propertyChange
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == null || "caret".equals(evt.getPropertyName())) { //NOI18N
if (caret != null) {
caret.removeChangeListener(caretListener);
caretListener = null;
}
caret = component.getCaret();
if (caret != null) {
caretListener = WeakListeners.change(this, caret);
caret.addChangeListener(caretListener);
}
updateLineInfo(true);
}
}
示例4: propertyChange
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == null || "caret".equals(evt.getPropertyName())) { //NOI18N
if (caret != null) {
caret.removeChangeListener(caretListener);
caretListener = null;
}
caret = component.getCaret();
if (caret != null) {
caretListener = WeakListeners.change(this, caret);
caret.addChangeListener(caretListener);
}
refresh();
} else if (MasterMatcher.PROP_SEARCH_DIRECTION.equals(evt.getPropertyName()) ||
MasterMatcher.PROP_CARET_BIAS.equals(evt.getPropertyName()) ||
MasterMatcher.PROP_MAX_BACKWARD_LOOKAHEAD.equals(evt.getPropertyName()) ||
MasterMatcher.PROP_MAX_FORWARD_LOOKAHEAD.equals(evt.getPropertyName())
) {
refresh();
}
}
示例5: addNotify
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
/** Initializes the children.
*/
@Override
protected void addNotify () {
err.fine("addNotify begin");
// add as a listener for changes on nodes
folder.addPropertyChangeListener(listener);
folder.getPrimaryFile().addFileChangeListener(fcListener);
// add listener to the filter
if ( filter instanceof ChangeableDataFilter ) {
ChangeableDataFilter chF = (ChangeableDataFilter)filter;
changeListener = WeakListeners.change(this, chF);
chF.addChangeListener( changeListener );
}
// #159628, #189979: do not block EQ loading this folder's children.
refreshChildren(RefreshMode.SHALLOW);
err.fine("addNotify end");
}
示例6: getWhiteLists
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private Iterable<WhiteListImplementation> getWhiteLists() {
synchronized (this) {
if (cache != null) {
return cache.keySet();
}
}
final Map<WhiteListImplementation,ChangeListener> map = new IdentityHashMap<WhiteListImplementation,ChangeListener>();
for (WhiteListQueryImplementation wlq : lr.allInstances()) {
final WhiteListImplementation wl = wlq.getWhiteList(file);
if (wl != null) {
final ChangeListener cl = WeakListeners.change(this, wl);
wl.addChangeListener(cl);
map.put(wl, cl);
}
}
synchronized (this) {
if (cache == null) {
cache = map;
}
return cache.keySet();
}
}
示例7: initListeners
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void initListeners() {
if (manuallySelectedId == null) {
manuallySelectedId = chooseId();
}
scopeList = new SearchScopeList(extraSearchScopes);
manualSelectionListener = new ManualSelectionListener();
searchScopeChangeListener = new SearchScopeChangeListener();
searchScopeChangeListenerWeak = WeakListeners.change(
searchScopeChangeListener, scopeList);
scopeList.addChangeListener(searchScopeChangeListenerWeak);
updateScopeItems(manuallySelectedId);
component.addActionListener(manualSelectionListener);
active = true;
}
示例8: run
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void run() {
computeKeys();
refreshKeys();
try {
FileSystem fs = root.getFileSystem();
wfcl = FileUtil.weakFileChangeListener(this, fs);
fs.addFileChangeListener( wfcl );
}
catch ( FileStateInvalidException e ) {
Exceptions.printStackTrace(e);
}
wvqcl = WeakListeners.change( this, VisibilityQuery.getDefault() );
VisibilityQuery.getDefault().addChangeListener( wvqcl );
}
示例9: init
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void init() {
this.component.addPropertyChangeListener(WeakListeners.propertyChange(this, this.component));
// Hook up the caret
this.caret = component.getCaret();
if (this.caret != null) {
this.caretListener = WeakListeners.change(this, this.caret);
this.caret.addChangeListener(caretListener);
}
// Calculate the current line position
updateLineInfo(false);
}
示例10: setProjectFiles
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void setProjectFiles(Project project) {
Sources sources = ProjectUtils.getSources(project); // returns singleton
if (sourcesListener == null) {
sourcesListener = WeakListeners.change(this, sources);
sources.addChangeListener(sourcesListener);
}
setGroups(Arrays.asList(sources.getSourceGroups(Sources.TYPE_GENERIC)), project.getProjectDirectory());
}
示例11: BracesMatchHighlighting
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public BracesMatchHighlighting(JTextComponent component, Document document) {
this.document = document;
String mimeType = getMimeType(component);
MimePath mimePath = mimeType == null ? MimePath.EMPTY : MimePath.parse(mimeType);
// Load the colorings
FontColorSettings fcs = MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
AttributeSet match = fcs.getFontColors(BRACES_MATCH_COLORING);
AttributeSet mismatch = fcs.getFontColors(BRACES_MISMATCH_COLORING);
AttributeSet matchMultichar = fcs.getFontColors(BRACES_MATCH_MULTICHAR_COLORING);
AttributeSet mismatchMultichar = fcs.getFontColors(BRACES_MISMATCH_MULTICHAR_COLORING);
this.bracesMatchColoring = match != null ? match : SimpleAttributeSet.EMPTY;
this.bracesMismatchColoring = mismatch != null ? mismatch : SimpleAttributeSet.EMPTY;
this.bracesMatchMulticharColoring = matchMultichar != null ? matchMultichar : SimpleAttributeSet.EMPTY;
this.bracesMismatchMulticharColoring = mismatchMultichar != null ? mismatchMultichar : SimpleAttributeSet.EMPTY;
// Create and hook up the highlights bag
this.bag = new OffsetsBag(document, true);
this.bag.addHighlightsChangeListener(this);
// Hook up the component
this.component = component;
this.component.addPropertyChangeListener(WeakListeners.propertyChange(this, this.component));
// Hook up the caret
this.caret = component.getCaret();
if (this.caret != null) {
this.caretListener = WeakListeners.change(this, this.caret);
this.caret.addChangeListener(caretListener);
}
// Refresh the layer
refresh();
}
示例12: setRerunCondition
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void setRerunCondition(RerunCondition condition) {
synchronized (this) {
if (this.condition != null) {
this.condition.removeChangeListener(listener);
}
this.condition = condition;
if (this.condition != null) {
listener = WeakListeners.change(this, this.condition);
this.condition.addChangeListener(listener);
}
}
stateChanged(null);
}
示例13: setupMode
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
public void setupMode (DiffController view) {
JTabbedPane tabPane = findTabbedPane(view.getJComponent());
if (tabPane != null) {
if (!handledViews.containsKey(tabPane)) {
ChangeListener list = WeakListeners.change(this, tabPane);
handledViews.put(tabPane, list);
tabPane.addChangeListener(list);
}
if (tabPane.getTabCount() > diffViewMode) {
tabPane.setSelectedIndex(diffViewMode);
}
}
}
示例14: rebuild
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private void rebuild() {
// Hookup the bookmark list
BookmarkList newBookmarks = BookmarkList.get(component.getDocument());
if (newBookmarks != bookmarks) {
if (bookmarksListener != null) {
bookmarks.removePropertyChangeListener (bookmarksListener);
bookmarksListener = null;
}
bookmarks = newBookmarks;
if (bookmarks != null) {
bookmarksListener = WeakListeners.propertyChange(this, bookmarks);
bookmarks.addPropertyChangeListener (bookmarksListener);
}
}
// Hookup the caret
Caret newCaret = component.getCaret();
if (newCaret != caret) {
if (caretListener != null) {
caret.removeChangeListener(caretListener);
caretListener = null;
}
caret = newCaret;
if (caret != null) {
caretListener = WeakListeners.change(this, caret);
caret.addChangeListener(caretListener);
}
}
lastCurrentLineStartOffset = -1;
updateState();
}
示例15: RunScriptAction
import org.openide.util.WeakListeners; //导入方法依赖的package包/类
private RunScriptAction(Lookup context, JTextComponent editor, FileObject scriptOrFolder,
String name, String description) {
this();
this.context = context;
this.editor = editor;
this.storage = PersistentSnippetsSupport.create(context);
this.scriptFile = scriptOrFolder;
putValue(NAME, name);
if (scriptFile == null) {
putValue(SHORT_DESCRIPTION, Bundle.DESC_RunSavedScript());
putValue(SMALL_ICON, ImageUtilities.loadImageIcon(RESOURCE_ICON, false));
} else {
putValue(SHORT_DESCRIPTION, description);
}
if (storage == null) {
setEnabled(false);
return;
}
boolean enabled = true;
if (scriptOrFolder == null || scriptOrFolder.isFolder()) {
if (scriptOrFolder == null) {
popup = new JPopupMenu() {
@Override
public int getComponentCount() {
refresh();
return super.getComponentCount();
}
};
} else {
subMenu = new JMenu() {
@Override
public int getMenuComponentCount() {
refresh();
return super.getMenuComponentCount();
}
};
subMenu.setText(name);
subMenu.setToolTipText(description);
}
if (storage.getSavedClasses(null).isEmpty()) {
setEnabled(false);
}
invalidate();
if (scriptOrFolder != null) {
FileChangeListener fcl = WeakListeners.create(FileChangeListener.class, listen, scriptOrFolder);
scriptOrFolder.addFileChangeListener(fcl);
weakListen = fcl;
} else {
ChangeListener cl = WeakListeners.change(listen, storage);
storage.addChangeListener(cl);
weakListen = cl;
}
}
}