|
|
Re: e4: add view with secondary ID [message #890213 is a reply to message #890195] |
Thu, 21 June 2012 13:31 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03166 seconds