本文整理汇总了Java中org.openide.windows.TopComponent.getActionMap方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getActionMap方法的具体用法?Java TopComponent.getActionMap怎么用?Java TopComponent.getActionMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getActionMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Finds appropriate map to work with.
* @return map from lookup or from activated TopComponent, null no available
*/
private ActionMap map() {
if (result == null) {
TopComponent tc = TopComponent.getRegistry().getActivated();
if (tc != null) {
return tc.getActionMap();
}
} else {
for (ActionMap am : result.allInstances()) {
return am;
}
}
return null;
}
示例2: FindSupport
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private FindSupport(TopComponent tc) {
this.tc = tc;
bar = new FindBar(this);
ActionMap actionMap = tc.getActionMap();
CallbackSystemAction a = SystemAction.get(org.openide.actions.FindAction.class);
actionMap.put(a.getActionMapKey(), new FindAction(true));
actionMap.put(FIND_NEXT_ACTION, new FindAction(true));
actionMap.put(FIND_PREVIOUS_ACTION, new FindAction(false));
// Hack ensuring the same shortcuts as editor
JEditorPane pane = new JEditorPane();
for (Action action : pane.getEditorKitForContentType("text/x-java").getActions()) { // NOI18N
Object name = action.getValue(Action.NAME);
if (FIND_NEXT_ACTION.equals(name) || FIND_PREVIOUS_ACTION.equals(name)) {
reuseShortcut(action);
}
}
// PENDING the colors below should not be hardcoded
highlighterAll = new DefaultHighlighter.DefaultHighlightPainter(new Color(255,180,66));
highlighterCurrent = new DefaultHighlighter.DefaultHighlightPainter(new Color(176,197,227));
pattern = Pattern.compile("$^"); // NOI18N
}
示例3: someoneActivated
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private void someoneActivated() {
TopComponent win = TopComponent.getRegistry().getActivated();
if (LOG.isLoggable(Level.FINER)) {
String winId;
if (win == null) {
winId = "<null>";
} else {
String winName = win.getDisplayName();
if (winName == null) {
winName = win.getHtmlDisplayName();
}
if (winName == null) {
winName = win.getName();
}
if (winName != null) {
winName = '"' + winName + '"';
} else {
winName = "<noname>";
}
winId = winName + '(' + win.getClass().getName() + ')';
}
LOG.log(Level.FINER, "someoneActivated ({0})", winId);
}
if ((win == null) || (win instanceof CloneableEditorSupport.Pane)) {
return;
}
Object key = getActionMapKey();
ActionMap actionMap = win.getActionMap();
if ((actionMap.get(key) == null) && activatedOnWindows.add(win)) {
Action ls = getAction();
actionMap.put(key, ls);
win.putClientProperty(getMappedActionKey(),
new WeakReference<Action>(ls));
}
}
示例4: findActionFromActivatedTopComponentMap
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Finds paste action from currently activated TopComponent's action map. */
private static Action findActionFromActivatedTopComponentMap() {
TopComponent tc = TopComponent.getRegistry().getActivated();
if (tc != null) {
ActionMap map = tc.getActionMap();
return findActionFromMap(map);
}
return null;
}