• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JavaEditor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: showQuickAnnotations

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private void showQuickAnnotations(final JavaEditor editor) {
  InformationPresenter presenter = new InformationPresenter(new IInformationControlCreator() {
    public IInformationControl createInformationControl(Shell parent) {
      int shellStyle = SWT.RESIZE;
      int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
      return new QuickAnnotationInformationControl(parent, shellStyle, treeStyle, editor);
    }
  });

  IInformationProvider provider = new JavaElementProvider(editor, false);
  presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);

  presenter.install(editor.getViewer());
  presenter.install(editor.getViewer().getTextWidget());
  presenter.showInformation();
}
 
开发者ID:nblix,项目名称:overviewruler,代码行数:17,代码来源:OpenHandler.java


示例2: createActions

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * This adds the Open Declaration (F3) behavior to Java references inside JSNI
 * blocks.
 */
@Override
protected void createActions() {
  super.createActions();

  GWTOpenEditorActionGroup gwtOpenEditorActionGroup = new GWTOpenEditorActionGroup(
      this);

  try {
    // Replace the OpenEditorActionGroup from JavaEditor that contributes the
    // main menu items and keyboard binding
    replaceOpenEditorAction(fActionGroups, gwtOpenEditorActionGroup);

    // Also need to replace the OpenEditorActionGroup that contributes the
    // context menu items. This field is private, so we use reflection here.
    Field contextMenuField = JavaEditor.class.getDeclaredField("fContextMenuGroup");
    contextMenuField.setAccessible(true);
    CompositeActionGroup contextMenuGroup = (CompositeActionGroup) contextMenuField.get(this);
    replaceOpenEditorAction(contextMenuGroup, gwtOpenEditorActionGroup);

  } catch (Exception e) {
    GWTPluginLog.logError(e);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:28,代码来源:GWTJavaEditor.java


示例3: getHoverRegion

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
@Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
	if (!(getEditor() instanceof JavaEditor))
		return null;

	ITypeRoot je= getEditorInputJavaElement();
	if (je == null)
		return null;

	// Never wait for an AST in UI thread.
	CompilationUnit ast= SharedASTProvider.getAST(je, SharedASTProvider.WAIT_NO, null);
	if (ast == null)
		return null;

	ASTNode node= NodeFinder.perform(ast, offset, 1);
	if (node instanceof StringLiteral) {
		StringLiteral stringLiteral= (StringLiteral)node;
		return new Region(stringLiteral.getStartPosition(), stringLiteral.getLength());
	} else if (node instanceof SimpleName) {
		SimpleName simpleName= (SimpleName)node;
		return new Region(simpleName.getStartPosition(), simpleName.getLength());
	}

	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:NLSStringHover.java


示例4: createQuery

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
@Override
QuerySpecification createQuery(IJavaElement element) throws JavaModelException {
	JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
	JavaEditor editor= getEditor();

	IJavaSearchScope scope;
	String description;
	boolean isInsideJRE= true;
	if (editor != null) {
		scope= factory.createJavaProjectSearchScope(editor.getEditorInput(), isInsideJRE);
		description= factory.getProjectScopeDescription(editor.getEditorInput(), isInsideJRE);
	} else {
		scope= factory.createJavaProjectSearchScope(element.getJavaProject(), isInsideJRE);
		description=  factory.getProjectScopeDescription(element.getJavaProject(), isInsideJRE);
	}
	return new ElementQuerySpecification(element, getLimitTo(), scope, description);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:FindDeclarationsInProjectAction.java


示例5: ImplementorsSearchGroup

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public ImplementorsSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindImplementorsAction= new FindImplementorsAction(fEditor);
	fFindImplementorsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKSPACE);
	fEditor.setAction("SearchImplementorsInWorkspace", fFindImplementorsAction); //$NON-NLS-1$

	fFindImplementorsInProjectAction= new FindImplementorsInProjectAction(fEditor);
	fFindImplementorsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_PROJECT);
	fEditor.setAction("SearchImplementorsInProject", fFindImplementorsInProjectAction); //$NON-NLS-1$

	fFindImplementorsInWorkingSetAction= new FindImplementorsInWorkingSetAction(fEditor);
	fFindImplementorsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKING_SET);
	fEditor.setAction("SearchImplementorsInWorkingSet", fFindImplementorsInWorkingSetAction); //$NON-NLS-1$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:24,代码来源:ImplementorsSearchGroup.java


示例6: updateActions

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private void updateActions() {
	IWorkbenchPart activePart= JavaPlugin.getActivePage().getActivePart();
	if (!(activePart instanceof JavaEditor))
		return;

	ISelection javaSelection= getEditorSelection((JavaEditor) activePart);
	if (javaSelection == null)
		return;

	for (int i= 0; i < fRetargetActions.length; i++) {
		RetargetAction action= fRetargetActions[i];
		IAction actionHandler= action.getActionHandler();
		if (actionHandler instanceof SelectionDispatchAction) {
			((SelectionDispatchAction) actionHandler).update(javaSelection);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:OccurrencesSearchMenuAction.java


示例7: WriteReferencesSearchGroup

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public WriteReferencesSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindWriteReferencesAction= new FindWriteReferencesAction(fEditor);
	fFindWriteReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
	fEditor.setAction("SearchWriteAccessInWorkspace", fFindWriteReferencesAction); //$NON-NLS-1$

	fFindWriteReferencesInProjectAction= new FindWriteReferencesInProjectAction(fEditor);
	fFindWriteReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_PROJECT);
	fEditor.setAction("SearchWriteAccessInProject", fFindWriteReferencesInProjectAction); //$NON-NLS-1$

	fFindWriteReferencesInHierarchyAction= new FindWriteReferencesInHierarchyAction(fEditor);
	fFindWriteReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
	fEditor.setAction("SearchWriteAccessInHierarchy", fFindWriteReferencesInHierarchyAction); //$NON-NLS-1$

	fFindWriteReferencesInWorkingSetAction= new FindWriteReferencesInWorkingSetAction(fEditor);
	fFindWriteReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
	fEditor.setAction("SearchWriteAccessInWorkingSet", fFindWriteReferencesInWorkingSetAction); //$NON-NLS-1$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:WriteReferencesSearchGroup.java


示例8: createQuery

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
@Override
QuerySpecification createQuery(IJavaElement element) throws JavaModelException {
	JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
	JavaEditor editor= getEditor();

	IJavaSearchScope scope;
	String description;
	boolean isInsideJRE= factory.isInsideJRE(element);
	if (editor != null) {
		scope= factory.createJavaProjectSearchScope(editor.getEditorInput(), isInsideJRE);
		description= factory.getProjectScopeDescription(editor.getEditorInput(), isInsideJRE);
	} else {
		scope= factory.createJavaProjectSearchScope(element.getJavaProject(), isInsideJRE);
		description=  factory.getProjectScopeDescription(element.getJavaProject(), isInsideJRE);
	}
	return new ElementQuerySpecification(element, getLimitTo(), scope, description);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:FindReferencesInProjectAction.java


示例9: ReadReferencesSearchGroup

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public ReadReferencesSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindReadReferencesAction= new FindReadReferencesAction(fEditor);
	fFindReadReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
	fEditor.setAction("SearchReadAccessInWorkspace", fFindReadReferencesAction); //$NON-NLS-1$

	fFindReadReferencesInProjectAction= new FindReadReferencesInProjectAction(fEditor);
	fFindReadReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_READ_ACCESS_IN_PROJECT);
	fEditor.setAction("SearchReadAccessInProject", fFindReadReferencesInProjectAction); //$NON-NLS-1$

	fFindReadReferencesInHierarchyAction= new FindReadReferencesInHierarchyAction(fEditor);
	fFindReadReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
	fEditor.setAction("SearchReadAccessInHierarchy", fFindReadReferencesInHierarchyAction); //$NON-NLS-1$

	fFindReadReferencesInWorkingSetAction= new FindReadReferencesInWorkingSetAction(fEditor);
	fFindReadReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
	fEditor.setAction("SearchReadAccessInWorkingSet", fFindReadReferencesInWorkingSetAction); //$NON-NLS-1$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ReadReferencesSearchGroup.java


示例10: execute

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null) {
        return null;
    }
    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    if (activePage == null) {
        return null;
    }
    IEditorPart editor = activePage.getActiveEditor();
    if (editor == null) {
        return null;
    }
    IEditorInput input = editor.getEditorInput();
    if (input == null || ! (input instanceof FileEditorInput)) {
        return null;
    }
    IFile file = ((FileEditorInput) input).getFile();
    if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) {
        utils = new ProjectUtils(file.getProject());
        if (utils.isGluonMobileProject()) {
            ISelection selection = HandlerUtil.getCurrentSelection(event);
            Display.getDefault().asyncExec(() -> new JCode(utils, selection,  (JavaEditor) editor));
        }
    }
    return null;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:29,代码来源:InsertGluonFunctionHandler.java


示例11: JCode

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
public JCode(ProjectUtils utils, ISelection selection, JavaEditor javaEditor) {
    this.utils = utils;
    this.selection = selection;
    this.javaEditor = javaEditor;

    if (selection != null) {
        runCode();
    }
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:10,代码来源:JCode.java


示例12: provideOffsetOfCurrentCursorPosition

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
public int provideOffsetOfCurrentCursorPosition() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart activeEditor = page.getActiveEditor();
    if (activeEditor instanceof JavaEditor) {
        JavaEditor javaEditor = (JavaEditor) activeEditor;
        ISelection selection = javaEditor.getSelectionProvider().getSelection();
        if (selection instanceof ITextSelection) {
            ITextSelection iTextSelection = (ITextSelection) selection;
            return iTextSelection.getOffset();
        }
    }
    return 0;
}
 
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:14,代码来源:ActiveJavaEditorOffsetProvider.java


示例13: execute

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
public Object execute(ExecutionEvent arg0) {
  IEditorPart editor = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
  if (editor instanceof JavaEditor) {
    showQuickAnnotations((JavaEditor) editor);
  }
  return null;
}
 
开发者ID:nblix,项目名称:overviewruler,代码行数:8,代码来源:OpenHandler.java


示例14: GWTOpenEditorActionGroup

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * Note: This constructor is for internal use only. Clients should not call
 * this constructor.
 * 
 * @param editor the Java editor
 */
public GWTOpenEditorActionGroup(JavaEditor editor) {
  isEditorOwner = true;
  openAction = new GWTOpenAction(editor);
  openAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
  editor.setAction("OpenEditor", openAction); //$NON-NLS-1$
  site = editor.getEditorSite();
  initialize(site.getSelectionProvider());
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:15,代码来源:GWTOpenEditorActionGroup.java


示例15: AllCleanUpsAction

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
public AllCleanUpsAction(JavaEditor editor) {
	super(editor);
	setToolTipText(ActionMessages.CleanUpAction_tooltip);
	setDescription(ActionMessages.CleanUpAction_description);
	installPreferenceListener();
	updateActionLabel();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:AllCleanUpsAction.java


示例16: getActiveEditor

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private ITextEditor getActiveEditor() {
	IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	if (window != null) {
		IWorkbenchPage page= window.getActivePage();
		if (page != null) {
			IEditorPart editor= page.getActiveEditor();
			if (editor instanceof ITextEditor)
				return (JavaEditor) editor;
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:JavaContentAssistHandler.java


示例17: getJavaEditor

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
/**
 * Returns the currently active java editor, or <code>null</code> if it
 * cannot be determined.
 *
 * @return  the currently active java editor, or <code>null</code>
 */
private JavaEditor getJavaEditor() {
	IEditorPart part= JavaPlugin.getActivePage().getActiveEditor();
	if (part instanceof JavaEditor)
		return (JavaEditor) part;
	else
		return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:14,代码来源:ParameterGuessingProposal.java


示例18: getCompilationUnit

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private static ICompilationUnit getCompilationUnit(JavaEditor editor) {
	IJavaElement element= JavaUI.getEditorInputJavaElement(editor.getEditorInput());
	if (!(element instanceof ICompilationUnit))
		return null;

	return (ICompilationUnit)element;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:CleanUpAction.java


示例19: getDocument

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private IDocument getDocument() {
	JavaEditor editor= fEditor;
	if (editor == null)
		return null;

	IDocumentProvider provider= editor.getDocumentProvider();
	if (provider == null)
		return null;

	return provider.getDocument(editor.getEditorInput());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:DefaultJavaFoldingStructureProvider.java


示例20: getRenameRefactoringProposal

import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入依赖的package包/类
private static boolean getRenameRefactoringProposal(IInvocationContext context, ASTNode node, IProblemLocation[] locations, Collection<ICommandAccess> resultingCollections)
		throws CoreException {
	if (!(context instanceof AssistContext)) {
		return false;
	}
	IEditorPart editor= ((AssistContext)context).getEditor();
	if (!(editor instanceof JavaEditor))
		return false;
	
	if (!(node instanceof SimpleName)) {
		return false;
	}
	SimpleName name= (SimpleName) node;
	IBinding binding= name.resolveBinding();
	if (binding == null) {
		return false;
	}
	
	IJavaElement javaElement= binding.getJavaElement();
	if (javaElement == null || !RefactoringAvailabilityTester.isRenameElementAvailable(javaElement)) {
		return false;
	}
	
	if (resultingCollections == null) {
		return true;
	}
	
	RenameRefactoringProposal proposal= new RenameRefactoringProposal((JavaEditor) editor);
	if (locations.length != 0) {
		proposal.setRelevance(IProposalRelevance.RENAME_REFACTORING_ERROR);
	} else if (containsQuickFixableRenameLocal(locations)) {
		proposal.setRelevance(IProposalRelevance.RENAME_REFACTORING_QUICK_FIX);
	}
	

	resultingCollections.add(proposal);
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:QuickAssistProcessor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Container类代码示例发布时间:2022-05-22
下一篇:
Java ZipFileIndex类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap