コード例 #1
0
      @Override
      public Object[] create(ICreateContext context) {
        // create SPP
        SPPRef spp = RoomFactory.eINSTANCE.createSPPRef();
        spp.setName("");

        ActorContainerClass acc =
            (ActorContainerClass)
                context.getTargetContainer().getLink().getBusinessObjects().get(0);

        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        SPPPropertyDialog dlg = new SPPPropertyDialog(shell, spp, acc, true, false);
        if (dlg.open() != Window.OK)
          // find a method to abort creation
          // throw new RuntimeException();
          return EMPTY;

        doneChanges = true;

        acc.getIfSPPs().add(spp);

        // do the add
        addGraphicalRepresentation(context, spp);

        // return newly created business object(s)
        return new Object[] {spp};
      }
コード例 #2
0
      @Override
      public void execute(ICustomContext context) {
        SPPRef spp =
            (SPPRef) getBusinessObjectForPictogramElement(context.getPictogramElements()[0]);
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        ActorContainerClass acc = (ActorContainerClass) spp.eContainer();
        boolean refport = isRefItem(context.getPictogramElements()[0]);

        SPPPropertyDialog dlg = new SPPPropertyDialog(shell, spp, acc, false, refport);
        if (dlg.open() != Window.OK)
          // TODOHRR: introduce a method to revert changes, does hasDoneChanges=false roll back
          // changes?
          // throw new RuntimeException();
          return;

        updateSPPFigure(
            spp,
            context.getPictogramElements()[0],
            manageColor(DARK_COLOR),
            manageColor(BRIGHT_COLOR));
      }