KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > exports > FeatureOptionsTab


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.pde.internal.ui.wizards.exports;
12
13 import org.eclipse.jface.dialogs.IDialogSettings;
14 import org.eclipse.pde.internal.core.FeatureModelManager;
15 import org.eclipse.pde.internal.core.PDECore;
16 import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.events.SelectionAdapter;
20 import org.eclipse.swt.events.SelectionEvent;
21 import org.eclipse.swt.widgets.Button;
22 import org.eclipse.swt.widgets.Composite;
23
24 public class FeatureOptionsTab extends ExportOptionsTab {
25
26     private static final String JavaDoc S_MULTI_PLATFORM = "multiplatform"; //$NON-NLS-1$
27

28     private Button fMultiPlatform;
29
30     public FeatureOptionsTab(FeatureExportWizardPage page) {
31         super(page);
32     }
33     
34     protected void addCrossPlatformOption(Composite comp) {
35         FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager();
36         IFeatureModel model = manager.findFeatureModel("org.eclipse.platform.launchers"); //$NON-NLS-1$
37
if (model != null) {
38             fMultiPlatform = new Button(comp, SWT.CHECK);
39             fMultiPlatform.setText(PDEUIMessages.ExportWizard_multi_platform);
40         }
41     }
42     
43     protected boolean getInitialJarButtonSelection(IDialogSettings settings){
44        return settings.getBoolean(S_JAR_FORMAT);
45     }
46
47     protected String JavaDoc getJarButtonText() {
48         return PDEUIMessages.BaseExportWizardPage_fPackageJARs;
49     }
50     
51     protected void initialize(IDialogSettings settings) {
52         super.initialize(settings);
53         if (fMultiPlatform != null)
54             fMultiPlatform.setSelection(settings.getBoolean(S_MULTI_PLATFORM));
55     }
56     
57     protected void saveSettings(IDialogSettings settings) {
58         super.saveSettings(settings);
59         if (fMultiPlatform != null)
60             settings.put(S_MULTI_PLATFORM, fMultiPlatform.getSelection());
61     }
62
63     protected void hookListeners() {
64         super.hookListeners();
65         if (fMultiPlatform != null) {
66             fMultiPlatform.addSelectionListener(new SelectionAdapter() {
67                 public void widgetSelected(SelectionEvent e) {
68                     fPage.pageChanged();
69                 }
70             });
71         }
72     }
73     
74     protected boolean doMultiplePlatform() {
75         return fMultiPlatform != null && fMultiPlatform.getSelection();
76     }
77 }
78
Popular Tags