Eclipse 插件
我想讓編輯器打開一個源代碼。我只有一個字串(java.lang.String)。我怎么做?
uj5u.com熱心網友回復:
如果您的意思是要打開該類的類檔案編輯器java.lang.String(如果可以找到,它將打開源代碼)。你會做這樣的事情:
IProject project = ... java project you are interested in
// Get the JavaModel project
IJavaProject javaProject = JavaCore.create(project);
// Find the String type using the classpath defined in the project
IType stringType = javaProject.findType("java.lang.String");
// Find the class file
IJavaElement classFile = stringType.getAncestor(IJavaElement.CLASS_FILE);
// Open the editor
JavaUI.openInEditor(classFile);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/363287.html
