psmith      2004/05/13 20:21:13

  Modified:    src/java/org/apache/log4j/chainsaw LogUI.java
                        ApplicationPreferenceModel.java
               src/java/org/apache/log4j/chainsaw/prefs default.properties
  Log:
  If the last version the user ran is different from the version number that is being 
run now,
  then the user is prompted to view the Release Notes.
  
  A nice way I think of getting the user to see what has changed, and be able to 
communicate
  anything ugly they might need to workaround, or anything they might need to do by 
hand etc...
  
  Revision  Changes    Path
  1.93      +33 -0     logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- LogUI.java        14 May 2004 02:44:58 -0000      1.92
  +++ LogUI.java        14 May 2004 03:21:13 -0000      1.93
  @@ -32,6 +32,7 @@
   import org.apache.log4j.chainsaw.prefs.SettingsListener;
   import org.apache.log4j.chainsaw.prefs.SettingsManager;
   import org.apache.log4j.chainsaw.receivers.ReceiversPanel;
  +import org.apache.log4j.chainsaw.version.VersionManager;
   import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.helpers.OptionConverter;
   import org.apache.log4j.net.SocketNodeEventListener;
  @@ -280,6 +281,8 @@
   
       logUI.getApplicationPreferenceModel().apply(model);
   
  +    logUI.checkForNewerVersion();
  +    
       if (newShutdownAction != null) {
         logUI.setShutdownAction(newShutdownAction);
       } else {
  @@ -793,6 +796,8 @@
         initializationLock.notifyAll();
       }
   
  +    
  +    
       if (
         noReceiversDefined
           && applicationPreferenceModel.isShowNoReceiverWarning()) {
  @@ -925,6 +930,34 @@
     }
   
     /**
  +   * Checks the last run version number against this compiled version number and 
prompts the user
  +   * to view the release notes if the 2 strings are different.
  +   */
  +  private void checkForNewerVersion()
  +  {
  +      /**
  +       * Now check if the version they last used (if any) is
  +       * different than the version that is currently running
  +       */
  +      
  +      String lastUsedVersion = getApplicationPreferenceModel().getLastUsedVersion();
  +      String currentVersionNumber = VersionManager.getInstance().getVersionNumber();
  +      if(lastUsedVersion==null || !lastUsedVersion.equals(currentVersionNumber)) {
  +          if(JOptionPane.showConfirmDialog(this, "This version looks like it is 
different than the version you last ran. (" + lastUsedVersion + " vs " + 
currentVersionNumber+")\n\nWould you like to view the Release Notes?", "Newer 
Version?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
  +              SwingUtilities.invokeLater(new Runnable() {
  +                  
  +                  public void run()
  +                  {
  +                      
HelpManager.getInstance().setHelpURL(ChainsawConstants.RELEASE_NOTES_URL);
  +                      
  +                  }});
  +          }
  +      }
  +      // Lets set this new version as the current version so we don't get nagged 
all the time...
  +      getApplicationPreferenceModel().setLastUsedVersion(currentVersionNumber);
  +  }
  +
  +/**
      * Display the log tree pane, using the last known divider location
      */
     private void showReceiverPanel() {
  
  
  
  1.18      +20 -0     
logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java
  
  Index: ApplicationPreferenceModel.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ApplicationPreferenceModel.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ApplicationPreferenceModel.java   20 Apr 2004 00:39:40 -0000      1.17
  +++ ApplicationPreferenceModel.java   14 May 2004 03:21:13 -0000      1.18
  @@ -40,6 +40,7 @@
       private boolean showSplash;
       private String lookAndFeelClassName;
       private int toolTipDisplayMillis;
  +    private String lastUsedVersion;
       
       
       private int responsiveness;
  @@ -169,6 +170,7 @@
          setShowSplash(event.asBoolean("showSplash"));
          setToolTipDisplayMillis(event.asInt("toolTipDisplayMillis"));
          setConfigurationURL(event.getSetting("configurationURL"));
  +       setLastUsedVersion(event.getSetting("lastUsedVersion"));
       }
   
       /* (non-Javadoc)
  @@ -187,6 +189,7 @@
           event.saveSetting("showSplash", isShowSplash());
           event.saveSetting("toolTipDisplayMillis", getToolTipDisplayMillis());
           event.saveSetting("configurationURL", getConfigurationURL());
  +        event.saveSetting("lastUsedVersion", getLastUsedVersion());
       }
   
       /**
  @@ -207,6 +210,7 @@
         setShowSplash(model.isShowSplash());
         setToolTipDisplayMillis(model.getToolTipDisplayMillis());
         setConfigurationURL(model.getConfigurationURL());
  +      setLastUsedVersion(model.getLastUsedVersion());
       }
       
       /**
  @@ -355,5 +359,21 @@
           Object oldValue = this.configurationURL;
           this.configurationURL = configurationURL;
           firePropertyChange("configurationURL", oldValue, this.configurationURL);
  +    }
  +    /**
  +     * @return Returns the lastUsedVersion.
  +     */
  +    public final String getLastUsedVersion()
  +    {
  +        return this.lastUsedVersion;
  +    }
  +    /**
  +     * @param lastUsedVersion The lastUsedVersion to set.
  +     */
  +    public final void setLastUsedVersion(String lastUsedVersion)
  +    {
  +        String oldValue = this.lastUsedVersion;
  +        this.lastUsedVersion = lastUsedVersion;
  +        firePropertyChange("lastUsedVersion", oldValue, this.lastUsedVersion);
       }
   }
  
  
  
  1.17      +1 -0      
logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- default.properties        12 May 2004 06:37:31 -0000      1.16
  +++ default.properties        14 May 2004 03:21:13 -0000      1.17
  @@ -25,6 +25,7 @@
   confirmExit=true
   toolTipDisplayMillis=4000
   configurationURL=
  +lastUsedVersion=
   
   # These are the default LogPanel settings
   dateFormatPattern=ISO8601
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to