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.1 -r1.2 --- org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java 4 Sep 2007 07:01:33 -0000 1.1 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/renameTool/RenameTool.java 4 Sep 2007 12:38:52 -0000 1.2 @@ -21,15 +21,15 @@ */ public class RenameTool { - private String taskliststr; + private Set txtType = new HashSet(); - private List nameList = new ArrayList(); + private List nameList; - public RenameTool(String taskliststr, String source) + public RenameTool() { - this.taskliststr = taskliststr; + txtType.add("clay"); txtType.add("classpath"); txtType.add("txt"); @@ -53,10 +53,20 @@ txtType.add("xml"); } - public boolean renameTool() throws Exception + public boolean renameTool(List nameList, String source) throws Exception { - File tasklist = new File(taskliststr); + this.nameList = nameList; + File sourceDir = new File(source); + if (!sourceDir.exists()) + { + LamsToolBuilderLog.logError(new FileNotFoundException("Source file: " + source + "not found.")); + throw new FileNotFoundException("Source file: " + source + "not found."); + } + visitFile(sourceDir, "rename"); + return true; + + /* if (!tasklist.exists()) { LamsToolBuilderLog.logError(new Exception("Cannot find tasklist configuration file")); @@ -107,83 +117,10 @@ return true; + */ } - /* - public static void main(String[] args) { - - txtType.add("clay"); - txtType.add("classpath"); - txtType.add("txt"); - txtType.add("cvsignore"); - txtType.add("html"); - txtType.add("htm"); - txtType.add("java"); - txtType.add("js"); - txtType.add("jsp"); - txtType.add("MF"); - txtType.add("bat"); - txtType.add("myd"); - txtType.add("mymetadata"); - txtType.add("project"); - txtType.add("properties"); - txtType.add("sh"); - txtType.add("sql"); - txtType.add("tag"); - txtType.add("log"); - txtType.add("tld"); - txtType.add("xml"); - - - File tasklist = new File("src/org/lams/toolbuilder/renameTool/tasklist.conf"); - if (!tasklist.exists()) { - System.out.println("Can't find 'tasklist.conf'"); - } - - 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(); - } - } - */ public void renameFile(File dir) { for (String[] pair : nameList) { String newFileName = updateFilename(dir.getName(), pair[0], pair[1]); 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.2 -r1.3 --- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 4 Sep 2007 07:01:33 -0000 1.2 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizard.java 4 Sep 2007 12:38:52 -0000 1.3 @@ -19,6 +19,9 @@ 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; @@ -47,7 +50,7 @@ private static String toolName; private static String vendor; private static String compatibility; - private static String toolSignature; + private static String toolDisplayName; private static boolean isLAMS; private static boolean toolVisible; @@ -83,7 +86,7 @@ //private static String toolName; vendor = page.getVendor(); compatibility = page.getCompatibility(); - toolSignature = page.getToolSignature(); + toolDisplayName = page.getToolDisplayName(); isLAMS = page.getIsLams(); toolVisible = page.getVisible(); @@ -171,8 +174,6 @@ { throwCoreException("Project \"" + containerName + "\" does not exist."); } - - monitor.worked(2); try{ @@ -182,6 +183,27 @@ { LamsToolBuilderLog.logError(e); } + + List commandList = new ArrayList(); + 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{ + rt.renameTool(commandList, projHandle.getLocation().toPortableString()); + } + catch (Exception e) + { + LamsToolBuilderLog.logError(e); + } + + root.refreshLocal(IWorkspaceRoot.DEPTH_INFINITE, monitor); projHandle.open(monitor); monitor.worked(2); @@ -206,9 +228,9 @@ * the editor on the newly created file. */ - private void doFinish( + /*private void doFinish( String toolName, - String toolSignature, + String toolDisplayName, String vendor, String compatibility, IProgressMonitor monitor) @@ -219,7 +241,7 @@ Properties buildProperties = new Properties(); buildProperties.setProperty(Constants.PROP_TOOL_NAME, toolName); - buildProperties.setProperty(Constants.PROP_SIGNATURE, toolSignature); + 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"); @@ -261,9 +283,9 @@ } } }); - */ + monitor.worked(1); - } + }*/ /** * We will initialize file contents with a sample text. 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.1 -r1.2 --- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java 22 Aug 2007 14:07:19 -0000 1.1 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/LAMSNewToolWizardPage.java 4 Sep 2007 12:38:52 -0000 1.2 @@ -24,6 +24,7 @@ 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; /** @@ -36,7 +37,7 @@ private Text toolName; private Text vendor; private Text compatibility; - private Text toolSignature; + private Text toolDisplayName; private Button LAMSButton; private Button RAMSButton; private Button notVisible; @@ -52,8 +53,8 @@ */ public LAMSNewToolWizardPage(ISelection selection) { super("wizardPage"); - setTitle(WizardConstants.WIZARD_TITLE); - setDescription(WizardConstants.WIZARD_DESCRIPTION); + setTitle("LAMS Tool Project Wizard"); + setDescription("Enter in details to produce a new LAMS tool project."); this.selection = selection; } @@ -63,7 +64,6 @@ public void createControl(Composite parent) { LamsToolBuilderLog.logInfo("Drawing LAMS Tool Wizard"); super.createControl(parent); - Composite control = (Composite)getControl(); GridLayout layout = new GridLayout(); layout.verticalSpacing = 10; @@ -78,24 +78,19 @@ namesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // put the key field in the group - createLabel(namesGroup, "Tool Signature"); - toolSignature = createText(namesGroup); - toolSignature.setText(WizardConstants.SAMPLE_TOOL_SIGNATURE); /*createLabel(namesGroup, ""); //$NON-NLS-1$ - Label label = new Label(namesGroup, SWT.WRAP); - label.setText(KEY_INSTRUCTIONS); - GridData gd = new GridData(); - gd.horizontalIndent = 30; - label.setLayoutData(gd); - */ + createLabel(namesGroup, "Tool Display Name"); + toolDisplayName = createText(namesGroup); + //toolDisplayName.setText(WizardConstants.SAMPLE_TOOL_SIGNATURE); + // put the package field in the group - createLabel(namesGroup, "Vendor Prefix"); + createLabel(namesGroup, "Vendor"); vendor = createText(namesGroup); - vendor.setText(WizardConstants.SAMPLE_VENDOR); + //vendor.setText(WizardConstants.SAMPLE_VENDOR); createLabel(namesGroup, "Minimum Server Version"); compatibility = createText(namesGroup); - compatibility.setText(WizardConstants.LAMS_BASE_VERSION); + compatibility.setText("2.0"); // create a group for columns Group organisingGroup = new Group(control, SWT.NONE); @@ -242,11 +237,11 @@ label = new Label(container, SWT.NULL); label.setText("&File name:"); - toolSignature = new Text(container, SWT.BORDER | SWT.SINGLE); + toolDisplayName = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan=2; - toolSignature.setLayoutData(gd); - toolSignature.addModifyListener(new ModifyListener() { + toolDisplayName.setLayoutData(gd); + toolDisplayName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } @@ -284,7 +279,7 @@ - //initialise(); + //toolDisplayName(); //dialogChanged(); //setControl(container); @@ -312,10 +307,10 @@ } } - compatibility.setText(WizardConstants.LAMS_BASE_VERSION); - toolName.setText(WizardConstants.SAMPLE_TOOL_NAME); - toolSignature.setText(WizardConstants.SAMPLE_TOOL_SIGNATURE); - vendor.setText(WizardConstants.SAMPLE_VENDOR); + compatibility.setText("2.0"); + //toolName.setText(WizardConstants.SAMPLE_TOOL_NAME); + //toolDisplayName.setText(WizardConstants.SAMPLE_TOOL_SIGNATURE); + //vendor.setText(WizardConstants.SAMPLE_VENDOR); } /** @@ -347,7 +342,7 @@ updateStatus("Tool Name must be specified"); return; } - if (getToolSignature().length() == 0) { + if (getToolDisplayName().length() == 0) { updateStatus("Tool Signature must be specified"); return; } @@ -429,7 +424,7 @@ public String getToolName(){return toolName.getText();} public String getVendor(){return vendor.getText();} - public String getToolSignature() {return toolSignature.getText();} + public String getToolDisplayName() {return toolDisplayName.getText();} public String getCompatibility(){return compatibility.getText();} public boolean getIsLams(){return LAMSButton.getSelection();} public boolean getVisible(){return isVisible.getSelection();} 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.1 -r1.2 --- org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java 22 Aug 2007 14:07:19 -0000 1.1 +++ org.lams.toolbuilder/src/org/lams/toolbuilder/wizards/WizardConstants.java 4 Sep 2007 12:38:52 -0000 1.2 @@ -2,12 +2,5 @@ public class WizardConstants { - // Wizard constants - public static String WIZARD_TITLE = "LAMS Tool Builder Wizard"; - public static String WIZARD_DESCRIPTION = "This wizard creates an empty LAMS tool project"; - public static String LAMS_BASE_VERSION = "2.0"; - public static String TOOL_VERSION="20070000"; - public static String SAMPLE_TOOL_NAME = "Sample Tool"; - public static String SAMPLE_TOOL_SIGNATURE = "lams_tool_smpl"; - public static String SAMPLE_VENDOR = "org.lamsfoundation"; + }