The workbench window in Eclipse terminology is a window containing, as a rule, a menu, a toolbar, an editor area and views. Eclipse RCP applications typically contain a single window, but some applications allow you to create multiple windows. For example, in the Eclipse IDE, you can open another window by selecting "New Window" in the window menu. Perspectives can be set independently in each window.
, . , , , . RCP. , , .
RCP , .
" " RCP. , RCP , . ActionBarAdvisor:
:
private IWorkbenchAction newWindowAction;
, ( , makeActions):
newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
register(newWindowAction);
, :
menu.add(newWindowAction);
"". , :
MenuManager = MenuManager ( "& ; ", IWorkbenchActionConstants.M_WINDOW);
, , Window- > New Window Eclipse IDE.
. , "" . , Eclipse IDE , , .
- , . "" . , , .
, . . . , (, getActivePage ). Eclipse 2.0 , .
:
IWorkbenchPage newPage = window.openPage(myInput);
, , .
, , :
newPage.getWorkbenchWindow().getShell().setText("My App - " + myInput.getName());
There are situations where you can change the input to the window. You cannot change the input to the page, so you must do this by closing the existing page and creating a new page. The following code will close the existing page:
IWorkbenchPage activePage = window.getActivePage();
activePage.close();
Please note that some of the views provided by Eclipse use page input. For example, the Common Navigator view will use the page input as the root element of the navigation tree.
To access page input from your own view, you must call site.getPage().getInput(). If you do not have context for the site, the following is called:
..PlatformUI.getWorkbench () getActiveWorkbenchWindow () getActivePage () getInput () ;.
, "" - . , . Page::getInput(), . . . , , . Eclipse , Page::getInput().