Classes, Objects, and Methods - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Classes, Objects, and Methods

Description:

PlatformUI class provides access to a single workbench. ... A page's parts are arranged (tiled or stacked) for presentation on the screen. ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 25
Provided by: Bru460
Category:

less

Transcript and Presenter's Notes

Title: Classes, Objects, and Methods


1
Chapter 4
org.eclipse.ui
2
Package org.eclipse.ui Description
  • Application programming interfaces for
    interaction with any extension of the Eclipse
    Platform User Interface.

3
  • PlatformUI class provides access to a single
    workbench. 
  • A workbench is the root object for the UI and has
    one or more workbench windows. 
  • Each workbench window has a collection of
    workbench pages, only one of which is active and
    visible to the end user. 
  • Each workbench page has a collection of workbench
    parts. 
  • A page's parts are arranged (tiled or stacked)
    for presentation on the screen. 
  • Within a page and its parts the user can interact
    with and modify a model (typically resources in a
    workspace).  

4
  • There are two kinds of workbench parts views and
    editors. 
  • An editor is typically used to edit or browse a
    document or input object. 
  • A view is typically used to navigate a hierarchy
    of information (like the workspace), open an
    editor, or display properties for the active
    editor.

5
  • The platform creates a workbench when the
    workbench plug-in is activated. 
  • Since this happens at most once during the life
    of the running platform, there is only one
    workbench instance. Due to its singular nature,
    it is commonly referred to as the workbench.
  • Within a workbench the user will interact with
    many different resource types.  Because different
    tools are required for each, the workbench
    defines a number of extension points which allow
    for the integration of new tools.  There are
    extension points for views, editors, action sets,
    import wzards, export wizards, etc.  

6
(No Transcript)
7
org.eclipse.ui.PlatformUI
  • public final class PlatformUI extends Object
  • The central class for access to the Eclipse
    Platform User Interface.
  • cannot be instantiated all functionality is
    provided by static methods.
  • Features provided access to the workbench.
  • static String PLUGIN_ID "org.eclipse.ui"
  • Identifies the workbench plugin.
  • static IWorkbench getWorkbench()
  • Returns the workbench interface.

8
IWorkbench
  • A workbench is the root object for the Eclipse
    Platform user interface.
  • has one or more main windows which present to the
    end user information based on some underlying
    model, typically on resources in an underlying
    workspace.
  • usually starts with a single open window, and
    automatically closes when its last window closes.

9
Method Summary
  •  void addWindowListener( IWindowListener listener)
  •  Adds a window listener.
  •  boolean close()
  • Closes this workbench and all its open windows.
  •  IWorkbenchWindow getActiveWorkbenchWindow()
  • Returns the currently active window for this
    workbench (if any).
  •  IDecoratorManager getDecoratorManager()
  • Returns the decorator manager.
  •  IEditorRegistry getEditorRegistry()
  • Returns the editor registry for the workbench.
  •  IMarkerHelpRegistry getMarkerHelpRegistry()
  • Returns the marker help registry for the
    workbench.

10
  •  IPerspectiveRegistry getPerspectiveRegistry()
  • Returns the perspective registry for the
    workbench.
  •  PreferenceManager getPreferenceManager()
  • Returns the preference manager for the workbench.
  •  IPreferenceStore getPreferenceStore()
  • Returns the preference store for the workbench.
  •  ISharedImages getSharedImages()
  • Returns the shared images for the workbench.
  •  IWorkbenchWindow getWorkbenchWindows()
  • Returns a list of the open main windows
    associated with this workbench.
  •  IWorkingSetManager getWorkingSetManager()
  • Returns the working set manager for the
    workbench.

11
  •  IWorkbenchWindow openWorkbenchWindow
    (IAdaptable input)
  • Creates and opens a new workbench window with one
    page.
  •  IWorkbenchWindow openWorkbenchWindow
    (String perspID, IAdaptable input)
  • Creates and opens a new workbench window with one
    page.
  •  void removeWindowListener(IWindowListener l)
  • Removes a window listener.
  •  boolean restart()
  • Closes then restarts this workbench.

12
  •  IWorkbenchPage showPerspective
    (String perspectiveId, IWorkbenchWindow  window)
  • IWorkbenchPage showPerspective(
    String perspectiveId, IWorkbenchWindow window,
    IAdaptable input)
  • Shows the specified perspective to the user.

13
IWorkbenchSite
  • All Known Subinterfaces
  • IEditorSite, IPageSite,
  • IViewSite, IWorkbenchPartSite
  • All Known Implementing Classes
  • MultiPageEditorSite, PageSite
  • The common interface between the workbench and
    its parts, including pages within parts.
  • Not intended to be implemented or extended by
    clients.

14
Method Summary
  • IWorkbenchPage getPage()
  • Returns the page containing this workbench site.
  •  Shell getShell()
  • Returns the shell for this workbench site.
  •  IWorkbenchWindow getWorkbenchWindow()
  • Returns the workbench window containing this
    workbench site.
  •  ISelectionProvider getSelectionProvider()
  • Returns the selection provider for this workbench
    site.
  •  void setSelectionProvider(ISelectionProvider prov
    ider)
  • Sets the selection provider for this workbench
    site.

15
IWorkbenchPage
  • public interface IWorkbenchPage extends
    IPartService, ISelectionService
  • A workbench page consists of an arrangement of
    views and editors intended to be presented
    together to the user in a single workbench
    window.
  • A page can contain 0 or more views and 0 or more
    editors.
  • These views and editors are contained wholly
    within the page and are not shared with other
    pages.
  • The layout and visible action set for the page is
    defined by a perspective.

16
  • The number of views and editors within a page is
    restricted to simplify part management for the
    user. In particular
  • Only one instance of a particular view type may
    exist within a workbench page.
  • Only one editor can exist for each editor input
    (i.e., resource) within a page.
  • This interface is not intended to be implemented
    by clients.

17
Method Summary
  • void activate(IWorkbenchPart part)
  • Activates the given part.part must belongs to
    this page.
  • void addPropertyChangeListener (IPropertyChangeLis
    tener listener)
  • Deprecated. 
  • void bringToTop(IWorkbenchPart part)
  • Moves the given part forward in the Z order of
    this page so as to make it visible, without
    changing which part has focus.
  •  boolean close()
  • Closes this workbench page.
  •  boolean closeAllEditors(boolean save)
  • Closes all of the editors belonging to this
    workbench page.

18
  • boolean closeEditor ( IEditorPart editor,
    boolean save)
  • Closes the given editor.
  • IEditorPart findEditor(IEditorInput input)
  • Returns the editor with the specified input.
  •  IViewPart findView(String viewId)
  • Returns the view in this page with the specified
    id.
  •  IEditorPart getActiveEditor()
  • Returns the active editor open in this page.
  •  IEditorPart getDirtyEditors()
  • Returns a list of dirty editors in this page.
  •  IEditorReference getEditorReferences()
  • Returns a array of references to open editors in
    this page.

19
  •  int getEditorReuseThreshold()
  • Deprecated.  
  •  IEditorPart getEditors()
  • Deprecated. use getEditorReferences() instead
  •  IAdaptable getInput()
  • Returns the input for this page.
  •  String getLabel()
  • Returns the page label.
  •  IPerspectiveDescriptor getPerspective()
  • Returns the current perspective descriptor for
    this page.
  •  IViewReference getViewReferences()
  • Returns a list of the reference to views visible
    on this page.

20
  • IViewPart getViews()
  • Deprecated. use getViewReferences() instead.
  •  IWorkbenchWindow getWorkbenchWindow()
  • Returns the workbench window of this page.
  •  IWorkingSet getWorkingSet()
  • Deprecated. individual views should store a
    working set if needed
  •  void hideActionSet(String actionSetID)
  • Hides an action set in this page.
  •  void hideView(IViewPart view)
  • Hides the given view.

21
  •  boolean isEditorAreaVisible()
  • Returns whether the page's current perspective is
    showing the editor area.
  •  IEditorPart openEditor( (IEditorInput IFile
    ) input , String editorId , boolean activate)
  • Opens an editor on the given input object.
  • editorId is the extension id in plugin.xml
  • IEditorPart openEditor(IMarker marker ,
    boolean activate)
  • Opens an editor on the file resource of the given
    marker.
  •  void openSystemEditor(IFile input)
  • Opens an operating system editor on a given file.
  • void removePropertyChangeListener
    (IPropertyChangeListener listener)
  • Deprecated. 

22
  •  void resetPerspective()
  • Changes the visible views, their layout, and the
    visible action sets within the page to match the
    current perspective descriptor.
  •  boolean saveAllEditors(boolean confirm)
  • Saves the contents of all dirty editors belonging
    to this workbench page.
  •  boolean saveEditor(IEditorPart editor,
    boolean confirm)
  • Saves the contents of the given editor if dirty.
  •  void savePerspective()
  • Saves the visible views, their layout, and the
    visible action sets for this page to the current
    perspective descriptor.

23
  • void savePerspectiveAs( IPerspectiveDescriptor 
    perspective)
  • Saves the visible views, their layout, and the
    visible action sets for this page to the given
    perspective descriptor.
  • void setEditorAreaVisible(boolean showEditorArea)
  • Show or hide the editor area for the page's
    active perspective.
  • void setEditorReuseThreshold(int openEditors)
  • Deprecated. 
  •  void setPerspective(IPerspectiveDescriptor perspe
    ctive)
  • Changes the visible views, their layout, and the
    visible action sets within the page to match the
    given perspective descriptor.

24
  •  void showActionSet(String actionSetID)
  • Shows an action set in this page.
  •  IViewPart showView(String viewId)
  • Shows a view in this page and give it focus.
Write a Comment
User Comments (0)
About PowerShow.com