Eclipse rcp 在主编辑器区域外以编程方式打开方言编辑器(E3/E4混合)

Eclipse rcp 在主编辑器区域外以编程方式打开方言编辑器(E3/E4混合),eclipse-rcp,e4,eclipse-pde,pde,eclipse-sirius,Eclipse Rcp,E4,Eclipse Pde,Pde,Eclipse Sirius,我想做什么: 在我的RCP E3/E4混合版中,我有一个基于天狼星树的项目和库。用户可以将拖放项从库树拖动到项目树。这工作得很好,构建起来也不是什么大问题。所以现在我想让UI更可用。它应该是这样的布局: 什么有效: 应用程序启动后,我用DialoguiManager打开我的库演示文稿 final DialectEditor editor = (DialectEditor) DialectUIManager.INSTANCE.openEditor(siriusSession, descript

我想做什么:

在我的RCP E3/E4混合版中,我有一个基于天狼星树的项目和库。用户可以将拖放项从库树拖动到项目树。这工作得很好,构建起来也不是什么大问题。所以现在我想让UI更可用。它应该是这样的布局:

什么有效:

应用程序启动后,我用DialoguiManager打开我的库演示文稿

final DialectEditor editor = (DialectEditor) 
DialectUIManager.INSTANCE.openEditor(siriusSession, description, monitor);
好的,这很有效。但它在零件市场的编辑器中以org.eclipse.ui.editors的形式打开它。这不是我想要的

什么不起作用:

我想在“图书馆部分”中展示它。在打开编辑器后,我可以用鼠标手动移动它,但是我如何告诉DialoguiManager直接在那里打开它呢。或者我如何通过编程将其移动到那里

我在谷歌做了很多研究,但没有找到解决方案。我唯一发现的是皮埃尔·查尔斯·大卫的暗示

如果需要,只需在主编辑器之外显示编辑器 这是可能的,因为Eclipse4.2(e4)并没有真正处理 主编辑器区域),因此您可以使用您的编辑器 “围绕”另一个编辑器在其他视图中间。

但在这一步,我坚持了下来。我也在天狼星论坛上问过,但他们说这是Eclipse4的问题


感谢您的帮助、代码片段或指向手册正确部分的链接。

我找到了解决方案。这不是很好,但很管用。在编辑器打开后,我在这里执行这些代码

代码的作用:

他正在寻找ID为org的模板持有者。日食。用户界面。编辑。在那里,他下降,直到他与部分。它们处于兼容编辑器模式。然后,他选择我们要移出的部分,并将它们连接到MPartStack目标

  public static void movePart(MApplication application, 
            EModelService modelService) {

    MPart partToMove = null;
    MUIElement muiElement = 
            modelService.find("org.eclipse.ui.editorss", application);

    if (muiElement instanceof MPlaceholder) {
      MPlaceholder placeholder = (MPlaceholder) muiElement;
      MUIElement ref = placeholder.getRef();

      if (ref instanceof MArea) {
        MArea area = (MArea) ref;
        List<MPartSashContainerElement> children = area.getChildren();

        for (MPartSashContainerElement mPartSashContainerElement 
                                                       : children) {

          if (mPartSashContainerElement instanceof MPartStack) {
            MPartStack partStack = (MPartStack) mPartSashContainerElement;
            List<MStackElement> children2 = partStack.getChildren();
            for (MStackElement mStackElement : children2) {
              if (mStackElement instanceof MPart) {
                MPart part = (MPart) mStackElement;
                // Library is the Editor Name wiche I want to move
                if (part.getLabel().equals("Library")) {
                  partToMove = part;
                  break;
                }
              }
            }
          }
        }

      }
    }

    if (partToMove != null) {
      moveElement(modelService, application, partToMove);
    }
  }

  private static void moveElement(EModelService modelService, 
                    MApplication application, MPart part) {
    // target PartStack
    MUIElement find = modelService.find("de.bsg.onesps.rcp.
                               partstack.library", application);

    if (find instanceof MPartStack) {
      MPartStack mPartStack = (MPartStack) find;

      mPartStack.getChildren().add(part);
      mPartStack.setSelectedElement(part);
    }
  }
publicstaticvoidmovepart(MApplication应用程序、,
EModelService(模型服务){
MPart partToMove=null;
MUIElement MUIElement=
modelService.find(“org.eclipse.ui.editors”,应用程序);
if(模板持有者的多个实例){
MPlaceholder占位符=(MPlaceholder)muiElement;
MUIElement ref=占位符.getRef();
if(参考MArea实例){
MArea面积=(MArea)参考;
List children=area.getChildren();
用于(MPartSashContainerElement MPartSashContainerElement)
:儿童){
if(MPARTSHANCainerElement实例MPartStack){
MPartStack partStack=(MPartStack)MPARTSACHANDERElement;
List children2=partStack.getChildren();
for(MStackElement MStackElement:children2){
if(MPart的mStackElement实例){
MPart部件=(MPart)MSTACK元件;
//Library是我要移动的编辑器名称
if(part.getLabel().equals(“库”)){
partToMove=零件;
打破
}
}
}
}
}
}
}
if(partToMove!=null){
moveElement(模型服务、应用程序、partToMove);
}
}
私有静态void moveElement(EModelService modelService,
地图应用程序(MPart部分){
//目标部件堆栈
MUIElement find=modelService.find(“de.bsg.onesps.rcp。
partstack.library”,应用程序);
if(查找MPartStack的实例){
MPartStack MPartStack=(MPartStack)查找;
mPartStack.getChildren().add(部分);
mPartStack.setSelectedElement(零件);
}
}

我找到了解决办法。这不是很好,但很管用。在编辑器打开后,我在这里执行这些代码

代码的作用:

他正在寻找ID为org的模板持有者。日食。用户界面。编辑。在那里,他下降,直到他与部分。它们处于兼容编辑器模式。然后,他选择我们要移出的部分,并将它们连接到MPartStack目标

  public static void movePart(MApplication application, 
            EModelService modelService) {

    MPart partToMove = null;
    MUIElement muiElement = 
            modelService.find("org.eclipse.ui.editorss", application);

    if (muiElement instanceof MPlaceholder) {
      MPlaceholder placeholder = (MPlaceholder) muiElement;
      MUIElement ref = placeholder.getRef();

      if (ref instanceof MArea) {
        MArea area = (MArea) ref;
        List<MPartSashContainerElement> children = area.getChildren();

        for (MPartSashContainerElement mPartSashContainerElement 
                                                       : children) {

          if (mPartSashContainerElement instanceof MPartStack) {
            MPartStack partStack = (MPartStack) mPartSashContainerElement;
            List<MStackElement> children2 = partStack.getChildren();
            for (MStackElement mStackElement : children2) {
              if (mStackElement instanceof MPart) {
                MPart part = (MPart) mStackElement;
                // Library is the Editor Name wiche I want to move
                if (part.getLabel().equals("Library")) {
                  partToMove = part;
                  break;
                }
              }
            }
          }
        }

      }
    }

    if (partToMove != null) {
      moveElement(modelService, application, partToMove);
    }
  }

  private static void moveElement(EModelService modelService, 
                    MApplication application, MPart part) {
    // target PartStack
    MUIElement find = modelService.find("de.bsg.onesps.rcp.
                               partstack.library", application);

    if (find instanceof MPartStack) {
      MPartStack mPartStack = (MPartStack) find;

      mPartStack.getChildren().add(part);
      mPartStack.setSelectedElement(part);
    }
  }
publicstaticvoidmovepart(MApplication应用程序、,
EModelService(模型服务){
MPart partToMove=null;
MUIElement MUIElement=
modelService.find(“org.eclipse.ui.editors”,应用程序);
if(模板持有者的多个实例){
MPlaceholder占位符=(MPlaceholder)muiElement;
MUIElement ref=占位符.getRef();
if(参考MArea实例){
MArea面积=(MArea)参考;
List children=area.getChildren();
用于(MPartSashContainerElement MPartSashContainerElement)
:儿童){
if(MPARTSHANCainerElement实例MPartStack){
MPartStack partStack=(MPartStack)MPARTSACHANDERElement;
List children2=partStack.getChildren();
for(MStackElement MStackElement:children2){
if(MPart的mStackElement实例){
MPart部件=(MPart)MSTACK元件;
//Library是我要移动的编辑器名称
if(part.getLabel().equals(“库”)){
partToMove=零件;
打破
}
}
}
}
}
}
}
if(partToMove!=null){
moveElement(模型服务、应用程序、partToMove);
}
}
私有静态void moveElement(EModelService modelService,
地图应用程序(MPart部分){
//目标部件堆栈
MUIElement find=modelService.find(“de.bsg.onesps.rcp。
partstack.library”,应用程序);
if(查找MPartStack的实例){
MPartStack MPartStack=(MPartStack)查找;
mPartStack.getChildren().add(部分);
mPartStack.setSelectedElement(零件);
}
}
我不知道是什么
D