1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.jface.viewers.IStructuredSelection; 14 import org.eclipse.jface.viewers.TableViewer; 15 import org.eclipse.jface.wizard.IWizardNode; 16 import org.eclipse.jface.wizard.IWizardPage; 17 import org.eclipse.jface.wizard.WizardSelectionPage; 18 import org.eclipse.ui.IWorkbench; 19 import org.eclipse.ui.activities.ITriggerPoint; 20 import org.eclipse.ui.activities.WorkbenchActivityHelper; 21 import org.eclipse.ui.internal.WorkbenchMessages; 22 import org.eclipse.ui.model.AdaptableList; 23 24 27 public abstract class WorkbenchWizardSelectionPage extends WizardSelectionPage { 28 29 protected IWorkbench workbench; 31 32 protected AdaptableList wizardElements; 33 34 public TableViewer wizardSelectionViewer; 35 36 protected IStructuredSelection currentResourceSelection; 37 38 protected String triggerPointId; 39 40 43 public WorkbenchWizardSelectionPage(String name, IWorkbench aWorkbench, 44 IStructuredSelection currentSelection, AdaptableList elements, 45 String triggerPointId) { 46 super(name); 47 this.wizardElements = elements; 48 this.currentResourceSelection = currentSelection; 49 this.workbench = aWorkbench; 50 this.triggerPointId = triggerPointId; 51 setTitle(WorkbenchMessages.Select); 52 } 53 54 61 protected WorkbenchWizardElement findWizard(String searchId) { 62 Object [] children = wizardElements.getChildren(); 63 for (int i = 0; i < children.length; ++i) { 64 WorkbenchWizardElement currentWizard = (WorkbenchWizardElement) children[i]; 65 if (currentWizard.getId().equals(searchId)) { 66 return currentWizard; 67 } 68 } 69 70 return null; 71 } 72 73 public IStructuredSelection getCurrentResourceSelection() { 74 return currentResourceSelection; 75 } 76 77 public IWorkbench getWorkbench() { 78 return this.workbench; 79 } 80 81 89 public void selectWizardNode(IWizardNode node) { 90 setSelectedNode(node); 91 } 92 93 96 public IWizardPage getNextPage() { 97 ITriggerPoint triggerPoint = getWorkbench().getActivitySupport() 98 .getTriggerPointManager().getTriggerPoint(triggerPointId); 99 if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) { 100 return super.getNextPage(); 101 } 102 return null; 103 } 104 } 105 | Popular Tags |