1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.jface.viewers.DoubleClickEvent; 14 import org.eclipse.jface.viewers.IDoubleClickListener; 15 import org.eclipse.jface.viewers.ISelectionChangedListener; 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.jface.viewers.SelectionChangedEvent; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.ui.IWorkbench; 20 import org.eclipse.ui.activities.ITriggerPoint; 21 import org.eclipse.ui.internal.IWorkbenchHelpContextIds; 22 import org.eclipse.ui.internal.WorkbenchMessages; 23 import org.eclipse.ui.internal.WorkbenchPlugin; 24 import org.eclipse.ui.internal.activities.ws.WorkbenchTriggerPoints; 25 import org.eclipse.ui.wizards.IWizardCategory; 26 27 33 public class ExportPage extends ImportExportPage { 34 private static final String STORE_SELECTED_EXPORT_WIZARD_ID = DIALOG_SETTING_SECTION_NAME 35 + "STORE_SELECTED_EXPORT_WIZARD_ID"; 37 private static final String STORE_EXPANDED_EXPORT_CATEGORIES = DIALOG_SETTING_SECTION_NAME 38 + "STORE_EXPANDED_EXPORT_CATEGORIES"; 40 CategorizedWizardSelectionTree exportTree; 41 42 48 public ExportPage(IWorkbench aWorkbench, 49 IStructuredSelection currentSelection) { 50 super(aWorkbench, currentSelection); 51 } 52 53 protected void initialize() { 54 workbench.getHelpSystem().setHelp(getControl(), 55 IWorkbenchHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE); 56 } 57 58 protected Composite createTreeViewer(Composite parent) { 59 IWizardCategory root = WorkbenchPlugin.getDefault() 60 .getExportWizardRegistry().getRootCategory(); 61 exportTree = new CategorizedWizardSelectionTree( 62 root, WorkbenchMessages.ExportWizard_selectDestination); 63 Composite exportComp = exportTree.createControl(parent); 64 exportTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener(){ 65 public void selectionChanged(SelectionChangedEvent event) { 66 listSelectionChanged(event.getSelection()); 67 } 68 }); 69 exportTree.getViewer().addDoubleClickListener(new IDoubleClickListener(){ 70 public void doubleClick(DoubleClickEvent event) { 71 treeDoubleClicked(event); 72 } 73 }); 74 setTreeViewer(exportTree.getViewer()); 75 return exportComp; 76 } 77 78 public void saveWidgetValues(){ 79 storeExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportTree.getViewer()); 80 storeSelectedCategoryAndWizard(STORE_SELECTED_EXPORT_WIZARD_ID, exportTree.getViewer()); 81 super.saveWidgetValues(); 82 } 83 84 protected void restoreWidgetValues(){ 85 IWizardCategory exportRoot = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory(); 86 expandPreviouslyExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportRoot, exportTree.getViewer()); 87 selectPreviouslySelected(STORE_SELECTED_EXPORT_WIZARD_ID, exportRoot, exportTree.getViewer()); 88 super.restoreWidgetValues(); 89 } 90 91 protected ITriggerPoint getTriggerPoint(){ 92 return getWorkbench().getActivitySupport() 93 .getTriggerPointManager().getTriggerPoint(WorkbenchTriggerPoints.EXPORT_WIZARDS); 94 } 95 96 protected void updateMessage(){ 97 setMessage(WorkbenchMessages.ImportExportPage_chooseExportDestination); 98 super.updateMessage(); 99 } 100 } 101 | Popular Tags |