RCP app & change background color and putting image in center of application
I would like to set the background color of my RCP application to white and show a center image (logo). This is because due to the fact, that no views or editors are shown beforehand and the user should select which perspective to open. This is necessary because I defined a backgroundview which would be shown first, but this prevents me of showing the intro / welcome page in full mode (it shows just in standby mode).
I fiddled with the ApplicationWorkbenchWindowAdvis开发者_高级运维or and created a method createWindowContent(Shell shell), but the only thing I achieved was to set the shells background image and color. This results in a white border of the page (logically because the shell lies behind the page). All attempts to get the pages composite failed.
Can you help here? Is there a way to change the page composite?
Thanks
It should be on ViewSashContainer
class. Based on my experience I put the code inside a method postWindowOpen()
. Below here is my code:
ArrayList list = (ArrayList)getWindowConfigurer().getWindow().getShell().getData("org.eclipse.ui.internal.dnd.dropTarget");
ViewSashContainer viewSash = (ViewSashContainer) list.get(2);
Composite composite = viewSash.getParent();
composite.setBackgroundImage(image);
The way the workbench is setup is to have a persistant group of editors while perspectives change the editor location area and provide a group of views with positions that are tied to the perspective. That means you are really limited to views and editors unless you start delving into creating your own workbench behavior. This is extremely complicated and although possible, it is really difficult.
The easiest option is to create a perspective that contains a single View that displays the content you are looking for. The disadvantage is that your perspective will show up in the perspective chooser. When I did something similar I created my own perspective chooser instead of using the default one provided by the platform so that certain perspectives would not be selectable by the user.
To make sure the user can't mess up the perspective make sure it is fixed as explained in this link
精彩评论