コード例 #1
0
  /**
   * Removes the passed profile from the configuration.
   *
   * @param p the profile to be removed
   */
  public void removeProfile(Profile p) {
    profiles.remove(p);
    try {
      profileModels.removeAll(p.getProfilePackages());
    } catch (ProfileException e) {
      LOG.error("Exception", e);
    }

    FigNodeStrategy fns = p.getFigureStrategy();
    if (fns != null) {
      figNodeStrategies.remove(fns);
    }

    if (formatingStrategy == p.getFormatingStrategy()) {
      formatingStrategy = null;
    }

    List<Profile> markForRemoval = new ArrayList<Profile>();
    for (Profile profile : profiles) {
      if (profile.getDependencies().contains(p)) {
        markForRemoval.add(profile);
      }
    }

    for (Profile profile : markForRemoval) {
      removeProfile(profile);
    }

    updateStrategies();
    ArgoEventPump.fireEvent(
        new ArgoProfileEvent(
            ArgoEventTypes.PROFILE_REMOVED, new PropertyChangeEvent(this, "profile", p, null)));
  }
コード例 #2
0
  /**
   * Applies a new profile to this configuration
   *
   * @param p the profile to be applied
   */
  @SuppressWarnings("unchecked")
  public void addProfile(Profile p) {
    if (!profiles.contains(p)) {
      profiles.add(p);
      try {
        profileModels.addAll(p.getProfilePackages());
      } catch (ProfileException e) {
        LOG.warn("Error retrieving profile's " + p + " packages.", e);
      }

      FigNodeStrategy fns = p.getFigureStrategy();
      if (fns != null) {
        figNodeStrategies.add(fns);
      }

      for (Profile dependency : p.getDependencies()) {
        addProfile(dependency);
      }

      updateStrategies();
      ArgoEventPump.fireEvent(
          new ArgoProfileEvent(
              ArgoEventTypes.PROFILE_ADDED, new PropertyChangeEvent(this, "profile", null, p)));
    }
  }
コード例 #3
0
 /*
  * @see org.argouml.uml.notation.NotationProvider#parse(java.lang.Object, java.lang.String)
  */
 public void parse(Object modelElement, String text) {
   try {
     parseStateBody(modelElement, text);
   } catch (ParseException pe) {
     String msg = "statusmsg.bar.error.parsing.statebody";
     Object[] args = {
       pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()),
     };
     ArgoEventPump.fireEvent(
         new ArgoHelpEvent(
             ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args)));
   }
 }
コード例 #4
0
 /**
  * Send all events when the settings are changed to refresh anything rendered with these settings.
  */
 public void notifyOfChangedSettings() {
   /*
    * Since body ever looks
    * at the type of the diagram appearance event, we can simplify from
    * sending every existing event to one event only. But since there is no
    * catch-all event defined, we just use one. Rationale: reduce the
    * number of total refreshes of the drawing.
    */
   ConfigurationKey key = Configuration.makeKey("diagramappearance", "all");
   ArgoEventPump.fireEvent(
       new ArgoDiagramAppearanceEvent(
           ArgoEventTypes.DIAGRAM_FONT_CHANGED,
           new PropertyChangeEvent(this, key.getKey(), "0", "0")));
 }
コード例 #5
0
 @Override
 public void parse(Object modelElement, String text) {
   try {
     parseEnumerationLiteralFig(
         Model.getFacade().getEnumeration(modelElement), modelElement, text);
   } catch (ParseException pe) {
     String msg = "statusmsg.bar.error.parsing.enumeration-literal";
     Object[] args = {
       pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()),
     };
     ArgoEventPump.fireEvent(
         new ArgoHelpEvent(
             ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args)));
   }
 }
コード例 #6
0
 /**
  * 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.
  *
  * <p>TODO: This code is also present in other root Figs...
  *
  * @param s the given string to be localized and shown
  */
 protected void showHelp(String s) {
   ArgoEventPump.fireEvent(
       new ArgoHelpEvent(ArgoEventTypes.HELP_CHANGED, this, Translator.localize(s)));
 }