类org.eclipse.ui.editors.text.IFoldingCommandIds源码实例Demo

下面列出了怎么用org.eclipse.ui.editors.text.IFoldingCommandIds的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: APICloud-Studio   文件: FoldingActionsGroup.java
/**
 * Constructs a new FoldingActionsGroup with a given text editor.
 * 
 * @param textEditor
 */
public FoldingActionsGroup(ITextEditor textEditor)
{
	// Initialize the actions.
	collapseAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.Collapse.", textEditor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$
	collapseAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE);
	textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE, collapseAction);

	expandAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.Expand.", textEditor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$
	expandAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND);
	textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND, expandAction);

	collapseAllAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.CollapseAll.", textEditor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$
	collapseAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
	textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE_ALL, collapseAllAction);

	expandAllAction = new TextOperationAction(Messages.getResourceBundle(),
			"Folding.ExpandAll.", textEditor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$
	expandAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
	textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND_ALL, expandAllAction);
}
 
@Override
public void contributeActions(XtextEditor xtextEditor) {
	foldingActionGroup = new FoldingActionGroup(xtextEditor, xtextEditor.getInternalSourceViewer()) {
		@Override
		protected TextEditorAction createToggleFoldingAction(ITextEditor editor) {
			TextEditorAction toggle = new ResourceActionExtension(FoldingMessages.getResourceBundle(),
					"Projection.Toggle.", editor, ProjectionViewer.TOGGLE);
			toggle.setChecked(true);
			toggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE);
			return toggle;
		}
	};
}
 
源代码3 项目: tlaplus   文件: FoldAllRegionsHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
       final TLAEditor editor = EditorUtil.getTLAEditorWithFocus();

	if (editor != null) {
		final TextOperationAction action = new TextOperationAction(RESOURCE_BUNDLE, "Projection.CollapseAll.", editor,
				ProjectionViewer.COLLAPSE_ALL, true);

		action.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
		action.run();
       }

       return null;
}
 
源代码4 项目: tlaplus   文件: ExpandAllRegionsHandler.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
       final TLAEditor editor = EditorUtil.getTLAEditorWithFocus();

	if (editor != null) {
		final TextOperationAction action = new TextOperationAction(RESOURCE_BUNDLE, "Projection.ExpandAll.", editor,
				ProjectionViewer.EXPAND_ALL, true);

		action.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
		action.run();
       }

       return null;
}
 
源代码5 项目: 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 ) );
}
 
 类所在包
 同包方法