|
From: <pat...@us...> - 2009-08-13 18:42:33
|
Revision: 918
http://cishell.svn.sourceforge.net/cishell/?rev=918&view=rev
Author: pataphil
Date: 2009-08-13 18:42:24 +0000 (Thu, 13 Aug 2009)
Log Message:
-----------
* Added the choose source code files page.
* Had entire code base for the wizard reviewed by Chintan.
* Attempted to comment code well.
Modified Paths:
--------------
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOption.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOptionProvider.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/pagepanels/SetupPlatformsPanel.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SpecifyTemplateStringPanel.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseExecutableFilesPage.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ParameterListBuilderPage.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/pages/SpecifyTemplateStringPage.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItem.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItemEditor.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/NewStaticExecutableAlgorithmWizard.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItem.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItemEditor.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableInputDataDelegate.java
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/widgets/ChooseExecutableFileWidget.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseFileWidget.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseRelatedFilesWidget.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupHeaderWidget.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupWidget.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ResizeCompositeHackWidget.java
Added Paths:
-----------
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/ChooseSourceCodeFilesPanel.java
trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseSourceCodeFilesPage.java
trunk/templates/org.cishell.templates.wizards/templates_3.0/static_executable/src/
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOption.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOption.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOption.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -1,11 +1,24 @@
package org.cishell.templates.staticexecutable.providers;
import org.eclipse.pde.ui.templates.BaseOptionTemplateSection;
-import org.eclipse.pde.ui.templates.StringOption;
+import org.eclipse.pde.ui.templates.TemplateOption;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
-public class PlatformOption extends StringOption {
+public class PlatformOption extends TemplateOption {
+ public final static int DEFAULT_STYLE = SWT.SINGLE | SWT.BORDER;
+
private String platformName;
private String platformPath;
+ private Text textWidget;
+ private Label labelWidget;
+ private boolean shouldIgnoreListener;
+ private int style;
public PlatformOption(BaseOptionTemplateSection section,
String name,
@@ -14,6 +27,9 @@
String platformPath) {
super(section, name, label);
+ this.style = DEFAULT_STYLE;
+ setRequired(true);
+
this.platformName = platformName;
this.platformPath = platformPath;
}
@@ -25,4 +41,86 @@
public String getPlatformPath() {
return this.platformPath;
}
+
+ public void setReadOnly(boolean readOnly) {
+ if (readOnly) {
+ this.style = DEFAULT_STYLE | SWT.READ_ONLY;
+ } else {
+ this.style = DEFAULT_STYLE;
+ }
+ }
+
+ public String getText() {
+ if (getValue() != null) {
+ return getValue().toString();
+ } else {
+ return null;
+ }
+ }
+
+ public void setText(String newText) {
+ setValue(newText);
+ }
+
+ public void setValue(Object value) {
+ super.setValue(value);
+
+ if (this.textWidget != null) {
+ this.shouldIgnoreListener = true;
+ String textValue = getText();
+
+ if (textValue != null) {
+ this.textWidget.setText(textValue);
+ } else {
+ this.textWidget.setText("");
+ }
+
+ this.shouldIgnoreListener = false;
+ }
+ }
+
+ public void createControl(Composite parent, int span) {
+ this.labelWidget = createLabel(parent, 1);
+ this.labelWidget.setEnabled(isEnabled());
+ this.textWidget = new Text(parent, style);
+
+ if (getValue() != null) {
+ this.textWidget.setText(getValue().toString());
+ }
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = span - 1;
+ this.textWidget.setLayoutData(gridData);
+ this.textWidget.setEnabled(isEnabled());
+
+ this.textWidget.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent modifyEvent) {
+ if (PlatformOption.this.shouldIgnoreListener) {
+ return;
+ }
+
+ PlatformOption.super.setValue(
+ PlatformOption.this.textWidget.getText());
+ getSection().validateOptions(PlatformOption.this);
+ }
+ });
+ }
+
+ public boolean isEmpty() {
+ if (getValue() == null ||
+ getValue().toString().length() == 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+
+ if (this.labelWidget != null) {
+ this.labelWidget.setEnabled(enabled);
+ this.textWidget.setEnabled(enabled);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOptionProvider.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOptionProvider.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/providers/PlatformOptionProvider.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -1,5 +1,7 @@
package org.cishell.templates.staticexecutable.providers;
+import org.eclipse.pde.ui.templates.TemplateOption;
+
public interface PlatformOptionProvider {
public PlatformOption getExecutableFileOption(String platformName);
public PlatformOption[] getExecutableFileOptions();
@@ -10,7 +12,7 @@
public PlatformOption[] getRelatedFileOptions(String platformName);
public void addRelatedFileOption(PlatformOption relatedFileOption);
- public void removeRelatedFileOption(PlatformOption relatedFileOption);
+ public void removeRelatedFileOption(TemplateOption relatedFileOption);
public PlatformOption createRelatedFileOption(
String platformName, String platformPath);
public String formRelatedFileOptionName(String platformName);
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 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddInputDataPanel.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -3,7 +3,6 @@
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;
@@ -19,6 +18,18 @@
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.TableItem;
+/*
+ * This panel provides the user an interface for managing input data via
+ * org.cishell.templates.guibuilder.ListBuilder, an appropriate delegate
+ * (org.cishell.templates.wizards.staticexecutable.
+ * StaticExecutableInputDataDelegate), and an appropriate editor
+ * (org.cishell.templates.wizards.staticexecutable.InputDataItemEditor).
+ * The ListBuilder manages the GUI table and associated buttons.
+ * The delegate provides the ListBuilder and editor the appropriate columns
+ * that represent the data items being managed. It also stores the input data
+ * items.
+ * The editor provides an interface for the user to edit the actual data items.
+ */
public class AddInputDataPanel extends Composite {
public static final String INPUT_DATA_LABEL_TEXT = "Input Data";
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 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/AddOutputDataPanel.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -4,7 +4,6 @@
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;
@@ -19,6 +18,18 @@
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.TableItem;
+/*
+ * This panel provides the user an interface for managing output data via
+ * org.cishell.templates.guibuilder.ListBuilder, an appropriate delegate
+ * (org.cishell.templates.wizards.staticexecutable.
+ * StaticExecutableOutputDataDelegate), and an appropriate editor
+ * (org.cishell.templates.wizards.staticexecutable.OutputDataItemEditor).
+ * The ListBuilder manages the GUI table and associated buttons.
+ * The delegate provides the ListBuilder and editor the appropriate columns
+ * that represent the data items being managed. It also stores the output
+ * data items.
+ * The editor provides an interface for the user to edit the actual data items.
+ */
public class AddOutputDataPanel extends Composite {
public static final String OUTPUT_DATA_LABEL_TEXT = "Output Data";
Added: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/ChooseSourceCodeFilesPanel.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/ChooseSourceCodeFilesPanel.java (rev 0)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/ChooseSourceCodeFilesPanel.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -0,0 +1,37 @@
+package org.cishell.templates.wizards.pagepanels;
+
+import org.cishell.templates.wizards.widgets.ChooseFileWidget;
+import org.eclipse.pde.ui.templates.TemplateOption;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Layout;
+
+/*
+ */
+public class ChooseSourceCodeFilesPanel extends Composite {
+ public ChooseSourceCodeFilesPanel(
+ Composite parent,
+ int style,
+ TemplateOption sourceCodeFilesLocationOption) {
+ super(parent, style);
+
+ setLayout(createLayoutForThis());
+ createChooseSourceCodeFilesWidget(sourceCodeFilesLocationOption);
+ }
+
+ private Layout createLayoutForThis() {
+ GridLayout layout = new GridLayout(3, true);
+ layout.makeColumnsEqualWidth = false;
+
+ return layout;
+ }
+
+ private void createChooseSourceCodeFilesWidget(
+ TemplateOption sourceCodeFilesLocationOption) {
+ int parentWidth =
+ this.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
+ ChooseFileWidget fileSelector = new ChooseFileWidget(
+ this, SWT.NONE, false, parentWidth, sourceCodeFilesLocationOption);
+ }
+}
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SetupPlatformsPanel.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SetupPlatformsPanel.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SetupPlatformsPanel.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -15,12 +15,16 @@
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Text;
+/*
+ * This panel contains several platform setup widgets
+ * (org.cishell.templates.wizards.widgets.PlatformSetupWidget). There is one
+ * platform setup widget per (operating system) platform and a special
+ * platform setup widget for files common to all (operating system) platforms.
+ */
public class SetupPlatformsPanel extends ResizeCompositeHackWidget {
public static final String SPECIFY_EXECUTABLE_NAME_LABEL =
"Executable Name";
- // public static final int SPECIFY_EXECUTABLE_NAME_TEXT_WIDTH = 350;
-
private ArrayList platformSetupWidgets;
public SetupPlatformsPanel(Composite parent,
@@ -52,22 +56,6 @@
executableNameOption.createControl(this, 2);
}
- private void createSpecifyExecutableNameLabel() {
- Label specifyExecutableNameLabel = new Label(this, SWT.NONE);
- specifyExecutableNameLabel.setLayoutData(
- createSpecifyExecutableNameLableLayoutData());
- specifyExecutableNameLabel.setText(
- SPECIFY_EXECUTABLE_NAME_LABEL + ":");
- }
-
- private Text createSpecifyExecutableNameText() {
- Text specifyExecutableNameText = new Text(this, SWT.BORDER);
- specifyExecutableNameText.setLayoutData(
- createSpecifyExecutableNameTextLayoutData());
-
- return specifyExecutableNameText;
- }
-
private ArrayList createPlatformSetupWidgets(
PlatformOptionProvider platformOptionProvider) {
ArrayList platformSetupWidgets = new ArrayList();
@@ -103,21 +91,6 @@
return platformSetupWidgets;
}
- private Object createSpecifyExecutableNameLableLayoutData() {
- GridData data = new GridData();
-
- return data;
- }
-
- private Object createSpecifyExecutableNameTextLayoutData() {
- GridData data = new GridData();
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = true;
- // data.widthHint = SPECIFY_EXECUTABLE_NAME_TEXT_WIDTH;
-
- return data;
- }
-
private Object createPlatformSetupWidgetLayoutData() {
GridData data = new GridData();
data.horizontalAlignment = SWT.FILL;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SpecifyTemplateStringPanel.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SpecifyTemplateStringPanel.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pagepanels/SpecifyTemplateStringPanel.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -16,9 +16,10 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
import org.osgi.service.metatype.AttributeDefinition;
+/*
+ */
public class SpecifyTemplateStringPanel extends Composite
implements SelectionListener {
public static final String PLACEHOLDER_LABEL =
@@ -100,11 +101,13 @@
createPlaceholderTableLabelLayoutData());
placeholderTableLabel.setText(PLACEHOLDER_LABEL);
- Label insertButtonLabel = new Label(this, SWT.NONE);
- insertButtonLabel.setLayoutData(
+ // This is to keep the layout manager happy and make everything line up
+ // the way it should.
+ Label dummyLabel = new Label(this, SWT.NONE);
+ dummyLabel.setLayoutData(
createInsertPlaceholderButtonLayoutData());
- insertButtonLabel.setText(INSERT_PLACEHOLDER_BUTTON_LABEL);
- insertButtonLabel.setVisible(false);
+ dummyLabel.setText(INSERT_PLACEHOLDER_BUTTON_LABEL);
+ dummyLabel.setVisible(false);
// To accomodate for the option label control.
new Label(this, SWT.NONE).setLayoutData(new GridData());
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseExecutableFilesPage.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseExecutableFilesPage.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseExecutableFilesPage.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -10,6 +10,13 @@
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.widgets.Composite;
+/*
+ * This page allows users to specify the name of the executable file (which
+ * should be the same across all platforms), the actual executable files for
+ * the various platforms, and the related files for the various platforms.
+ * The logic for this page is spread out in several locations, but for a start,
+ * check org.cishell.templates.wizards.pagepanels.SetupPlatformsPanel .
+ */
public class ChooseExecutableFilesPage extends WizardPage {
private SetupPlatformsPanel setupPlatformsPanel;
private TemplateOption executableNameOption;
Added: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseSourceCodeFilesPage.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseSourceCodeFilesPage.java (rev 0)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ChooseSourceCodeFilesPage.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -0,0 +1,31 @@
+package org.cishell.templates.wizards.pages;
+
+import org.cishell.templates.wizards.pagepanels.ChooseSourceCodeFilesPanel;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.pde.ui.templates.TemplateOption;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/*
+ * This page allows algorithm creators to choose a single file that is intended
+ * to be an archive file containing their algorithm source code.
+ */
+public class ChooseSourceCodeFilesPage extends WizardPage {
+ private ChooseSourceCodeFilesPanel chooseSourceCodeFilesPanel;
+ private TemplateOption sourceCodeFilesLocationOption;
+
+ public ChooseSourceCodeFilesPage(
+ String pageName,
+ TemplateOption sourceCodeFilesLocationOption) {
+ super(pageName);
+
+ this.sourceCodeFilesLocationOption = sourceCodeFilesLocationOption;
+ }
+
+ public void createControl(Composite parent) {
+ this.chooseSourceCodeFilesPanel = new ChooseSourceCodeFilesPanel(
+ parent, SWT.NONE, this.sourceCodeFilesLocationOption);
+
+ setControl(this.chooseSourceCodeFilesPanel);
+ }
+}
\ No newline at end of file
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ParameterListBuilderPage.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ParameterListBuilderPage.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/ParameterListBuilderPage.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -27,7 +27,10 @@
import org.eclipse.swt.widgets.Shell;
import org.osgi.service.metatype.AttributeDefinition;
-
+/*
+ * This page provides algorithm creators with an interface for specifying the
+ * GUI-based input parameters that their algorithms accept.
+ */
public class ParameterListBuilderPage extends WizardPage
implements InputParameterProvider {
ParameterListBuilder builder;
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 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyInAndOutDataPage.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -13,6 +13,13 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Layout;
+/*
+ * This page allows users the specify input and output data.
+ * Input data is handled in
+ * org.cishell.templates.wizards.pagepanels.AddInputDataPanel, and output data
+ * is handled in
+ * org.cishell.templates.wizards.pagepanels.AddOutputDataPanel.
+ */
public class SpecifyInAndOutDataPage extends WizardPage
implements InputDataProvider, OutputDataProvider {
private AddInputDataPanel addInputDataPanel;
@@ -42,19 +49,19 @@
return layout;
}
- private AddInputDataPanel createAndSetupInputDataPanel(Composite container,
- final Composite parent) {
+ private AddInputDataPanel createAndSetupInputDataPanel(
+ Composite container, final Composite parent) {
AddInputDataPanel addInputDataPanel =
- new AddInputDataPanel(container, SWT.BORDER);
+ new AddInputDataPanel(container, SWT.NONE);
addInputDataPanel.setLayoutData(createPanelLayoutData());
return addInputDataPanel;
}
- private AddOutputDataPanel createAndSetupOutputDataPanel(Composite container,
- final Composite parent) {
+ private AddOutputDataPanel createAndSetupOutputDataPanel(
+ Composite container, final Composite parent) {
AddOutputDataPanel addOutputDataPanel =
- new AddOutputDataPanel(container, SWT.BORDER);
+ new AddOutputDataPanel(container, SWT.NONE);
addOutputDataPanel.setLayoutData(createPanelLayoutData());
return addOutputDataPanel;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyTemplateStringPage.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyTemplateStringPage.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/pages/SpecifyTemplateStringPage.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -8,6 +8,14 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+/*
+ * This page provides algorithm creators with a list of possible "placeholders"
+ * that can be used in the template string.
+ * The template string is the string used when invoking the static executable
+ * on the command line. As such, it specifies all program arguments.
+ * The placeholders possible are the input data items and algorithm parameters
+ * that the algorithm creator specified.
+ */
public class SpecifyTemplateStringPage extends WizardPage {
private SpecifyTemplateStringPanel specifyTemplateStringPanel;
private InputParameterProvider inputParameterProvider;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItem.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItem.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItem.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -1,5 +1,11 @@
package org.cishell.templates.wizards.staticexecutable;
+/*
+ * For static executable algorithms, input data items are always files, and
+ * they are always referred to by an index (as opposed to an ID).
+ * Thus, input data items only contain mime types and a position, and the
+ * position is determined by the delegate.
+ */
public class InputDataItem {
String mimeType;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItemEditor.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItemEditor.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/InputDataItemEditor.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -10,6 +10,10 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+/*
+ * This editor provides the user with an interface to edit input data items
+ * (InputDataItem).
+ */
public class InputDataItemEditor extends Dialog {
private Text mimeTypeText;
private InputDataItem inputDataItem;
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 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmTemplate.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -13,8 +13,6 @@
* ***************************************************************************/
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;
@@ -23,6 +21,7 @@
import org.cishell.templates.staticexecutable.providers.PlatformOptionProvider;
import org.cishell.templates.wizards.BasicTemplate;
import org.cishell.templates.wizards.pages.ChooseExecutableFilesPage;
+import org.cishell.templates.wizards.pages.ChooseSourceCodeFilesPage;
import org.cishell.templates.wizards.pages.ParameterListBuilderPage;
import org.cishell.templates.wizards.pages.SpecifyInAndOutDataPage;
import org.cishell.templates.wizards.pages.SpecifyTemplateStringPage;
@@ -57,6 +56,8 @@
"specifyInAndOutDataPage";
public static final String SPECIFY_TEMPLATE_STRING_PAGE_ID =
"specifyTemplateStringPage";
+ public static final String CHOOSE_SOURCE_CODE_FILES_PAGE_ID =
+ "chooseSoureCodeFilesPage";
public static final String BUNDLE_NAME_ID = "bundleName";
public static final String BUNDLE_NAME_LABEL = "Bundle Name";
@@ -171,6 +172,10 @@
public static final String TEMPLATE_STRING_LABEL = "";
public static final String DEFAULT_TEMPLATE_STRING = "";
+ public static final String CHOOSE_SOURCE_CODE_FILES_ID = "sourceCodeFiles";
+ public static final String CHOOSE_SOURCE_CODE_FILES_LABEL =
+ "Choose an archive file that contains your source code files";
+
public static final String[][] GROUP_CHOICES = new String[][] {
{ MENU_START_LABEL, MENU_START_DESCRIPTION },
{ MENU_ADDITIONS_LABEL, MENU_ADDITIONS_DESCRIPTION },
@@ -178,19 +183,20 @@
};
private WizardNewProjectCreationPage createProjectPage;
+ private WizardPage bundlePropertiesPage;
private ChooseExecutableFilesPage chooseExecutableFilesPage;
- private WizardPage bundlePropertiesPage;
private WizardPage projectPropertiesPage;
private ParameterListBuilderPage projectParametersPage;
private SpecifyInAndOutDataPage inputAndOutputDataPage;
private SpecifyTemplateStringPage specifyTemplateStringPage;
- private WizardPage sourceCodeFilesPage;
+ private ChooseSourceCodeFilesPage sourceCodeFilesPage;
private TemplateOption executableNameOption;
private Map platformExecutableOptions = new HashMap();
private MultiHashMapWithCounts relatedFileOptions =
new MultiHashMapWithCounts();
private TemplateOption templateStringOption;
+ private TemplateOption sourceCodeFilesOption;
public NewStaticExecutableAlgorithmTemplate() {
super("static_executable");
@@ -207,19 +213,47 @@
setupSourceCodeFilesPage();
}
+ public TemplateOption getSourceCodeFilesTemplateOption() {
+ return this.sourceCodeFilesOption;
+ }
+
public void addPages(Wizard wizard) {
- wizard.addPage(createCreateProjectPage());
- createBundlePropertiesPage(wizard);
- createChooseExecutableFilesPage(wizard);
- createProjectPropertiesPage(wizard);
- createProjectParametersPage(wizard);
- createInputAndOutputDataPage(wizard);
- createTemplateStringPage(wizard);
- createSourceCodeFilesPage(wizard);
+ this.createProjectPage = createCreateProjectPage();
+ wizard.addPage(this.createProjectPage);
+ this.bundlePropertiesPage = createBundlePropertiesPage();
+ wizard.addPage(this.bundlePropertiesPage);
+
+ this.chooseExecutableFilesPage = createChooseExecutableFilesPage();
+ wizard.addPage(this.chooseExecutableFilesPage);
+
+ this.projectPropertiesPage = createProjectPropertiesPage();
+ wizard.addPage(this.projectPropertiesPage);
+
+ this.projectParametersPage = createProjectParametersPage();
+ wizard.addPage(this.projectParametersPage);
+
+ this.inputAndOutputDataPage = createInputAndOutputDataPage();
+ wizard.addPage(this.inputAndOutputDataPage);
+
+ this.specifyTemplateStringPage = createTemplateStringPage();
+ wizard.addPage(this.specifyTemplateStringPage);
+
+ this.sourceCodeFilesPage = createSourceCodeFilesPage();
+ wizard.addPage(this.sourceCodeFilesPage);
+
markPagesAdded();
}
+ /*
+ * execute is basically called when the user clicks the Finish button in
+ * the wizard. This is where all of the template options should be
+ * processed and/or created.
+ * Template options are basically key/value string pairs. If a template
+ * option's key is found in the project template files (in the
+ * templates_3.0 directory), it is replaced with the template option's
+ * value.
+ */
public void execute(IProject project,
IPluginModelBase model,
IProgressMonitor monitor) throws CoreException {
@@ -229,6 +263,7 @@
// Project Properties Page
+ // See comments on handleEmptyOption.
handleEmptyOption(ON_MENU_ID, IS_ON_MENU_ID, Boolean.TRUE);
handleEmptyOption(LABEL_ID, HAS_LABEL_ID, "");
handleEmptyOption(DESCRIPTION_ID, HAS_DESCRIPTION_ID, "");
@@ -264,7 +299,12 @@
this.projectParametersPage.toOutputString());
// In and Out Data Page
- try{
+
+ /*
+ * These options are not tied directly to input fields on any of the
+ * pages. Their values are derviced from the input fields that ARE on
+ * the pages.
+ */
addOption(IN_DATA_ID,
"",
this.inputAndOutputDataPage.
@@ -284,17 +324,7 @@
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);
}
@@ -326,81 +356,93 @@
return createProjectPage.getProjectHandle();
}
- private WizardPage createCreateProjectPage() {
- this.createProjectPage =
+ private WizardNewProjectCreationPage createCreateProjectPage() {
+ WizardNewProjectCreationPage createProjectPage =
new WizardNewProjectCreationPage(CREATE_PROJECT_PAGE_ID);
- this.createProjectPage.setTitle(
+ createProjectPage.setTitle(
"Create a New Static Executable Project");
- this.createProjectPage.setDescription("Enter the project name");
+ createProjectPage.setDescription("Enter the project name");
return createProjectPage;
}
- private void createBundlePropertiesPage(Wizard wizard) {
- this.bundlePropertiesPage =
+ private WizardPage createBundlePropertiesPage() {
+ WizardPage bundlePropertiesPage =
createPage(PROJECT_BUNDLE_PROPERTIES_PAGE_NUMBER);
- this.bundlePropertiesPage.setTitle("Bundle Properties");
- this.bundlePropertiesPage.setDescription(
+ bundlePropertiesPage.setTitle("Bundle Properties");
+ bundlePropertiesPage.setDescription(
"Enter the bundle name, and bundle version");
- wizard.addPage(this.bundlePropertiesPage);
+
+ return bundlePropertiesPage;
}
- private void createChooseExecutableFilesPage(Wizard wizard) {
- this.chooseExecutableFilesPage = new ChooseExecutableFilesPage(
- CHOOSE_EXECUTABLE_FILES_PAGE_ID, this.executableNameOption, this);
- this.chooseExecutableFilesPage.setTitle("Choose Executable Files");
- this.chooseExecutableFilesPage.setDescription(
+ private ChooseExecutableFilesPage createChooseExecutableFilesPage() {
+ ChooseExecutableFilesPage chooseExecutableFilesPage =
+ new ChooseExecutableFilesPage(CHOOSE_EXECUTABLE_FILES_PAGE_ID,
+ this.executableNameOption,
+ this);
+ chooseExecutableFilesPage.setTitle("Choose Executable Files");
+ chooseExecutableFilesPage.setDescription(
"Choose the executable files and any files they depend on");
- wizard.addPage(this.chooseExecutableFilesPage);
+
+ return chooseExecutableFilesPage;
}
- private void createProjectPropertiesPage(Wizard wizard) {
- this.projectPropertiesPage =
+ private WizardPage createProjectPropertiesPage() {
+ WizardPage projectPropertiesPage =
createPage(PROJECT_PROPERTIES_PAGE_NUMBER);
- this.projectPropertiesPage.setTitle("Project Properties");
- this.projectPropertiesPage.setDescription("Enter project properties");
- wizard.addPage(this.projectPropertiesPage);
+ projectPropertiesPage.setTitle("Project Properties");
+ projectPropertiesPage.setDescription("Enter project properties");
+
+ return projectPropertiesPage;
}
- private void createProjectParametersPage(Wizard wizard) {
- this.projectParametersPage =
+ private ParameterListBuilderPage createProjectParametersPage() {
+ ParameterListBuilderPage projectParametersPage =
new ParameterListBuilderPage(SETUP_PARAMETERS_PAGE_ID);
- this.projectParametersPage.setTitle("Project Parameters");
- this.projectParametersPage.setDescription("Enter project parameters");
- wizard.addPage(this.projectParametersPage);
+ projectParametersPage.setTitle("Project Parameters");
+ projectParametersPage.setDescription("Enter project parameters");
+
+ return projectParametersPage;
}
- private void createInputAndOutputDataPage(Wizard wizard) {
- this.inputAndOutputDataPage =
+ private SpecifyInAndOutDataPage createInputAndOutputDataPage() {
+ SpecifyInAndOutDataPage inputAndOutputDataPage =
new SpecifyInAndOutDataPage(SPECIFY_IN_AND_OUT_DATA_PAGE_ID);
- this.inputAndOutputDataPage.setTitle("Input and Output Data");
- this.inputAndOutputDataPage.setDescription(
+ inputAndOutputDataPage.setTitle("Input and Output Data");
+ inputAndOutputDataPage.setDescription(
"Enter the input and output data");
- wizard.addPage(this.inputAndOutputDataPage);
+
+ return inputAndOutputDataPage;
}
- private void createTemplateStringPage(Wizard wizard) {
- this.specifyTemplateStringPage = new SpecifyTemplateStringPage(
- SPECIFY_TEMPLATE_STRING_PAGE_ID,
- projectParametersPage,
- inputAndOutputDataPage,
- this.templateStringOption);
- this.specifyTemplateStringPage.setTitle("Template String");
- this.specifyTemplateStringPage.setDescription(
+ private SpecifyTemplateStringPage createTemplateStringPage() {
+ SpecifyTemplateStringPage specifyTemplateStringPage =
+ new SpecifyTemplateStringPage(
+ SPECIFY_TEMPLATE_STRING_PAGE_ID,
+ projectParametersPage,
+ inputAndOutputDataPage,
+ this.templateStringOption);
+ specifyTemplateStringPage.setTitle("Template String");
+ specifyTemplateStringPage.setDescription(
"Enter the template string used to execute your program");
- wizard.addPage(this.specifyTemplateStringPage);
+
+ return specifyTemplateStringPage;
}
- private void createSourceCodeFilesPage(Wizard wizard) {
- this.sourceCodeFilesPage = createPage(SOURCE_CODE_FILES_PAGE_NUMBER);
- this.sourceCodeFilesPage.setTitle("Source Code Files (Optional)");
- this.sourceCodeFilesPage.setDescription(
+ private ChooseSourceCodeFilesPage createSourceCodeFilesPage() {
+ ChooseSourceCodeFilesPage sourceCodeFilesPage =
+ new ChooseSourceCodeFilesPage(
+ CHOOSE_SOURCE_CODE_FILES_PAGE_ID,
+ this.sourceCodeFilesOption);
+ sourceCodeFilesPage.setTitle("Source Code Files (Optional)");
+ sourceCodeFilesPage.setDescription(
"Enter the source code files for your program");
- wizard.addPage(this.sourceCodeFilesPage);
+
+ return sourceCodeFilesPage;
}
- private void setupCreateProjectPage() {
- }
+ private void setupCreateProjectPage() { }
private void setupBundlePropertiesPage() {
addOption(BUNDLE_NAME_ID,
@@ -491,11 +533,9 @@
PROJECT_PROPERTIES_PAGE_NUMBER).setRequired(true);
}
- private void setupProjectParametersPage() {
- }
+ private void setupProjectParametersPage() { }
- private void setupInputAndOutputDataPage() {
- }
+ private void setupInputAndOutputDataPage() { }
private void setupTemplateStringPage() {
this.templateStringOption = addOption(
@@ -507,8 +547,29 @@
}
private void setupSourceCodeFilesPage() {
+ this.sourceCodeFilesOption = addOption(
+ CHOOSE_SOURCE_CODE_FILES_ID,
+ CHOOSE_SOURCE_CODE_FILES_LABEL + ":",
+ "",
+ SOURCE_CODE_FILES_PAGE_NUMBER);
+ this.sourceCodeFilesOption.setRequired(false);
}
+ /*
+ * As far as I know, there are no conditionals in the templating langauge
+ * used when processing the new project templates (in the templates_3.0
+ * directory).
+ * To avoid having empty values in the properties files, the templates must
+ * be setup to comment out key/value lines in case the values are empty.
+ * What handleEmptyOption does is check if the value of the option optionID
+ * is NOT equal to compareTo, and if so, it sets the "comment-out"
+ * template option isEmptyOptionID to have the value "#", which will
+ * comment out the line if it's placed accordingly in the template.
+ * For example, if there were the line
+ * $isOptionEmpty$key=$value$
+ * the template option isOptionEmpty would be set to "#" if the template
+ * option value is empty.
+ */
private void handleEmptyOption(
String optionID, String isEmptyOptionID, String compareTo) {
if (getOption(optionID).getValue() == null ||
@@ -592,9 +653,15 @@
relatedFileOption.getPlatformName(), relatedFileOption);
}
- public void removeRelatedFileOption(PlatformOption relatedFileOption) {
- this.relatedFileOptions.removeValue(
- relatedFileOption.getPlatformName(), relatedFileOption);
+ public void removeRelatedFileOption(TemplateOption relatedFileOption) {
+ if (relatedFileOption instanceof PlatformOption) {
+ PlatformOption relatedFilePlatformOption =
+ (PlatformOption)relatedFileOption;
+
+ this.relatedFileOptions.removeValue(
+ relatedFilePlatformOption.getPlatformName(),
+ relatedFilePlatformOption);
+ }
}
public PlatformOption createRelatedFileOption(String platformName,
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmWizard.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmWizard.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/NewStaticExecutableAlgorithmWizard.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -35,6 +35,7 @@
import org.eclipse.pde.internal.core.bundle.BundlePluginModelBase;
import org.eclipse.pde.ui.templates.ITemplateSection;
import org.eclipse.pde.ui.templates.NewPluginTemplateWizard;
+import org.eclipse.pde.ui.templates.TemplateOption;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
@@ -53,7 +54,6 @@
public class NewStaticExecutableAlgorithmWizard extends NewPluginTemplateWizard
implements IWorkbenchWizard {
- // TODO: Different label string?
public static final String DEFAULT_LABEL = "Common to All";
public static final String DEFAULT_PATH = "/default/";
@@ -75,25 +75,24 @@
public static final String WIN_32_LABEL = "Windows (32 bit)";
public static final String WIN_32_PATH = "/win32/";
- // TODO: This should be improved.
public static final String[] PLATFORM_LABELS = new String[] {
DEFAULT_LABEL,
+ WIN_32_LABEL,
+ MAC_OSX_X86_LABEL,
+ MAC_OSX_PPC_LABEL,
LINUX_X86_32_LABEL,
LINUX_X86_64_LABEL,
- MAC_OSX_PPC_LABEL,
- MAC_OSX_X86_LABEL,
- SOLARIS_SPARC_LABEL,
- WIN_32_LABEL
+ SOLARIS_SPARC_LABEL
};
public static final String[] PLATFORM_PATHS = new String[] {
DEFAULT_PATH,
+ WIN_32_PATH,
+ MAC_OSX_X86_PATH,
+ MAC_OSX_PPC_PATH,
LINUX_X86_32_PATH,
LINUX_X86_64_PATH,
- MAC_OSX_PPC_PATH,
- MAC_OSX_X86_PATH,
- SOLARIS_SPARC_PATH,
- WIN_32_PATH
+ SOLARIS_SPARC_PATH
};
NewStaticExecutableAlgorithmTemplate template;
@@ -148,7 +147,7 @@
PlatformOption executableFileOption =
template.getExecutableFileOption(
PLATFORM_LABELS[ii]);
- copyPlatformOptionFile(
+ copyTemplateOptionFile(
executableFileOption, directoryPath, project);
}
@@ -156,11 +155,18 @@
template.getRelatedFileOptions(PLATFORM_LABELS[ii]);
for (int jj = 0; jj < relatedFileOptions.length; jj++) {
- copyPlatformOptionFile(
+ copyTemplateOptionFile(
relatedFileOptions[jj], directoryPath, project);
}
}
+ String sourceCodeDirectoryPath = "src/";
+ TemplateOption sourceCodeFilesTemplateOption =
+ template.getSourceCodeFilesTemplateOption();
+ copyTemplateOptionFile(sourceCodeFilesTemplateOption,
+ sourceCodeDirectoryPath,
+ project);
+
monitor.done();
}
};
@@ -204,11 +210,11 @@
}
- private void copyPlatformOptionFile(PlatformOption platformOption,
+ private void copyTemplateOptionFile(TemplateOption templateOption,
String directoryPath,
IProject project)
throws CoreException {
- String sourceFilePath = platformOption.getText();
+ String sourceFilePath = templateOption.getValue().toString();
if (sourceFilePath == null || "".equals(sourceFilePath)) {
return;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItem.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItem.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItem.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -1,5 +1,17 @@
package org.cishell.templates.wizards.staticexecutable;
+/*
+ * For static executable algorithms, output data items are always files. It is
+ * up to the algorithm creators to make the names the output files their
+ * programs create and the names specified in the static executable algorithm
+ * match up, so CIShell can find the files.
+ * Labels can be specified for the output files.
+ * Output files for static executable algorithms also contain data types, which
+ * determine the icon CIShell uses for the associated data item in the Data
+ * Manager.
+ * Example data types are Network and Plot.
+ * Output files must also specify appropriate mime types.
+ */
public class OutputDataItem {
private String fileName = "";
private String label = "";
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItemEditor.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItemEditor.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/OutputDataItemEditor.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -11,7 +11,6 @@
import org.eclipse.swt.widgets.Text;
public class OutputDataItemEditor extends Dialog {
- private Text idText;
private Text fileNameText;
private Text labelText;
private Text dataTypeText;
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableInputDataDelegate.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableInputDataDelegate.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableInputDataDelegate.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -47,7 +47,7 @@
idToInputDataItemMap.put("" + this.lastID, inputDataItem);
String[] item = new String[] {
- "" + this.lastID,
+ Integer.toString(this.lastID),
inputDataItem.getMimeType()
};
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 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/staticexecutable/StaticExecutableOutputDataDelegate.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -53,7 +53,8 @@
boolean success = editOutputDataItem(outputDataItem);
if (success) {
- idToOutputDataItemMap.put("" + this.lastID, outputDataItem);
+ idToOutputDataItemMap.put(Integer.toString(this.lastID),
+ outputDataItem);
String[] item = new String[] {
"" + this.lastID,
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseExecutableFileWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseExecutableFileWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseExecutableFileWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -9,6 +9,10 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
+/*
+ * This widget allows the user to choose one file, which is intended to be the
+ * executable file for the provided platform (name and path).
+ */
public class ChooseExecutableFileWidget extends Composite {
public static final String CHOOSE_EXECUTABLE_FILE_LABEL =
"Choose Executable File";
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseFileWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseFileWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseFileWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -1,6 +1,6 @@
package org.cishell.templates.wizards.widgets;
-import org.cishell.templates.staticexecutable.providers.PlatformOption;
+import org.eclipse.pde.ui.templates.TemplateOption;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -13,6 +13,14 @@
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Text;
+/*
+ * This widget allows the user the choose a file off of his/her hard drive.
+ * It ties the chosen file's path to a provided TemplateOption so the chosen
+ * files can be processed upon the wizard's completion.
+ * This widget can optionally call back upon it being filled or its Remove
+ * button being selected to allow its parent component handle any appropriate
+ * actions.
+ */
public class ChooseFileWidget extends Composite implements SelectionListener {
public static final String BROWSE_FILES_BUTTON_LABEL = "Browse";
public static final String REMOVE_FILE_LABEL_TEXT = "Remove?";
@@ -24,14 +32,15 @@
private Text filePathText;
private Button browseFilesButton;
+ // TODO: Make these listeners of an interface.
private ChooseRelatedFilesWidget fileChosenListener;
private ChooseRelatedFilesWidget removeElementListener;
- private PlatformOption platformOption;
+ private TemplateOption platformOption;
public ChooseFileWidget(Composite parent,
int style,
int parentParentWidth,
- PlatformOption stringOption) {
+ TemplateOption stringOption) {
this(parent, style, true, parentParentWidth, stringOption);
}
@@ -39,7 +48,7 @@
int style,
boolean hasRemoveButton,
int parentParentWidth,
- PlatformOption platformOption) {
+ TemplateOption platformOption) {
super(parent, style);
this.platformOption = platformOption;
@@ -49,24 +58,20 @@
Composite container =
createContainer(hasRemoveButton, parentParentWidth);
this.platformOption.createControl(container, 2);
-// this.filePathText = createFilePathText();
this.browseFilesButton = createBrowseFilesButton();
createRemoveElement(hasRemoveButton);
-
- // fixFilePathTextWidth(widthForFilePathText);
}
- public PlatformOption getPlatformOption() {
+ public TemplateOption getPlatformOption() {
return this.platformOption;
}
public String getFilePath() {
- return this.platformOption.getText();
- // return this.filePathText.getText();
+ return this.platformOption.getValue().toString();
}
public void setFilePath(String filePath) {
- this.platformOption.setText(filePath);
+ this.platformOption.setValue(filePath);
}
public void widgetDefaultSelected(SelectionEvent selectionEvent) {
@@ -133,13 +138,6 @@
return container;
}
- private Text createFilePathText() {
- Text filePathText = new Text(this, SWT.BORDER);
- filePathText.setEditable(true);
-
- return filePathText;
- }
-
private Button createBrowseFilesButton() {
Button browseFilesButton = new Button(this, SWT.PUSH);
browseFilesButton.setLayoutData(createBrowseFilesButtonLayoutData());
@@ -163,11 +161,6 @@
}
}
- private void fixFilePathTextWidth(int widthForFilePathText) {
- this.filePathText.setLayoutData(
- createFilePathTextLayoutData(widthForFilePathText));
- }
-
private void browseButtonSelected(SelectionEvent selectionEvent) {
FileDialog fileDialog = new FileDialog(getShell(), SWT.NULL);
fileDialog.setFileName(getFilePath());
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseRelatedFilesWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseRelatedFilesWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ChooseRelatedFilesWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -11,6 +11,15 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
+/*
+ * This widget the user to choose and remove one or more files related to the
+ * executable file for the provided platform (name and path).
+ * As soon as the last file selector is filled with a file path, this widget
+ * provides an additional file selector for the user to continue providing
+ * additional related files.
+ * All related file selectors besides the first one can be removed in this
+ * widget.
+ */
public class ChooseRelatedFilesWidget extends ResizeCompositeHackWidget {
public static final String CHOOSE_RELATED_FILES_LABEL_TEXT =
"Choose Related Files";
@@ -45,7 +54,6 @@
this.firstFileSelector = createAndSetupFileSelector(false);
}
- // TODO: How to get the file paths out?
public ChooseFileWidget getFirstFileSelector() {
return this.firstFileSelector;
}
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupHeaderWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupHeaderWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupHeaderWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -9,6 +9,10 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+/*
+ * This widget contains any appropriate header widgets for a
+ * PlatformSetupWidget.
+ */
public class PlatformSetupHeaderWidget extends Composite {
public static final String PLATFORM_LABEL = "Platform";
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/PlatformSetupWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -7,6 +7,15 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Layout;
+/*
+ * This widget contains a header, which is a PlatformSetupHeaderWidget object,
+ * and it is associated with an operating system platform via its platformName
+ * and platformPath member variables.
+ * There is also optionally a widget for choosing an executable file for the
+ * associated platform, which is of type ChooseExecutableFileWidget.
+ * There is always a widget for choosing and removing one or more related
+ * files, which is of the type ChooseRelatedFilesWidget.
+ */
public class PlatformSetupWidget extends ResizeCompositeHackWidget {
public static final int WIDGET_WIDTH = 454;
public static final int WIDGET_HEIGHT = 317;
@@ -101,8 +110,6 @@
GridData data = new GridData();
data.horizontalSpan = 2;
data.grabExcessHorizontalSpace = true;
-// data.horizontalAlignment = SWT.CENTER;
-// data.verticalAlignment = SWT.CENTER;
return data;
}
@@ -125,13 +132,11 @@
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
- // data.widthHint = WIDGET_WIDTH;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
if (!shouldSpanEntireWidth) {
data.horizontalAlignment = GridData.FILL;
- // data.widthHint = WIDGET_WIDTH;
data.grabExcessHorizontalSpace = true;
data.horizontalSpan = 2;
} else {
Modified: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ResizeCompositeHackWidget.java
===================================================================
--- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ResizeCompositeHackWidget.java 2009-08-06 22:02:26 UTC (rev 917)
+++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/widgets/ResizeCompositeHackWidget.java 2009-08-13 18:42:24 UTC (rev 918)
@@ -5,6 +5,12 @@
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
+/*
+ * This "widget" ensures that both it and its parent component get resized
+ * appropriate when its size is set.
+ * It handles the case where its parent component is a ScrolledComposite, so
+ * scrolling happens properly.
+ */
public class ResizeCompositeHackWidget extends Composite {
public ResizeCompositeHackWidget(Composite parent, int style) {
super(parent, style);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|