You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by jr...@apache.org on 2002/10/29 18:10:40 UTC

cvs commit: jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui CactusPreferencePage.java CactusPlugin.java CactusPreferences.java CactusMessages.java

jruaux      2002/10/29 09:10:40

  Modified:    Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui
                        CactusPreferencePage.java CactusPlugin.java
                        CactusPreferences.java CactusMessages.java
  Log:
  Added preferences in the preference page for directories
  
  Revision  Changes    Path
  1.5       +37 -16    jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPreferencePage.java
  
  Index: CactusPreferencePage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPreferencePage.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CactusPreferencePage.java	22 Oct 2002 13:50:09 -0000	1.4
  +++ CactusPreferencePage.java	29 Oct 2002 17:10:39 -0000	1.5
  @@ -57,7 +57,6 @@
   package org.apache.cactus.eclipse.ui;
   
   import org.eclipse.jface.preference.FieldEditorPreferencePage;
  -import org.eclipse.jface.preference.IPreferenceStore;
   import org.eclipse.jface.preference.RadioGroupFieldEditor;
   import org.eclipse.jface.preference.StringFieldEditor;
   import org.eclipse.jface.preference.IntegerFieldEditor;
  @@ -82,8 +81,10 @@
    * @version $Id$
    * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
  + * @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
    */
  -public class CactusPreferencePage extends FieldEditorPreferencePage
  +public class CactusPreferencePage
  +    extends FieldEditorPreferencePage
       implements IWorkbenchPreferencePage
   {
       /**
  @@ -94,8 +95,9 @@
           super(GRID);
           setPreferenceStore(CactusPlugin.getDefault().getPreferenceStore());
           // TODO: externalize
  -        setDescription("Preferences of the Apache Cactus plug-in "
  -            + "for in-container unit testing");
  +        setDescription(
  +            "Preferences of the Apache Cactus plug-in "
  +                + "for in-container unit testing");
       }
   
       /**
  @@ -108,18 +110,37 @@
       {
           // TODO: externalize labels
           addField(new RadioGroupFieldEditor(
  -            CactusPreferences.CONTEXT_URL_SCHEME, "Protocol:", 1,
  -            new String[][] { { "HTTP", "http" }, { "HTTP over SSL", "https" } },
  -            getFieldEditorParent()));
  -        addField(new StringFieldEditor(
  -            CactusPreferences.CONTEXT_URL_HOST, "Host:",
  -            getFieldEditorParent()));
  -        addField(new IntegerFieldEditor(
  -            CactusPreferences.CONTEXT_URL_PORT, "Port:",
  -            getFieldEditorParent()));
  -        addField(new StringFieldEditor(
  -            CactusPreferences.CONTEXT_URL_PATH, "Context:",
  -            getFieldEditorParent()));
  +            CactusPreferences.CONTEXT_URL_SCHEME,
  +            "Protocol:",
  +            1,
  +            new String[][] { { "HTTP", "http" }, {
  +                "HTTP over SSL", "https" }
  +        }, getFieldEditorParent()));
  +        addField(
  +            new StringFieldEditor(
  +                CactusPreferences.CONTEXT_URL_HOST,
  +                "Host:",
  +                getFieldEditorParent()));
  +        addField(
  +            new IntegerFieldEditor(
  +                CactusPreferences.CONTEXT_URL_PORT,
  +                "Port:",
  +                getFieldEditorParent()));
  +        addField(
  +            new StringFieldEditor(
  +                CactusPreferences.CONTEXT_URL_PATH,
  +                "Context:",
  +                getFieldEditorParent()));
  +        addField(
  +            new StringFieldEditor(
  +                CactusPreferences.JARS_DIR,
  +                "Jars directory:",
  +                getFieldEditorParent()));
  +        addField(
  +            new StringFieldEditor(
  +                CactusPreferences.TEMP_DIR,
  +                "Temp directory:",
  +                getFieldEditorParent()));
       }
   
       /**
  
  
  
  1.7       +29 -5     jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPlugin.java
  
  Index: CactusPlugin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPlugin.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CactusPlugin.java	22 Oct 2002 13:33:14 -0000	1.6
  +++ CactusPlugin.java	29 Oct 2002 17:10:39 -0000	1.7
  @@ -56,6 +56,8 @@
    */
   package org.apache.cactus.eclipse.ui;
   
  +import org.apache.cactus.eclipse.containers.GenericAntProvider;
  +import org.apache.cactus.eclipse.containers.IContainerProvider;
   import org.eclipse.core.runtime.IPluginDescriptor;
   import org.eclipse.core.runtime.IStatus;
   import org.eclipse.core.runtime.Status;
  @@ -81,7 +83,8 @@
       private static CactusPlugin plugin;
   
       /**
  -     * @see org.eclipse.core.runtime.Plugin#Plugin(IPluginDescriptor)
     */
  +     * @see org.eclipse.core.runtime.Plugin#Plugin(IPluginDescriptor)
  +     */
       public CactusPlugin(IPluginDescriptor theDescription)
       {
           super(theDescription);
  @@ -89,14 +92,16 @@
       }
   
       /**
  -     * @return the single instance of this plug-in runtime class
     */
  +     * @return the single instance of this plug-in runtime class
  +     */
       public static CactusPlugin getDefault()
       {
           return plugin;
       }
   
       /**
  -     * @return the active workbench shell
     */
  +     * @return the active workbench shell
  +     */
       public static Shell getActiveWorkbenchShell()
       {
           IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow();
  @@ -131,8 +136,13 @@
   
       public static void log(Throwable theThrowable)
       {
  -        log(new Status(IStatus.ERROR, getPluginId(), IStatus.ERROR, "Error", 
  -            theThrowable));
  +        log(
  +            new Status(
  +                IStatus.ERROR,
  +                getPluginId(),
  +                IStatus.ERROR,
  +                "Error",
  +                theThrowable));
       }
   
       public static void log(IStatus theStatus)
  @@ -165,6 +175,20 @@
           theStore.setDefault(CactusPreferences.CONTEXT_URL_HOST, "localhost");
           theStore.setDefault(CactusPreferences.CONTEXT_URL_PORT, 8080);
           theStore.setDefault(CactusPreferences.CONTEXT_URL_PATH, "test");
  +        theStore.setDefault(
  +            CactusPreferences.JARS_DIR,
  +            "D:/dev/cactus/jakarta-cactus-13-1.4b1/lib");
  +        theStore.setDefault(CactusPreferences.TEMP_DIR, "D:/temp/target");
       }
   
  +    /**
  +     * Returns a container provider.
  +     * @return IContainerProvider a container provider to use for Cactus tests.
  +     */
  +    public static IContainerProvider getContainerProvider()
  +    {
  +        return new GenericAntProvider(
  +            CactusPreferences.getContextURLPort(),
  +            CactusPreferences.getTempDir());
  +    }
   }
  
  
  
  1.2       +71 -13    jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPreferences.java
  
  Index: CactusPreferences.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusPreferences.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CactusPreferences.java	22 Oct 2002 08:43:41 -0000	1.1
  +++ CactusPreferences.java	29 Oct 2002 17:10:39 -0000	1.2
  @@ -63,6 +63,7 @@
    * 
    * @version $Id$
    * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
  + * @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
    */
   public class CactusPreferences
   {
  @@ -70,26 +71,32 @@
        * The protocol scheme component of the context URL (either 'http' or 
        * 'https') preference.
        */
  -    public static final String CONTEXT_URL_SCHEME =
  -        "contextURL_Scheme";
  +    public static final String CONTEXT_URL_SCHEME = "contextURL_Scheme";
   
       /**
        * The host component of the context URL preference. 
        */
  -    public static final String CONTEXT_URL_HOST =
  -        "contextURL_Host";
  +    public static final String CONTEXT_URL_HOST = "contextURL_Host";
   
       /**
        * The port component of the context URL preference.
        */
  -    public static final String CONTEXT_URL_PORT =
  -        "contextURL_Port";
  +    public static final String CONTEXT_URL_PORT = "contextURL_Port";
   
       /**
        * The path component of the context URL preference.
        */
  -    public static final String CONTEXT_URL_PATH =
  -        "contextURL_Path";
  +    public static final String CONTEXT_URL_PATH = "contextURL_Path";
  +    
  +    /**
  +     * The directory of the jars needed by Cactus.
  +     */
  +    public static final String JARS_DIR = "jars_Dir";
  +
  +    /**
  +     * The temp directory used by the plugin to set up containers.
  +     */
  +    public static final String TEMP_DIR = "temp_Dir";
   
       /**
        * Returns the context URL that should be used by the client, as 
  @@ -100,12 +107,63 @@
       public static String getContextURL()
       {
           IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
  -        StringBuffer buf = new StringBuffer()
  -            .append(store.getString(CONTEXT_URL_SCHEME)).append("://")
  -            .append(store.getString(CONTEXT_URL_HOST)).append(":")
  -            .append(store.getInt(CONTEXT_URL_PORT)).append("/")
  -            .append(store.getString(CONTEXT_URL_PATH));
  +        StringBuffer buf =
  +            new StringBuffer()
  +                .append(store.getString(CONTEXT_URL_SCHEME))
  +                .append("://")
  +                .append(store.getString(CONTEXT_URL_HOST))
  +                .append(":")
  +                .append(store.getInt(CONTEXT_URL_PORT))
  +                .append("/")
  +                .append(store.getString(CONTEXT_URL_PATH));
           return buf.toString();
       }
   
  +    /**
  +     * Returns the context URL port that should be used by the client, as 
  +     * configured in the plug-in preferences.
  +     * 
  +     * @return the context port
  +     */
  +    public static int getContextURLPort()
  +    {
  +        IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
  +        return store.getInt(CONTEXT_URL_PORT);
  +    }
  +    
  +    /**
  +     * Returns the context URL path that should be used by the client, as 
  +     * configured in the plug-in preferences.
  +     * 
  +     * @return the context path
  +     */
  +    public static String getContextURLPath()
  +    {
  +        IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
  +        return store.getString(CONTEXT_URL_PATH);
  +    }
  +
  +    /**
  +     * Returns the directory containing the jars needed by cactus, as 
  +     * configured in the plug-in preferences.
  +     * 
  +     * @return the context path
  +     */
  +    public static String getJarsDir()
  +    {
  +        IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
  +        return store.getString(JARS_DIR);
  +    }
  +
  +    /**
  +     * Returns the temp directory used by cactus, as 
  +     * configured in the plug-in preferences.
  +     * 
  +     * @return the context path
  +     */
  +    public static String getTempDir()
  +    {
  +        IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
  +        return store.getString(TEMP_DIR);
  +    }    
   }
  
  
  
  1.2       +56 -0     jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusMessages.java
  
  Index: CactusMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/ui/CactusMessages.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CactusMessages.java	19 Oct 2002 09:54:47 -0000	1.1
  +++ CactusMessages.java	29 Oct 2002 17:10:39 -0000	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Cactus" and "Apache Software
  + *    Foundation" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
  + *    written permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + *
  + */
   package org.apache.cactus.eclipse.ui;
   
   import java.text.MessageFormat;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>