当前位置: 首页>>代码示例>>Java>>正文


Java ITextOperationTarget.STRIP_PREFIX属性代码示例

本文整理汇总了Java中org.eclipse.jface.text.ITextOperationTarget.STRIP_PREFIX属性的典型用法代码示例。如果您正苦于以下问题:Java ITextOperationTarget.STRIP_PREFIX属性的具体用法?Java ITextOperationTarget.STRIP_PREFIX怎么用?Java ITextOperationTarget.STRIP_PREFIX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jface.text.ITextOperationTarget的用法示例。


在下文中一共展示了ITextOperationTarget.STRIP_PREFIX属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

/**
 * Implementation of the <code>IAction</code> prototype. Checks if the selected
 * lines are all commented or not and uncomments/comments them respectively.
 */
public void run()
{
    if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
        return;

    ITextEditor editor = getTextEditor();
    if (editor == null)
        return;

    if (!validateEditorInputState())
        return;

    final int operationCode;
    if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
        operationCode = ITextOperationTarget.STRIP_PREFIX;
    else
        operationCode = ITextOperationTarget.PREFIX;

    Shell shell = editor.getSite().getShell();
    if (!fOperationTarget.canDoOperation(operationCode))
    {
        if (shell != null)
            MessageDialog.openError(shell, TLAEditorMessages.getString("ToggleComment.error.title"),
                    TLAEditorMessages.getString("ToggleComment.error.message"));
        return;
    }

    Display display = null;
    if (shell != null && !shell.isDisposed())
        display = shell.getDisplay();

    BusyIndicator.showWhile(display, new Runnable() {
        public void run()
        {
            fOperationTarget.doOperation(operationCode);
        }
    });
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:42,代码来源:ToggleCommentAction.java

示例2: run

/**
 * Implementation of the <code>IAction</code> prototype. Checks if the selected
 * lines are all commented or not and uncomments/comments them respectively.
 */
@Override
public void run() {
	if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
		return;

	ITextEditor editor= getTextEditor();
	if (editor == null)
		return;

	if (!validateEditorInputState())
		return;

	final int operationCode;
	if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
		operationCode= ITextOperationTarget.STRIP_PREFIX;
	else
		operationCode= ITextOperationTarget.PREFIX;

	Shell shell= editor.getSite().getShell();
	if (!fOperationTarget.canDoOperation(operationCode)) {
		if (shell != null)
			MessageDialog.openError(shell, Messages.ToggleSLCommentAction_0, Messages.ToggleSLCommentAction_1); 
		return;
	}

	Display display= null;
	if (shell != null && !shell.isDisposed())
		display= shell.getDisplay();

	BusyIndicator.showWhile(display, new Runnable() {
		public void run() {
			fOperationTarget.doOperation(operationCode);
		}
	});
}
 
开发者ID:cplutte,项目名称:bts,代码行数:39,代码来源:ToggleSLCommentAction.java

示例3: run

/**
 * Implementation of the <code>IAction</code> prototype. Checks if the
 * selected lines are all commented or not and uncomments/comments them
 * respectively.
 */
public void run()
{
    if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null) return;
    ITextEditor editor = getTextEditor();
    if (editor == null) return;
    if (!validateEditorInputState()) return;
    final int operationCode;
    if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
        operationCode = ITextOperationTarget.STRIP_PREFIX;
    else
        operationCode = ITextOperationTarget.PREFIX;
    Shell shell = editor.getSite().getShell();
    if (!fOperationTarget.canDoOperation(operationCode))
    {
        if (shell != null)
        // MessageDialog.openError(shell,
            // JavaEditorMessages.getString("ToggleComment.error.title"),
            // JavaEditorMessages.getString("ToggleComment.error.message"));
            // //$NON-NLS-1$ //$NON-NLS-2$
            return;
    }
    Display display = null;
    if (shell != null && !shell.isDisposed()) display = shell.getDisplay();
    BusyIndicator.showWhile(display, new Runnable() {

        public void run()
        {
            fOperationTarget.doOperation(operationCode);
        }
    });
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:36,代码来源:ToggleCommentAction.java

示例4: run

/**
 * Implementation of the <code>IAction</code> prototype. Checks if the selected
 * lines are all commented or not and uncomments/comments them respectively.
 */
@Override
public void run() {
	if (fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
		return;

	ITextEditor editor= getTextEditor();
	if (editor == null)
		return;

	if (!validateEditorInputState())
		return;

	final int operationCode;
	if (isSelectionCommented(editor.getSelectionProvider().getSelection()))
		operationCode= ITextOperationTarget.STRIP_PREFIX;
	else
		operationCode= ITextOperationTarget.PREFIX;

	Shell shell= editor.getSite().getShell();
	if (!fOperationTarget.canDoOperation(operationCode)) {
		if (shell != null)
			MessageDialog.openError(shell, JavaEditorMessages.ToggleComment_error_title, JavaEditorMessages.ToggleComment_error_message);
		return;
	}

	Display display= null;
	if (shell != null && !shell.isDisposed())
		display= shell.getDisplay();

	BusyIndicator.showWhile(display, new Runnable() {
		public void run() {
			fOperationTarget.doOperation(operationCode);
		}
	});
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:ToggleCommentAction.java

示例5: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor editor = null;
	
	if (editorPart instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) {
		editor = (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:DwprofileToggleCommentHandler.java

示例6: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) {
		editor = (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HyexpressionToggleCommentHandler.java

示例7: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) {
		editor = (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HyvalidityformulaToggleCommentHandler.java

示例8: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) {
		editor = (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HydatavalueToggleCommentHandler.java

示例9: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) {
		editor = (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HymappingToggleCommentHandler.java

示例10: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) {
		editor = (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HyconstraintsToggleCommentHandler.java

示例11: execute

public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
	eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor editor = null;
	
	if (editorPart instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) {
		editor = (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) editorPart;
		operationTarget = (ITextOperationTarget) editorPart.getAdapter(ITextOperationTarget.class);
		document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
	}
	if (editor == null || operationTarget == null || document == null) {
		return null;
	}
	
	prefixesMap = new LinkedHashMap<String, String[]>();
	prefixesMap.put(IDocument.DEFAULT_CONTENT_TYPE, COMMENT_PREFIXES);
	
	ISelection currentSelection = editor.getSelectionProvider().getSelection();
	final int operationCode;
	if (isSelectionCommented(currentSelection)) {
		operationCode = ITextOperationTarget.STRIP_PREFIX;
	} else {
		operationCode = ITextOperationTarget.PREFIX;
	}
	
	if (!operationTarget.canDoOperation(operationCode)) {
		return null;
	}
	
	Shell shell = editorPart.getSite().getShell();
	Display display = null;
	if (shell != null && !shell.isDisposed()) {
		display = shell.getDisplay();
	}
	
	BusyIndicator.showWhile(display, new  Runnable() {
		public void run() {
			operationTarget.doOperation(operationCode);
		}
	});
	
	return null;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:42,代码来源:HymanifestToggleCommentHandler.java


注:本文中的org.eclipse.jface.text.ITextOperationTarget.STRIP_PREFIX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。