13
13
*******************************************************************************/
14
14
package org .eclipse .ui .internal .dialogs ;
15
15
16
+ import java .util .HashSet ;
17
+ import java .util .Set ;
16
18
import java .util .StringTokenizer ;
17
19
import org .eclipse .jface .viewers .IStructuredSelection ;
18
20
import org .eclipse .jface .wizard .IWizard ;
19
21
import org .eclipse .jface .wizard .Wizard ;
20
22
import org .eclipse .ui .IWorkbench ;
23
+ import org .eclipse .ui .activities .WorkbenchActivityHelper ;
21
24
import org .eclipse .ui .internal .IWorkbenchGraphicConstants ;
22
25
import org .eclipse .ui .internal .WorkbenchImages ;
23
26
import org .eclipse .ui .internal .WorkbenchMessages ;
@@ -42,6 +45,7 @@ public class NewWizard extends Wizard {
42
45
private IStructuredSelection selection ;
43
46
44
47
private IWorkbench workbench ;
48
+ private static Set <IWizardDescriptor > filteredWizards = new HashSet <>();
45
49
46
50
/**
47
51
* Create the wizard pages
@@ -51,6 +55,14 @@ public void addPages() {
51
55
IWizardCategory root = WorkbenchPlugin .getDefault ().getNewWizardRegistry ().getRootCategory ();
52
56
IWizardDescriptor [] primary = WorkbenchPlugin .getDefault ().getNewWizardRegistry ().getPrimaryWizards ();
53
57
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
+
54
66
if (categoryId != null ) {
55
67
IWizardCategory categories = root ;
56
68
StringTokenizer familyTokenizer = new StringTokenizer (categoryId , CATEGORY_SEPARATOR );
@@ -65,7 +77,8 @@ public void addPages() {
65
77
}
66
78
}
67
79
68
- mainPage = new NewWizardSelectionPage (workbench , selection , root , primary , projectsOnly );
80
+ mainPage = new NewWizardSelectionPage (workbench , selection , root ,
81
+ filteredWizards .toArray (new IWizardDescriptor [filteredWizards .size ()]), projectsOnly );
69
82
addPage (mainPage );
70
83
}
71
84
0 commit comments