KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > dialogs > ExportPage


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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 /**
28  * Wizard page class from which an export wizard is selected.
29  *
30  * @since 3.2
31  *
32  */

33 public class ExportPage extends ImportExportPage {
34     private static final String JavaDoc STORE_SELECTED_EXPORT_WIZARD_ID = DIALOG_SETTING_SECTION_NAME
35         + "STORE_SELECTED_EXPORT_WIZARD_ID"; //$NON-NLS-1$
36

37     private static final String JavaDoc STORE_EXPANDED_EXPORT_CATEGORIES = DIALOG_SETTING_SECTION_NAME
38         + "STORE_EXPANDED_EXPORT_CATEGORIES"; //$NON-NLS-1$
39

40     CategorizedWizardSelectionTree exportTree;
41     
42     /**
43      * Constructor for export wizard selection page.
44      *
45      * @param aWorkbench
46      * @param currentSelection
47      */

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