Index: org.lams.toolbuilder/.cvsignore =================================================================== RCS file: /usr/local/cvsroot/org.lams.toolbuilder/.cvsignore,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ org.lams.toolbuilder/.cvsignore 6 Sep 2007 07:19:22 -0000 1.1 @@ -0,0 +1,2 @@ +*.class +bin \ No newline at end of file Index: org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java =================================================================== RCS file: /usr/local/cvsroot/org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java,v diff -u -r1.2 -r1.3 --- org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java 4 Sep 2007 12:38:52 -0000 1.2 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java 6 Sep 2007 07:19:22 -0000 1.3 @@ -8,19 +8,20 @@ import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.lams.toolbuilder.util.LamsToolBuilderLog; /** * - * @author Anthony Sukkar + * @author Luke Foxton - Based on code written by: Anthony Sukar * */ public class RenameTool { + //$$$$$$$$$$$$$$$$$$$$$$TO BE IMPLEMENTED DYNAMICALLY + private final String DEFAULT_LANGUAGE = "en_AU"; private Set txtType = new HashSet(); @@ -65,59 +66,6 @@ visitFile(sourceDir, "rename"); return true; - - /* - if (!tasklist.exists()) - { - LamsToolBuilderLog.logError(new Exception("Cannot find tasklist configuration file")); - throw new Exception("Cannot find tasklist configuration file"); - } - - File sourceDir = null; - try { - FileInputStream fis = new FileInputStream(tasklist); - BufferedReader br = new BufferedReader(new InputStreamReader(fis)); - - String line; - while ((line = br.readLine()) != null) { - - line = line.trim(); - - if (line.length() == 0 || (line.charAt(0) == '#')) - continue; - - String[] strArray = line.split("\\s"); - - String command = strArray[0]; - - if (command.equals("Source")) { - sourceDir = getFile(strArray); - } - - if (command.equals("Rename")) { - - if (strArray.length != 3) { - continue; - } else { - String[] pair = { strArray[1], strArray[2] }; - nameList.add(pair); - } - } - - } - - visitFile(sourceDir, "rename"); - - } catch (FileNotFoundException e) { - e.printStackTrace(); - System.exit(0); - } catch (IOException e) { - e.printStackTrace(); - } - - - return true; - */ } @@ -188,6 +136,21 @@ mode = "delete"; } + if (file.getName().contains("ApplicationResources")) + { + // 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)) + { + return; + } + else + { + file.delete(); + 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++) { 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameToolTaskList.java 6 Sep 2007 07:19:22 -0000 1.1 @@ -0,0 +1,170 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id: RenameToolTaskList.java,v 1.1 2007/09/06 07:19:22 lfoxton Exp $ */ + +package org.lams.toolbuilder.renameTool; + + +import java.util.List; +import org.lams.toolbuilder.util.Constants; +import java.util.ArrayList; + +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 List tasklist; // the tasklist created for the rename tool + + public RenameToolTaskList(String tooltemplate, String toolsig, String tooldispname) + { + tasklist = new ArrayList(); + 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 + * initialised when they are needed + * + * LAMS DEFAULT TOOLS: + * chat + * forum + * multiple choice + * question and answer + * share resource + * noticeboard + * notebook + * submit + * scribe + * survey + * vote + */ + public void init() + { + if (toolTemplate.equals(Constants.CHAT_TOOL_DIR)) {initChat();} + else if (toolTemplate.equals(Constants.FORUM_TOOL_DIR)) {initForum();} + else if (toolTemplate.equals(Constants.MC_TOOL_DIR)) {initMC();} + else if (toolTemplate.equals(Constants.QA_TOOL_DIR)) {initQa();} + else if (toolTemplate.equals(Constants.SHARE_RESOURCE_TOOL_DIR)) {initShareResources();} + else if (toolTemplate.equals(Constants.NOTICEBOARD_TOOL_DIR)) {initNoticeboard();} + else if (toolTemplate.equals(Constants.NOTEBOOK_TOOL_DIR)) {initNotebook();} + else if (toolTemplate.equals(Constants.SUBMIT_TOOL_DIR)) {initSubmit();} + else if (toolTemplate.equals(Constants.SCRIBE_TOOL_DIR)) {initScribe();} + else if (toolTemplate.equals(Constants.SURVEY_TOOL_DIR)) {initSurvey();} + else if (toolTemplate.equals(Constants.VOTE_TOOL_DIR)) {initVote();} + } + + public void initChat() {} + + public void initForum() {} + + public void initMC() {} + + public void initQa() {} + + public void initShareResources() {} + + public void initNoticeboard() {} + + public void initNotebook() {} + + public void initSubmit() + { + /* + * lasbmt11 + * SubmitFiles + * Submit Files + * sbmt + * Sbmt + * Submit + * submit + */ + + String submitClassPrefix = toJavaClassString(toolDispName); + String submitVariablePrefix = toJavaVariableString(toolDispName); + + tasklist.add(new String[] {"lasbmt11", toolSig}); + tasklist.add(new String[] {"SubmitFiles", submitClassPrefix}); + tasklist.add(new String[] {"Submit Files",toolDispName}); + tasklist.add(new String[] {"sbmt",submitVariablePrefix}); + tasklist.add(new String[] {"Sbmt",submitClassPrefix}); + tasklist.add(new String[] {"Submit",submitClassPrefix}); + tasklist.add(new String[] {"submit",submitVariablePrefix}); + tasklist.add(new String[] {"Submission",submitClassPrefix}); + tasklist.add(new String[] {"submission",submitVariablePrefix}); + } + + + public void initScribe() {} + + public void initSurvey() {} + + public void initVote() {} + + /** + * @param str + * @return string in the conventional java class form eg: JavaClass + */ + public String toJavaClassString(String str) + { + str = str.trim(); + String[] strs = str.split(" "); + + for (int i =0; i getTasklist() {return tasklist;} + + + +} Fisheye: Tag 1.2 refers to a dead (removed) revision in file `org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/readme.txt'. Fisheye: No comparison available. Pass `N' to diff? 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.1 -r1.2 --- org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java 22 Aug 2007 14:07:19 -0000 1.1 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/util/Constants.java 6 Sep 2007 07:19:22 -0000 1.2 @@ -12,4 +12,19 @@ public static final String PROP_SERVER_VERSION = "min.server.version.number"; public static final String PROP_LANG_PACKAGE = "language.files.package"; public static final String PROP_HIDE_TOOL = "hideTool"; + + + // Tool folder names for all defaul 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"; + public static final String QA_TOOL_DIR = "lams_tool_laqa"; + public static final String SHARE_RESOURCE_TOOL_DIR = "lams_tool_larsrc"; + public static final String NOTICEBOARD_TOOL_DIR = "lams_tool_nb"; + public static final String NOTEBOOK_TOOL_DIR = "lams_tool_notebook"; + public static final String SUBMIT_TOOL_DIR = "lams_tool_sbmt"; + public static final String SCRIBE_TOOL_DIR = "lams_tool_scribe"; + public static final String SURVEY_TOOL_DIR = "lams_tool_survey"; + public static final String VOTE_TOOL_DIR = "lams_tool_vote"; + } 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.3 -r1.4 --- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 4 Sep 2007 12:38:52 -0000 1.3 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 6 Sep 2007 07:19:22 -0000 1.4 @@ -29,6 +29,7 @@ import org.eclipse.jface.wizard.ProgressMonitorPart; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.lams.toolbuilder.renameTool.RenameTool; +import org.lams.toolbuilder.renameTool.RenameToolTaskList; /** * This is a sample new wizard. Its role is to create a new file * resource in the provided container. If the container resource @@ -184,15 +185,19 @@ LamsToolBuilderLog.logError(e); } - List commandList = new ArrayList(); - commandList.add(new String[] {"lasbmt11",projHandle.getName()}); + RenameToolTaskList tasklist = new RenameToolTaskList(Constants.SUBMIT_TOOL_DIR, projHandle.getName(), toolDisplayName); + + List commandList = tasklist.getTasklist(); + /*commandList.add(new String[] {"lasbmt11",projHandle.getName()}); commandList.add(new String[] {"SubmitFiles",toolDisplayName.replaceAll(" ", "").trim()}); commandList.add(new String[] {"Submit Files",toolDisplayName.trim()}); commandList.add(new String[] {"sbmt",projHandle.getName().toLowerCase()}); commandList.add(new String[] {"Sbmt",projHandle.getName()}); commandList.add(new String[] {"Submit",toolDisplayName.replaceAll(" ", "").trim()}); commandList.add(new String[] {"submit",toolDisplayName.replaceAll(" ", "").trim()}); + */ + RenameTool rt = new RenameTool(); LamsToolBuilderLog.logInfo(projHandle.getLocation().toPortableString()); try{