debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/OtherSettingsSection.java
changeset 956 d1e221a2875f
child 960 1b51db390dc4
equal deleted inserted replaced
948:ee68c935ffb7 956:d1e221a2875f
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 package com.nokia.cdt.internal.debug.launch.newwizard;
       
    19 
       
    20 import org.eclipse.core.runtime.Status;
       
    21 import org.eclipse.swt.widgets.Composite;
       
    22 import org.eclipse.swt.widgets.Shell;
       
    23 
       
    24 import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EBuildBeforeLaunchOption;
       
    25 
       
    26 /**
       
    27  * Present the "Build before debug" section with a short description.
       
    28  */
       
    29 public class OtherSettingsSection extends AbstractLaunchWizardSection {
       
    30 
       
    31 	/**
       
    32 	 * 
       
    33 	 */
       
    34 	public OtherSettingsSection(LaunchWizardData data) {
       
    35 		super(data, "Other settings");
       
    36 		
       
    37 	}
       
    38 	
       
    39 	/* (non-Javadoc)
       
    40 	 * @see com.nokia.cdt.internal.debug.launch.wizard2.IWizardSection#createComposite(org.eclipse.swt.widgets.Composite)
       
    41 	 */
       
    42 	public void createControl(Composite parent) {
       
    43 		createSection(parent, 2);
       
    44 	}
       
    45 	
       
    46 	/* (non-Javadoc)
       
    47 	 * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#dispose()
       
    48 	 */
       
    49 	@Override
       
    50 	protected void dispose() {
       
    51 	}
       
    52 	
       
    53 	public void initializeSettings() {
       
    54 		data.setBuildBeforeLaunchOption(EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING);
       
    55 	}
       
    56 
       
    57 	/* (non-Javadoc)
       
    58 	 * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#validate()
       
    59 	 */
       
    60 	@Override
       
    61 	protected void validate() {
       
    62 		status = Status.OK_STATUS;
       
    63 	}
       
    64 
       
    65 	/* (non-Javadoc)
       
    66 	 * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#updateUI()
       
    67 	 */
       
    68 	@Override
       
    69 	protected void updateUI() {
       
    70 		String msg;
       
    71 		
       
    72 		String ifWorkspace = "";
       
    73 		if (data.getBuildBeforeLaunch() == EBuildBeforeLaunchOption.USE_WORKSPACE_SETTING)
       
    74 			ifWorkspace = " (workspace setting)";
       
    75 		
       
    76 		if (data.isCurrentBuildBeforeLaunch())
       
    77 			msg = "Carbide will build the project before launch";
       
    78 		else
       
    79 			msg = "Carbide will not build the project before launch";
       
    80 		
       
    81 		descriptionLabel.setText(msg + ifWorkspace + ".");
       
    82 	}
       
    83 	
       
    84 	/* (non-Javadoc)
       
    85 	 * @see com.nokia.cdt.internal.debug.launch.wizard2.AbstractLaunchWizardSection#createChangeSettingsDialog(org.eclipse.swt.widgets.Shell, com.nokia.cdt.internal.debug.launch.wizard2.LaunchOptionsData)
       
    86 	 */
       
    87 	@Override
       
    88 	protected AbstractLaunchSettingsDialog createChangeSettingsDialog(
       
    89 			Shell shell, LaunchWizardData dialogData) {
       
    90 		return new OtherSettingsDialog(shell, dialogData);
       
    91 	}
       
    92 	
       
    93 	protected void refresh() {
       
    94 		validate();
       
    95 		updateUI();
       
    96 	}
       
    97 }