Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Perspective initial layout for views with allow multiple = true (compound ids)
Perspective initial layout for views with allow multiple = true (compound ids) [message #900566] Tue, 07 August 2012 10:49
Sergey Kuznetsov is currently offline Sergey Kuznetsov
Messages: 29
Registered: July 2009
Junior Member
<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>For 3.x RCP applications we use following code for ours perspectives
initial layout (we have a lot of views with allowMultiple == true)</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2 face="Courier New">public class Perspective implements
IPerspectiveFactory {</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public static final
String&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID =
"test.rcp.juno.perspective";</FONT></DIV>
<DIV><FONT size=2 face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
IFolderLayout&nbsp;&nbsp;&nbsp; viewsTopLeft;</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
String&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopLeftID = "viewsTopLeft";</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
IFolderLayout&nbsp;&nbsp;&nbsp; viewsTopRight;</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
String&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopRightID = "viewsTopRight";</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
IFolderLayout&nbsp;&nbsp;&nbsp; viewsBottom;</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public
String&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewsBottomID
= "viewsBottom";</FONT></DIV>
<DIV><FONT size=2 face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; public void
createInitialLayout(IPageLayout layout) {</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String editorArea = layout.getEditorArea();</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
layout.setEditorAreaVisible(false);</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
layout.setFixed(false);</FONT></DIV>
<DIV><FONT size=2 face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopLeft = layout.createFolder(viewsTopLeftID, IPageLayout.LEFT, 0.20f,
editorArea);</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsBottom = layout.createFolder(viewsBottomID, IPageLayout.BOTTOM, 0.5f,
viewsTopLeftID);</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopRight = layout.createFolder(viewsTopRightID, IPageLayout.RIGHT, 0.50f,
viewsTopLeftID);</FONT></DIV>
<DIV><FONT size=2 face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopLeft.addView(View1.ID + ":0001");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopLeft.addView(View1.ID + ":0002");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopRight.addView(View2.ID + ":0003");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsTopRight.addView(View2.ID + ":0004");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsBottom.addView(View3.ID + ":0005");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsBottom.addView(View3.ID + ":0006");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
viewsBottom.addView(View3.ID + ":0007");</FONT></DIV>
<DIV><FONT size=2 face="Courier New">&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT size=2 face="Courier New">}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>The code doesn't work for Juno, looks like createViewModel method of
ModeledPageLayout class has bug(s) (can not find views id), but Juno
documentation says "<STRONG>In layout methods taking a view id, the id can have
the compound form: primaryId [':' secondaryId]</STRONG>".</DIV>
<DIV>&nbsp;</DIV>
<DIV>May be we miss something? Or there is some workaround?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks</DIV></DIV></DIV></BODY></HTML>
Previous Topic:Override -product argument in Eclipse RCP application
Next Topic:Get selected project name when action is executed
Goto Forum:
  


Current Time: Sat Jul 26 09:25:38 EDT 2014

Powered by FUDForum. Page generated in 0.07906 seconds