|
From: <pat...@us...> - 2009-08-06 15:12:40
|
Revision: 915
http://cishell.svn.sourceforge.net/cishell/?rev=915&view=rev
Author: pataphil
Date: 2009-08-06 15:12:31 +0000 (Thu, 06 Aug 2009)
Log Message:
-----------
* Now outputs all necessary data in the newly-created projects.
* Fixed a couple of bugs with the way input/output data was being retrieved.
* STILL NOT REVIEWED.
Modified Paths:
--------------
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/InputDataProvider.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddInputDataPanel.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddOutputDataPanel.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyInAndOutDataPage.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmTemplate.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableOutputDataDelegate.java
trunk/templates/org.cishell.templates.wizards/templates_3.0/static_executable/ALGORITHM/config.properties
Added Paths:
-----------
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/OutputDataProvider.java
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/InputDataProvider.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/InputDataProvider.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/InputDataProvider.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -4,4 +4,6 @@
public interface InputDataProvider {
public InputDataItem[] getInputDataItems();
+
+ public String formServicePropertiesInputDataString();
}
\ No newline at end of file
Added: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/OutputDataProvider.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/OutputDataProvider.java (rev 0)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/OutputDataProvider.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -0,0 +1,10 @@
+package org.cishell.templates.staticexecutable.providers;
+
+import org.cishell.templates.wizards.staticexecutable.OutputDataItem;
+
+public interface OutputDataProvider {
+ public OutputDataItem[] getOutputDataItems();
+
+ public String formServicePropertiesOutputDataString();
+ public String formConfigPropertiesOutFilesString();
+}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddInputDataPanel.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddInputDataPanel.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddInputDataPanel.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -3,6 +3,7 @@
import java.util.Map;
import org.cishell.templates.guibuilder.BuilderDelegate;
+import org.cishell.templates.guibuilder.EditableAttributeDefinition;
import org.cishell.templates.guibuilder.ListBuilder;
import org.cishell.templates.wizards.staticexecutable.InputDataItem;
import org.cishell.templates.wizards.staticexecutable.StaticExecutableInputDataDelegate;
@@ -13,6 +14,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.TableItem;
@@ -44,16 +46,16 @@
}
public InputDataItem[] getInputDataItems() {
- TableItem[] tableItems = this.listBuilder.getTable().getItems();
- InputDataItem[] inputDataItems = new InputDataItem[tableItems.length];
- Map idToInputDataItemMap = this.delegate.getIDToInputDataItemMap();
-
- for (int ii = 0; ii < tableItems.length; ii++) {
- inputDataItems[ii] = (InputDataItem)
- idToInputDataItemMap.get(tableItems[ii].getText(0));
- }
-
- return inputDataItems;
+ Display display = Display.getDefault();
+
+ if (display != null) {
+ GetInputDataAction action = new GetInputDataAction();
+ display.syncExec(action);
+
+ return action.inputDataItems;
+ } else {
+ return new InputDataItem[0];
+ }
}
private Layout createLayoutForThis() {
@@ -94,4 +96,19 @@
return new Font(device, newFontData);
}
+
+ private class GetInputDataAction implements Runnable {
+ InputDataItem[] inputDataItems;
+
+ public void run() {
+ TableItem[] tableItems = listBuilder.getTable().getItems();
+ inputDataItems = new InputDataItem[tableItems.length];
+ Map idToInputDataItemMap = delegate.getIDToInputDataItemMap();
+
+ for (int ii = 0; ii < tableItems.length; ii++) {
+ inputDataItems[ii] = (InputDataItem)
+ idToInputDataItemMap.get(tableItems[ii].getText(0));
+ }
+ }
+ }
}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddOutputDataPanel.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddOutputDataPanel.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddOutputDataPanel.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -1,7 +1,11 @@
package org.cishell.templates.wizards.pagepanels;
+import java.util.Map;
+
import org.cishell.templates.guibuilder.BuilderDelegate;
import org.cishell.templates.guibuilder.ListBuilder;
+import org.cishell.templates.wizards.staticexecutable.InputDataItem;
+import org.cishell.templates.wizards.staticexecutable.OutputDataItem;
import org.cishell.templates.wizards.staticexecutable.StaticExecutableOutputDataDelegate;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Device;
@@ -10,14 +14,16 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.TableItem;
public class AddOutputDataPanel extends Composite {
public static final String OUTPUT_DATA_LABEL_TEXT = "Output Data";
private ListBuilder listBuilder;
- private BuilderDelegate delegate;
+ private StaticExecutableOutputDataDelegate delegate;
public AddOutputDataPanel(Composite parent, int style) {
super(parent, style);
@@ -40,6 +46,19 @@
return this.delegate;
}
+ public OutputDataItem[] getOutputDataItems() {
+ Display display = Display.getDefault();
+
+ if (display != null) {
+ GetOutputDataAction action = new GetOutputDataAction();
+ display.syncExec(action);
+
+ return action.inputDataItems;
+ } else {
+ return new OutputDataItem[0];
+ }
+ }
+
private Layout createLayoutForThis() {
GridLayout layout = new GridLayout(6, true);
@@ -76,4 +95,19 @@
return new Font(device, newFontData);
}
+
+ private class GetOutputDataAction implements Runnable {
+ OutputDataItem[] inputDataItems;
+
+ public void run() {
+ TableItem[] tableItems = listBuilder.getTable().getItems();
+ inputDataItems = new OutputDataItem[tableItems.length];
+ Map idToInputDataItemMap = delegate.getIDToOutputDataItemMap();
+
+ for (int ii = 0; ii < tableItems.length; ii++) {
+ inputDataItems[ii] = (OutputDataItem)
+ idToInputDataItemMap.get(tableItems[ii].getText(0));
+ }
+ }
+ }
}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyInAndOutDataPage.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyInAndOutDataPage.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyInAndOutDataPage.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -1,9 +1,11 @@
package org.cishell.templates.wizards.pages;
import org.cishell.templates.staticexecutable.providers.InputDataProvider;
+import org.cishell.templates.staticexecutable.providers.OutputDataProvider;
import org.cishell.templates.wizards.pagepanels.AddInputDataPanel;
import org.cishell.templates.wizards.pagepanels.AddOutputDataPanel;
import org.cishell.templates.wizards.staticexecutable.InputDataItem;
+import org.cishell.templates.wizards.staticexecutable.OutputDataItem;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -12,7 +14,7 @@
import org.eclipse.swt.widgets.Layout;
public class SpecifyInAndOutDataPage extends WizardPage
- implements InputDataProvider {
+ implements InputDataProvider, OutputDataProvider {
private AddInputDataPanel addInputDataPanel;
private AddOutputDataPanel addOutputDataPanel;
@@ -69,4 +71,72 @@
public InputDataItem[] getInputDataItems() {
return this.addInputDataPanel.getInputDataItems();
}
+
+ public String formServicePropertiesInputDataString() {
+ InputDataItem[] inputDataItems = getInputDataItems();
+
+ StringBuffer inputDataStringInProgress = new StringBuffer();
+
+ if (inputDataItems.length != 0) {
+ inputDataStringInProgress.append(
+ "file:" + inputDataItems[0].getMimeType());
+
+ for (int ii = 1; ii < inputDataItems.length; ii++) {
+ inputDataStringInProgress.append(
+ ",file:" + inputDataItems[0].getMimeType());
+ }
+ }
+
+ String inputDataString = inputDataStringInProgress.toString();
+
+ return inputDataString;
+ }
+
+ public OutputDataItem[] getOutputDataItems() {
+ return this.addOutputDataPanel.getOutputDataItems();
+ }
+
+ public String formServicePropertiesOutputDataString() {
+ OutputDataItem[] outputDataItems = getOutputDataItems();
+
+ StringBuffer outputDataStringInProgress = new StringBuffer();
+
+ if (outputDataItems.length != 0) {
+ outputDataStringInProgress.append(
+ "file:" + outputDataItems[0].getMimeType());
+
+ for (int ii = 1; ii < outputDataItems.length; ii++) {
+ outputDataStringInProgress.append(
+ ",file:" + outputDataItems[0].getMimeType());
+ }
+ }
+
+ String outputDataString = outputDataStringInProgress.toString();
+
+ return outputDataString;
+ }
+
+ public String formConfigPropertiesOutFilesString() {
+ OutputDataItem[] outputDataItems = getOutputDataItems();
+
+ StringBuffer outputFilesStringInProgress = new StringBuffer();
+
+ for (int ii = 0; ii < outputDataItems.length; ii++) {
+ String outFileBase = "outFile[" + ii + "]";
+ outputFilesStringInProgress.append(
+ outFileBase + "=" + outputDataItems[ii].getFileName() + "\n");
+ outputFilesStringInProgress.append(
+ outFileBase + ".label=" +
+ outputDataItems[ii].getLabel() +
+ "\n");
+ outputFilesStringInProgress.append(
+ outFileBase + ".type=" +
+ outputDataItems[ii].getDataType() +
+ "\n");
+ }
+
+ String outputDataString = outputFilesStringInProgress.toString();
+
+ return outputDataString;
+ }
}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmTemplate.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmTemplate.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmTemplate.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -13,6 +13,8 @@
* ***************************************************************************/
package org.cishell.templates.wizards.staticexecutable;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -137,6 +139,15 @@
public static final String REMOTABLE_LABEL = "Remotable?";
public static final boolean DEFAULT_REMOTABLE_VALUE = true;
+ public static final String IN_DATA_ID = "inData";
+ public static final String HAS_IN_DATA_ID = "hasInData";
+
+ public static final String OUT_DATA_ID = "outData";
+ public static final String HAS_OUT_DATA_ID = "hasOutData";
+ public static final String OUT_FILES_ID = "outFiles";
+ public static final String OUT_FILE_LABELS_ID = "outFileLabels";
+ public static final String OUT_FILE_TYPES_ID = "outFileTypes";
+
public static final String BASE_EXECUTABLE_FILE_OPTION_NAME =
"executableFileOption";
public static final String BASE_RELATED_FILE_OPTION_NAME =
@@ -223,7 +234,44 @@
handleEmptyOption(REFERENCE_URL_ID, HAS_REFERENCE_URL_ID, "");
handleEmptyOption(DOCUMENTATION_URL_ID, HAS_DOCUMENTATION_URL_ID, "");
handleEmptyOption(WRITTEN_IN_ID, HAS_WRITTEN_IN_ID, "");
-
+
+ // Project Parameters Page
+
+ setValue("attributeDefinitions",
+ this.projectParametersPage.toOutputString());
+
+ // In and Out Data Page
+ try{
+ addOption(IN_DATA_ID,
+ "",
+ this.inputAndOutputDataPage.
+ formServicePropertiesInputDataString(),
+ SPECIFY_INPUT_AND_OUTPUT_DATA_PAGE_NUMBER);
+ handleEmptyOption(IN_DATA_ID, HAS_IN_DATA_ID, "");
+
+ addOption(OUT_DATA_ID,
+ "",
+ this.inputAndOutputDataPage.
+ formServicePropertiesOutputDataString(),
+ SPECIFY_INPUT_AND_OUTPUT_DATA_PAGE_NUMBER);
+ handleEmptyOption(OUT_DATA_ID, HAS_OUT_DATA_ID, "");
+
+ addOption(OUT_FILES_ID,
+ "",
+ this.inputAndOutputDataPage.
+ formConfigPropertiesOutFilesString(),
+ SPECIFY_INPUT_AND_OUTPUT_DATA_PAGE_NUMBER);
+ }
+ catch (Exception e1) {
+ try {
+ FileWriter fstream = new FileWriter("C:/Documents and Settings/pataphil/Desktop/out.txt", true);
+ BufferedWriter out = new BufferedWriter(fstream);
+ out.write("exception: \'" + e1.toString() + "\'\n");
+ out.close();
+ } catch (Exception e) {
+ System.err.println("Error: " + e.getMessage());
+ }
+ }
super.execute(project, model, monitor);
}
@@ -440,7 +488,8 @@
private void handleEmptyOption(
String optionID, String isEmptyOptionID, String compareTo) {
- if (getOption(optionID).getValue().toString().equals(compareTo)) {
+ if (getOption(optionID).getValue() == null ||
+ getOption(optionID).getValue().toString().equals(compareTo)) {
setValue(isEmptyOptionID, "#");
} else {
setValue(isEmptyOptionID, "");
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableOutputDataDelegate.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableOutputDataDelegate.java 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableOutputDataDelegate.java 2009-08-06 15:12:31 UTC (rev 915)
@@ -38,6 +38,10 @@
public Composite getParent() {
return this.parent;
}
+
+ public Map getIDToOutputDataItemMap() {
+ return this.idToOutputDataItemMap;
+ }
public String[] createItem() {
OutputDataItem outputDataItem = new OutputDataItem();
Modified: trunk/templates/org.cishell.templates.wizards/templates_3.0/static_executable/ALGORITHM/config.properties
===================================================================
--- trunk/templates/org.cishell.templates.wizards/templates_3.0/static_executable/ALGORITHM/config.properties 2009-08-06 14:02:35 UTC (rev 914)
+++ trunk/templates/org.cishell.templates.wizards/templates_3.0/static_executable/ALGORITHM/config.properties 2009-08-06 15:12:31 UTC (rev 915)
@@ -1,5 +1,3 @@
executable=$executableName$
template=$${executable} $templateString$
$outFiles$
-$outFileLabels$
-$outFileTypes$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|