Beispiel #1
0
  /** Construct a ToDo tab for the property panel. */
  public TabToDo() {
    super("tab.todo-item");
    setIcon(new LeftArrowIcon());

    String position = Configuration.getString(Configuration.makeKey("layout", "tabtodo"));
    setOrientation(
        ((position.equals("West") || position.equals("East"))
            ? Vertical.getInstance()
            : Horizontal.getInstance()));

    setLayout(new BorderLayout());

    Object[] actions = {actionNewToDoItem, actionResolve, actionSnooze};
    ToolBarFactory factory = new ToolBarFactory(actions);
    factory.setRollover(true);
    factory.setFloatable(false);
    factory.setOrientation(SwingConstants.VERTICAL);
    JToolBar toolBar = factory.createToolBar();
    toolBar.setName(getTitle());
    add(toolBar, BorderLayout.WEST);

    splitPane = new BorderSplitPane();
    add(splitPane, BorderLayout.CENTER);
    setTarget(null);

    addComponentListener(this);

    // TODO: Register listener for target ToDo item changes
    // and for new showStep() requests
  }
  /**
   * Manages the selection of the default tool in a popup tool in the toolbar.
   *
   * <p>I.e. in a toolbar, you can have tools that can be opened, into a grid of tools. The last
   * used tool is remembered, and put at the top when the popup is closed, i.e. is the only tool
   * that remains visible. This remembering is persistent, hence stored in the configuration file,
   * under a certain key (i.e. name).
   *
   * @param actions the array of actions that make up the popup
   * @param key appendix for the key for the configuration file
   */
  public static void manageDefault(Object[] actions, String key) {
    Action defaultAction = null;
    ConfigurationKey k = Configuration.makeKey("default", "popupactions", key);
    String defaultName = Configuration.getString(k);
    PopupActionsListener listener = new PopupActionsListener(k);
    for (int i = 0; i < actions.length; ++i) {
      if (actions[i] instanceof Action) {
        Action a = (Action) actions[i];
        if (a.getValue(Action.NAME).equals(defaultName)) {
          defaultAction = a;
        }
        a.addPropertyChangeListener(listener);
      } else if (actions[i] instanceof Object[]) {
        Object[] actionRow = (Object[]) actions[i];
        for (int j = 0; j < actionRow.length; ++j) {
          Action a = (Action) actionRow[j];
          if (a.getValue(Action.NAME).equals(defaultName)) {
            defaultAction = a;
          }
          a.addPropertyChangeListener(listener);
        }
      }
    }

    if (defaultAction != null) {
      defaultAction.putValue("isDefault", Boolean.valueOf(true));
    }
  }
Beispiel #3
0
 private void loadDirectoriesFromConfiguration() {
   disableConfigurationUpdate = true;
   StringTokenizer tokenizer =
       new StringTokenizer(
           Configuration.getString(KEY_DEFAULT_DIRECTORIES), DIRECTORY_SEPARATOR, false);
   while (tokenizer.hasMoreTokens()) {
     searchDirectories.add(tokenizer.nextToken());
   }
   disableConfigurationUpdate = false;
 }
Beispiel #4
0
  /**
   * Try and return the existing instance if one exists.
   *
   * @return the instance
   * @throws MalformedURLException when the url is bad
   */
  public static ImportClassLoader getInstance() throws MalformedURLException {

    if (instance == null) {
      String path =
          Configuration.getString(Argo.KEY_USER_IMPORT_CLASSPATH, System.getProperty("user.dir"));
      return getInstance(getURLs(path));
    } else {
      return instance;
    }
  }
Beispiel #5
0
  private void loadDefaultProfilesfromConfiguration() {
    if (!disableConfigurationUpdate) {
      disableConfigurationUpdate = true;

      String defaultProfilesList = Configuration.getString(KEY_DEFAULT_PROFILES);
      if (defaultProfilesList.equals("")) {
        // if the list does not exist add the code generation and
        // good practices profiles as default
        addToDefaultProfiles(profileGoodPractices);
        addToDefaultProfiles(profileCodeGeneration);
      } else {
        StringTokenizer tokenizer =
            new StringTokenizer(defaultProfilesList, DIRECTORY_SEPARATOR, false);

        while (tokenizer.hasMoreTokens()) {
          String desc = tokenizer.nextToken();
          Profile p = null;

          if (desc.charAt(0) == 'U') {
            String fileName = desc.substring(1);
            File file;
            try {
              file = new File(new URI(fileName));

              p = findUserDefinedProfile(file);

              if (p == null) {
                try {
                  p = new UserDefinedProfile(file, this);
                  registerProfileInternal(p);
                } catch (ProfileException e) {
                  LOG.error("Error loading profile: " + file, e);
                }
              }
            } catch (URISyntaxException e1) {
              LOG.error("Invalid path for Profile: " + fileName, e1);
            } catch (Throwable e2) {
              LOG.error("Error loading profile: " + fileName, e2);
            }
          } else if (desc.charAt(0) == 'C') {
            String profileIdentifier = desc.substring(1);
            p = lookForRegisteredProfile(profileIdentifier);
          }
          if (p != null) {
            addToDefaultProfiles(p);
          }
        }
      }
      disableConfigurationUpdate = false;
    }
  }
  /**
   * This executes one of the actions, based on the stored ArgoUML configuration. This function is
   * intended for the initial setting of the snap when ArgoUML is started.
   */
  static void init() {
    String id = Configuration.getString(Argo.KEY_SNAP, DEFAULT_ID);
    List<Action> actions = createAdjustSnapActions();
    for (Action a : actions) {
      if (a.getValue("ID").equals(id)) {
        a.actionPerformed(null);

        if (myGroup != null) {
          for (Enumeration e = myGroup.getElements(); e.hasMoreElements(); ) {
            AbstractButton ab = (AbstractButton) e.nextElement();
            Action action = ab.getAction();
            if (action instanceof ActionAdjustSnap) {
              String currentID = (String) action.getValue("ID");
              if (id.equals(currentID)) {
                myGroup.setSelected(ab.getModel(), true);
                return;
              }
            }
          }
        }
        return;
      }
    }
  }
 @Override
 public boolean isEnabled() {
   String projectPath = Configuration.getString(Argo.ANDROMDA_PROJECT_PATH, null);
   if (projectPath != null) return true;
   return false;
 }
 /*
  * @see org.argouml.ui.GUISettingsTabInterface#handleResetToDefault()
  */
 public void handleResetToDefault() {
   userFullname.setText(Configuration.getString(Argo.KEY_USER_FULLNAME));
   userEmail.setText(Configuration.getString(Argo.KEY_USER_EMAIL));
   // There is no default description.
 }
Beispiel #9
0
 /** Get the user-configured path. */
 public void loadUserPath() {
   setPath(Configuration.getString(Argo.KEY_USER_IMPORT_CLASSPATH, ""));
 }