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


Java TextAction類代碼示例

本文整理匯總了Java中javax.swing.text.TextAction的典型用法代碼示例。如果您正苦於以下問題:Java TextAction類的具體用法?Java TextAction怎麽用?Java TextAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TextAction類屬於javax.swing.text包,在下文中一共展示了TextAction類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFocusedComponent

import javax.swing.text.TextAction; //導入依賴的package包/類
/**
 * Fetches the text component that currently has focus. It delegates to 
 * TextAction.getFocusedComponent().
 * @return the component
 */
public static JTextComponent getFocusedComponent() {
    /** Fake action for getting the focused component */
    class FocusedComponentAction extends TextAction {
        
        FocusedComponentAction() {
            super("focused-component"); // NOI18N
        }
        
        /** adding this method because of protected final getFocusedComponent */
        JTextComponent getFocusedComponent2() {
            return getFocusedComponent();
        }
        
        public @Override void actionPerformed(ActionEvent evt){}
    }
    
    if (focusedComponentAction == null) {
        focusedComponentAction = new FocusedComponentAction();
    }
    
    return ((FocusedComponentAction)focusedComponentAction).getFocusedComponent2();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:Utilities.java

示例2: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
protected @Override Action[] createActions() {
    Action[] myActions = new Action[] {
        new BraceCompletionInsertAction (),
        new BraceCompletionDeleteAction (),
        //new IndentAction (),
        new InstantRenameAction(),
        new LanguagesGenerateFoldPopupAction (),
        new org.netbeans.modules.languages.features.ToggleCommentAction(),
        new org.netbeans.modules.languages.features.CodeCommentAction(),
        new org.netbeans.modules.languages.features.CodeUncommentAction()
    };
    return TextAction.augmentList (
        super.createActions (), 
        myActions
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:LanguagesEditorKit.java

示例3: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[] superActions = super.createActions();

    StandardCommenter commenter = new StandardCommenter(LINE_COMMENT_FORMAT, BLOCK_COMMENT_FORMAT);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedCommentAction commentAction = new ExtendedCommentAction(commenter);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedUncommentAction uncommentAction = new ExtendedUncommentAction(commenter);

    Action[] actions = {
        new ToggleLegacyModeAction(),
        new GrammarGoToDeclarationAction(),
    };

    actions = TextAction.augmentList(superActions, actions);
    for (int i = 0; i < actions.length; i++) {
        if (actions[i] instanceof CommentAction) {
            actions[i] = commentAction;
        } else if (actions[i] instanceof UncommentAction) {
            actions[i] = uncommentAction;
        }
    }

    return actions;
}
 
開發者ID:tunnelvisionlabs,項目名稱:goworks,代碼行數:27,代碼來源:GrammarEditorKit.java

示例4: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[] superActions = super.createActions();

    Commenter commenter = new StandardCommenter(LINE_COMMENT_FORMAT, OUTER_BLOCK_COMMENT_FORMAT, INNER_BLOCK_COMMENT_FORMAT);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedCommentAction commentAction = new ExtendedCommentAction(commenter);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedUncommentAction uncommentAction = new ExtendedUncommentAction(commenter);

    Action[] extraActions = {
    };

    Action[] actions = TextAction.augmentList(superActions, extraActions);
    for (int i = 0; i < actions.length; i++) {
        if (actions[i] instanceof CommentAction) {
            actions[i] = commentAction;
        } else if (actions[i] instanceof UncommentAction) {
            actions[i] = uncommentAction;
        }
    }

    return actions;
}
 
開發者ID:tunnelvisionlabs,項目名稱:goworks,代碼行數:25,代碼來源:StringTemplateEditorKit.java

示例5: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[] superActions = super.createActions();

    StandardCommenter commenter = new StandardCommenter(LINE_COMMENT_FORMAT, BLOCK_COMMENT_FORMAT);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedCommentAction commentAction = new ExtendedCommentAction(commenter);
    @SuppressWarnings("LocalVariableHidesMemberVariable")
    ExtendedUncommentAction uncommentAction = new ExtendedUncommentAction(commenter);

    Action[] actions = {
        new GoGoToDeclarationAction(),
    };

    actions = TextAction.augmentList(superActions, actions);
    for (int i = 0; i < actions.length; i++) {
        if (actions[i] instanceof CommentAction) {
            actions[i] = commentAction;
        } else if (actions[i] instanceof UncommentAction) {
            actions[i] = uncommentAction;
        }
    }

    return actions;
}
 
開發者ID:tunnelvisionlabs,項目名稱:goworks,代碼行數:26,代碼來源:GoEditorKit.java

示例6: getDeclaredActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] getDeclaredActions() {
    Action swa = new TextAction("") {
        @Override
        public void actionPerformed(ActionEvent evt) {
            selectWordCalled = true;
        }
    };
    swa.putValue(Action.NAME, BaseKit.selectWordAction);
    
    Action[] actions = new Action[] {
        swa
    };
    return TextAction.augmentList(super.createActions(), actions);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:BaseCaretTest.java

示例7: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
protected @Override Action[] createActions() {
        ArrayList<Action> actions = new ArrayList<Action>();

        actions.add(new ExtDefaultKeyTypedAction());
// XXX: remove
//        if (!ExtCaret.NO_HIGHLIGHT_BRACE_LAYER) {
//            actions.add(new MatchBraceAction(matchBraceAction, false));
//            actions.add(new MatchBraceAction(selectionMatchBraceAction, true));
//        }
        actions.add(new CommentAction()); // to make ctrl-shift-T in Netbeans55 profile work
        actions.add(new UncommentAction()); // to make ctrl-shift-D in Netbeans55 profile work
                
        return TextAction.augmentList(super.createActions(), actions.toArray(new Action[actions.size()]));
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ExtKit.java

示例8: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[] superActions = super.createActions();
    Language language = LanguageRegistry.getInstance().getLanguageByMimeType(mimeType);
    ArrayList<Action> actions = new ArrayList<Action>(30);

    actions.add(new GsfDefaultKeyTypedAction());
    actions.add(new GsfInsertBreakAction());
    actions.add(new GsfDeleteCharAction(deletePrevCharAction, false));
    
    // The php needs to handle special cases of toggle comment. There has to be 
    // registered ToggleBlockCommentAction in PHP that handles these special cases,
    // but the current way, how the actions are registered, doesn't allow to overwrite the action
    // registered here.
    // See issue #204616. This hack can be removed, when issue #204616 will be done.
    if (!mimeType.equals("text/x-php5")) {
        actions.add(new ToggleBlockCommentAction());
    }
    actions.add(new GenerateFoldPopupAction());
    actions.add(new InstantRenameAction());
    actions.add(CslActions.createGoToDeclarationAction());
    actions.add(new GenericGenerateGoToPopupAction());
    actions.add(new SelectCodeElementAction(SelectCodeElementAction.selectNextElementAction, true));
    actions.add(new SelectCodeElementAction(SelectCodeElementAction.selectPreviousElementAction, false));

    if (language == null) {
        LOG.log(Level.WARNING, "Language missing for MIME type {0}", mimeType);
    } else if (language.hasOccurrencesFinder()) {
        actions.add(new GoToMarkOccurrencesAction(false));
        actions.add(new GoToMarkOccurrencesAction(true));
    }

    return TextAction.augmentList(superActions,
        actions.toArray(new Action[actions.size()]));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:CslEditorKit.java

示例9: createActionEvent

import javax.swing.text.TextAction; //導入依賴的package包/類
private static ActionEvent createActionEvent (Action action) {
    Object evSource = null;
    int evId = ActionEvent.ACTION_PERFORMED;

    // text (editor) actions
    if (action instanceof TextAction) {
        EditorCookie ec = Utilities.actionsGlobalContext().lookup(EditorCookie.class);
        if (ec == null) {
            return null;
        }

        JEditorPane[] editorPanes = ec.getOpenedPanes();
        if (editorPanes == null || editorPanes.length <= 0) {
            return null;
        }
        evSource = editorPanes[0];
    }

    if (evSource == null) {
        evSource = TopComponent.getRegistry().getActivated();
    }
    if (evSource == null) {
        evSource = WindowManager.getDefault().getMainWindow();
    }

    
    return new ActionEvent(evSource, evId, null);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ActionsSearchProvider.java

示例10: getName

import javax.swing.text.TextAction; //導入依賴的package包/類
private static String getName (Object action) {
    if (action instanceof TextAction)
        return (String) ((TextAction) action).getValue (Action.SHORT_DESCRIPTION);
    if (action instanceof Action)
        return (String) ((Action) action).getValue (Action.NAME);
    return action.toString ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:KeymapViewModelTest.java

示例11: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[]  actions = new Action[] {
        new ToggleCommentAction("#"), //NOI18N
    };
    return TextAction.augmentList(super.createActions(), actions);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:PropertiesKit.java

示例12: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
/**
 * Provide XML related actions.
 */
protected @Override Action[] createActions() {
    Action[] actions = new Action[] {
        new XMLCommentAction(),
        new XMLUncommentAction(),
        new ToggleBlockCommentAction(new XmlCommentHandler()),
        new TestAction(),
    };
    return TextAction.augmentList(super.createActions(), actions);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:XMLKit.java

示例13: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
@Override
protected Action[] createActions() {
    Action[] HtmlActions = new Action[]{
        CslActions.createSelectCodeElementAction(true),
        CslActions.createSelectCodeElementAction(false),
        CslActions.createInstantRenameAction(),
        CslActions.createToggleBlockCommentAction(),
        new ExtKit.CommentAction(""), //NOI18N
        new ExtKit.UncommentAction(""), //NOI18N
        CslActions.createGoToMarkOccurrencesAction(false),
        CslActions.createGoToMarkOccurrencesAction(true),
        CslActions.createGoToDeclarationAction()
    };
    return TextAction.augmentList(super.createActions(), HtmlActions);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:HtmlKit.java

示例14: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
protected Action[] createActions() {
    Action[] javaActions = new Action[] {
                               new JavaDefaultKeyTypedAction(),
                               new PrefixMakerAction(makeGetterAction, "get", getSetIsPrefixes), // NOI18N
                               new PrefixMakerAction(makeSetterAction, "set", getSetIsPrefixes), // NOI18N
                               new PrefixMakerAction(makeIsAction, "is", getSetIsPrefixes), // NOI18N
                               new AbbrevDebugLineAction(),
                           };
    return TextAction.augmentList(super.createActions(), javaActions);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:JavaKit.java

示例15: createActions

import javax.swing.text.TextAction; //導入依賴的package包/類
protected @Override Action[] createActions() {
        Action[] nbEditorActions = new Action[] {
                                       nbUndoActionDef,
                                       nbRedoActionDef,
                                       new GenerateFoldPopupAction(),
                                       new NavigationHistoryBackAction(),
                                       new NavigationHistoryForwardAction(),
//                                       new ToggleToolbarAction(),
//                                       new NbToggleLineNumbersAction(),
                                       new NbGenerateGoToPopupAction(),
                                   };
        return TextAction.augmentList(super.createActions(), nbEditorActions);
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:NbEditorKit.java


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