Esempio n. 1
0
  public void actionPerformed(ActionEvent ae) {
    ProjectBrowser pb = ProjectBrowser.TheInstance;
    Project p = pb.getProject();
    Object target = pb.getDetailsTarget();
    if (!(target instanceof MClassifier)) return;
    MClassifier cls = (MClassifier) target;

    MAttribute attr = MMUtil.SINGLETON.buildAttribute(cls);
    super.actionPerformed(ae);
  }
    public CopyAction(UMLDeploymentDiagram d) {

      super(MComponentInstanceImpl.class, d.getName());
      diagram = d;
      ProjectBrowser pb = ProjectBrowser.TheInstance;
      Object target = pb.getDetailsTarget();
      if (target instanceof MClass) {
        orig = (MClass) target;

        System.err.println("--------------------------------" + target.getClass());
      }
    }
  public boolean disable() {
    GenericArgoMenuBar menubar = (GenericArgoMenuBar) ProjectBrowser.getInstance().getJMenuBar();
    menubar.remove(menuSequence);
    menubar.updateUI();

    // remove it from the toolbar.
    JToolBar toolbar =
        ((GenericArgoMenuBar) ProjectBrowser.getInstance().getJMenuBar()).getCreateDiagramToolbar();

    toolbar.remove(toolbarBtn);
    toolbar.updateUI();

    PropPanelFactoryManager.removePropPanelFactory(propPanelFactory);

    LOG.info("SequenceDiagram Module disabled.");
    return true;
  }
 /*
  * @see junit.framework.TestCase#setUp()
  */
 public void setUp() throws Exception {
   super.setUp();
   InitializeModel.initializeDefault();
   new InitProfileSubsystem().init();
   ProjectBrowser.makeInstance(null, true, new JPanel());
   InitSubSystemForTest.initSubsystem(new InitUmlUI());
   InitSubSystemForTest.initSubsystem(new InitNotationUml());
 }
  /** @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(java.awt.event.MouseEvent) */
  public Vector getPopUpActions(MouseEvent me) {
    Vector popUpActions = super.getPopUpActions(me);

    // TODO: Remove this line after 0.20.
    // This is a hack that removes the ordering menu according to issue 3645
    popUpActions.remove(0);

    // popupAddOffset should be equal to the number of items added here:
    popUpActions.addElement(new JSeparator());
    popupAddOffset = 1;
    if (removeFromDiagram) {
      popUpActions.addElement(ProjectBrowser.getInstance().getRemoveFromDiagramAction());
      popupAddOffset++;
    }
    popUpActions.addElement(new ActionDeleteModelElements());
    popupAddOffset++;

    /* Check if multiple items are selected: */
    boolean ms = TargetManager.getInstance().getTargets().size() > 1;
    if (!ms) {
      // #if defined(COGNITIVE)
      // @#$LPS-COGNITIVE:GranularityType:Statement
      // @#$LPS-COGNITIVE:Localization:NestedStatement
      ToDoList list = Designer.theDesigner().getToDoList();
      Vector items = (Vector) list.elementsForOffender(getOwner()).clone();
      if (items != null && items.size() > 0) {
        ArgoJMenu critiques = new ArgoJMenu("menu.popup.critiques");
        ToDoItem itemUnderMouse = hitClarifier(me.getX(), me.getY());
        if (itemUnderMouse != null) {
          critiques.add(new ActionGoToCritique(itemUnderMouse));
          critiques.addSeparator();
        }
        int size = items.size();
        for (int i = 0; i < size; i++) {
          ToDoItem item = (ToDoItem) items.elementAt(i);
          if (item == itemUnderMouse) continue;
          critiques.add(new ActionGoToCritique(item));
        }
        popUpActions.insertElementAt(new JSeparator(), 0);
        popUpActions.insertElementAt(critiques, 0);
      }
    }
    // #endif

    // Add stereotypes submenu
    Action[] stereoActions = getApplyStereotypeActions();
    if (stereoActions != null) {
      popUpActions.insertElementAt(new JSeparator(), 0);
      ArgoJMenu stereotypes = new ArgoJMenu("menu.popup.apply-stereotypes");
      for (int i = 0; i < stereoActions.length; ++i) {
        stereotypes.addCheckItem(stereoActions[i]);
      }
      popUpActions.insertElementAt(stereotypes, 0);
    }
    return popUpActions;
  }
Esempio n. 6
0
 /**
  * @see
  *     org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
  */
 protected void textEdited(FigText ft) throws PropertyVetoException {
   super.textEdited(ft);
   Object classifier = getOwner();
   if (classifier == null) {
     return;
   }
   int i = new Vector(getAttributesFig().getFigs()).indexOf(ft);
   if (i != -1) {
     highlightedFigText = (CompartmentFigText) ft;
     highlightedFigText.setHighlighted(true);
     try {
       Object attribute = highlightedFigText.getOwner();
       ParserDisplay.SINGLETON.parseAttributeFig(
           classifier, attribute, highlightedFigText.getText().trim());
       ProjectBrowser.getInstance().getStatusBar().showStatus("");
     } catch (ParseException pe) {
       String msg = "statusmsg.bar.error.parsing.attribute";
       Object[] args = {pe.getLocalizedMessage(), new Integer(pe.getErrorOffset())};
       ProjectBrowser.getInstance().getStatusBar().showStatus(Translator.messageFormat(msg, args));
     }
     return;
   }
   i = new Vector(getOperationsFig().getFigs()).indexOf(ft);
   if (i != -1) {
     highlightedFigText = (CompartmentFigText) ft;
     highlightedFigText.setHighlighted(true);
     try {
       Object operation = highlightedFigText.getOwner();
       ParserDisplay.SINGLETON.parseOperationFig(
           classifier, operation, highlightedFigText.getText().trim());
       ProjectBrowser.getInstance().getStatusBar().showStatus("");
     } catch (ParseException pe) {
       String msg = "statusmsg.bar.error.parsing.operation";
       Object[] args = {pe.getLocalizedMessage(), new Integer(pe.getErrorOffset())};
       ProjectBrowser.getInstance().getStatusBar().showStatus(Translator.messageFormat(msg, args));
     }
     return;
   }
 }
  public boolean enable() {
    // Register into the menu.
    JToolBar toolbar =
        ((GenericArgoMenuBar) ProjectBrowser.getInstance().getJMenuBar()).getCreateDiagramToolbar();
    // there is no setIndex or similar, so we have to add
    // twice, and it moves the item instead of adding again.
    toolbarBtn = toolbar.add(newSequence);
    toolbar.add(toolbarBtn, 3);
    toolbar.updateUI();

    propPanelFactory = new SequenceDiagramPropPanelFactory();
    PropPanelFactoryManager.addPropPanelFactory(propPanelFactory);

    LOG.info("SequenceDiagram Module enabled.");
    return true;
  }
 /**
  * The use of this method in the top-level package prevents that the subsystem would depend on the
  * GUI.
  *
  * @param subsystem the subsystem to be initialised
  */
 static void initSubsystem(InitSubsystem subsystem) {
   subsystem.init();
   for (GUISettingsTabInterface tab : subsystem.getSettingsTabs()) {
     // TODO: This work should be deferred until actually needed for
     // display
     GUI.getInstance().addSettingsTab(tab);
   }
   for (GUISettingsTabInterface tab : subsystem.getProjectSettingsTabs()) {
     // TODO: This work should be deferred until actually needed for
     // display
     GUI.getInstance().addProjectSettingsTab(tab);
   }
   for (AbstractArgoJPanel tab : subsystem.getDetailsTabs()) {
     /* All tabs are added at the end, except a TabToDoTarget: */
     ((DetailsPane) ProjectBrowser.getInstance().getDetailsPane())
         .addTab(tab, !(tab instanceof TabToDoTarget));
   }
 }
Esempio n. 9
0
 public boolean shouldBeEnabled() {
   ProjectBrowser pb = ProjectBrowser.TheInstance;
   Object target = pb.getDetailsTarget();
   return super.shouldBeEnabled() && target instanceof MClassifier;
 }
 /**
  * Utility function to localize the given string with help text, and show it in the status bar of
  * the ArgoUML window. This function is used in favour of the inline call to enable later
  * improvements; e.g. it would be possible to show a help-balloon. TODO: Work this out. One matter
  * to possibly improve: show multiple lines.
  *
  * @param s the given string to be localized and shown
  */
 protected void showHelp(String s) {
   ProjectBrowser.getInstance().getStatusBar().showStatus(Translator.localize(s));
 }
 public void doIt() {
   ProjectBrowser pb = ProjectBrowser.TheInstance;
   pb.setTarget(diagram);
   super.doIt();
 }