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


Java ITextOperationTarget.canDoOperation方法代码示例

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


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

示例1: createContentAssistActionHandler

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
private ActionHandler createContentAssistActionHandler(
		final ITextOperationTarget textOperationTarget) {
	Action proposalAction = new Action() {
		@Override
		public void run() {
			if (textOperationTarget
					.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)
					&& getTextWidget().isFocusControl())
				textOperationTarget
						.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		}
	};
	proposalAction
			.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
	return new ActionHandler(proposalAction);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:17,代码来源:SpellcheckableMessageArea.java

示例2: run

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override
public void run() {
	try {
		// Move offset to the line of the annotation, if necessary
		IDocument document = getDocument();
		int annotationLine = ruler.getLineOfLastMouseButtonActivity();
		int annotationLineOffet = document.getLineOffset(annotationLine);
		Point currentSelection = textEditor.getInternalSourceViewer().getSelectedRange();
		int currentLine = document.getLineOfOffset(currentSelection.x);
		if (currentLine != annotationLine)
			textEditor.getInternalSourceViewer().setSelectedRange(annotationLineOffet, 0);
	
		// show QuickFix dialog
		ITextOperationTarget operation = (ITextOperationTarget) textEditor.getAdapter(ITextOperationTarget.class);
		final int opCode = ISourceViewer.QUICK_ASSIST;
		if (operation != null && operation.canDoOperation(opCode))
			operation.doOperation(opCode);
	} catch (BadLocationException e) {
		// Ignore -> do nothing
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:XtextMarkerRulerAction.java

示例3: runWithEvent

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override
public void runWithEvent(Event event) {
	if (fAnnotation instanceof OverrideIndicatorManager.OverrideIndicator) {
		((OverrideIndicatorManager.OverrideIndicator)fAnnotation).open();
		return;
	}

	if (fHasCorrection) {
		ITextOperationTarget operation= (ITextOperationTarget) fTextEditor.getAdapter(ITextOperationTarget.class);
		final int opCode= ISourceViewer.QUICK_ASSIST;
		if (operation != null && operation.canDoOperation(opCode)) {
			fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());
			operation.doOperation(opCode);
		}
		return;
	}

	super.run();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:JavaSelectAnnotationRulerAction.java

示例4: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:DwprofileToggleCommentHandler.java

示例5: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HyexpressionToggleCommentHandler.java

示例6: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HyvalidityformulaToggleCommentHandler.java

示例7: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HydatavalueToggleCommentHandler.java

示例8: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HymappingToggleCommentHandler.java

示例9: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HyconstraintsToggleCommentHandler.java

示例10: isEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override

public boolean isEnabled() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (activeEditor instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) {
		ITextOperationTarget operationTarget = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
		return (operationTarget != null && operationTarget.canDoOperation(ITextOperationTarget.PREFIX) && operationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
	}
	return false;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:11,代码来源:HymanifestToggleCommentHandler.java

示例11: execute

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISourceViewer viewer = null;

    Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl"); //$NON-NLS-1$
    if (activeFocusControl instanceof Control) {
        Control control = (Control) activeFocusControl;
        if (!control.isDisposed()) {
            viewer = (ISourceViewer) control.getData(ISourceViewer.class.getName());
        }
    }

    if (viewer == null) {
        IEditorPart editor = HandlerUtil.getActiveEditor(event);
        if (editor instanceof JsonEditor) {
            viewer = ((JsonEditor) editor).getProjectionViewer();
        }
    }

    if (viewer != null) {
        ITextOperationTarget operationTarget = viewer.getTextOperationTarget();
        if (operationTarget.canDoOperation(QUICK_OUTLINE)) {
            operationTarget.doOperation(QUICK_OUTLINE);
        }
    }

    return null;
}
 
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:29,代码来源:OpenQuickOutlineHandler.java

示例12: annotationDefaultSelected

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
@Override
public void annotationDefaultSelected(VerticalRulerEvent event) {
	Annotation annotation= event.getSelectedAnnotation();
	IAnnotationModel model= getAnnotationModel();

	if (isOverrideIndicator(annotation)) {
		((OverrideIndicatorManager.OverrideIndicator)annotation).open();
		return;
	}

	if (isBreakpoint(annotation))
		triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, event.getEvent());

	Position position= model.getPosition(annotation);
	if (position == null)
		return;

	if (isQuickFixTarget(annotation)) {
		ITextOperationTarget operation= (ITextOperationTarget) getTextEditor().getAdapter(ITextOperationTarget.class);
		final int opCode= ISourceViewer.QUICK_ASSIST;
		if (operation != null && operation.canDoOperation(opCode)) {
			getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
			operation.doOperation(opCode);
			return;
		}
	}

	// default:
	super.annotationDefaultSelected(event);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:JavaSelectMarkerRulerAction2.java

示例13: computeEnablement

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
private boolean computeEnablement(ITextEditor editor) {
	if (editor == null)
		return false;
	
	ITextOperationTarget target= (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
	if (target == null || ! target.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS))
		return false;
	
	IJavaProject javaProject = EditorUtility.getJavaProject(editor.getEditorInput());
	if (! fCategory.matches(javaProject))
		return false;
	
	ISelection selection= editor.getSelectionProvider().getSelection();
	return isValidSelection(selection);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:SpecificContentAssistAction.java

示例14: isTargetOperationEnabled

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
protected boolean isTargetOperationEnabled() {
	ITextEditor editor = getTextEditor();
	if(editor != null) {
		fOperationTarget = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
	}
	
	return fOperationTarget != null && 
		fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) && 
		fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX);
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:11,代码来源:ToggleCommentAction.java

示例15: execute

import org.eclipse.jface.text.ITextOperationTarget; //导入方法依赖的package包/类
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,代码行数:43,代码来源:DwprofileToggleCommentHandler.java


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