Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ui.presentations
Class StackPresentation

    java.lang.Object
      org.eclipse.ui.presentations.StackPresentation

public abstract class StackPresentation
extends Object

This represents an object that can supply trim around a IPresentablePart. Clients can implement subclasses to provide the appearance for editor workbooks, view folders, fast views, and detached windows.

StackPresentations do not store any persistent state and cannot directly make changes to the workbench. They are given an IStackPresentationSite reference on creation, which allows them to send events and requests to the workbench. However, the workbench is free to ignore these requests. The workbench will call one of the public methods on StackPresentation when (and if) the presentation is expected to change state.

For example, if the user clicks a button that is intended to close a part, the StackPresentation will send a close request to its site, but should not assume that the part has been closed until the workbench responds with a call `StackPresentation.remove`.

Since:
  3.0

Field Summary
`static int` | `AS_ACTIVE_FOCUS` Activation state indicating that one of the parts in the presentation currently has focus
`static int` | `AS_ACTIVE_NOFOCUS` Activation state indicating that none of the parts in the presentation have focus, but one of the parts is being used as the context for global menus and toolbars
`static int` | `AS_INACTIVE` Inactive state.

Constructor Summary
`protected` | `StackPresentation(IStackPresentationSite stackSite)` Constructs a new stack presentation with the given site.

Method Summary
`abstract void` | `addPart(IPresentablePart newPart, Object cookie)` Adds the given part to the stack.
`abstract Point` | `computeMinimumSize()` Returns the minimum size for this stack.
`abstract void` | `dispose()` Disposes all SWT resources being used by the stack.
`abstract StackDropResult` | `dragOver(Control currentControl, Point location)` This method is invoked whenever a part is dragged over the stack's control.
`abstract Control` | `getControl()` Returns the control for this presentation
`protected IStackPresentationSite` | `getSite()` Returns the presentation site (not null).
`abstract Control[]` | `getTabList(IPresentablePart part)` Returns the tab-key traversal order for the given `IPresentablePart`.
`abstract void` | `removePart(IPresentablePart oldPart)` Removes the given part from the stack.
`void` | `restoreState(IPresentationSerializer context, IMemento memento)` Restores the state of this presentation to a previously saved state.
`void` | `saveState(IPresentationSerializer context, IMemento memento)` Saves the state of this presentation to the given memento.
`abstract void` | `selectPart(IPresentablePart toSelect)` Brings the specified part to the foreground.
`abstract void` | `setActive(int newState)` This is invoked to notify the presentation that its activation state has changed.
`abstract void` | `setBounds(Rectangle bounds)` Sets the bounding rectangle for this presentation.
`abstract void` | `setState(int state)` Sets the state of the presentation.
`abstract void` | `setVisible(boolean isVisible)` This causes the presentation to become visible or invisible.
`abstract void` | `showPaneMenu()` Instructs the presentation to display the pane menu
`void` | `showPartList()` Instructs the presentation to display a list of all parts in the stack, and allow the user to change the selection using the keyboard.
`abstract void` | `showSystemMenu()` Instructs the presentation to display the system menu

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### AS_INACTIVE

    public static final int AS_INACTIVE

  Inactive state. This is the default state for deselected presentations.

  See Also:
    Constant Field Values

### AS_ACTIVE_FOCUS

    public static final int AS_ACTIVE_FOCUS

  Activation state indicating that one of the parts in the presentation currently has focus

  See Also:
    Constant Field Values

### AS_ACTIVE_NOFOCUS

    public static final int AS_ACTIVE_NOFOCUS

  Activation state indicating that none of the parts in the presentation have focus, but one of the parts is being used as the context for global menus and toolbars

  See Also:
    Constant Field Values

Constructor Detail

### StackPresentation

    protected StackPresentation(IStackPresentationSite stackSite)

  Constructs a new stack presentation with the given site.

Parameters:
  `stackSite` - the stack site

Method Detail

### getSite

    protected IStackPresentationSite getSite()

  Returns the presentation site (not null).

  Returns:
    IStackPresentationSite

### setBounds

    public abstract void setBounds(Rectangle bounds)

  Sets the bounding rectangle for this presentation.

  Parameters:
    `bounds` - new bounding rectangle (not null)

### computeMinimumSize

    public abstract Point computeMinimumSize()

  Returns the minimum size for this stack. The stack is prevented from being resized smaller than this amount, and this is used as the default size for the stack when it is minimized. Typically, this is the amount of space required to fit the minimize, close, and maximize buttons and one tab.

  Returns:
    the minimum size for this stack (not null)

### dispose

    public abstract void dispose()

  Disposes all SWT resources being used by the stack. This is the last method that will be invoked on the stack.

### setActive

    public abstract void setActive(int newState)

  This is invoked to notify the presentation that its activation state has changed. StackPresentations can have three possible activation states (see the AS_* constants above)

  Parameters:
    `newState` - one of AS_INACTIVE, AS_ACTIVE, or AS_ACTIVE_NOFOCUS

### setVisible

    public abstract void setVisible(boolean isVisible)

  This causes the presentation to become visible or invisible. When a presentation is invisible, it must not respond to user input or modify its parts. For example, a presentations will be made invisible if it belongs to a perspective and the user switches to another perspective.

  Parameters:
    `isVisible` - the state to set visibility to
  Since:
    3.0

### setState

    public abstract void setState(int state)

  Sets the state of the presentation. That is, notifies the presentation that is has been minimized, maximized, or restored. Note that this method is the only way that a presentation is allowed to change its state.

  If a presentation wishes to minimize itself, it must call setState on its associated IPresentationSite. If the site chooses to respond to the state change, it will call this method at the correct time. The presentation should not call this method directly.

  Parameters:
    `state` - one of the IPresentationSite.STATE_* constants.

### getControl

    public abstract Control getControl()

  Returns the control for this presentation

  Returns:
    the control for this presentation (not null)

### addPart

    public abstract void addPart(IPresentablePart newPart,
                                 Object cookie)

  Adds the given part to the stack. The presentation is free to determine where the part should be inserted. If the part is being inserted as the result of a drag/drop operation, it will be given a cookie identifying the drop location. Has no effect if an identical part is already in the presentation.

  Parameters:
    `newPart` - the new part to add (not null)
    `cookie` - an identifier for a drop location, or null. When the presentation attaches a cookie to a StackDropResult, that cookie is passed back into addPart when a part is actually dropped in that location.

### removePart

    public abstract void removePart(IPresentablePart oldPart)

  Removes the given part from the stack.

  Parameters:
    `oldPart` - the part to remove (not null)

### selectPart

    public abstract void selectPart(IPresentablePart toSelect)

  Brings the specified part to the foreground. This should not affect the current focus.

  Parameters:
    `toSelect` - the new active part (not null)

### dragOver

    public abstract StackDropResult dragOver(Control currentControl,
                                             Point location)

  This method is invoked whenever a part is dragged over the stack's control. It returns a StackDropResult if and only if the part may be dropped in this location.

  Parameters:
    `currentControl` - the control being dragged over
    `location` - cursor location (display coordinates)
  Returns:
    a StackDropResult or null if the presentation does not have a drop target in this location.

### showSystemMenu

    public abstract void showSystemMenu()

  Instructs the presentation to display the system menu

### showPaneMenu

    public abstract void showPaneMenu()

  Instructs the presentation to display the pane menu

### showPartList

    public void showPartList()

  Instructs the presentation to display a list of all parts in the stack, and allow the user to change the selection using the keyboard.

### saveState

    public void saveState(IPresentationSerializer context,
                          IMemento memento)

  Saves the state of this presentation to the given memento.

  Parameters:
    `context` - object that can be used to generate unique IDs for IPresentableParts (this may be a temporary object - the presentation should not keep any references to it)
    `memento` - memento where the data will be saved

### restoreState

    public void restoreState(IPresentationSerializer context,
                             IMemento memento)

  Restores the state of this presentation to a previously saved state.

  Parameters:
    `context` - object that can be used to find IPresentableParts given string IDs (this may be a temporary object - the presentation should not keep any references to it)
    `memento` - memento where the data will be saved

### getTabList

    public abstract Control[] getTabList(IPresentablePart part)

  Returns the tab-key traversal order for the given `IPresentablePart`.

  Parameters:
    `part` - the part
  Returns:
    the tab-key traversal order

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.