Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Strange behaviour when creating a view ...
Strange behaviour when creating a view ... [message #448254] Thu, 06 January 2005 11:51 Go to next message
Eclipse UserFriend
Originally posted by: benoit.villaumie.axabanque.fr

Hello everyone,

I define in a perspective a placeholder to open a view. When I show this
view in my perspective using page.showView(MyView.ID_VIEW), everything is
fine.

However, using page.showView(MyView.ID_VIEW, aFunctionalKey,
IWorkbenchPage.VIEW_ACTIVATE), the view is not opened at the place defined
by the placeholder => the view is opened in the bottom of the screen).

How can I do to open a view with a secondary id at the right place ?

Thanks.


Here is the Perspective code :

/**
* @see
org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.e clipse.ui.IPageLayout)
*/
public void createInitialLayout(IPageLayout pLayout) {
pLayout.addView(
AnotherView2.ID_VIEW,
IPageLayout.BOTTOM,
IPageLayout.DEFAULT_VIEW_RATIO,
IPageLayout.ID_EDITOR_AREA);
pLayout.addView(
AnotherView.ID_VIEW,
IPageLayout.LEFT,
IPageLayout.DEFAULT_VIEW_RATIO,
IPageLayout.ID_EDITOR_AREA);
pLayout.addPlaceholder(
MyView.ID_VIEW,
IPageLayout.TOP,
IPageLayout.DEFAULT_VIEW_RATIO,
IPageLayout.ID_EDITOR_AREA);
}

Here the code to show MyView (when I click on a button in AnotherView) :

public void onShowMyView(String pFunctionalKey) {
// Getting the page
IWorkbenchPage page = ...;
// View activation
IViewReference myViewRef = page.findViewReference(
MyView.ID_VIEW,
pFunctionalKey);
IViewPart myView = null;
try {
if(myViewRef == null) {
myView = page.showView(
MyView.ID_VIEW,
pFunctionalKey,
IWorkbenchPage.VIEW_ACTIVATE); // Bug - placeholder not
used ???
myView = page.showView(MyView.ID_VIEW); // placeholder is used
} else {
// focusing on existing view ...
myView = page.showView(DetailView.ID_VIEW, vFunctionalKey,
IWorkbenchPage.VIEW_ACTIVATE);
}
} catch (Exception e) {
//....
}
Re: Strange behaviour when creating a view ... [message #448308 is a reply to message #448254] Thu, 06 January 2005 19:19 Go to previous message
Charlie Surface is currently offline Charlie SurfaceFriend
Messages: 40
Registered: July 2009
Member
You should ask this question on eclipse.platform, since it is not really
related to SWT.

Charlie


benoit villaumie wrote:

> Hello everyone,
>
> I define in a perspective a placeholder to open a view. When I show this
> view in my perspective using page.showView(MyView.ID_VIEW), everything
> is fine.
>
> However, using page.showView(MyView.ID_VIEW, aFunctionalKey,
> IWorkbenchPage.VIEW_ACTIVATE), the view is not opened at the place
> defined by the placeholder => the view is opened in the bottom of the
> screen).
>
> How can I do to open a view with a secondary id at the right place ?
>
> Thanks.
>
>
> Here is the Perspective code :
>
> /**
> * @see
> org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.e clipse.ui.IPageLayout)
>
> */
> public void createInitialLayout(IPageLayout pLayout) {
> pLayout.addView(
> AnotherView2.ID_VIEW,
> IPageLayout.BOTTOM,
> IPageLayout.DEFAULT_VIEW_RATIO,
> IPageLayout.ID_EDITOR_AREA);
> pLayout.addView(
> AnotherView.ID_VIEW,
> IPageLayout.LEFT,
> IPageLayout.DEFAULT_VIEW_RATIO,
> IPageLayout.ID_EDITOR_AREA);
> pLayout.addPlaceholder(
> MyView.ID_VIEW, IPageLayout.TOP,
> IPageLayout.DEFAULT_VIEW_RATIO, IPageLayout.ID_EDITOR_AREA);
> }
>
> Here the code to show MyView (when I click on a button in AnotherView) :
>
> public void onShowMyView(String pFunctionalKey) {
> // Getting the page
> IWorkbenchPage page = ...;
> // View activation
> IViewReference myViewRef = page.findViewReference(
> MyView.ID_VIEW, pFunctionalKey);
> IViewPart myView = null;
> try {
> if(myViewRef == null) {
> myView = page.showView(
> MyView.ID_VIEW, pFunctionalKey,
> IWorkbenchPage.VIEW_ACTIVATE); // Bug - placeholder not
> used ???
> myView = page.showView(MyView.ID_VIEW); // placeholder is used
> } else {
> // focusing on existing view ...
> myView = page.showView(DetailView.ID_VIEW, vFunctionalKey,
> IWorkbenchPage.VIEW_ACTIVATE);
> }
> } catch (Exception e) {
> //....
> }
>
>
>
>
>
Previous Topic:3M4 Crashing on OS X
Next Topic:Question about view layout
Goto Forum:
  


Current Time: Thu Mar 28 09:31:32 GMT 2024

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

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

Back to the top