data.heightHint = SIZING_LISTS_HEIGHT;
}
composite.setLayoutData(data);
filteredTreeFilter = new WizardPatternFilter();
FilteredTree filterTree = new FilteredTree(composite, SWT.SINGLE
| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filteredTreeFilter,
true);
final TreeViewer treeViewer = filterTree.getViewer();
treeViewer.setContentProvider(new WizardContentProvider());
treeViewer.setLabelProvider(new WorkbenchLabelProvider());
treeViewer.addSelectionChangedListener(this);
ArrayList inputArray = new ArrayList();
for (int i = 0; i < primaryWizards.length; i++) {
inputArray.add(primaryWizards[i]);
}
if (!projectsOnly) {
IWizardCategory phpCategory = wizardCategories
.findCategory(new Path("org.eclipse.php.project.ui")); //$NON-NLS-1$
// IWizardCategory[] children = wizardCategories.getCategories();
// for (int i = 0; i < children.length; i++) {
// if ("org.eclipse.php.project.ui".equals(children[i].getId())) {
// phpCategory = children[i];
// }
// }
if (phpCategory != null) {
IWizardDescriptor[] wizards = phpCategory.getWizards();
for (int i = 0; i < wizards.length; i++) {
inputArray.add(wizards[i]);
}
inputArray = sortWizard(inputArray);
IWizardCategory[] categories = phpCategory.getCategories();
for (int i = 0; i < categories.length; i++) {
inputArray.add(categories[i]);
}
IWizardDescriptor folder = wizardCategories
.findWizard("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$
if (folder != null) {
inputArray.add(folder);
}
}
NewWizardCollectionComparator comparator = NewWizardCollectionComparator.INSTANCE;
Set set = new HashSet();
set.addAll(inputArray);
comparator.setPrimaryWizards(set);
treeViewer.setComparator(comparator);
} else {
NewWizardCollectionComparator comparator = NewWizardCollectionComparator.INSTANCE;
comparator.setPrimaryWizards(null);
treeViewer.setComparator(comparator);
}
boolean expandTop = false;
if (wizardCategories != null) {
if (wizardCategories.getParent() == null) {
IWizardCategory[] children = wizardCategories.getCategories();
for (int i = 0; i < children.length; i++) {
if (!"org.eclipse.php.project.ui".equals(children[i] //$NON-NLS-1$
.getId())) {
inputArray.add(children[i]);
}
}
} else {
expandTop = true;
inputArray.add(wizardCategories);
}
}
// ensure the category is expanded. If there is a remembered expansion
// it will be set later.
if (expandTop) {
treeViewer.setAutoExpandLevel(2);
}
AdaptableList input = new AdaptableList(inputArray);
treeViewer.setInput(input);
filterTree.setBackground(parent.getDisplay().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
treeViewer.getTree().setFont(parent.getFont());
treeViewer.addDoubleClickListener(new IDoubleClickListener() {