Commit d5884f6a authored by arbennett's avatar arbennett
Browse files

Adding option to choose IO format in project generation.


Signed-off-by: default avatararbennett <bennett.andr@gmail.com>
parent b5a44b24
......@@ -14,6 +14,7 @@ Export-Package: org.eclipse.ice.projectgeneration;uses:="org.eclipse.core.resour
Bundle-Vendor: Oak Ridge National Laboratory
Import-Package: org.eclipse.core.resources,
org.eclipse.core.runtime;version="3.5.0",
org.eclipse.ice.io.serializable,
org.eclipse.jface,
org.eclipse.jface.dialogs,
org.eclipse.jface.operation,
......
......@@ -14,10 +14,13 @@ package org.eclipse.ice.projectgeneration.templates;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.ArrayList;
import java.util.Locale;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ice.io.serializable.IReader;
import org.eclipse.ice.io.serializable.IWriter;
import org.eclipse.ice.projectgeneration.ICEProjectResources;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
......@@ -45,6 +48,7 @@ public class ICEItemTemplate extends OptionTemplateSection {
protected static final String KEY_EXTENSION_NAME = "packageName";
protected static final String KEY_JOB_LAUNCHER_EXT = "createJobLauncher";
protected static final String KEY_MODEL_EXT = "createModel";
protected static final String KEY_IO_FORMAT_EXT = "ioFormat";
/**
* Constructor
......@@ -75,6 +79,7 @@ public class ICEItemTemplate extends OptionTemplateSection {
addOption(KEY_CLASS_NAME , "Item Class Base Name" , "" , 0);
addOption(KEY_JOB_LAUNCHER_EXT, "Create Job Launcher?", true, 0);
addOption(KEY_MODEL_EXT, "Create Model?", true, 0);
addOption(KEY_IO_FORMAT_EXT, "File Format", getIOFormatOptions(), "", 0);
}
@Override
......@@ -94,6 +99,30 @@ public class ICEItemTemplate extends OptionTemplateSection {
public void setExtensionName(String extName) {
addOption(KEY_EXTENSION_NAME, "Extension Base Name", extName, 0);
}
private String[][] getIOFormatOptions() {
ArrayList<String> readerTypes = new ArrayList<String>();
ArrayList<String> writerTypes = new ArrayList<String>();
try {
for (IReader reader : IReader.getIReaders()) {
readerTypes.add(reader.getReaderType().replace("Reader", ""));
}
for (IWriter writer : IWriter.getIWriters()) {
writerTypes.add(writer.getWriterType().replace("Writer", ""));
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ArrayList<String> ioFormats = new ArrayList<String>();
for (String writer : writerTypes) {
if (readerTypes.contains(writer))
ioFormats.add(writer);
}
return new String[][] {(String[]) ioFormats.toArray(), (String[]) ioFormats.toArray()};
}
protected String getFormattedPackageName(String id) {
StringBuffer buffer = new StringBuffer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment