e4: add view with secondary ID [message #890138] |
Thu, 21 June 2012 05:01  |
Eclipse User |
|
|
|
Hi,
how can I add a View to IFolderLayout when I have to use secondary ID.
I want to have 3 Consoles displayed one next to the other. In 3.x I used the secondary ID but this
does not work with e4.
I found in class ModeledPageLayout the method createViewModel does not handle the secondary ID.
the wanted layout:
+--------------------------------------+
| | |
|project | editor area |
|explorer | |
| | |
| | |
| | |
+--------------------------------------+
| | | |
| console 1 | console 2 | console 3 |
| | | |
+--------------------------------------+
Martin
|
|
|
|
Re: e4: add view with secondary ID [message #890213 is a reply to message #890195] |
Thu, 21 June 2012 09:31   |
Eclipse User |
|
|
|
yes on 3.x it works but not on 4.2
Below the relevant code snipped.
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout pLayout) {
String editorArea = pLayout.getEditorArea();
addConsoleAndFolder(pLayout, IConstants.CONSOLE_NAME_APSERVER, IPageLayout.BOTTOM, 0.66f, editorArea);
addConsoleAndFolder(pLayout, IConstants.CONSOLE_NAME_PSC, IPageLayout.RIGHT, 0.66f,
IConstants.CONSOLE_NAME_APSERVER);
addConsoleAndFolder(pLayout, IConstants.CONSOLE_NAME_ATM, IPageLayout.RIGHT, 0.5f,
IConstants.CONSOLE_NAME_APSERVER);
// Top left: Project Explorer view and Bookmarks view placeholder
IFolderLayout topLeft = pLayout.createFolder("topLeft", IPageLayout.LEFT, 0.20f, editorArea);
topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
}
/**
* Creates a new console in the given folder and make the view visiable by calling {@link
IWorkbenchPage#showView(String, String, int)}.
*
* @param pFolder
* @param pConsoleName
*/
protected void addConsole(IFolderLayout pFolder, String pConsoleName) {
pFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW + ":" + pConsoleName);
ConsoleWriter.findConsole(pConsoleName);//creates a new console if not aready exists with name
"pConsoleName"
IWorkbench lWb = PlatformUI.getWorkbench();
IWorkbenchWindow lWindow = lWb.getActiveWorkbenchWindow();
IWorkbenchPage lPage = lWindow.getActivePage();
try {
if (null != lPage) {
lPage.showView(IConsoleConstants.ID_CONSOLE_VIEW, pConsoleName, IWorkbenchPage.VIEW_VISIBLE);
}
} catch (PartInitException e) {
e.printStackTrace();
}
}
/**
* Add a console and new console and folder. The name of the console and folder is the same by
using <code>pConsoleName</code> This methods calls
* {@link IPageLayout#createFolder(String, int, float, String)};
*
* @param pLayout
* The initial page layout.
* @param pConsoleName
* The name of the console and folder.
* @param pRelationship
* @param pRatio
* @param pRefId
* @return
*/
protected IFolderLayout addConsoleAndFolder(IPageLayout pLayout, String pConsoleName, int
pRelationship, float pRatio, String pRefId) {
IFolderLayout lRet = pLayout.createFolder(pConsoleName, pRelationship, pRatio, pRefId);
addConsole(lRet, pConsoleName);
return lRet;
}
}
Paul Webster wrote, On 21.06.2012 14:23:
> You're using IPageLayout and when you add views with secondary IDs and run on 3.x it works, but when
> you run on 4.2 it doesn't?
>
> PW
|
|
|
|
|
Re: e4: add view with secondary ID [message #1053659 is a reply to message #1053613] |
Tue, 07 May 2013 03:50  |
Eclipse User |
|
|
|
With which version 4.2 or 4.3? If you can reproduce with the latest 4.3
build please file a bugzilla with a sample to reproduce it.
Tom
On 06.05.13 22:50, Xihui Chen wrote:
> I have the same problem. It looks like the secondary id is ignored in e4.
>
> Here is my code:
>
> Place holder defined in perspective:
>
> final IPlaceholderFolderLayout left =
> layout.createPlaceholderFolder(Position.LEFT.name(),
> IPageLayout.LEFT, 0.25f, editor);
> left.addPlaceholder("myView:*Left");
>
>
> Code to open a new view in left:
>
> page.showView("myView","2Left", IWorkbenchPage.VIEW_ACTIVATE);
>
> The above code worked with Eclipse 3.x but won't work for e4.
> Maybe there is new way to do this in e4?
|
|
|
Powered by
FUDForum. Page generated in 0.29629 seconds