Index: org.lams.toolbuilder/.cvsignore
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/.cvsignore,v
diff -u -r1.1 -r1.2
--- org.lams.toolbuilder/.cvsignore 6 Sep 2007 07:19:22 -0000 1.1
+++ org.lams.toolbuilder/.cvsignore 11 Oct 2007 02:03:33 -0000 1.2
@@ -1,2 +1,2 @@
*.class
-bin
\ No newline at end of file
+bin
Index: org.lams.toolbuilder/build-toolbuidler.xml
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/build-toolbuidler.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ org.lams.toolbuilder/build-toolbuidler.xml 11 Oct 2007 02:03:33 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+
+
+
+
Index: org.lams.toolbuilder/plugin.xml
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/plugin.xml,v
diff -u -r1.1 -r1.2
--- org.lams.toolbuilder/plugin.xml 22 Aug 2007 14:07:19 -0000 1.1
+++ org.lams.toolbuilder/plugin.xml 11 Oct 2007 02:03:33 -0000 1.2
@@ -16,7 +16,7 @@
nameList;
- private String regexIgnorePrefix;
- private String regexIgnoreSuffix;
-
- private static final int MAX_REPLACEMENTS = 20;
+ private String vendor; // needs to be implicitly defined to replace the directory file
public RenameTool()
{
@@ -61,10 +60,10 @@
txtType.add("xml");
}
- public boolean renameTool(List nameList, String source) throws Exception
+ public boolean renameTool(List nameList, String source, String vendor, IProgressMonitor monitor) throws Exception
{
this.nameList = nameList;
-
+ this.vendor = vendor.replaceAll(" " , "").toLowerCase();
this.sourceDirStr = source;
File sourceDir = new File(sourceDirStr);
@@ -74,15 +73,16 @@
throw new FileNotFoundException("Source file: " + sourceDirStr + "not found.");
}
- visitFile(sourceDir, "rename");
+ visitFile(sourceDir, "rename", monitor);
return true;
}
public void renameFile(File dir) {
-
- for (String[] pair : nameList) {
- String newFileName = updateFilename(dir.getName(), pair[0], pair[1]);
+ String regex;
+ for (String[] task : nameList) {
+ regex = constructRegex(task[0], task[1], task[2], task[3]);
+ String newFileName = updateFilename(dir.getName(), regex, task[3]);
dir.renameTo(new File(dir.getParentFile(), newFileName));
}
}
@@ -92,13 +92,13 @@
String newFileName = currentFileName.replaceAll(regex, replacement);
- if (!currentFileName.equals(newFileName)) {
+ /*if (!currentFileName.equals(newFileName)) {
String format = "Renamed %1$-40s ---> %2$-1s\n";
System.out.format(format, currentFileName, newFileName);
- }
+ }*/
return newFileName;
}
@@ -115,80 +115,27 @@
String line;
while ((line = br.readLine()) != null) {
- regexIgnorePrefix = "";
- regexIgnoreSuffix = "";
String regex;
ArrayList replacedStrings = new ArrayList();
- for (String[] pair : nameList)
+ for (String[] task : nameList)
{
- regex = constructRegex(pair[0], pair[1], replacedStrings);
- System.out.println("REGEX: " + regex);
- /*
- * First check that the string to be replaced is not a substring of the replacement string
- * Ie if we want to replace forum with testforum, and the searcher finds testforum,
- * we dont want to end up with testtestforum.
- */
- /*
- if (pair[1].indexOf(pair[0])>0 || pair[1].startsWith(pair[0]))
- {
- // The string to be replaced is a substring of the replacement string
- System.out.println("SUB STRING: " + pair[1] + " " + pair[0] );
- Pattern p = Pattern.compile(pair[0]);
- String startAndEnd[]= p.split(pair[1]);
- System.out.println("SUB STRING startAndEnd: "+startAndEnd[0] +" " +startAndEnd[startAndEnd.length -1]);
-
-
- if (pair[1].startsWith(startAndEnd[0])&&startAndEnd[0].length()>0)
- {
- regexIgnorePrefix += addRegexIgnoreConstruct(startAndEnd[0], true);
- System.out.println("Prefix regex changed: " + regexIgnorePrefix);
- }
-
- if (pair[1].endsWith(startAndEnd[startAndEnd.length -1]) && startAndEnd[startAndEnd.length -1].length()>0)
- {
- regexIgnoreSuffix += addRegexIgnoreConstruct(startAndEnd[startAndEnd.length -1], false);
- System.out.println("Suffix regex changed: " + regexIgnoreSuffix);
- }
- }
+ //regex = constructRegex(task[0], task[1], replacedStrings);
+ //System.out.println("REGEX: " + regex);
+
+ //System.out.println("AARGH: " + task[0] + "," + task[1] + "," + task[2] + "," + task[3]);
+ regex = constructRegex(task[0], task[1], task[2], task[3]);
- /* TODO:
- * Next check all strings that have been replaced and dont replace them again
- */
- /*
- for (String replaceString: replaceStrings)
- {
- if (pair[1].indexOf(replaceString)>0)
- {
- System.out.println("REPLACE STRING: "+pair[1] + " " + replaceString);
- Pattern p = Pattern.compile(pair[1]);
- String startAndEnd[]= p.split(replaceString);
- System.out.println("REPLACE startAndEnd: "+startAndEnd[0] +" " +startAndEnd[startAndEnd.length -1]);
-
- if (pair[1].startsWith(startAndEnd[0]))
- regexIgnorePrefix += addRegexIgnoreConstruct(startAndEnd[0], true);
-
- if (pair[1].endsWith(startAndEnd[startAndEnd.length -1]))
- regexIgnoreSuffix += addRegexIgnoreConstruct(startAndEnd[startAndEnd.length -1], false);
- }
- }
- regex = "(" +regexIgnorePrefix+ ")" +pair[0]+ "(" +regexIgnoreSuffix+ ")";
- */
-
-
-
-
-
String temp = line;
- line = line.replaceAll(regex, pair[1]);
+ line = line.replaceAll(regex, task[3]);
if (!temp.equals(line))
- System.out.println("REGEX: " +regex+ " TEXT REPLACEMENT: " + temp + " replaced with: " + line);
+ //System.out.println("REGEX: " +regex+ " TEXT REPLACEMENT: " + temp + " replaced with: " + line);
- replacedStrings.add(pair[1]);
+ replacedStrings.add(task[1]);
}
bw.write(line);
@@ -210,7 +157,7 @@
}
- public void visitFile(File file, String mode)
+ public void visitFile(File file, String mode, IProgressMonitor monitor)
{
boolean rename=true;
@@ -230,21 +177,21 @@
{
// it is a language file, delete if not the default language
// if it is the default language, do not alter it
- if (file.getName().contains(this.DEFAULT_LANGUAGE))
+ if (file.getName().contains(this.DEFAULT_LANGUAGE) || file.getName().equals("ApplicationResources.properties"))
{
return;
}
else
{
file.delete();
- System.out.println("Deleted non-default language file: " + file.getPath());
+ //System.out.println("Deleted non-default language file: " + file.getPath());
}
}
if (file.isDirectory()) {
String[] children = file.list();
for (int i = 0; i < children.length; i++) {
- visitFile(new File(file, children[i]), mode);
+ visitFile(new File(file, children[i]), mode, monitor);
}
}
@@ -261,11 +208,23 @@
}
renameFile(file);
}
-
+
+ /**
+ * This rename must be done after the recursion to prevent
+ * an unexpected break in the recursion
+ */
+ if (file.isDirectory() && file.getName().equals("lamsfoundation"))
+ {
+ // we need to implicitly replace this with the new vendor
+ String newFileName = updateFilename(file.getName(), "lamsfoundation", vendor);
+ file.renameTo(new File(file.getParentFile(), newFileName));
+ }
+
if (mode.equals("delete")) {
file.delete();
- System.out.println("Deleted file: " + file.getPath());
+ //System.out.println("Deleted file: " + file.getPath());
}
+ monitor.worked(1);
}
public File getFile(String[] array) {
@@ -298,15 +257,52 @@
return "("+operator+ignore+")";
}
+ /**
+ * This method returns adds an ignore prefix or suffix to an existing regex construct
+ * @param currRegex the current regex
+ * @param ignoreRegex the ignore string you wish to add
+ * @param isPrefix true if it is a prefix false if it is a suffix
+ * @return the regex with the ignore contruct added to it
+ */
+ public String constructRegexPrefixOrSuffix(String currRegex, String ignoreRegex, boolean isPrefix)
+ {
+ String ret = addRegexIgnoreConstruct(ignoreRegex, isPrefix);
+
+
+ if (currRegex.length()==0) // if it is an empty regex, return a new ignore regex
+ {
+ if (ignoreRegex.length()==0) //if there is nothing to add, return nothing
+ {
+ return "";
+ }
+ else
+ {
+ return ret;
+ }
+ }
+ else // add an ignore construct to the existing regex
+ {
+ if(ignoreRegex.length()==0) //return the current regex if theres nothing to add
+ {
+ return currRegex;
+ }
+ else
+ {
+ return "("+ ret + currRegex + ")";
+ }
+ }
+
+ }
+
/**
* This function constructs a safe regular expression for search and replace
* @param startRegex the starting regex that needs to be validated
* @param rename the string that will be replacing the strings found by regex
* @param replacedStrings a list of strings that have already been used for replacement
* @return
*/
- public String constructRegex(String startRegex, String rename, ArrayList replacedStrings)
+ public String constructRegex(String regexPrefix, String regexSuffix, String startRegex, String rename)
{
//System.out.println("HELLO: " + startRegex + " " + rename);
if (rename.contains(startRegex))
@@ -317,71 +313,42 @@
String startAndEnd[]= p.split(rename);
//System.out.println("SUB STRING startAndEnd: "+startAndEnd[0] +" " +startAndEnd[startAndEnd.length -1]);
-
+ //System.out.println("HELLO: " + regexPrefix + "," + regexSuffix + "," + startRegex + "," + rename);
if (startAndEnd.length>0)
{
if (startAndEnd[0].length()>0 && rename.startsWith(startAndEnd[0]))
{
- String prefix = addRegexIgnoreConstruct(startAndEnd[0], true);
- if (!regexIgnoreSuffix.contains(prefix))
- {
- regexIgnorePrefix += prefix;
- //System.out.println("Prefix regex changed: " + regexIgnorePrefix);
- }
+ regexPrefix = constructRegexPrefixOrSuffix(regexPrefix, startAndEnd[0], true);
+ //System.out.println("Prefix regex changed: " + regexPrefix);
+
}
if (startAndEnd[startAndEnd.length -1].length()>0 && rename.endsWith(startAndEnd[startAndEnd.length -1]))
{
- String suffix = addRegexIgnoreConstruct(startAndEnd[startAndEnd.length -1], false);
- if (!regexIgnoreSuffix.contains(suffix))
- {
- regexIgnoreSuffix += suffix;
- //System.out.println("Suffix regex changed: " + regexIgnoreSuffix);
- }
+
+ regexSuffix = constructRegexPrefixOrSuffix(regexSuffix, startAndEnd[0], true);;
+ //System.out.println("Suffix regex changed: " + regexSuffix);
+
}
}
}
+ return regexPrefix + startRegex + regexSuffix;
+
+ }
+
+
+ public void renameProperties(String serverVersion, String hideTool, String toolVersion, IProgressMonitor monitor)
+ {
+ File properties = new File(sourceDirStr+ "/build.properties");
- /* TODO: add regex prefix and suffix into separate methods to reduce code size
- * Next check all strings that have been replaced and dont replace them again
- */
- for (String replacedString: replacedStrings)
- {
- System.out.println("REPLACE STRING: "+startRegex + " " + replacedString);
- if (startRegex.contains(replacedString))
- {
- System.out.println("REPLACE STRING TRUE: "+startRegex + " " + replacedString);
- Pattern p = Pattern.compile(startRegex);
- String startAndEnd[]= p.split(replacedString);
-
-
-
- if (startAndEnd.length>0)
- {
- if (startAndEnd[0].length()>0 && startRegex.startsWith(startAndEnd[0]))
- {
- String prefix = addRegexIgnoreConstruct(startAndEnd[0], true);
- if (!regexIgnoreSuffix.contains(prefix))
- {
- regexIgnorePrefix += prefix;
- System.out.println("Prefix regex changed: " + regexIgnorePrefix);
- }
- }
-
-
- if (startAndEnd[startAndEnd.length -1].length()>0 && startRegex.endsWith(startAndEnd[startAndEnd.length -1]))
- {
- String suffix = addRegexIgnoreConstruct(startAndEnd[startAndEnd.length -1], false);
- if (!regexIgnoreSuffix.contains(suffix))
- {
- regexIgnoreSuffix += suffix;
- System.out.println("Suffix regex changed: " + regexIgnoreSuffix);
- }
- }
- }
- }
- }
+ nameList.clear();
+ nameList.add(new String[] {"", "", "hideTool=.+", "hideTool=" + hideTool});
+ nameList.add(new String[] {"", "", "min.server.version.number=.+", "min.server.version.number=" + serverVersion});
+ nameList.add(new String[] {"", "", "tool.version=.+", "tool.version=" + toolVersion});
- return "(" +regexIgnorePrefix+ ")" +startRegex+ "(" +regexIgnoreSuffix+ ")";
+ this.replaceText(properties);
+
}
+
+
}
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameToolTaskList.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameToolTaskList.java,v
diff -u -r1.4 -r1.5
--- org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameToolTaskList.java 19 Sep 2007 06:49:44 -0000 1.4
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameToolTaskList.java 11 Oct 2007 02:03:33 -0000 1.5
@@ -28,34 +28,54 @@
import java.util.List;
import org.lams.toolbuilder.util.Constants;
import java.util.ArrayList;
+import java.util.Random;
+import java.lang.Math;
+/**
+ * A helper class to create task lists for the rename tool
+ * based on information gained from the wizard
+ *
+ * Uses Eclipse lazy initialisation so that only the needed
+ * tasklists are initialised to preserve memory
+ *
+ * @author Luke Foxton
+ */
public class RenameToolTaskList
{
private String toolTemplate; // the tool that will be used as a template
private String toolSig; // the tool signature of the new tool
- //private String toolName; // the name of the new tool
private String toolDispName; // the display name of the new tool
-
+ private String vendor; // the vendor who is creating the new tool
private String classPrefix; // the string to replce the tool's java class prefixes with eg JavaClass
private String variablePrefix; // the string to replce the tool's java variable prefixes with eg javaVariable
private List tasklist; // the tasklist created for the rename tool
- public RenameToolTaskList(String tooltemplate, String toolsig, String tooldispname)
+ // success tests came with lamsfoundation(([\\\\/\\.]lams[\\\\/\\.]tool[\\\\/\\.]forum))
+ private static final String VENDOR_REGEX_SUFFIX = "(?=([\\\\/\\.]lams[\\\\/\\.]tool[\\\\/\\.]";
+ /**
+ * Contructor for the RenameToolTaskList
+ * @param tooltemplate the template that will be used for the new project
+ * @param toolsig the new tool signature of the project
+ * @param tooldispname the new display name of the project
+ */
+ public RenameToolTaskList(String tooltemplate, String toolsig, String tooldispname, String vendorin)
{
- tasklist = new ArrayList();
+ tasklist = new ArrayList();
+
+ this.vendor = vendorin.replace(" ", "").toLowerCase();
+
this.toolTemplate = tooltemplate.trim();
this.toolSig = toolsig.trim();
- //this.toolName = toolname.trim();
this.toolDispName = tooldispname.trim();
init();
}
-
- /* Main init
- * Calls other inits to creat different tasklists for each tool template
- * Using Eclipse lazy initialisation to make sure variables are only
+ /**
+ * Main init
+ * Calls other inits to create different tasklists for each tool template
+ * using Eclipse lazy initialisation to make sure variables are only
* initialised when they are needed
*
* LAMS DEFAULT TOOLS:
@@ -89,38 +109,80 @@
else if (toolTemplate.equals(Constants.VOTE_TOOL_DIR)) {initVote();}
}
- public void initChat() {}
-
+ /**
+ * Init for forum template
+ */
public void initForum()
{
- System.out.println("Java Class Prefix: " + classPrefix);
- System.out.println("Java Variable Prefix: " + variablePrefix);
-
-
-
- tasklist.add(new String[] {"TestForum", "Test" + classPrefix});
- tasklist.add(new String[] {"Forum", classPrefix});
- tasklist.add(new String[] {"forum", variablePrefix.toLowerCase()});
- tasklist.add(new String[] {"lafrum11", toolSig});
+ tasklist.add(new String[] {"", VENDOR_REGEX_SUFFIX + "forum))", "lamsfoundation", vendor});
+ tasklist.add(new String[] {"","","TestForum", "Test" + classPrefix});
+ tasklist.add(new String[] {"","","Forum", classPrefix});
+ tasklist.add(new String[] {"((? getTasklist() {return tasklist;}
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java,v
diff -u -r1.3 -r1.4
--- org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java 18 Sep 2007 05:56:54 -0000 1.3
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java 11 Oct 2007 02:03:33 -0000 1.4
@@ -16,7 +16,7 @@
public static final String PROP_HIDE_TOOL = "hideTool";
- // Tool folder names for all defaul LAMS tools
+ // Tool folder names for all default LAMS tools
public static final String CHAT_TOOL_DIR = "lams_tool_chat";
public static final String FORUM_TOOL_DIR = "lams_tool_forum";
public static final String MC_TOOL_DIR = "lams_tool_lamc";
@@ -34,31 +34,71 @@
/**
* Instantiates the defaultTools variable
+ * We are only making forum, share resources, noticeboard and notebook
+ * available becuase the others are either too complicated or too badly
+ * structured for re-use
*/
public static void initToolProjects()
{
defaultTools = new String[]
{
- CHAT_TOOL_DIR,
+ //CHAT_TOOL_DIR,
FORUM_TOOL_DIR,
- MC_TOOL_DIR,
- QA_TOOL_DIR,
+ //MC_TOOL_DIR,
+ //QA_TOOL_DIR,
SHARE_RESOURCE_TOOL_DIR,
NOTICEBOARD_TOOL_DIR,
- NOTEBOOK_TOOL_DIR,
- SUBMIT_TOOL_DIR,
- SCRIBE_TOOL_DIR,
- SURVEY_TOOL_DIR,
- VOTE_TOOL_DIR
+ NOTEBOOK_TOOL_DIR//,
+ //SUBMIT_TOOL_DIR,
+ //SCRIBE_TOOL_DIR,
+ //SURVEY_TOOL_DIR,
+ //VOTE_TOOL_DIR
};
}
+
+ // Tool signatures for all default LAMS tools
+ public static final String CHAT_TOOL_SIG = "lachat11";
+ public static final String FORUM_TOOL_SIG = "lafrum11";
+ public static final String MC_TOOL_SIG = "lamc11";
+ public static final String QA_TOOL_SIG = "laqa11";
+ public static final String SHARE_RESOURCES_TOOL_SIG = "larsrc11";
+ public static final String NOTICEBOARD_TOOL_SIG = "lanb11";
+ public static final String NOTEBOOK_TOOL_SIG = "lantbk11";
+ public static final String SUBMIT_TOOL_SIG = "lasbmt11";
+ public static final String SCRIBE_TOOL_SIG = "lascrb11";
+ public static final String SURVEY_TOOL_SIG = "lasurv11";
+ public static final String VOTE_TOOL_SIG = "lavote11";
+
+
+
+ public static String[] getToolSignatures()
+ {
+ String[] defaultToolSignatures = new String[]
+ {
+ CHAT_TOOL_SIG,
+ FORUM_TOOL_SIG,
+ MC_TOOL_SIG,
+ QA_TOOL_SIG,
+ SHARE_RESOURCES_TOOL_SIG,
+ NOTICEBOARD_TOOL_SIG,
+ NOTEBOOK_TOOL_SIG,
+ SUBMIT_TOOL_SIG,
+ SCRIBE_TOOL_SIG,
+ SURVEY_TOOL_SIG,
+ VOTE_TOOL_SIG
+ };
+ return defaultToolSignatures;
+
+ }
+
// All the LAMS core tools
public static final String LAMS_ADMIN_DIR = "lams_admin";
public static final String LAMS_CENTRAL_DIR = "lams_central";
public static final String LAMS_COMMON_DIR = "lams_common";
public static final String LAMS_LEARNING_DIR = "lams_learning";
public static final String LAMS_MONITORING_DIR = "lams_monitoring";
+ public static final String LAMS_CONTENT_REPOSITORY = "lams_contentrepository";
public static final String LAMS_BUILD_DIR = "lams_build";
public static final String LAMS_TOOL_DEPLOY = "lams_tool_deploy";
public static final String LAMS_WWW_DIR = "lams_www";
@@ -68,6 +108,8 @@
/*
* Instantiates the coreProjects list
+ * added forum to the core projects as it will be the default project
+ * used for the lams tool builder
*/
public static void initCorePrjects()
{
@@ -78,10 +120,14 @@
coreProjects.add(LAMS_COMMON_DIR);
coreProjects.add(LAMS_LEARNING_DIR);
coreProjects.add(LAMS_MONITORING_DIR);
+ coreProjects.add(LAMS_CONTENT_REPOSITORY);
coreProjects.add(LAMS_BUILD_DIR);
coreProjects.add(LAMS_TOOL_DEPLOY);
coreProjects.add(LAMS_WWW_DIR);
+ coreProjects.add(FORUM_TOOL_DIR);
}
+
+
}
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java,v
diff -u -r1.8 -r1.9
--- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 19 Sep 2007 06:49:44 -0000 1.8
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 11 Oct 2007 02:03:33 -0000 1.9
@@ -3,30 +3,21 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.*;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
-import java.io.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.ide.IDE;
import org.lams.toolbuilder.util.LamsToolBuilderLog;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.lams.toolbuilder.util.Constants;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.lams.toolbuilder.renameTool.RenameTool;
import org.lams.toolbuilder.renameTool.RenameToolTaskList;
@@ -44,8 +35,8 @@
*/
public class LAMSNewToolWizard extends Wizard implements INewWizard {
- private LAMSNewToolWizardPage page;
- private LAMSNewToolWizardTemplatePage page2;
+ private LAMSNewToolWizardPage projectPage;
+ private LAMSNewToolWizardTemplatePage templatesPage;
private ISelection selection;
@@ -54,17 +45,27 @@
// The handle to the new LAMS Tool Project to be created
private IProject projectHandle;
- private String toolTemplate;
+
+ // Set to the default tool to begin with, if the user chooses anoher
+ // template it will use that one
+ private String toolTemplate = WizardConstants.DEFAULT_TOOL_TEMPLATE;
+
private String toolSignature;
private String vendor;
private String compatibility;
private String toolDisplayName;
+ private String toolVersion;
private boolean isLAMS;
private boolean toolVisible;
+
+
// The list of base LAMS projects required for the workspace
private List projectList;
+
+
+
/**
* Constructor for LAMSNewToolWizard.
*/
@@ -83,23 +84,6 @@
this.dispose();
}
- }
-
-
- /**
- * Initiate some local static variblaes
- */
- public void initiate()
- {
- projectList = new ArrayList();
- projectList.add("lams_admin");
- projectList.add("lams_central");
- projectList.add("lams_common");
- projectList.add("lams_learning");
- projectList.add("lams_monitoring");
- projectList.add("lams_build");
- projectList.add("lams_tool_deploy");
- projectList.add("lams_www");
}
@@ -110,7 +94,7 @@
public boolean checkWorkspace()
{
boolean result = true;
- List missingList = new ArrayList();
+ List missingList = new ArrayList();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
LamsToolBuilderLog.logInfo("Checking required LAMS projects exist");
@@ -168,11 +152,15 @@
if(workspaceValid)
{
LamsToolBuilderLog.logInfo("Adding pages to LAMS Tool Wizard");
- page = new LAMSNewToolWizardPage(selection);
- addPage(page);
- page2 = new LAMSNewToolWizardTemplatePage(selection);
- addPage(page2);
+ templatesPage = new LAMSNewToolWizardTemplatePage(selection);
+ addPage(templatesPage);
+
+ projectPage = new LAMSNewToolWizardPage(selection);
+ addPage(projectPage);
+
+
+
}
}
@@ -185,21 +173,44 @@
LamsToolBuilderLog.logInfo("Attempting to perform finish for LAMS Tool Wizard");
// Get the project from the page
- final IProject project = page.getProjectHandle();
+ final IProject project = projectPage.getProjectHandle();
- //private static String toolName;
- vendor = page.getVendor();
- compatibility = page.getCompatibility();
- toolDisplayName = page.getToolDisplayName();
- isLAMS = page.getIsLams();
- toolVisible = page.getVisible();
- toolSignature = page.getToolSignature();
+ this.vendor = projectPage.getVendor();
+ this.compatibility = projectPage.getCompatibility();
+ this.toolDisplayName = projectPage.getToolDisplayName();
+ this.isLAMS = projectPage.getIsLams();
+ this.toolVisible = projectPage.getVisible();
+ this.toolSignature = projectPage.getToolSignature();
+ this.toolVersion = projectPage.getToolVersion();
+ if (
+ vendor.equals("") ||
+ compatibility.equals("") ||
+ vendor.equals("") ||
+ toolDisplayName.equals("") ||
+ toolSignature.equals("") ||
+ toolVersion.equals("")
+
+ )
+ {
+ projectPage.setPageComplete(false);
+ projectPage.setErrorMessage(WizardConstants.PLEASE_ENTER_DETAILS);
+ return false;
+ }
+
+ // check if user clicked the finish button from the first page
+ if (templatesPage != null && !(templatesPage.getTemplate()==null) && !templatesPage.getTemplate().equals(""))
+ {
+ toolTemplate = templatesPage.getTemplate();
+ toolTemplate = toolTemplate.substring(toolTemplate.indexOf('(') + 1, toolTemplate.indexOf(')'));
+ LamsToolBuilderLog.logInfo("Using LAMS tool template:" + toolTemplate);
+ }
+
// create a project descriptor
IPath projPath = null;
- if (!page.useDefaults())
+ if (!projectPage.useDefaults())
{
- projPath = page.getLocationPath();
+ projPath = projectPage.getLocationPath();
if (projPath.toFile().exists()) {
// add the project key to the path if this folder exists
projPath = projPath.addTrailingSeparator().append("Sample_Project").addTrailingSeparator();
@@ -256,23 +267,21 @@
}
this.projectHandle = project;
+ MessageDialog.openInformation(getShell(), "LAMS Tool Created", WizardConstants.SUCCESS_MESSAGE);
return true;
}
private void createLamsToolProject (IProject projHandle, IProjectDescription description,IProgressMonitor monitor)
throws CoreException, OperationCanceledException
{
- monitor.beginTask("Creating LAMS tool project", 50);
+ monitor.beginTask("Creating LAMS tool project: ", 50);
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
- //############### test project to template from
- toolTemplate = page2.getTemplate();
-
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject projTemplate = (IProject)root.findMember(new Path(toolTemplate));
if (!projTemplate.exists() || !(projTemplate instanceof IContainer))
@@ -282,20 +291,28 @@
monitor.worked(2);
try{
+ projTemplate.open(monitor);
projTemplate.copy(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(monitor, 50));
}
catch (CoreException e)
{
LamsToolBuilderLog.logError(e);
}
- //TODO:
-
- RenameToolTaskList taskList = new RenameToolTaskList(Constants.FORUM_TOOL_DIR, toolSignature, toolDisplayName );
+ monitor.subTask("Creating LAMS tool tasklist");
+ RenameToolTaskList taskList = new RenameToolTaskList(toolTemplate, toolSignature, toolDisplayName, vendor);
+ monitor.worked(1);
RenameTool rt = new RenameTool();
+ monitor.subTask("Translating LAMS tool template: " + toolTemplate);
LamsToolBuilderLog.logInfo(projHandle.getLocation().toPortableString());
try{
- rt.renameTool(taskList.getTasklist(), projHandle.getLocation().toPortableString());
+ rt.renameTool(taskList.getTasklist(), projHandle.getLocation().toPortableString(), vendor, monitor);
+ monitor.worked(10);
+ String hideTool = toolVisible ? "false" : "true";
+
+
+ monitor.subTask("Translating properties file");
+ rt.renameProperties(compatibility, hideTool, toolVersion, monitor);
System.out.print(taskList.getTasklist().toString());
}
catch (Exception e)
@@ -311,106 +328,30 @@
projHandle.open(monitor);
monitor.done();
-
-
}
+ private void throwCoreException(String message) throws CoreException {
+ IStatus status =
+ new Status(IStatus.ERROR, "org.lams.toolbuilder", IStatus.OK, message, null);
+ throw new CoreException(status);
+ }
-
-
// Get method for the project created by this wizard
public IProject getProjectHandle()
{
return this.projectHandle;
}
/**
- * The worker method. It will find the container, create the
- * file if missing or just replace its contents, and open
- * the editor on the newly created file.
- */
-
- /*private void doFinish(
- String toolName,
- String toolDisplayName,
- String vendor,
- String compatibility,
- IProgressMonitor monitor)
- throws CoreException {
- // create a sample file
- monitor.beginTask("Creating build.properties", 2);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-
- Properties buildProperties = new Properties();
- buildProperties.setProperty(Constants.PROP_TOOL_NAME, toolName);
- buildProperties.setProperty(Constants.PROP_SIGNATURE, toolDisplayName);
- buildProperties.setProperty(Constants.PROP_PACKAGE, "org.lams.testtool");
- buildProperties.setProperty(Constants.PROP_PACKAGE_PATH, "org/lams/testtool");
- buildProperties.setProperty(Constants.PROP_TOOL_VERSION, "20070000");
- buildProperties.setProperty(Constants.PROP_SERVER_VERSION, compatibility);
- buildProperties.setProperty(Constants.PROP_HIDE_TOOL, "false");
-
-
-
-
-
-
-
- /*IResource resource = root.findMember(new Path(containerName));
- if (!resource.exists() || !(resource instanceof IContainer)) {
- throwCoreException("Container \"" + containerName + "\" does not exist.");
- }
-
- IContainer container = (IContainer) resource;
- final IFile file = container.getFile(new Path(fileName));
- try {
- InputStream stream = openContentStream();
- if (file.exists()) {
- file.setContents(stream, true, true, monitor);
- } else {
- file.create(stream, true, monitor);
- }
- stream.close();
- } catch (IOException e) {
- }
- monitor.worked(1);
- monitor.setTaskName("Opening file for editing...");
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try {
- IDE.openEditor(page, file, true);
- } catch (PartInitException e) {
- }
- }
- });
-
- monitor.worked(1);
- }*/
-
- /**
- * We will initialize file contents with a sample text.
- */
-
- private InputStream openContentStream() {
- String contents =
- "This is the initial file contents for *.mpe file that should be word-sorted in the Preview page of the multi-page editor";
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- private void throwCoreException(String message) throws CoreException {
- IStatus status =
- new Status(IStatus.ERROR, "org.lams.toolbuilder", IStatus.OK, message, null);
- throw new CoreException(status);
- }
-
- /**
* We will accept the selection in the workbench to see if
* we can initialize from it.
* @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
}
+
+
+
+
}
\ No newline at end of file
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java,v
diff -u -r1.6 -r1.7
--- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java 20 Sep 2007 07:14:08 -0000 1.6
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java 11 Oct 2007 02:03:33 -0000 1.7
@@ -2,63 +2,61 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.lams.toolbuilder.util.LamsToolBuilderLog;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import org.lams.toolbuilder.util.LamsToolBuilderLog;
+import org.lams.toolbuilder.util.Constants;
/**
* The "New" wizard page allows setting the container for the new file as well
* as the file name. The page will only accept file name without the extension
* OR with the extension that matches the expected one (mpe).
*/
public class LAMSNewToolWizardPage extends WizardNewProjectCreationPage {
- private Text toolName;
private Text toolSignature;
private Text vendor;
- private Text compatibility;
+ private Text compatibility;
private Text toolDisplayName;
+ private Text toolVersion;
private Button LAMSButton;
private Button RAMSButton;
private Button notVisible;
private Button isVisible;
-
-
+ private boolean canContinue= false;
private ISelection selection;
/**
* Constructor for SampleNewWizardPage.
- *
- * @param pageName
*/
public LAMSNewToolWizardPage(ISelection selection) {
super("wizardPage");
- setTitle("LAMS Tool Project Wizard");
+ this.canContinue = false;
+ setTitle("LAMS Tool Project Wizard: Project Details");
setDescription("Enter in details to produce a new LAMS tool project.");
this.selection = selection;
}
+ public boolean canFlipToNextPage()
+ {
+ return canContinue;
+ }
+
+
/**
* @see IDialogPage#createControl(Composite)
*/
@@ -80,23 +78,35 @@
createLabel(namesGroup, "Tool Signature");
toolSignature = createText(namesGroup);
+ toolSignature.setToolTipText(WizardConstants.TOOL_SIG_TOOL_TIP);
+ toolSignature.addModifyListener(new wizardModifyListener());
// put the key field in the group
- createLabel(namesGroup, "Tool Display Name");
+ createLabel(namesGroup, "Tool Name");
toolDisplayName = createText(namesGroup);
- //toolDisplayName.setText(WizardConstants.SAMPLE_TOOL_SIGNATURE);
+ toolDisplayName.setToolTipText(WizardConstants.TOOL_NAME_TOOL_TIP);
+ toolDisplayName.addModifyListener(new wizardModifyListener());
// put the package field in the group
createLabel(namesGroup, "Vendor");
vendor = createText(namesGroup);
- //vendor.setText(WizardConstants.SAMPLE_VENDOR);
+ vendor.setToolTipText(WizardConstants.TOOL_VENDOR_TOOL_TIP);
+ vendor.addModifyListener(new wizardModifyListener());
- createLabel(namesGroup, "Minimum Server Version");
+ createLabel(namesGroup, "Tool Version");
+ toolVersion = createText(namesGroup);
+ toolVersion.setText(WizardConstants.DEFAULT_TOOL_VERSION);
+ toolVersion.setToolTipText(WizardConstants.TOOL_VERSION_TOOL_TIP);
+ toolVersion.addModifyListener(new wizardModifyListener());
+
+ createLabel(namesGroup, "Minimum LAMS Version");
compatibility = createText(namesGroup);
- compatibility.setText("2.0");
-
+ compatibility.setText(WizardConstants.DEFAULT_SERVER_VERSION);
+ compatibility.setToolTipText(WizardConstants.SERVER_VERSION_TOOL_TIP);
+ compatibility.addModifyListener(new wizardModifyListener());
+
// create a group for columns
Group organisingGroup = new Group(control, SWT.NONE);
organisingGroup.setText("Tool Options");
@@ -143,152 +153,10 @@
isVisible.setSelection(true);
notVisible = createButton(toolVisibleGroup, SWT.RADIO, buttonSpan, buttonIndent);
notVisible.setText("No");
-
-
- /*
- for (int i=0; i 0) {
- updateStatus("File name must be valid");
- return;
- }
- int dotLoc = fileName.lastIndexOf('.');
- if (dotLoc != -1) {
- String ext = fileName.substring(dotLoc + 1);
- if (ext.equalsIgnoreCase("mpe") == false) {
- updateStatus("File extension must be \"mpe\"");
- return;
- }
- }*/
- updateStatus(null);
- }
-
- private void updateStatus(String message) {
- setErrorMessage(message);
- setPageComplete(message == null);
- }
+
private Button createButton(Composite container, int style, int span, int indent) {
Button button = new Button(container, style);
GridData gd = new GridData();
@@ -427,12 +225,161 @@
}
+
+
+
+ public class wizardModifyListener implements ModifyListener
+ {
+ public void modifyText(ModifyEvent event)
+ {
+ dialogChanged();
+ }
+ }
+
+ /**
+ * Ensures that all required fields are set.
+ */
+ private void dialogChanged() {
+ super.setPageComplete(false);
+ this.canContinue = false;
+
+
+ if(super.getProjectName().trim().length()==0)
+ {
+ // allow super class to handle this case
+ return;
+ }
+ if (getToolSignature().trim().length()==0)
+ {
+ updateStatus("Tool signature must be specified.");
+ return;
+ }
+ else
+ {
+ if (!matchRegex(WizardConstants.TOOL_SIG_REGEX, getToolSignature()))
+ {
+ setErrorMessage(WizardConstants.TOOL_SIG_ERROR);
+ setPageComplete(false);
+ return;
+ }
+ else
+ {
+ // check the tool signature does not clash with an existing
+ for (String sig : Constants.getToolSignatures())
+ {
+ if (getToolSignature().trim().equals(sig))
+ {
+ setErrorMessage(WizardConstants.TOOL_SIG_EXISTS_ERROR);
+ setPageComplete(false);
+ return;
+ }
+
+ }
+ }
+ }
+
+ if (getToolDisplayName().trim().length() == 0) {
+ updateStatus("Tool name must be specified.\n\n" + WizardConstants.TOOL_NAME_TOOL_TIP);
+ return;
+ }
+ else
+ {
+ if (!matchRegex(WizardConstants.TOOL_NAME_REGEX, getToolDisplayName()))
+ {
+ setErrorMessage(WizardConstants.TOOL_NAME_ERROR);
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ if (getCompatibility().trim().length() == 0) {
+ updateStatus("Minimum LAMS Server version must be specified");
+ return;
+ }
+ else
+ {
+ if (!matchRegex(WizardConstants.SERVER_VERSION_REGEX, getCompatibility()))
+ {
+ setErrorMessage(WizardConstants.SERVER_VERSION_ERROR);
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ if (getVendor().trim().length() == 0)
+ {
+ updateStatus("Vendor details must be specified");
+ return;
+ }
+ else
+ {
+ if (!matchRegex(WizardConstants.VENDOR_REGEX, getVendor()))
+ {
+ setErrorMessage(WizardConstants.VENDOR_ERROR);
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ if (getToolVersion().trim().length() == 0)
+ {
+ updateStatus("Tool version must be specified");
+ return;
+ }
+ else
+ {
+ if (!matchRegex(WizardConstants.TOOL_VERSION_REGEX, getToolVersion()))
+ {
+ setErrorMessage(WizardConstants.TOOL_VERSION_ERROR);
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ updateStatus(null);
+ }
+
+ /**
+ *
+ * @param regex The regex to test the text
+ * @param text The text to be tested
+ * @return true if the regex matches the string
+ */
+ private boolean matchRegex(String regex, String text)
+ {
+ Pattern p = Pattern.compile(regex);
+ Matcher m = p.matcher(text.trim());
+ if (!m.matches())
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ private void updateStatus(String message) {
+
+
+ if (message==null)
+ {
+ this.setMessage(WizardConstants.PAGE_COMPLETE_MESSAGE);
+ setPageComplete(true);
+ }
+ else
+ {
+ this.setMessage(message);
+ setPageComplete(false);
+ }
+ }
+
+ // GET METHODS
public String getToolSignature() {return toolSignature.getText().trim().toLowerCase();}
- public String getToolName() {return toolName.getText().trim();}
public String getVendor() {return vendor.getText().trim();}
public String getToolDisplayName() {return toolDisplayName.getText().trim();}
public String getCompatibility() {return compatibility.getText().trim();}
public boolean getIsLams() {return LAMSButton.getSelection();}
public boolean getVisible() {return isVisible.getSelection();}
-
+ public String getToolVersion() {return toolVersion.getText().trim();}
}
\ No newline at end of file
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardTemplatePage.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardTemplatePage.java,v
diff -u -r1.2 -r1.3
--- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardTemplatePage.java 19 Sep 2007 06:49:44 -0000 1.2
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardTemplatePage.java 11 Oct 2007 02:03:33 -0000 1.3
@@ -5,37 +5,28 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-
-
-import org.lams.toolbuilder.LAMSToolBuilderPlugin;
import org.lams.toolbuilder.util.LamsToolBuilderLog;
import org.lams.toolbuilder.util.Constants;
+
/**
* The second page of the wizard contains a checkbox list of key/value
* pairs that can be extracted from the source file. Rather than
@@ -59,10 +50,11 @@
{
super("selectTemplate");
this.selection = selection;
- setTitle("Select a Template");
+ setTitle("LAMS Tool Project Wizard: Select a Template");
setDescription("Select a LAMS tool template to build your tool from");
templatesAvailable = false; // set to false to begin with
setAvailableTemplates();
+ this.setPageComplete(true);
}
@@ -97,9 +89,6 @@
else
{
LamsToolBuilderLog.logInfo("No templates found in workspace");
- //this.setVisible(false);
- //TODO: Dialog box goes here "Do you want to use default template?"
- // choose a default template to use. Hopefully an empty example tool
}
}
@@ -114,13 +103,22 @@
*/
public void createControl(Composite parent)
{
+ if(!templatesAvailable)
+ {
+ MessageDialog.openError(getShell(),
+ "Workspace error:",
+ "No LAMS tool templates found in the workspace");
+ return;
+ }
+
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new FormLayout());
setControl(container);
-
- LamsToolBuilderLog.logInfo("Drawing LAMS Tool Template Wizard");
Composite control = (Composite)getControl();
+ LamsToolBuilderLog.logInfo("Drawing LAMS Tool Template Wizard");
+
+
GridLayout layout = new GridLayout();
layout.verticalSpacing = 10;
control.setLayout(layout);
@@ -132,7 +130,10 @@
"\n\n\t* access method: pserver " +
"\n\t* user name: anonymous" +
"\n\t* server name: lamscvs.melcoe.mq.edu.au" +
- "\n\t* location: /usr/local/cvsroot\n\n");
+ "\n\t* location: /usr/local/cvsroot\n\n" +
+ "Note: Only Forum, Noticeboard, Notebook and Share Resources are available as " +
+ "\ntemplates at this stage. Please refer to the ToolBuilder wiki page for more details:" +
+ "\nhttp://wiki.lamsfoundation.org/display/lams/Tool+Builder\n\n");
//create a group
Group templatesGroup = new Group(control, SWT.NONE);
@@ -154,6 +155,23 @@
// add all available templates to the list
for(String dir:availableTemplates)
{
+ if (dir.equals(Constants.FORUM_TOOL_DIR))
+ {
+ dir = "Forum (" +dir+ ")";
+ }
+ else if (dir.equals(Constants.SHARE_RESOURCE_TOOL_DIR))
+ {
+ dir = "Share Resources (" +dir+ ")";
+ }
+ else if ( dir.equals(Constants.NOTEBOOK_TOOL_DIR))
+ {
+ dir = "Notebook (" +dir+ ")";
+ }
+ else if ( dir.equals(Constants.NOTICEBOARD_TOOL_DIR))
+ {
+ dir = "Noticeboard (" +dir+ ")";
+ }
+
dispList.add(dir);
}
@@ -169,6 +187,7 @@
if (selected.length==1)
{
chosenTemplate = selected[0];
+
}
}
Index: org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java
===================================================================
RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java,v
diff -u -r1.2 -r1.3
--- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java 4 Sep 2007 12:38:52 -0000 1.2
+++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java 11 Oct 2007 02:03:33 -0000 1.3
@@ -2,5 +2,119 @@
public class WizardConstants
{
+ // the default template to be used if the user clicks finish on the
+ // first wizard page
+ public static final String DEFAULT_TOOL_TEMPLATE="lams_tool_forum";
+ public static final String DEFAULT_SERVER_VERSION="2.0";
+
+ public static final String DEFAULT_VENDOR="LAMS foundation";
+
+ public static final String DEFAULT_TOOL_VERSION="20071100";
+
+ /*
+ * Regular expression for the required form of the tool signature
+ * Takes the form [mmttttvv] where:
+ * mm is a two character name representing the maker
+ * tttt is a two character name representing the tool
+ * vv is a two character number representing the major and minor versions of the tool
+ *
+ * for example with lasurv10 "la" represents "lams" "surv" represents "survey"
+ * and "10" represents version 1.0
+ */
+ public static final String TOOL_SIG_REGEX = "^[a-zA-Z]{3,6}\\d\\d$";
+
+ /*
+ * Regex for the vendor string, must only contain alpha-numeric numbers
+ * and it must start with an alphabetic character
+ */
+ public static final String VENDOR_REGEX = "^[a-zA-Z][$a-zA-z0-9\\s]*+$";
+
+ /*
+ * Regex for the tool name
+ * Must start with alpha numeric
+ * Then can have optionally many letters, numbers, spaces or underscores
+ */
+ public static final String TOOL_NAME_REGEX = "^[a-zA-Z][$a-zA-z0-9\\s_]*+$";
+
+ /*
+ * Regex for the server version string,
+ * must take the form 2.10.3.2 or something simular
+ * Ie, starts with 1 or many numbers, followed by a .
+ * followed by 1 or mant numvers... etc
+ */
+ public static final String SERVER_VERSION_REGEX = "^2(\\.\\d+)*+$";
+
+ /*
+ * Regex for tool version
+ * should just be a string of numbers 8 characters long
+ * to denote the date
+ */
+ public static final String TOOL_VERSION_REGEX = "^\\d{8}$";
+
+
+ public static final String TOOL_NAME_ERROR =
+ "Tool name must only contain alpha-numeric characters\n" +
+ "and must start with an alphabetic character.";
+
+ public static final String TOOL_VERSION_ERROR =
+ "Tool version must be a string of numbers denoting the date\n " +
+ "the tool is created in the form yyyymmdd.";
+
+ public static final String SERVER_VERSION_ERROR =
+ "LAMS2 Server version must start with a 2, followed by any number\n" +
+ "of major and minor versions. eg 2.0.4";
+
+ public static final String VENDOR_ERROR =
+ "Vendor name must start with a alphabetic character and only\n" +
+ "contain alpha-numeric characters.";
+
+ public static final String TOOL_SIG_ERROR =
+ "Tool signature must follow the form mmttttvv where mm is the maker, tttt\n" +
+ "is the abbreviated tool name and vv is the minor and major tool versions.";
+
+ public static final String TOOL_SIG_EXISTS_ERROR =
+ "The tool signature given is the same as an existing default tool.\n" +
+ "Please enter a new unique tool signature.";
+
+ public static final String TOOL_SIG_TOOL_TIP =
+ "Enter tool signature here. It should follow the form mmttttvv where " +
+ "mm = maker, ttttt = tool name, and vv = major and minor version numbers.";
+
+ public static final String TOOL_NAME_TOOL_TIP =
+ "This name will be used to rename your chosen LAMS tool template.";
+
+ public static final String TOOL_VENDOR_TOOL_TIP =
+ "Put your vendor name here.";
+
+ public static final String SERVER_VERSION_TOOL_TIP =
+ "Put the minimum required server" +
+ " version of LAMS here. 2.0 is the default.";
+
+ public static final String TOOL_VERSION_TOOL_TIP =
+ "The tool version should be a string of numbers denoting the date" +
+ " the tool is created in the form yyyymmdd.";
+
+
+ public static final String PAGE_COMPLETE_MESSAGE =
+ "Click next to go to the templates page.";
+
+ public static final String PLEASE_ENTER_DETAILS =
+ "One or more required fields are missing\n" +
+ "Please enter the details below for your new LAMS tool.";
+
+ public static final String PLEASE_CLICK_NEXT =
+ "No template chosen.\nClick next to go to the templates page";
+
+ public static final String SUCCESS_MESSAGE =
+ "Tool created successfully.\n\n" +
+ "To build and deploy the tool, first run a normal LAMS build by\n" +
+ "running the following ant tasks in lams_build/build.xml.\n" +
+ "* rebuild-db\n" +
+ "* assemble-ear\n" +
+ "* deploy-ear\n" +
+ "* copyfiles\n" +
+ "* deploy-tools\n\n" +
+ "Once you have LAMS core deployed, you can run the tool's 'deploy'\n" +
+ "task in its build.xml. Then run LAMS to check that the tool appears in author.";
}