}
public ObjectClassDefinition mutateParameters(Data[] data,
ObjectClassDefinition parameters) {
BasicObjectClassDefinition definition;
definition = new BasicObjectClassDefinition("fileViewWithDefinition", "Application Viewer Type", "Please choose an application viewer to read this file.", null);
Display.getDefault().syncExec(new Runnable() {
public void run() {
programTxt = Program.findProgram("txt");
}});
Display.getDefault().syncExec(new Runnable() {
public void run() {
programDoc = Program.findProgram("doc");
}});
Display.getDefault().syncExec(new Runnable() {
public void run() {
programHtml = Program.findProgram("htm");
}});
//TC181
Display.getDefault().syncExec(new Runnable() {
public void run() {
programCsv = Program.findProgram("csv");
}});
String[] defValStringArray = null; //doesn't actually work yet...
int possiblePrograms = 0;
int counter = 0;
if (programHtml != null) {
possiblePrograms++;
}
if (programDoc != null) {
possiblePrograms++;
}
if (programTxt != null) {
possiblePrograms++;
}
if (programCsv != null) {
possiblePrograms++;
}
String[] myOptionLabels = new String[possiblePrograms];
String[] myOptionValues = new String[possiblePrograms];
if (programHtml != null) {
myOptionLabels[counter] = programHtml.getName();
myOptionValues[counter++] = "html";
}
if (programDoc != null) {
myOptionLabels[counter] = programDoc.getName();
myOptionValues[counter++] = "doc";
}
if (programTxt != null) {
myOptionLabels[counter] = programTxt.getName();
myOptionValues[counter++] = "txt";
}
//TC181
if (programTxt != null) {
myOptionLabels[counter] = programCsv.getName();
myOptionValues[counter++] = "csv";
}
AttributeDefinition ad = new BasicAttributeDefinition("viewWith", "View file as", "Type of viewer", AttributeDefinition.STRING, 0, defValStringArray, null, myOptionLabels, myOptionValues);
definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, ad);
return definition;
}