Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » e4: add view with secondary ID
e4: add view with secondary ID [message #890138] Thu, 21 June 2012 05:01 Go to next message
Eclipse UserFriend
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 #890195 is a reply to message #890138] Thu, 21 June 2012 08:23 Go to previous messageGo to next message
Eclipse UserFriend
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 #890213 is a reply to message #890195] Thu, 21 June 2012 09:31 Go to previous messageGo to next message
Eclipse UserFriend
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 #890255 is a reply to message #890195] Thu, 21 June 2012 11:40 Go to previous messageGo to next message
Eclipse UserFriend
In the mean time I found how to defined a perspective in fragment.e4xmi by adding a perspective
under Application#snipped.
And I can add placeholders for the Console View. But how can I define 3 console views with different
names?
When I do it by hand and check with the live editor I see the created consoles are placed under
Shared Elements. How can I define this in a fragment.e4xmi?

Martin

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 #1053613 is a reply to message #890138] Mon, 06 May 2013 16:50 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: e4: add view with secondary ID [message #1053659 is a reply to message #1053613] Tue, 07 May 2013 03:50 Go to previous message
Eclipse UserFriend
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?
Previous Topic:RCP+JNLP x64: bundle org.eclipse.core.runtime not resolved
Next Topic:Custom XML content type source validation in Eclipse RCP
Goto Forum:
  


Current Time: Tue Apr 15 02:24:35 EDT 2025

Powered by FUDForum. Page generated in 0.06351 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top