Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse 向现有Gui添加新的透视图_Eclipse_User Interface_Plugins_View_Perspective - Fatal编程技术网

Eclipse 向现有Gui添加新的透视图

Eclipse 向现有Gui添加新的透视图,eclipse,user-interface,plugins,view,perspective,Eclipse,User Interface,Plugins,View,Perspective,因此,我一直在开发一个具有不同视图的单一透视图的GUI。但现在我们需要另一种不同观点的新视角。我一直在网上寻找添加透视图的示例和教程,但没有找到我想要的 附加的图像显示了我的GUI。在“示例菜单”中,我希望有一个菜单项可以打开我的新透视图 我试图解决这个问题,是想在原有的基础上添加另一个视角,但什么也没发生。 我的下一个想法是将第二个透视图的打开添加为第一个透视图菜单中的一个动作。但我不知道该怎么做,也不知道这是否是正确的方法。插件的一个片段如下所示 您确实需要添加一个菜单项来打开

因此,我一直在开发一个具有不同视图的单一透视图的GUI。但现在我们需要另一种不同观点的新视角。我一直在网上寻找添加透视图的示例和教程,但没有找到我想要的

附加的图像显示了我的GUI。在“示例菜单”中,我希望有一个菜单项可以打开我的新透视图

我试图解决这个问题,是想在原有的基础上添加另一个视角,但什么也没发生。 我的下一个想法是将第二个透视图的打开添加为第一个透视图菜单中的一个动作。但我不知道该怎么做,也不知道这是否是正确的方法。插件的一个片段如下所示




您确实需要添加一个菜单项来打开新的透视图。此操作的代码类似于Eclipse
ShowPerspectiveHandler

IWorkbench workbench=PlatformUI.getWorkbench();
IWorkbenchWindow activeWorkbenchWindow=workbench.getActiveWorkbenchWindow();
IWorkbenchPage activePage=activeWorkbenchWindow.getActivePage();
IPerspectiveDescriptor desc=workbench.getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
setPerspective(desc);
(为了清晰起见,省略了大量错误检查)

  <perspective
        name="RCP Perspective"
        class="chipcoach.Perspective"
        id="ChipCoach.perspective">
  </perspective>

  <perspective
        class="chipcoach.Perspective2"
        id="ChipCoach.perspective2"
        name="PopupPerspective">
  </perspective>
<extension
     point="org.eclipse.ui.perspectiveExtensions">
  <perspectiveExtension
        targetID="ChipCoach.perspective">
  </perspectiveExtension>
  <perspectiveExtension
        targetID="ChipCoach.perspective2">
  </perspectiveExtension>
</extension>

   <extension
     point="org.eclipse.ui.actionSets">
  <actionSet
        id="ChipCoach.actionSet"
        label="Sample Action Set"
        visible="true">
     <menu
           id="sampleMenu"
           label="Sample &amp;Menu">
        <separator
              name="sampleGroup">
        </separator>
     </menu>
     <action
           class="chipcoach.actions.SampleAction"
           icon="icons/sample.gif"
           id="chipcoach.actions.SampleAction"
           label="&amp;Sample Action"
           menubarPath="sampleMenu/sampleGroup"
           toolbarPath="sampleGroup"
           tooltip="Hello, Eclipse world">
     </action>
     <action
           class="chipcoach.actions.OpenPerspective1"
           icon="icons/sample.gif"
           id="chipcoach.actions.openPerspective1"
           label="&amp;Open Perspective"
           menubarPath="sampleMenu/sampleGroup"
           style="push"
           toolbarPath="sampleGroup">
     </action>
  </actionSet>