001: /*******************************************************************************
002: * Copyright (c) 2006, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.pde.ui.launcher;
011:
012: import org.eclipse.core.runtime.CoreException;
013: import org.eclipse.debug.core.ILaunchConfiguration;
014: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
015: import org.eclipse.jface.dialogs.Dialog;
016: import org.eclipse.pde.internal.ui.IHelpContextIds;
017: import org.eclipse.pde.internal.ui.PDEPlugin;
018: import org.eclipse.pde.internal.ui.PDEPluginImages;
019: import org.eclipse.pde.internal.ui.PDEUIMessages;
020: import org.eclipse.pde.internal.ui.launcher.OSGiBundleBlock;
021: import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkBlock;
022: import org.eclipse.swt.SWT;
023: import org.eclipse.swt.graphics.Image;
024: import org.eclipse.swt.layout.GridLayout;
025: import org.eclipse.swt.widgets.Composite;
026: import org.eclipse.ui.PlatformUI;
027:
028: /**
029: * A launch configuration tab that customizes the list of bundles to launch with,
030: * their start level and their auto-start attributes.
031: * <p>
032: * This class may be instantiated, but it is not intended to be subclassed by clients.
033: * </p>
034: * @since 3.3
035: */
036: public class BundlesTab extends AbstractLauncherTab {
037:
038: private Image fImage;
039: private OSGiBundleBlock fPluginBlock;
040: OSGiFrameworkBlock fFrameworkBlock;
041:
042: public BundlesTab() {
043: fImage = PDEPluginImages.DESC_PLUGINS_FRAGMENTS.createImage();
044: fPluginBlock = new OSGiBundleBlock(this );
045: fFrameworkBlock = new OSGiFrameworkBlock(this );
046: }
047:
048: /**
049: * Dispose images
050: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
051: */
052: public void dispose() {
053: fPluginBlock.dispose();
054: fImage.dispose();
055: super .dispose();
056: }
057:
058: /*
059: * (non-Javadoc)
060: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
061: */
062: public void createControl(Composite parent) {
063: Composite composite = new Composite(parent, SWT.NONE);
064: composite.setLayout(new GridLayout(2, false));
065:
066: fFrameworkBlock.createControl(composite);
067: fPluginBlock.createControl(composite, 2, 5);
068:
069: setControl(composite);
070: Dialog.applyDialogFont(composite);
071: PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
072: IHelpContextIds.LAUNCHER_ADVANCED);
073: }
074:
075: /*
076: * (non-Javadoc)
077: *
078: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
079: */
080: public void initializeFrom(ILaunchConfiguration config) {
081: try {
082: fFrameworkBlock.initializeFrom(config);
083: fPluginBlock.initializeFrom(config);
084: } catch (CoreException e) {
085: PDEPlugin.log(e);
086: }
087: }
088:
089: /*
090: * (non-Javadoc)
091: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
092: */
093: public void setDefaults(ILaunchConfigurationWorkingCopy config) {
094: fPluginBlock.setDefaults(config);
095: }
096:
097: /*
098: * (non-Javadoc)
099: * @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 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: }
|