final Object[] result = new Object[1];
final BPListElement newElement = new BPListElement(
fScriptProject, IBuildpathEntry.BPE_SOURCE, false);
final AddSourceFolderWizard wizard = newSourceFolderWizard(
newElement, fExistingElements, container);
AbstractOpenWizardAction action = new AbstractOpenWizardAction() {
protected INewWizard createWizard() throws CoreException {
return wizard;
}
};
action.addPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(IAction.RESULT)) {
if (event.getNewValue().equals(Boolean.TRUE)) {
result[0] = addFakeFolder(
fScriptProject.getProject(), newElement);
} else {
wizard.cancel();
}
}
}
});
action.run();
return result[0];
}
};
dialog.setExisting(existingContainers.toArray());
dialog.setTitle(title);