Open View from Dialog [message #448833] |
Thu, 04 May 2006 04:58  |
Eclipse User |
|
|
|
Originally posted by: b.h.stud.uni-goettingen.de
Hello,
I have a RCP applcation. I open a view from menu and it works. Now I want
to open the view from a button in a Dialog. The view is multiple. I can
open many views from the menu.
The method makeAction(..) in class ApplicationActionBarAdvisor.java called
new OpenViewAction(window, TreeView.ID);
and the view open. I tried to called this from my Dialog but I need the
window. How can I get the window? In the moment where the Dialog is open I
can't get the activeWorkbenchwindow.
What can I do, to open the view? Sorry my english is very bad but I hope
you understand me?
Gruß
Björn
|
|
|
|
|
|
Re: Open View from Dialog [message #448896 is a reply to message #448848] |
Sat, 06 May 2006 11:22   |
Eclipse User |
|
|
|
Originally posted by: tom.seidel.javawiki.org
Hi Björn,
why don't you open the view _after_ closing the dialog
something like that:
MyDialog diag = new MyDialog(currentShell);
if (diag.open() == IDialogConstants.OK_ID) {
MyDataFromDialog data = diag.getData();
openNewView(data);
}
Cheerz,
Björn wrote:
> Hello Stefan,
>
> I start my RCP application and wenn I press a button a Dialog open. In
> this Dialog I can choose a datasource. After that I press the OK Button
> and now I want to open a view to fill this with data from the datasource.
>
> I dont't understand what you mean with I could pass it as argument in
> the constructor? I don't get the window, this is my problem. My class
> ViewOpenAction need as argument (IWorkbenchWindow window, String viewid).
>
> The String is viewid = TreeView.ID;
>
> But I don't know how to get the window? I have tried this but it doesn't
> work, because I think the dialog is active and not the window.
>
> IWorkbench wb = PlatformUI.getWorkbench();
>
> IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
>
> What can I do? :-(
>
>
>
>
> public class OpenViewAction extends Action {
>
>
>
> private final IWorkbenchWindow window;
>
>
>
> private int instanceNum;
>
>
>
> private final String viewId;
>
>
>
> public OpenViewAction(IWorkbenchWindow window, String viewId) {
>
> this.window = window;
>
> this.viewId = viewId;
>
> }
>
>
>
> public void run() {
>
> try {
>
> window.getActivePage().showView(viewId,
>
> Integer.toString(instanceNum++),
>
> IWorkbenchPage.VIEW_ACTIVATE);
>
> } catch (PartInitException e) {
>
> e.printStackTrace();
>
> }
>
> }
>
> }
>
>
>
>
>
>
>
|
|
|
Re: Open View from Dialog [message #448907 is a reply to message #448848] |
Sun, 07 May 2006 11:26  |
Eclipse User |
|
|
|
Hello Björn,
afaik you can get the active WorkbenchWindow anytime staticly by:
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
Hope that helps
Best regards
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.04179 seconds