use of org.eclipse.ui.actions.NewWizardAction in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method createNewProjectsSection.
private void createNewProjectsSection(Composite parent) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
section.setText("Create");
GridDataFactory.fillDefaults().grab(false, false).applyTo(section);
section.setLayout(new GridLayout());
final Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.marginTop = 0;
rowLayout.marginBottom = 0;
headerComposite.setLayout(rowLayout);
headerComposite.setBackground(null);
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
toolBarManager.createControl(headerComposite);
section.setTextClient(headerComposite);
toolBarManager.add(new NewWizardAction(getSite().getWorkbenchWindow()));
toolBarManager.update(true);
Composite container = toolkit.createComposite(section);
container.setLayout(new GridLayout(2, false));
GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_ID_NEW_WIZARD);
IExtension[] extensions = extensionPoint.getExtensions();
IConfigurationElement[] foundElements = new IConfigurationElement[6];
String[] ids = new String[] { JAVA_WIZARD_ID, SPRING_WIZARD_ID, ROO_WIZARD_ID, GROOVY_WIZARD_ID, GRAILS_WIZARD_ID };
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
String id = element.getAttribute("id");
for (int i = 0; i < ids.length; i++) {
if (ids[i].equals(id) && element.getAttribute(ELEMENT_CLASS) != null && element.getAttribute(ELEMENT_NAME) != null && element.getAttribute(ELEMENT_ICON) != null) {
foundElements[i] = element;
}
}
}
}
for (IConfigurationElement element : foundElements) {
createNewProjectFromExtension(container, element);
}
section.setClient(container);
}
Aggregations