1313 *******************************************************************************/
1414package org .eclipse .ui .internal .dialogs ;
1515
16+ import java .util .Collection ;
17+ import java .util .HashSet ;
18+ import java .util .List ;
1619import java .util .StringTokenizer ;
1720import org .eclipse .jface .viewers .IStructuredSelection ;
1821import org .eclipse .jface .wizard .IWizard ;
1922import org .eclipse .jface .wizard .Wizard ;
2023import org .eclipse .ui .IWorkbench ;
24+ import org .eclipse .ui .activities .WorkbenchActivityHelper ;
2125import org .eclipse .ui .internal .IWorkbenchGraphicConstants ;
2226import org .eclipse .ui .internal .WorkbenchImages ;
2327import org .eclipse .ui .internal .WorkbenchMessages ;
3337public class NewWizard extends Wizard {
3438 private static final String CATEGORY_SEPARATOR = "/" ; //$NON-NLS-1$
3539
36- private String categoryId = null ;
40+ private String categoryId ;
3741
3842 private NewWizardSelectionPage mainPage ;
3943
40- private boolean projectsOnly = false ;
44+ private boolean projectsOnly ;
4145
4246 private IStructuredSelection selection ;
4347
@@ -51,6 +55,10 @@ 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+ Collection <IWizardDescriptor > filteredWizards = WorkbenchActivityHelper .filterCollection (List .of (primary ),
60+ new HashSet <>());
61+
5462 if (categoryId != null ) {
5563 IWizardCategory categories = root ;
5664 StringTokenizer familyTokenizer = new StringTokenizer (categoryId , CATEGORY_SEPARATOR );
@@ -65,7 +73,8 @@ public void addPages() {
6573 }
6674 }
6775
68- mainPage = new NewWizardSelectionPage (workbench , selection , root , primary , projectsOnly );
76+ mainPage = new NewWizardSelectionPage (workbench , selection , root ,
77+ filteredWizards .toArray (IWizardDescriptor []::new ), projectsOnly );
6978 addPage (mainPage );
7079 }
7180
0 commit comments