IPartListener2 [message #84895] |
Fri, 25 April 2008 08:37  |
Eclipse User |
|
|
|
I need add part listener to window.getPartService() or activePage, but i
need add this listener before all view (workbenchpart) created.
I have one perspective which opening on start two view.
code:
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor{
.....
public void preStartup() {
Sysout("PRE STARTUP");
PlatformUI.getWorkbench().addWindowListener(new WindowListener(){
...
public void windowOpened(IWorkbenchWindow window) {
Sysout("WINDOW OPENED");
window.getPartService().addPartListener(new
MyPartListener());
}
});
}
}
and in View in method :
public void createPartControl(Composite parent) {
sysout("VIEW CREATED");
}
and in MyPartListener:
.....
public void partOpened(IWorkbenchPartReference partRef) {
Sysout("PART OPENED");
}
....
Result is:
PRE STARTUP
VIEW CREATED
WINDOW OPENED
and i need:
PRE STARTUP
WINDOW OPENED
PART OPENED
VIEW CREATED
or
PRE STARTUP
WINDOW OPENED
VIEW CREATED
PART OPENED
When i register IPartListener ??
P.S. sry for my English
|
|
|
|
|
|
Re: IPartListener2 [message #85120 is a reply to message #85107] |
Mon, 28 April 2008 02:50  |
Eclipse User |
|
|
|
if i use:
DemoWorkbenchWindowAdvisor#postWindowCreate(){
getWindowConfigurer().getWindow().getPartService().addPartLi stener(new
MyPartListener());
}
log:
1. View - Part CREATED view.listofpersons
2. View - Part CREATED view.persondashboard
3. View - Part CREATED view.relationdashboard
4. PartListener - partOpened view.relationdashboard
5. View - Part CREATED view.address
6. PartListener - partOpened view.address
.....
missed two view (1,2)
if i use:
ApplicationActionBarAdvisor#akeActions(final IWorkbenchWindow window){
window.getPartService().addPartListener(new MyPartListener());
}
log:
1. View - Part CREATED view.listofpersons
2. PartListener - partOpened view.listofpersons
3. View - Part CREATED view.persondashboard
4. PartListener - partOpened view.persondashboard
5. View - Part CREATED view.relationdashboard
6. PartListener - partOpened view.relationdashboard
7. View - Part CREATED view.address
8. PartListener - partOpened view.address
.....
it's right
About other important thing:
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);
IFolderLayout left = layout.createFolder("folder.left",
IPageLayout.LEFT, 0.25f, editorArea);
left.addView(ViewId.LIST_OF_PERSONS.ID);
left.addPlaceholder(ViewId.LIST_OF_VIEWS.ID);
IPlaceholderFolderLayout right =
layout.createPlaceholderFolder("folder.right", IPageLayout.RIGHT, 0.80f,
editorArea);
right.addPlaceholder(ViewId.LOG.ID);
IFolderLayout top = layout.createFolder("folder.top",
IPageLayout.TOP, 0.37f, editorArea);
top.addView(ViewId.PERSON_DASHBOARD.ID);
top.addView(ViewId.RELATION_DASHBOARD.ID);
IPlaceholderFolderLayout bottom =
layout.createPlaceholderFolder("folder.bottom", IPageLayout.BOTTOM,
0.63f, editorArea);
bottom.addPlaceholder(ViewId.ADDRESS.ID);
bottom.addPlaceholder(ViewId.BIRT.ID);
bottom.addPlaceholder(ViewId.REMUN_VIEW.ID);
}
}
and view.address is open from (only for developing):
WorkbenchWindowAdvisor#postWindowOpen() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView( "view.address");
} catch (PartInitException e) {
throw new RuntimeException(e);
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03476 seconds