KickJava   Java API By Example, From Geeks To Geeks.

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


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.PDEPlugin;
19 import org.eclipse.pde.internal.ui.PDEPluginImages;
20 import org.eclipse.pde.internal.ui.PDEUIMessages;
21 import org.eclipse.pde.internal.ui.launcher.OSGiBundleBlock;
22 import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkBlock;
23 import org.eclipse.swt.SWT;
24 import org.eclipse.swt.graphics.Image;
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 customizes the list of bundles to launch with,
31  * their start level and their auto-start attributes.
32  * <p>
33  * This class may be instantiated, but it is not intended to be subclassed by clients.
34  * </p>
35  * @since 3.3
36  */

37 public class BundlesTab extends AbstractLauncherTab {
38
39     private Image fImage;
40     private OSGiBundleBlock fPluginBlock;
41     OSGiFrameworkBlock fFrameworkBlock;
42
43     public BundlesTab() {
44         fImage = PDEPluginImages.DESC_PLUGINS_FRAGMENTS.createImage();
45         fPluginBlock = new OSGiBundleBlock(this);
46         fFrameworkBlock = new OSGiFrameworkBlock(this);
47     }
48
49     /**
50      * Dispose images
51      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
52      */

53     public void dispose() {
54         fPluginBlock.dispose();
55         fImage.dispose();
56         super.dispose();
57     }
58
59     /*
60      * (non-Javadoc)
61      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
62      */

63     public void createControl(Composite parent) {
64         Composite composite = new Composite(parent, SWT.NONE);
65         composite.setLayout(new GridLayout(2, false));
66
67         fFrameworkBlock.createControl(composite);
68         fPluginBlock.createControl(composite, 2, 5);
69
70         setControl(composite);
71         Dialog.applyDialogFont(composite);
72         PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.LAUNCHER_ADVANCED);
73     }
74
75     /*
76      * (non-Javadoc)
77      *
78      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
79      */

80     public void initializeFrom(ILaunchConfiguration config) {
81         try {
82             fFrameworkBlock.initializeFrom(config);
83             fPluginBlock.initializeFrom(config);
84         } catch (CoreException e) {
85             PDEPlugin.log(e);
86         }
87     }
88
89     /*
90      * (non-Javadoc)
91      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
92      */

93     public void setDefaults(ILaunchConfigurationWorkingCopy config) {
94         fPluginBlock.setDefaults(config);
95     }
96
97     /*
98      * (non-Javadoc)
99      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
100      */

101     public void performApply(ILaunchConfigurationWorkingCopy config) {
102         fFrameworkBlock.performApply(config);
103         fPluginBlock.performApply(config);
104     }
105     
106     /*
107      * (non-Javadoc)
108      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
109      */

110     public String JavaDoc getName() {
111         return PDEUIMessages.BundlesTab_title;
112     }
113
114     /*
115      * (non-Javadoc)
116      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
117      */

118     public Image getImage() {
119         return fImage;
120     }
121
122     /*
123     /* (non-Javadoc)
124      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
125      */

126     public void activated(ILaunchConfigurationWorkingCopy config) {
127     }
128
129     /*
130      * (non-Javadoc)
131      * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#validateTab()
132      */

133     public void validateTab() {
134     }
135
136 }
137
Popular Tags