本文整理匯總了Java中org.openide.util.Utilities.actionsGlobalContext方法的典型用法代碼示例。如果您正苦於以下問題:Java Utilities.actionsGlobalContext方法的具體用法?Java Utilities.actionsGlobalContext怎麽用?Java Utilities.actionsGlobalContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.util.Utilities
的用法示例。
在下文中一共展示了Utilities.actionsGlobalContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPopupPresenter
import org.openide.util.Utilities; //導入方法依賴的package包/類
@Override
public JMenuItem getPopupPresenter() {
Lookup l = Utilities.actionsGlobalContext();
Collection<? extends MatchingObject> matchingObjects
= l.lookupAll(MatchingObject.class);
LinkedHashSet<Action> commonActions = new LinkedHashSet<Action>();
boolean first = true;
for (MatchingObject mo : matchingObjects) {
DataObject dob = mo.getDataObject();
if (dob != null) {
Node nodeDelegate = dob.getNodeDelegate();
Collection<Action> dobActions = Arrays.asList(
nodeDelegate.getActions(false));
if (first) {
commonActions.addAll(dobActions);
first = false;
} else {
commonActions.retainAll(dobActions);
}
}
}
return actionsToMenu(commonActions, l);
}
示例2: navigatorTCOpened
import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Starts listening to selected nodes and active component */
private void navigatorTCOpened() {
if (panelLookupNodesResult != null) {
return;
}
LOG.fine("Entering navigatorTCOpened");
Lookup globalContext = Utilities.actionsGlobalContext();
curNodesRes = globalContext.lookup(CUR_NODES);
curNodesRes.addLookupListener(this);
curHintsRes = globalContext.lookup(CUR_HINTS);
curHintsRes.addLookupListener(this);
panelLookupNodesResult = panelLookup.lookup(CUR_NODES);
panelLookupNodesResult.addLookupListener(panelLookupListener);
updateContext(globalContext.lookup(NavigatorLookupPanelsPolicy.class), globalContext.lookupAll(NavigatorLookupHint.class));
closed = false;
}
示例3: resultChanged
import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Invokes navigator data context change upon current nodes change or
* current navigator hints change,
* performs coalescing of fast coming changes.
*/
@Override
public void resultChanged(LookupEvent ev) {
if (!navigatorTC.getTopComponent().equals(WindowManager.getDefault().getRegistry().getActivated())
// #117089: allow node change when we are empty
|| (curNodes == null || curNodes.isEmpty())) {
Lookup globalContext = Utilities.actionsGlobalContext();
NavigatorLookupPanelsPolicy panelsPolicy = globalContext.lookup(NavigatorLookupPanelsPolicy.class);
Collection<? extends NavigatorLookupHint> lkpHints = globalContext.lookupAll(NavigatorLookupHint.class);
ActNodeSetter nodeSetter = new ActNodeSetter(panelsPolicy, lkpHints);
if (navigatorTC.allowAsyncUpdate()) {
synchronized (NODE_SETTER_LOCK) {
if (nodeSetterTask != null) {
nodeSetterTask.cancel();
}
// wait some time before propagating the change further
nodeSetterTask = RequestProcessor.getDefault().post(nodeSetter, COALESCE_TIME);
nodeSetterTask.addTaskListener(nodeSetter);
}
} else {
nodeSetter.run();
}
}
}
示例4: nodeDestroyed
import org.openide.util.Utilities; //導入方法依賴的package包/類
/****** NodeListener implementation *****/
public void nodeDestroyed(NodeEvent ev) {
LOG.fine("Node destroyed reaction...");
// #121944: don't react on node destroy when we are active
if (navigatorTC.getTopComponent().equals(WindowManager.getDefault().getRegistry().getActivated())) {
LOG.fine("NavigatorTC active, skipping node destroyed reaction.");
return;
}
LOG.fine("invokeLater on updateContext from node destroyed reaction...");
// #122257: update content later to fight possible deadlocks
Lookup globalContext = Utilities.actionsGlobalContext();
NavigatorLookupPanelsPolicy panelsPolicy = globalContext.lookup(NavigatorLookupPanelsPolicy.class);
Collection<? extends NavigatorLookupHint> lkpHints = globalContext.lookupAll(NavigatorLookupHint.class);
EventQueue.invokeLater(getUpdateRunnable(true, panelsPolicy, lkpHints));
}
示例5: setActive
import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Activates/passivates the listener.
*/
synchronized void setActive(boolean active) {
Lookup context = Utilities.actionsGlobalContext();
if (active) {
if (result == null) {
result = context.lookupResult(Node.class);
result.addLookupListener(this);
}
} else {
// result.removeLookupListener (this);
// result = null;
// Any saved PROP_ENABLED will be bogus now:
forget(true);
forget(false);
}
}
示例6: obtainProviders
import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
* Shortcut for test purposes
*
* @node Nodes collection context, may be empty.
*/
List<NavigatorPanel> obtainProviders(Collection<? extends Node> nodes) {
Lookup globalContext = Utilities.actionsGlobalContext();
NavigatorLookupPanelsPolicy panelsPolicy = globalContext.lookup(NavigatorLookupPanelsPolicy.class);
Collection<? extends NavigatorLookupHint> lkpHints = globalContext.lookupAll(NavigatorLookupHint.class);
return obtainProviders(nodes, panelsPolicy, lkpHints);
}
示例7: makeActive
import org.openide.util.Utilities; //導入方法依賴的package包/類
/**Specify when the TC is shown*/
void makeActive(boolean tcShown) {
boolean oldValue = this.tcShown;
this.tcShown = tcShown;
if (tcShown && tcShown != oldValue && updateWhenActivated) {
updateWhenActivated = false;
tcActivating = true;
Lookup globalContext = Utilities.actionsGlobalContext();
updateContext(globalContext.lookup(NavigatorLookupPanelsPolicy.class), globalContext.lookupAll(NavigatorLookupHint.class));
}
}
示例8: findFocusOwner
import org.openide.util.Utilities; //導入方法依賴的package包/類
public static Component findFocusOwner() {
if (focusOwner == null) {
Utilities.actionsGlobalContext();
if (focusOwner == null) {
// give up
setFocusOwner(null);
}
}
return focusOwner.get();
}
示例9: SearchScopeNodeSelection
import org.openide.util.Utilities; //導入方法依賴的package包/類
public SearchScopeNodeSelection() {
Lookup lookup = Utilities.actionsGlobalContext();
lookupResult = lookup.lookupResult(Node.class);
lookupListener = WeakListeners.create(LookupListener.class,
this,
lookupResult);
lookupResult.addLookupListener(lookupListener);
}
示例10: BaseDelAction
import org.openide.util.Utilities; //導入方法依賴的package包/類
protected BaseDelAction(Map map, Action fallback) {
this(
map,
map.get("key"), // NOI18N
Utilities.actionsGlobalContext(), // NOI18N
fallback, // NOI18N
Boolean.TRUE.equals(map.get("surviveFocusChange")), // NOI18N
Boolean.TRUE.equals(map.get("asynchronous")) // NOI18N
);
}
示例11: create
import org.openide.util.Utilities; //導入方法依賴的package包/類
public static Action create(Map<?,?> map) {
if (Boolean.TRUE.equals(map.get("redo"))) { // NOI18N
return new UndoRedoAction(Utilities.actionsGlobalContext(), false, true);
}
if (Boolean.TRUE.equals(map.get("undo"))) { // NOI18N
return new UndoRedoAction(Utilities.actionsGlobalContext(), true, true);
}
throw new IllegalStateException();
}
示例12: LogDevicesComboBoxSupport
import org.openide.util.Utilities; //導入方法依賴的package包/類
protected LogDevicesComboBoxSupport(LogReader reader) {
this.reader = reader;
// get notification for logged devices
reader.addPropertyChangeListener(WeakListeners.propertyChange(this, reader));
// get notifications for attached and detached devices
AndroidDebugBridge.addDeviceChangeListener(this);
Lookup lookup = Utilities.actionsGlobalContext();
deviceLookup = lookup.lookupResult(IDevice.class);
deviceLookup.addLookupListener(this);
update();
}
示例13: resolveContext
import org.openide.util.Utilities; //導入方法依賴的package包/類
private void resolveContext() {
if (context == null) {
context = Utilities.actionsGlobalContext();
}
}
示例14: SaveAsAction
import org.openide.util.Utilities; //導入方法依賴的package包/類
private SaveAsAction() {
this( Utilities.actionsGlobalContext(), true );
}
示例15: AnalyzeFolder
import org.openide.util.Utilities; //導入方法依賴的package包/類
public AnalyzeFolder() {
context = Utilities.actionsGlobalContext();
def = true;
putValue(NAME, NbBundle.getMessage(AnalyzeFolder.class, "CTL_AnalyzeFolder"));
}