public void postWindowOpen() {

    if (UnwCorePlugin.useBatchMode) {
      window = getWindowConfigurer().getWindow();
      window.getShell().setMinimized(true);
    }

    actionBarConfigurer = getWindowConfigurer().getActionBarConfigurer();
    myMenuBar = actionBarConfigurer.getMenuManager();

    ViewUtils.setStatusLineManager(actionBarConfigurer.getStatusLineManager());

    imageSsght = UnwGUIPlugin.getImageDescriptor("icons/eye2_32.png").createImage();
    getWindowConfigurer().getWindow().getShell().setImage(imageSsght);

    // register into the CoreManager the reference to the status line
    saveStatusLine();

    // remove foreign menu items
    cleanMenuBar();

    // remove foreign buttons in the tool bar
    cleanToolBar();

    UnwInfrastructure.postWindowOpen();
  }
예제 #2
0
  public Object run(ExecutionEvent event) throws ExecutionException {

    DBSelection dbSel =
        event == null ? null : new DBSelection(HandlerUtil.getCurrentSelection(event));

    if (model == null) {
      ElementDBNode sel = dbSel.getSel();

      if (sel instanceof InstanceDBNode)
        model = addSibling ? ((InstanceDBNode) sel).getInstDB().modelRoot() : dbSel.getModel();
      else if (sel instanceof ModelDBNode) model = ((ModelDBNode) sel).model();
    }

    if (model == null) {
      ViewUtils.setErrorMessage("no model selected to add the instance to, request ignored");
      return null;
    }

    Shell activeShell = ViewUtils.getTopShellActivePage();

    if (!ToolsDesignLib.isEditable(model.getDb())) {
      MessageDialog.openError(
          activeShell,
          "Add model",
          "Attempting to add a new model to the library "
              + model.getDb().getName()
              + ". Only the work library is editable, all others are read-only");
      return null;
    }

    SelectionDialogModel dialog = new SelectionDialogModel(activeShell, model.techno());

    if (dialog.open() == Window.OK) {
      for (ModelDB m : dialog.getDataModel().getSelectedModels()) {
        DBJobParam param = new DBJobParam();
        param.setSrcModel(m);
        param.setDstModel(model);

        InstanceAddDBJob job = new InstanceAddDBJob(param);

        job.launch();
      }
    }
    model = null;

    return null;
  }
예제 #3
0
  public Object execute(ExecutionEvent event) throws ExecutionException {

    DBSelection dbSel = new DBSelection(HandlerUtil.getCurrentSelection(event));

    ElementDBNode sel = dbSel.getSel();
    if (sel == null) {
      Logger.warn("nothing selected in the design browser, nothing to report");
      return null;
    }
    String selName = (sel instanceof ModelDBNode) ? "/" : ((InstanceDBNode) sel).getInstPath();

    MessageDialogWithToggle dialog =
        new MessageDialogWithToggle(
            HandlerUtil.getActiveShell(event),
            "Report type",
            null,
            "After clicking OK, the states of the current model are applied successively; "
                + "the currents found in each state are stored in a PowerPoint document ",
            MessageDialog.INFORMATION,
            new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
            0,
            "generate a power report instead",
            false);

    if (dialog.open() == Window.OK) {

      IScriptService interpreter = ScriptRegistry.instance.interpreter(SCRIPT_LANGAGE.TCL);

      try {
        interpreter.eval(
            "package require ms_report; ms_report::ppa_report "
                + selName
                + " "
                + (dialog.getToggleState() ? "power" : "current"),
            SCR_LOG_TYPE.PRINT_TRANSCRIPT);
      } catch (ScriptServiceException e) {
        ViewUtils.setErrorMessage("report generation failed", true);
      }
    }

    return null;
  }
 @Override
 public void run() {
   ClonePadBundleDialog dialog = new ClonePadBundleDialog(ViewUtils.getTopShellActivePage());
   dialog.open();
 }