Example #1
0
  /**
   * Runs the tool denoted by the given name.
   *
   * @param aToolName the name of the tool to run, cannot be <code>null</code>;
   * @param aParent the parent window to use, can be <code>null</code>.
   */
  public void runTool(final String aToolName, final Window aParent) {
    if (LOG.isLoggable(Level.INFO)) {
      LOG.log(Level.INFO, "Running tool: \"{0}\" ...", aToolName);
    }

    final Tool tool = findToolByName(aToolName);
    if (tool == null) {
      JOptionPane.showMessageDialog(
          aParent, "No such tool found: " + aToolName, "Error ...", JOptionPane.ERROR_MESSAGE);
    } else {
      final ToolContext context = createToolContext();
      tool.process(aParent, this.dataContainer, context, this);
    }

    updateActions();
  }
Example #2
0
 /**
  * Asks the user for confirmation.
  *
  * @param aWindow the parent window of the confirmation dialog;
  * @param aMessage the message to display in the confirmation dialog;
  * @param aTitle the title to display in the confirmation dialog.
  * @return <code>true</code> if the user acknowledged the confirmation, <code>false</code>
  *     otherwise.
  */
 public static boolean askConfirmation(
     final Window aWindow, final String aMessage, final String aTitle) {
   return JOptionPane.showConfirmDialog(
           aWindow, aMessage, aTitle, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)
       != JOptionPane.YES_OPTION;
 }