Java 类org.eclipse.ui.texteditor.ResourceAction 实例源码

项目:birt    文件:DecoratedScriptEditor.java   
protected void createActions( )
{
    super.createActions( );

    IAction contentAssistAction = new TextOperationAction( Messages.getReportResourceBundle( ),
            "ContentAssistProposal_", this, ISourceViewer.CONTENTASSIST_PROPOSALS, true );//$NON-NLS-1$

    IAction expandAll = new TextOperationAction( Messages.getReportResourceBundle( ),
            "JSEditor.Folding.ExpandAll.", this, ProjectionViewer.EXPAND_ALL, true ); //$NON-NLS-1$

    IAction collapseAll = new TextOperationAction( Messages.getReportResourceBundle( ),
            "JSEditor.Folding.CollapseAll.", this, ProjectionViewer.COLLAPSE_ALL, true ); //$NON-NLS-1$

    IAction collapseComments = new ResourceAction( Messages.getReportResourceBundle( ),
            "JSEditor.Folding.CollapseComments." ) { //$NON-NLS-1$

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.action.Action#run()
         */
        public void run( )
        {
            collapseStyle( ScriptProjectionAnnotation.SCRIPT_COMMENT );
        }
    };

    IAction collapseMethods = new ResourceAction( Messages.getReportResourceBundle( ),
            "JSEditor.Folding.CollapseMethods." ) { //$NON-NLS-1$

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.action.Action#run()
         */
        public void run( )
        {
            collapseStyle( ScriptProjectionAnnotation.SCRIPT_METHOD );
        }
    };

    contentAssistAction.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS );
    expandAll.setActionDefinitionId( IFoldingCommandIds.FOLDING_EXPAND_ALL );
    collapseAll.setActionDefinitionId( IFoldingCommandIds.FOLDING_COLLAPSE_ALL );

    setAction( "ContentAssistProposal", contentAssistAction );//$NON-NLS-1$
    setAction( "FoldingExpandAll", expandAll ); //$NON-NLS-1$
    setAction( "FoldingCollapseAll", collapseAll ); //$NON-NLS-1$
    setAction( "FoldingCollapseComments", collapseComments ); //$NON-NLS-1$
    setAction( "FoldingCollapseMethods", collapseMethods ); //$NON-NLS-1$
    setAction( ITextEditorActionConstants.SAVE, new TextSaveAction( this ) );
}