workspaceRoot.getFile() does not return [message #1818164] |
Mon, 09 December 2019 09:00  |
Ming Cheng Messages: 19 Registered: December 2019 |
Junior Member |
|
|
My Code:
public static void openClassFile(String locationString) {
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().asyncExec(new Runnable() {
public void run() {
IPath p = new Path(locationString);
IWorkspace workspace = ResourcesPlugin.getWorkspace();
if (workspace == null ) {
JOptionPane.showMessageDialog(null,"null workspace");
return;
}
IWorkspaceRoot workspaceRoot = workspace.getRoot();
if (workspaceRoot == null ) {
JOptionPane.showMessageDialog(null,"null workspaceRoot");
return;
}
JOptionPane.showMessageDialog(null,"before getFileForLocation");
IFile file = workspaceRoot.getFile(p);
JOptionPane.showMessageDialog(null,locationString);
FileEditorInput input = new FileEditorInput(file);
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
if (null != activePage) {
try {
JOptionPane.showMessageDialog(null,"HERE");
activePage.openEditor(input, "bndtools.bndWorkspaceConfigEditor", true);
} catch (PartInitException ex) {
JOptionPane.showMessageDialog(null,"Unable to open editor");
//ErrorDialog.openError(getSection().getShell(), "Error", "Unable to open editor", ex.getStatus());
}
} else {
JOptionPane.showMessageDialog(null,"No activePage");
}
}
});
}
I can see popup of "before getFileForLocation"; but I can't see the next popup which is supposed to display the file name:
JOptionPane.showMessageDialog(null,locationString);
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02111 seconds