Open external file into rcp [message #973454] |
Tue, 06 November 2012 05:47  |
Eclipse User |
|
|
|
Hello Experts,
I want to open a local file in my rcp view. I created a welcome view where has a button to open a file dialog. I want to get the file path chosen in the file dialog and do something with this path in another view.
I have saved the file name with following code.
fileName = dialog.getFileNames();
filterPath = dialog.getFilterPath();
selectedFiles = new File[fileName.length];
for (int i = 0; i < fileName.length; i++) {
if(filterPath != null && filterPath.trim().length() > 0) {
selectedFiles[i] = new File(filterPath, fileName[i]);
} else {
selectedFiles[i] = new File(fileName[i]);
}
}
And also I can call the another view after choosing the file, but I cannot get the file path in the another view. This is my another view calling code.
if (openFile.getXMLFileName() != null ) {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String viewIdToClose = WelcomeView.ID;
IViewReference viewToClose = activePage.findViewReference(viewIdToClose);
activePage.hideView(viewToClose);
try {
String viewIdToOpen_1 = IPXACTView.ID;
String viewIdToOpen_2 = DetailView.ID;
activePage.showView(viewIdToOpen_1, viewIdToOpen_2, 2);
} catch (PartInitException ex) {
ex.printStackTrace();
}
}
I have searched some online. I doubt whether I should use "activity" stuff or change this another view to editor?
Thank you in advance!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05144 seconds