本文整理汇总了Java中org.openide.util.WeakSet类的典型用法代码示例。如果您正苦于以下问题:Java WeakSet类的具体用法?Java WeakSet怎么用?Java WeakSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WeakSet类属于org.openide.util包,在下文中一共展示了WeakSet类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PresenterUpdater
import org.openide.util.WeakSet; //导入依赖的package包/类
private PresenterUpdater(int type, Action action) {
if (action == null) {
throw new IllegalArgumentException("action must not be null"); // NOI18N
}
this.type = type;
this.actionName = (String) action.getValue(Action.NAME);
this.action = action;
if (type == TOOLBAR) {
presenter = new JButton();
useActionSelectedProperty = false;
} else { // MENU or POPUP
useActionSelectedProperty = (action.getValue(AbstractEditorAction.PREFERENCES_KEY_KEY) != null);
if (useActionSelectedProperty) {
presenter = new LazyJCheckBoxMenuItem();
presenter.setSelected(isActionSelected());
} else {
presenter = new LazyJMenuItem();
}
}
action.addPropertyChangeListener(WeakListeners.propertyChange(this, action));
if (type == MENU) {
listenedContextActions = new WeakSet<Action>();
EditorRegistryWatcher.get().registerPresenterUpdater(this); // Includes notification of active component
} else {
listenedContextActions = null;
}
presenter.addActionListener(this);
updatePresenter(null); // Not active yet => mark updates pending
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:PresenterUpdater.java
示例2: annotate
import org.openide.util.WeakSet; //导入依赖的package包/类
private void annotate (final FileObject fo) {
synchronized (breakpointToAnnotations) {
for (Breakpoint breakpoint : DebuggerManager.getDebuggerManager().getBreakpoints()) {
if (isAnnotatable(breakpoint)) {
JPDABreakpoint b = (JPDABreakpoint) breakpoint;
int[] lines = getAnnotationLines(b, fo);
if (lines != null && lines.length > 0) {
removeAnnotations(b); // Remove any staled breakpoint annotations
breakpointToAnnotations.put(b, new WeakSet<Annotation>());
if (b instanceof LineBreakpoint) {
LineBreakpoint lb = (LineBreakpoint) b;
LineTranslations.getTranslations().unregisterFromLineUpdates(lb); // To be sure
LineTranslations.getTranslations().registerForLineUpdates(lb);
}
addAnnotationTo(b, fo, lines);
}
}
}
annotatedFiles.add(fo);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:BreakpointAnnotationProvider.java
示例3: setScope
import org.openide.util.WeakSet; //导入依赖的package包/类
@Override
public void setScope(TaskScanningScope scope, Callback callback) {
cancelAllCurrent();
if (scope == null || callback == null)
return ;
final Set<FileObject> files = new WeakSet<FileObject>();
for (FileObject file : scope.getLookup().lookupAll(FileObject.class)) {
files.add(file);
}
for (Project p : scope.getLookup().lookupAll(Project.class)) {
for (SourceGroup javaSG : ProjectUtils.getSources(p).getSourceGroups("java")) { //NOI18N
files.add(javaSG.getRootFolder());
}
}
for (FileObject fo : files) {
enqueue(new Work(fo, callback));
}
synchronized (this) {
currentFiles = files;
currentCallback = callback;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:WhiteListTaskProvider.java
示例4: unregisterAgent
import org.openide.util.WeakSet; //导入依赖的package包/类
static void unregisterAgent(NbInstrumentation instr) {
synchronized (LOCK) {
if (ACTIVE != null) {
Collection<NbInstrumentation> clone = new WeakSet<NbInstrumentation>(ACTIVE);
clone.remove(instr);
ACTIVE = clone;
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:NbInstrumentation.java
示例5: HudsonRemoteFileSystem
import org.openide.util.WeakSet; //导入依赖的package包/类
private HudsonRemoteFileSystem(URL baseURL, String displayName, HudsonJob job) {
this.baseURL = baseURL;
this.displayName = displayName;
this.job = job;
attr = this;
change = this;
list = this;
info = this;
synchronized (Mapper.class) {
if (Mapper.workspaces == null) {
Mapper.workspaces = new WeakSet<HudsonRemoteFileSystem>();
}
Mapper.workspaces.add(this);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HudsonRemoteFileSystem.java
示例6: registerAction
import org.openide.util.WeakSet; //导入依赖的package包/类
public void registerAction(String command, Action action) {
synchronized (this) {
Set<Action> commandActions = actions.get(command);
if (commandActions == null) {
commandActions = new WeakSet<Action>();
actions.put(command, commandActions);
}
commandActions.add(action);
}
Object shorcut = getShortcut(command);
if (shorcut != null) {
action.putValue(Action.ACCELERATOR_KEY, shorcut);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ShortcutManager.java
示例7: refreshAnnotation
import org.openide.util.WeakSet; //导入依赖的package包/类
private void refreshAnnotation(JPDABreakpoint b) {
removeAnnotations(b);
if (remove) {
if (!add) {
breakpointToAnnotations.remove(b);
}
}
if (add) {
breakpointToAnnotations.put(b, new WeakSet<Annotation>());
for (FileObject fo : annotatedFiles) {
addAnnotationTo(b, fo);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:BreakpointAnnotationProvider.java
示例8: setExpanded
import org.openide.util.WeakSet; //导入依赖的package包/类
public synchronized void setExpanded(Object child) {
if (currentChildren == null) throw new NullPointerException("Call setChildrenToActOn() before!!!");
try {
Set<Object> expanded = expandedNodes.get(currentChildren);
if (expanded == null) {
expanded = new WeakSet<Object>();
expandedNodes.put(currentChildren, expanded);
}
expanded.add(child);
} finally {
currentChildren = null;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DefaultTreeExpansionManager.java
示例9: getFilesWithAttachedErrors
import org.openide.util.WeakSet; //导入依赖的package包/类
private static Set<FileObject> getFilesWithAttachedErrors(FileObject root) {
synchronized (root2FilesWithAttachedErrors) {
Set<FileObject> result = root2FilesWithAttachedErrors.get(root);
if (result == null) {
root2FilesWithAttachedErrors.put(root, result = new WeakSet<FileObject>());
}
return result;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:WhiteListTaskProvider.java
示例10: lookup
import org.openide.util.WeakSet; //导入依赖的package包/类
public <T> Result<T> lookup(Template<T> template) {
ProxyResult<T> p = new ProxyResult<T>(template);
synchronized (this) {
if (results == null) {
results = new WeakSet<ProxyResult>();
}
results.add(p);
}
return p;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:FilterNode.java
示例11: getFilesWithAttachedErrors
import org.openide.util.WeakSet; //导入依赖的package包/类
private static Set<FileObject> getFilesWithAttachedErrors(FileObject root) {
Set<FileObject> result = root2FilesWithAttachedErrors.get(root);
if (result == null) {
root2FilesWithAttachedErrors.put(root, result = new WeakSet<FileObject>());
}
return result;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TaskProvider.java
示例12: registerListener
import org.openide.util.WeakSet; //导入依赖的package包/类
public final void registerListener(Object key, GeneralAction.BaseDelAction a) {
if (key == null) {
return;
}
synchronized (CACHE) {
Set<GeneralAction.BaseDelAction> existing = listeners.get(key);
if (existing == null) {
existing = new WeakSet<GeneralAction.BaseDelAction>();
listeners.put(key, existing);
}
existing.add(a);
a.updateState(new ActionMap(), actionMap.get(), false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:GlobalManager.java
示例13: getToolbarPresenter
import org.openide.util.WeakSet; //导入依赖的package包/类
public AbstractButton getToolbarPresenter() {
if(toolbarItems == null) {
toolbarItems = new WeakSet<AbstractButton>(4);
}
AbstractButton b = new DefaultIconToggleButton();
toolbarItems.add(b);
b.setSelected(isPreferencesSelected());
Actions.connect(b, this);
return b;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:AlwaysEnabledAction.java
示例14: registerNodeWithPropertiesWindow
import org.openide.util.WeakSet; //导入依赖的package包/类
void registerNodeWithPropertiesWindow(FormNode node) {
if (nodesWithPropertiesWindows == null) {
nodesWithPropertiesWindows = new WeakSet<FormNode>();
}
nodesWithPropertiesWindows.add(node);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:FormEditor.java
示例15: main
import org.openide.util.WeakSet; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
Set s = new WeakSet();
s.add("hello");
System.out.println("A WeakSet from lib1.jar: " + s);
System.out.println("A NullInputStream.available from lib2.jar: " + new NullInputStream().available());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MyApp.java
示例16: addAttachHistorySupport
import org.openide.util.WeakSet; //导入依赖的package包/类
private static synchronized void addAttachHistorySupport(AttachHistorySupport support) {
if (ahs == null) {
ahs = new WeakSet<AttachHistorySupport>();
}
ahs.add(support);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:DebugMainProjectAction.java
示例17: RefreshAction
import org.openide.util.WeakSet; //导入依赖的package包/类
private RefreshAction(List<Refreshable> nodes) {
super(NbBundle.getMessage(Actions.class, "CTL_Refresh"));
putValue(ACCELERATOR_KEY, REFRESH_KEY);
this.nodes = new WeakSet<Refreshable>(nodes);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:Actions.java
示例18: QueryAction
import org.openide.util.WeakSet; //导入依赖的package包/类
public QueryAction(String name, QueryNode... queryNodes) {
super(name);
this.queryNodes = new WeakSet<QueryNode>(Arrays.asList(queryNodes));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:QueryAction.java
示例19: addChangeListener
import org.openide.util.WeakSet; //导入依赖的package包/类
public synchronized void addChangeListener(URL source, ChangeListener l) {
String ext = source.toExternalForm();
listener2File.put(l, ext);
Set<ChangeListener> ls = file2Listener.get(ext);
if (ls == null) {
file2Listener.put(ext, ls = new WeakSet<ChangeListener>());
}
ls.add(l);
file2Listener.put(ext, ls);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ExecutableFilesIndex.java
注:本文中的org.openide.util.WeakSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论