KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > ui > launcher > OSGiSettingsTab


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.ui.launcher;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.core.ILaunchConfiguration;
15 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16 import org.eclipse.jface.dialogs.Dialog;
17 import org.eclipse.pde.internal.ui.IHelpContextIds;
18 import org.eclipse.pde.internal.ui.PDEPluginImages;
19 import org.eclipse.pde.internal.ui.PDEUIMessages;
20 import org.eclipse.pde.internal.ui.launcher.ConfigurationAreaBlock;
21 import org.eclipse.pde.internal.ui.launcher.JREBlock;
22 import org.eclipse.swt.SWT;
23 import org.eclipse.swt.graphics.Image;
24 import org.eclipse.swt.layout.GridData;
25 import org.eclipse.swt.layout.GridLayout;
26 import org.eclipse.swt.widgets.Composite;
27 import org.eclipse.ui.PlatformUI;
28
29 /**
30  * A launch configuration tab that displays and edits the VM install
31  * launch configuration attributes.
32  * <p>
33  * This class may be instantiated. This class is not intended to be subclassed.
34  * </p>
35  * @since 3.3
36  */

37 public class OSGiSettingsTab extends AbstractLauncherTab {
38     
39     private JREBlock fJREBlock;
40     private ConfigurationAreaBlock fConfigurationBlock;
41     private Image fImage;
42     private boolean fInitializing = false;
43     
44     /**
45      * Constructor
46      *
47      */

48     public OSGiSettingsTab() {
49         fImage = PDEPluginImages.DESC_SETTINGS_OBJ.createImage();
50         fJREBlock = new JREBlock(this);
51         fConfigurationBlock = new ConfigurationAreaBlock(this);
52     }
53     
54     /*
55     /* (non-Javadoc)
56      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
57      */

58     public void createControl(Composite parent) {
59         Composite container = new Composite(parent, SWT.NONE);
60         container.setLayout(new GridLayout());
61         container.setLayoutData(new GridData(GridData.FILL_BOTH));
62         
63         fJREBlock.createControl(container);
64         fConfigurationBlock.createControl(container);
65         
66         Dialog.applyDialogFont(container);
67         setControl(container);
68         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.LAUNCHER_CONFIGURATION);
69     }
70     
71     /* (non-Javadoc)
72      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
73      */

74     public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
75         fJREBlock.setDefaults(configuration);
76         fConfigurationBlock.setDefaults(configuration, false);
77     }
78     
79     /* (non-Javadoc)
80      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
81      */

82     public void initializeFrom(ILaunchConfiguration configuration) {
83         try {
84             fInitializing = true;
85             fJREBlock.initializeFrom(configuration);
86             fConfigurationBlock.initializeFrom(configuration);
87             fInitializing = false;
88         } catch (CoreException e) {
89         }
90     }
91     
92     /* (non-Javadoc)
93      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
94      */

95     public void performApply(ILaunchConfigurationWorkingCopy configuration) {
96         fJREBlock.performApply(configuration);
97         fConfigurationBlock.performApply(configuration);
98     }
99     
100     /*
101     /* (non-Javadoc)
102      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
103      */

104     public String JavaDoc getName() {
105         return PDEUIMessages.EquinoxSettingsTab_name;
106     }
107     
108     /*
109     /* (non-Javadoc)
110      * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getImage()
111      */

112     public Image getImage() {
113         return fImage;
114     }
115     
116     /*
117     /* (non-Javadoc)
118      * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#dispose()
119      */

120     public void dispose() {
121         if (fImage != null)
122             fImage.dispose();
123     }
124
125     /*
126      * (non-Javadoc)
127      * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#validateTab()
128      */

129     public void validateTab() {
130     }
131     
132     /*
133      * (non-Javadoc)
134      * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#updateLaunchConfigurationDialog()
135      */

136     public void updateLaunchConfigurationDialog() {
137         if (!fInitializing)
138             super.updateLaunchConfigurationDialog();
139     }
140 }
141
Popular Tags