Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » workspaceRoot.getFile() does not return
workspaceRoot.getFile() does not return [message #1818164] Mon, 09 December 2019 04:00 Go to next message
Eclipse UserFriend
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);
Re: workspaceRoot.getFile() does not return [message #1818170 is a reply to message #1818164] Mon, 09 December 2019 04:59 Go to previous messageGo to next message
Eclipse UserFriend
Using the Java debugger you can probably find the answer to your question.

To learn about the Java debugger, look at the Eclipse documentation and tutorials, some examples:
https://help.eclipse.org/2019-09/topic/org.eclipse.jdt.doc.user/gettingStarted/qs-13.htm?cp=1_1_0_11
https://help.eclipse.org/2019-09/topic/org.eclipse.jdt.doc.user/tasks/task-running_and_debugging.htm?cp=1_3_6
https://www.vogella.com/tutorials/EclipseDebugging/article.html
Re: workspaceRoot.getFile() does not return [message #1818343 is a reply to message #1818170] Thu, 12 December 2019 22:03 Go to previous message
Eclipse UserFriend
Odds are it is related to using Swing controls while SWT is also running in-process.
Previous Topic:why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null
Next Topic:Need to "Close / Open project" - after EACH edit ( CDT ) !
Goto Forum:
  


Current Time: Mon May 12 17:59:48 EDT 2025

Powered by FUDForum. Page generated in 0.05084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top