1313 *******************************************************************************/
1414package org .eclipse .ui .internal .dialogs ;
1515
16+ import java .util .HashSet ;
17+ import java .util .Set ;
1618import java .util .StringTokenizer ;
1719import org .eclipse .jface .viewers .IStructuredSelection ;
1820import org .eclipse .jface .wizard .IWizard ;
1921import org .eclipse .jface .wizard .Wizard ;
2022import org .eclipse .ui .IWorkbench ;
23+ import org .eclipse .ui .activities .WorkbenchActivityHelper ;
2124import org .eclipse .ui .internal .IWorkbenchGraphicConstants ;
2225import org .eclipse .ui .internal .WorkbenchImages ;
2326import org .eclipse .ui .internal .WorkbenchMessages ;
@@ -42,6 +45,7 @@ public class NewWizard extends Wizard {
4245 private IStructuredSelection selection ;
4346
4447 private IWorkbench workbench ;
48+ private static Set <IWizardDescriptor > filteredWizards = new HashSet <>();
4549
4650 /**
4751 * Create the wizard pages
@@ -51,6 +55,14 @@ public void addPages() {
5155 IWizardCategory root = WorkbenchPlugin .getDefault ().getNewWizardRegistry ().getRootCategory ();
5256 IWizardDescriptor [] primary = WorkbenchPlugin .getDefault ().getNewWizardRegistry ().getPrimaryWizards ();
5357
58+ // Filter the wizards that are disabled by activity support. Issue 2809
59+ filteredWizards .clear ();
60+ for (IWizardDescriptor wizardElement : primary ) {
61+ if (!WorkbenchActivityHelper .filterItem (wizardElement )) {
62+ filteredWizards .add (wizardElement );
63+ }
64+ }
65+
5466 if (categoryId != null ) {
5567 IWizardCategory categories = root ;
5668 StringTokenizer familyTokenizer = new StringTokenizer (categoryId , CATEGORY_SEPARATOR );
@@ -65,7 +77,8 @@ public void addPages() {
6577 }
6678 }
6779
68- mainPage = new NewWizardSelectionPage (workbench , selection , root , primary , projectsOnly );
80+ mainPage = new NewWizardSelectionPage (workbench , selection , root ,
81+ filteredWizards .toArray (new IWizardDescriptor [filteredWizards .size ()]), projectsOnly );
6982 addPage (mainPage );
7083 }
7184
0 commit comments