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


Java IClassFileEditorInput类代码示例

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


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

示例1: createJavaProjectThroughActiveEditor

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private IJavaProject createJavaProjectThroughActiveEditor() {
	
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	 	    if(page.getActiveEditor().getEditorInput() instanceof IFileEditorInput)
	 	    {	
	 		IFileEditorInput input = (IFileEditorInput) page.getActiveEditor().getEditorInput();
	 		IFile file = input.getFile();
	 		IProject activeProject = file.getProject();
	 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(activeProject.getName());
	 		return JavaCore.create(project);
	 	    }
	 	    else if(page.getActiveEditor().getEditorInput() instanceof IClassFileEditorInput)
	 	    {
	  IClassFileEditorInput classFileEditorInput=(InternalClassFileEditorInput)page.getActiveEditor().getEditorInput() ;
	  IClassFile classFile=classFileEditorInput.getClassFile();
	  return classFile.getJavaProject();
	 	    }
	 	    return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:ValidatorUtility.java

示例2: setActiveEditor

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
@Override
public void setActiveEditor(IAction action, IEditorPart part) {
  if (part != null && part.getEditorInput() instanceof IClassFileEditorInput) {
    Set<IPackageFragmentRoot> queue = new LinkedHashSet<>();
    try {
      IClassFileEditorInput input = (IClassFileEditorInput) part.getEditorInput();
      IJavaElement element = input.getClassFile();
      while (element.getParent() != null) {
        element = element.getParent();
        if (element instanceof IPackageFragmentRoot) {
          IPackageFragmentRoot fragment = (IPackageFragmentRoot) element;
          if (canProcess(fragment)) {
            queue.add(fragment);
          }
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    findSources(queue);
  }
}
 
开发者ID:fbricon,项目名称:pde.source.lookup,代码行数:23,代码来源:DownloadSourcesActionDelegate.java

示例3: getProject

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private IJavaProject getProject() {
	ITextEditor editor= getEditor();
	if (editor == null)
		return null;

	IJavaElement element= null;
	IEditorInput input= editor.getEditorInput();
	IDocumentProvider provider= editor.getDocumentProvider();
	if (provider instanceof ICompilationUnitDocumentProvider) {
		ICompilationUnitDocumentProvider cudp= (ICompilationUnitDocumentProvider) provider;
		element= cudp.getWorkingCopy(input);
	} else if (input instanceof IClassFileEditorInput) {
		IClassFileEditorInput cfei= (IClassFileEditorInput) input;
		element= cfei.getClassFile();
	}

	if (element == null)
		return null;

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

示例4: computeContainedMatches

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
	//TODO same code in JavaSearchResult
	IEditorInput editorInput= editor.getEditorInput();
	if (editorInput instanceof IFileEditorInput)  {
		IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput;
		return computeContainedMatches(result, fileEditorInput.getFile());

	} else if (editorInput instanceof IClassFileEditorInput) {
		IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput;
		IClassFile classFile= classFileEditorInput.getClassFile();

		Object[] elements= getElements();
		if (elements.length == 0)
			return NO_MATCHES;
		//all matches from same file:
		JavaElementLine jel= (JavaElementLine) elements[0];
		if (jel.getJavaElement().equals(classFile))
			return collectMatches(elements);
	}
	return NO_MATCHES;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:OccurrencesSearchResult.java

示例5: isShownInEditor

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public boolean isShownInEditor(Match match, IEditorPart editor) {
	Object element= match.getElement();
	IJavaElement je= ((JavaElementLine) element).getJavaElement();
	IEditorInput editorInput= editor.getEditorInput();
	if (editorInput instanceof IFileEditorInput) {
		try {
			return ((IFileEditorInput)editorInput).getFile().equals(je.getCorrespondingResource());
		} catch (JavaModelException e) {
			return false;
		}
	} else if (editorInput instanceof IClassFileEditorInput) {
		return ((IClassFileEditorInput)editorInput).getClassFile().equals(je);
	}

	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:OccurrencesSearchResult.java

示例6: getCurrentClassFile

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public static IClassFile getCurrentClassFile(IWorkbenchWindow window) {
	IClassFile file = null;
	IEditorPart editor = window.getActivePage().getActiveEditor();
	if (editor != null) {
		IEditorInput input = editor.getEditorInput();
		if (input instanceof IClassFileEditorInput) {
			file = ((IClassFileEditorInput) input).getClassFile();
		}
	}
	return file;
}
 
开发者ID:aroog,项目名称:code,代码行数:12,代码来源:WorkspaceUtilities.java

示例7: computeContainedMatches

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
	//TODO: copied from JavaSearchResult:
	IEditorInput editorInput= editor.getEditorInput();
	if (editorInput instanceof IFileEditorInput)  {
		IFileEditorInput fileEditorInput= (IFileEditorInput) editorInput;
		return computeContainedMatches(result, fileEditorInput.getFile());
	} else if (editorInput instanceof IClassFileEditorInput) {
		IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) editorInput;
		Set<Match> matches= new HashSet<Match>();
		collectMatches(matches, classFileEditorInput.getClassFile());
		return matches.toArray(new Match[matches.size()]);
	}
	return NO_MATCHES;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:NLSSearchResult.java

示例8: isShownInEditor

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public boolean isShownInEditor(Match match, IEditorPart editor) {
	IEditorInput editorInput= editor.getEditorInput();
	if (match.getElement() instanceof FileEntry) {
		IFile file= ((FileEntry) match.getElement()).getPropertiesFile();
		if (editorInput instanceof IFileEditorInput) {
			return ((IFileEditorInput) editorInput).getFile().equals(file);
		}
	} else if (match.getElement() instanceof IJavaElement || match.getElement() instanceof CompilationUnitEntry) {
		IJavaElement je= null;
		if (match.getElement() instanceof IJavaElement) {
			je= (IJavaElement) match.getElement();
		} else {
			je= ((CompilationUnitEntry)match.getElement()).getCompilationUnit();
		}
		if (editorInput instanceof IFileEditorInput) {
			try {
				ICompilationUnit cu= (ICompilationUnit) je.getAncestor(IJavaElement.COMPILATION_UNIT);
				if (cu == null)
					return false;
				else
					return ((IFileEditorInput) editorInput).getFile().equals(cu.getCorrespondingResource());
			} catch (JavaModelException e) {
				return false;
			}
		} else if (editorInput instanceof IClassFileEditorInput) {
			return ((IClassFileEditorInput) editorInput).getClassFile().equals(je.getAncestor(IJavaElement.CLASS_FILE));
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:NLSSearchResult.java

示例9: getInput

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private static IJavaElement getInput(JavaEditor editor) {
	if (editor == null)
		return null;
	IEditorInput input= editor.getEditorInput();
	if (input instanceof IClassFileEditorInput)
		return ((IClassFileEditorInput)input).getClassFile();
	IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
	return manager.getWorkingCopy(input);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:TextSelectionConverter.java

示例10: getJavaElement

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private IJavaElement getJavaElement(Object element) {
	if (element instanceof IJavaElement)
		return (IJavaElement)element;
	if (element instanceof IClassFileEditorInput)
		return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement();

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

示例11: computeScore

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
public int computeScore(String id, Object element) {
	if (!JavaSearchPage.EXTENSION_POINT_ID.equals(id))
		// Can't decide
		return ISearchPageScoreComputer.UNKNOWN;

	if (element instanceof IJavaElement || element instanceof IClassFileEditorInput || element instanceof LogicalPackage
			|| (element instanceof IEditorInput && JavaUI.getEditorInputJavaElement((IEditorInput)element) != null))
		return 90;

	return ISearchPageScoreComputer.LOWEST;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:JavaSearchPageScoreComputer.java

示例12: getTypes

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private IType[] getTypes() throws JavaModelException {
	IEditorInput input= fEditor.getEditorInput();
	if (input instanceof IClassFileEditorInput) {
		return new IType[] { ((IClassFileEditorInput)input).getClassFile().getType() };
	} else {
		return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input).getAllTypes();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:GoToNextPreviousMemberAction.java

示例13: getSourceReference

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private ISourceReference getSourceReference() {
	IEditorInput input= fEditor.getEditorInput();
	if (input instanceof IClassFileEditorInput) {
		return ((IClassFileEditorInput)input).getClassFile();
	} else {
		return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:GoToNextPreviousMemberAction.java

示例14: getCodeAssist

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
protected ICodeAssist getCodeAssist() {
	if (fEditor != null) {
		IEditorInput input= fEditor.getEditorInput();
		if (input instanceof IClassFileEditorInput) {
			IClassFileEditorInput cfeInput= (IClassFileEditorInput) input;
			return cfeInput.getClassFile();
		}

		WorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
		return manager.getWorkingCopy(input, false);
	}

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

示例15: updateSelectionInActiveEditor

import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput; //导入依赖的package包/类
private void updateSelectionInActiveEditor(DeclarationReference reference, int offset, int length)
{
    IWorkbenchPage activePage = window.getActivePage();
    
    if (activePage != null)
    {
        IEditorPart activeEditor = activePage.getActiveEditor();
        
        if (activeEditor != null)
        {
            IEditorInput input = activeEditor.getEditorInput();
            
            if (input instanceof IClassFileEditorInput)
            {
                IClassFile classFile = ((IClassFileEditorInput) input).getClassFile();
                
                if (ObjectUtils.equals(classFile.getType(), EclipseUtils.findParentType(reference.getElement())))
                {
                    new SetEditorCaretPositionOffsetLength(offset, length).editorOpened(activeEditor);
                }
            }
            else if (input instanceof IFileEditorInput)
            {
                IFile file = ((IFileEditorInput) input).getFile();
                
                if (ObjectUtils.equals(file, reference.getElement().getResource()))
                {
                    new SetEditorCaretPositionOffsetLength(offset, length).editorOpened(activeEditor);
                }
            }
        }
    }
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:34,代码来源:TreeObjectSelectionListener.java


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