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.PDEPluginImages;
018: import org.eclipse.pde.internal.ui.PDEUIMessages;
019: import org.eclipse.pde.internal.ui.launcher.ConfigurationAreaBlock;
020: import org.eclipse.pde.internal.ui.launcher.JREBlock;
021: import org.eclipse.swt.SWT;
022: import org.eclipse.swt.graphics.Image;
023: import org.eclipse.swt.layout.GridData;
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 displays and edits the VM install
030: * launch configuration attributes.
031: * <p>
032: * This class may be instantiated. This class is not intended to be subclassed.
033: * </p>
034: * @since 3.3
035: */
036: public class OSGiSettingsTab extends AbstractLauncherTab {
037:
038: private JREBlock fJREBlock;
039: private ConfigurationAreaBlock fConfigurationBlock;
040: private Image fImage;
041: private boolean fInitializing = false;
042:
043: /**
044: * Constructor
045: *
046: */
047: public OSGiSettingsTab() {
048: fImage = PDEPluginImages.DESC_SETTINGS_OBJ.createImage();
049: fJREBlock = new JREBlock(this );
050: fConfigurationBlock = new ConfigurationAreaBlock(this );
051: }
052:
053: /*
054: /* (non-Javadoc)
055: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
056: */
057: public void createControl(Composite parent) {
058: Composite container = new Composite(parent, SWT.NONE);
059: container.setLayout(new GridLayout());
060: container.setLayoutData(new GridData(GridData.FILL_BOTH));
061:
062: fJREBlock.createControl(container);
063: fConfigurationBlock.createControl(container);
064:
065: Dialog.applyDialogFont(container);
066: setControl(container);
067: PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
068: IHelpContextIds.LAUNCHER_CONFIGURATION);
069: }
070:
071: /* (non-Javadoc)
072: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
073: */
074: public void setDefaults(
075: ILaunchConfigurationWorkingCopy configuration) {
076: fJREBlock.setDefaults(configuration);
077: fConfigurationBlock.setDefaults(configuration, false);
078: }
079:
080: /* (non-Javadoc)
081: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
082: */
083: public void initializeFrom(ILaunchConfiguration configuration) {
084: try {
085: fInitializing = true;
086: fJREBlock.initializeFrom(configuration);
087: fConfigurationBlock.initializeFrom(configuration);
088: fInitializing = false;
089: } catch (CoreException e) {
090: }
091: }
092:
093: /* (non-Javadoc)
094: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
095: */
096: public void performApply(
097: ILaunchConfigurationWorkingCopy configuration) {
098: fJREBlock.performApply(configuration);
099: fConfigurationBlock.performApply(configuration);
100: }
101:
102: /*
103: /* (non-Javadoc)
104: * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
105: */
106: public String getName() {
107: return PDEUIMessages.EquinoxSettingsTab_name;
108: }
109:
110: /*
111: /* (non-Javadoc)
112: * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getImage()
113: */
114: public Image getImage() {
115: return fImage;
116: }
117:
118: /*
119: /* (non-Javadoc)
120: * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#dispose()
121: */
122: public void dispose() {
123: if (fImage != null)
124: fImage.dispose();
125: }
126:
127: /*
128: * (non-Javadoc)
129: * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#validateTab()
130: */
131: public void validateTab() {
132: }
133:
134: /*
135: * (non-Javadoc)
136: * @see org.eclipse.pde.ui.launcher.AbstractLauncherTab#updateLaunchConfigurationDialog()
137: */
138: public void updateLaunchConfigurationDialog() {
139: if (!fInitializing)
140: super.updateLaunchConfigurationDialog();
141: }
142: }
|