简体   繁体   中英

How do I create a dockable “perspective-like” view in Eclipse PDE?

I've been searching for this information via Google but can't seem to get a satisfactory answer.

I wish to create a dockable view (similar to the " perspective " selection toolbar item) in Eclipse but don't really know which is the appropriate extension point to use.

The intent of this is to create some buttons on the top left of the toolbar when a certain perspective is activated. The "perspective" type view matches the behavior I wish to see.

So my question is:

  • Is this type of view reserved only for switching perspectives?
  • If so, what extension point should I look at, if not which extension point should I look at?

You can add a toolbar with your own commands to the main toolbar using org.eclipse.ui.menus . You would put a visibleWhen element on the command elements if you want it only visible when a certain perspective is open.

<visibleWhen>
   <with variable="activeWorkbenchWindow.activePerspective">
      <equals value="the.perspective.id"/>
   </with>
</visibleWhen>

See Toolbar Example for an example of the org.eclipse.ui.menus extension point, and Plugging into the Workbench for some basics on commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM