Saturday, 7 September 2013

Create Plug-in Wizard in Eclipse

Create Plug-in Wizard in Eclipse

Following code section is used to create Plugin Development project. in
the first page user select a value from drop down menu. I want to the
second page to be diffret according to the value selected in the frist
page how can I do it.
public class RemoteServiceHostExample1Template extends
OptionTemplateSection {
private String packageName;
private String[][] Value_ecg_providers;
private Properties providers=new Properties();//create the property file
for the providers
public RemoteServiceHostExample1Template() {
setPageCount(3);//set page count of the wizard two
//read from the property file
try {
providers.load(RemoteServiceConsumerExample1Template.class.getClassLoader().getResourceAsStream("providers.properties"));
Value_ecg_providers =
fetchArrayFromPropFile("ecf_providers",providers);
} catch (FileNotFoundException e) {
System.out.print("Property file not found");
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
addComboChoiceOption("containerID", "service.exported.configs",
Value_ecg_providers, "",0);
}
//to get data from the property file
private static String[][] fetchArrayFromPropFile(String propertyName,
Properties propFile) {
String[] a = propFile.getProperty(propertyName).split(";");
String[][] array = new String[a.length][a.length];
for(int i = 0;i < a.length;i++) {
array[i] = a[i].split(",");
}
return array;
}
public void addPages(Wizard wizard) {
WizardPage page = createPage(0, "org.eclipse.pde.doc.user.rcp_mail");
page.setTitle("Hello! Remote Service Host");
page.setDescription("This template creates and exports a Hello remote
service");
wizard.addPage(page);
}

No comments:

Post a Comment