Jump to: navigation, search

Difference between revisions of "FAQ How do I create fixed views and perspectives?"

 
 
Line 1: Line 1:
''
 
 
 
 
 
 
 
 
 
 
 
New APIs in Eclipse 3.0 allow perspectives more control over how their views
 
New APIs in Eclipse 3.0 allow perspectives more control over how their views
 
are presented. These APIs are useful in RCP applications that want  
 
are presented. These APIs are useful in RCP applications that want  
Line 48: Line 38:
 
== See Also: ==
 
== See Also: ==
  
[[FAQ_How_can_I_add_my_views_and_actions_to_an_existing_perspective%3F]]
+
[[FAQ How can I add my views and actions to an existing perspective?]]
  
[[FAQ_Why_can%26%23146%3Bt_I_control_when%2C_where%2C_and_how_my_view_is_presented%3F]]
+
[[FAQ Why can't I control when, where, and how my view is presented?]]
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
{{Template: FAQ_Tagline}}

Latest revision as of 10:03, 26 January 2007

New APIs in Eclipse 3.0 allow perspectives more control over how their views are presented. These APIs are useful in RCP applications that want different view-presentation models. The IPageLayout interface, provided when your perspective factory is creating its initial layout, has methods for customizing how views will be presented in that perspective. The setFixed method on IPageLayout indicates that a perspective should be fixed. In a fixed perspective, views and editors cannot be moved or zoomed by the user.

A stand-alone view, created with the method addStandaloneView, cannot be stacked together with other views and can optionally hide its title bar. A view with its title bar hidden cannot be closed, minimized, or moved. For further control over whether views can be closed or moved, you can obtain an IViewLayout instance for any view in the perspective. Following is an example of a fixed perspective that creates a stand-alone view above the editor area that cannot be moved or closed.

   class RecipePerspective implements IPerspectiveFactory {
      public void createInitialLayout(IPageLayout page) {
         page.setEditorAreaVisible(true);
         page.setFixed(true);
         page.addStandaloneView(
            RecipePlugin.VIEW_CATEGORIES, 
            false, IPageLayout.TOP, 0.2f, 
            IPageLayout.ID_EDITOR_AREA);
         IViewLayout view = page.getViewLayout(
            RecipePlugin.VIEW_CATEGORIES);
         view.setCloseable(false);
         view.setMoveable(false);
      }
   }

You can add fixed and stand-alone views to perspectives from other plug-ins using the perspectiveExtensions extension point. See the extension point documentation for more details.


See Also:

FAQ How can I add my views and actions to an existing perspective?

FAQ Why can't I control when, where, and how my view is presented?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.