當前位置: 首頁>>代碼示例>>Java>>正文


Java TopComponent.getActionMap方法代碼示例

本文整理匯總了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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:PasteAction.java

示例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
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:FindSupport.java

示例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));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:ActionManager.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:PasteAction.java


注:本文中的org.openide.windows.TopComponent.getActionMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。