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


Java ITextEditorExtension类代码示例

本文整理汇总了Java中org.eclipse.ui.texteditor.ITextEditorExtension的典型用法代码示例。如果您正苦于以下问题:Java ITextEditorExtension类的具体用法?Java ITextEditorExtension怎么用?Java ITextEditorExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: canModifyEditor

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
private boolean canModifyEditor(ITextEditor editor)
{
	if (editor instanceof ITextEditorExtension2)
	{
		return ((ITextEditorExtension2) editor).isEditorInputModifiable();
	}
	else if (editor instanceof ITextEditorExtension)
	{
		return !((ITextEditorExtension) editor).isEditorInputReadOnly();
	}
	else if (editor != null)
	{
		return editor.isEditable();
	}
	return false;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:17,代码来源:ExpandSnippetVerifyKeyListener.java

示例2: setActiveEditor

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
@Override
public void setActiveEditor(IEditorPart part) {
	super.setActiveEditor(part);
	if (part instanceof ITextEditor) {
		ITextEditor textEditor = (ITextEditor) part;
		if (commandsMenuContributionItem != null) {
			commandsMenuContributionItem.setTextEditor(textEditor);
		}

		if (inputPositionStatsContributionItem != null) {
			inputPositionStatsContributionItem.setActionHandler(getAction(textEditor, ITextEditorActionConstants.GOTO_LINE));
			ITextEditorExtension extension = (ITextEditorExtension) textEditor;
			extension.setStatusField(inputPositionStatsContributionItem, ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
		}

		if (part instanceof AbstractThemeableEditor) {
			FoldingActionsGroup foldingActions = ((AbstractThemeableEditor) part).getFoldingActionsGroup();
			if (foldingActions != null) {
				foldingActions.updateActionBars();
			}
		}
		markOccurrencesAction.setEditor(textEditor);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:25,代码来源:CommonTextEditorActionContributor.java

示例3: canModifyEditor

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
/**
 * @return true if the contents of the editor may be changed. Clients MUST call this before actually
 * modifying the editor.
 */
public static boolean canModifyEditor(ITextEditor editor) {

    if (editor instanceof ITextEditorExtension2) {
        return ((ITextEditorExtension2) editor).isEditorInputModifiable();

    } else if (editor instanceof ITextEditorExtension) {
        return !((ITextEditorExtension) editor).isEditorInputReadOnly();

    } else if (editor != null) {
        return editor.isEditable();

    }

    //If we don't have the editor, let's just say it's ok (working on document).
    return true;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:21,代码来源:BaseAction.java

示例4: getEditable

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
/**
 * Eclipse forces us to check this ourselves
 * 
 * @return true if the editor is modifiable
 */
private boolean getEditable() {
	boolean result = false;
	ITextEditor editor= getThisEditor();
	if (editor != null) {
		if (editor instanceof ITextEditorExtension2)
			result = ((ITextEditorExtension2) editor).isEditorInputModifiable();
		else if (editor instanceof ITextEditorExtension)
			result = !((ITextEditorExtension) editor).isEditorInputReadOnly();
		else 
			result = editor.isEditable();
	} 
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:19,代码来源:EmacsPlusCmdHandler.java

示例5: findJavaAnnotation

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
private void findJavaAnnotation() {
	fPosition= null;
	fAnnotation= null;
	fHasCorrection= false;

	AbstractMarkerAnnotationModel model= getAnnotationModel();
	IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();

	IDocument document= getDocument();
	if (model == null)
		return ;

	boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);

	Iterator<Annotation> iter= model.getAnnotationIterator();
	int layer= Integer.MIN_VALUE;

	while (iter.hasNext()) {
		Annotation annotation= iter.next();
		if (annotation.isMarkedDeleted())
			continue;

		int annotationLayer= layer;
		if (annotationAccess != null) {
			annotationLayer= annotationAccess.getLayer(annotation);
			if (annotationLayer < layer)
				continue;
		}

		Position position= model.getPosition(annotation);
		if (!includesRulerLine(position, document))
			continue;

		AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
		if (preference == null)
			continue;

		String key= preference.getVerticalRulerPreferenceKey();
		if (key == null)
			continue;

		if (!fStore.getBoolean(key))
			continue;

		boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
		if (!isReadOnly
				&& (
					((hasAssistLightbulb && annotation instanceof AssistAnnotation)
					|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
			fPosition= position;
			fAnnotation= annotation;
			fHasCorrection= true;
			layer= annotationLayer;
			continue;
		} else if (!fHasCorrection) {
				fPosition= position;
				fAnnotation= annotation;
				layer= annotationLayer;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:JavaSelectAnnotationRulerAction.java

示例6: findJavaAnnotation

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
private void findJavaAnnotation() {
	fPosition= null;
	fAnnotation= null;
	fHasCorrection= false;

	AbstractMarkerAnnotationModel model= getAnnotationModel();
	IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();

	IDocument document= getDocument();
	if (model == null)
		return ;

	boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);

	Iterator<Annotation> iter= model.getAnnotationIterator();
	int layer= Integer.MIN_VALUE;

	while (iter.hasNext()) {
		Annotation annotation= iter.next();
		if (annotation.isMarkedDeleted())
			continue;

		int annotationLayer= layer;
		if (annotationAccess != null) {
			annotationLayer= annotationAccess.getLayer(annotation);
			if (annotationLayer < layer)
				continue;
		}

		Position position= model.getPosition(annotation);
		if (!includesRulerLine(position, document))
			continue;

		boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
		if (!isReadOnly
				&& (
					((hasAssistLightbulb && annotation instanceof AssistAnnotation)
					|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
			fPosition= position;
			fAnnotation= annotation;
			fHasCorrection= true;
			layer= annotationLayer;
			continue;
		} else if (!fHasCorrection) {
			AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
			if (preference == null)
				continue;

			String key= preference.getVerticalRulerPreferenceKey();
			if (key == null)
				continue;

			if (fStore.getBoolean(key)) {
				fPosition= position;
				fAnnotation= annotation;
				layer= annotationLayer;
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:61,代码来源:JavaSelectAnnotationRulerAction.java

示例7: canModifyEditor

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
/**
 * Checks the editor's modifiable state. Returns <code>true</code> if the editor can be modified,
 * taking in account the possible editor extensions.
 *
 * <p>If the editor implements <code>ITextEditorExtension2</code>,
 * this method returns {@link ITextEditorExtension2#isEditorInputModifiable()};<br> else if the editor
 * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br>
 * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p>
 *
 * <p>There is only a difference to {@link #validateEditorInputState()} if the editor implements
 * <code>ITextEditorExtension2</code>.</p>
 *
 * @return <code>true</code> if a modifying action should be enabled, <code>false</code> otherwise
 * @since 3.0
 */
protected boolean canModifyEditor() {
	ITextEditor editor= getTextEditor();
	if (editor instanceof ITextEditorExtension2)
		return ((ITextEditorExtension2) editor).isEditorInputModifiable();
	else if (editor instanceof ITextEditorExtension)
		return !((ITextEditorExtension) editor).isEditorInputReadOnly();
	else if (editor != null)
		return editor.isEditable();
	else
		return false;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:27,代码来源:TextEditorAction_Adapter.java

示例8: validateEditorInputState

import org.eclipse.ui.texteditor.ITextEditorExtension; //导入依赖的package包/类
/**
 * Checks and validates the editor's modifiable state. Returns <code>true</code> if an action
 * can proceed modifying the editor's input, <code>false</code> if it should not.
 *
 * <p>If the editor implements <code>ITextEditorExtension2</code>,
 * this method returns {@link ITextEditorExtension2#validateEditorInputState()};<br> else if the editor
 * implements <code>ITextEditorExtension</code>, it returns {@link ITextEditorExtension#isEditorInputReadOnly()};<br>
 * else, {@link ITextEditor#isEditable()} is returned, or <code>false</code> if the editor is <code>null</code>.</p>
 *
 * <p>There is only a difference to {@link #canModifyEditor()} if the editor implements
 * <code>ITextEditorExtension2</code>.</p>
 *
 * @return <code>true</code> if a modifying action can proceed to modify the underlying document, <code>false</code> otherwise
 * @since 3.0
 */
protected boolean validateEditorInputState() {
	ITextEditor editor= getTextEditor();
	if (editor instanceof ITextEditorExtension2)
		return ((ITextEditorExtension2) editor).validateEditorInputState();
	else if (editor instanceof ITextEditorExtension)
		return !((ITextEditorExtension) editor).isEditorInputReadOnly();
	else if (editor != null)
		return editor.isEditable();
	else
		return false;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:27,代码来源:TextEditorAction_Adapter.java


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