debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java
author dadubrow
Wed, 20 Oct 2010 09:35:54 -0500
changeset 2163 f0a9f2d04d4a
parent 2160 3a82092877ea
permissions -rw-r--r--
Refactor data model for new launch wizard
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     1
/*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     3
* All rights reserved.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     8
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
     9
* Initial Contributors:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    11
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    12
* Contributors:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    13
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    14
* Description: 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    15
*
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    16
*/
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    17
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    18
package com.nokia.cdt.internal.debug.launch.newwizard;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    19
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    20
import java.io.File;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    21
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    22
import org.eclipse.core.runtime.IStatus;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    23
import org.eclipse.core.runtime.Status;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    24
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    25
import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    26
import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    27
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    28
/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    29
 * This page presents three sections:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    30
 * <p>
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    31
 * Connection to use:  container for the Remote Connection selection UI, plus a label
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    32
 * explaining how to handle the case of no connections defined.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    33
 * <p>
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    34
 * Debug process: section explaining how the launch will happen, with a combo
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    35
 * allowing selecting different process to launch, and a button allowing more
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    36
 * in-depth configuration.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    37
 * <p>
1265
f90f47d3882f PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
Ed Swartz <ed.swartz@nokia.com>
parents: 1067
diff changeset
    38
 * Other settings: section with (currently only) the build-before-debug preference for this
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    39
 * launch configuration.
1265
f90f47d3882f PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
Ed Swartz <ed.swartz@nokia.com>
parents: 1067
diff changeset
    40
 * <p>
f90f47d3882f PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
Ed Swartz <ed.swartz@nokia.com>
parents: 1067
diff changeset
    41
 * Each section is validated separately and editable with its own dialog.  Changes in
f90f47d3882f PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
Ed Swartz <ed.swartz@nokia.com>
parents: 1067
diff changeset
    42
 * the dialog are not applied until the dialog is accepted.
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    43
 */
2160
3a82092877ea initial commit for PS wizard
dadubrow
parents: 1265
diff changeset
    44
public class UnifiedLaunchOptionsPage extends AbstractUnifiedLaunchOptionsPage {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    45
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    46
	public UnifiedLaunchOptionsPage(IWizardData data) {
2160
3a82092877ea initial commit for PS wizard
dadubrow
parents: 1265
diff changeset
    47
		super(Messages.getString("UnifiedLaunchOptionsPage.Title"), data); //$NON-NLS-1$
969
b0dd389735fb externalize strings
dadubrow
parents: 960
diff changeset
    48
		setDescription(Messages.getString("UnifiedLaunchOptionsPage.Desc")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    49
		
2160
3a82092877ea initial commit for PS wizard
dadubrow
parents: 1265
diff changeset
    50
		addSection(new ConnectToDeviceSection(data, this));
3a82092877ea initial commit for PS wizard
dadubrow
parents: 1265
diff changeset
    51
		addSection(new DebugRunProcessSection(data, this));
3a82092877ea initial commit for PS wizard
dadubrow
parents: 1265
diff changeset
    52
		addSection(new OtherSettingsSection(data, this));
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    53
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    54
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    55
	protected IStatus getStatus() {
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    56
		return checkBuildProducts();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    57
	}
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    58
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    59
	private IStatus checkBuildProducts() {
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    60
		IOtherSettingsWizardData otherSettingsWizardData = (IOtherSettingsWizardData) data;
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    61
		if (!otherSettingsWizardData.isCurrentBuildBeforeLaunch()) {
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    62
			// check sis files
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    63
			IDebugRunProcessWizardData debugRunProcessWizardData = (IDebugRunProcessWizardData) data;
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    64
			String sisPath = debugRunProcessWizardData.getSisPath();
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    65
			if (debugRunProcessWizardData.isInstallPackage() && 
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    66
					sisPath != null && !new File(sisPath).exists()) {
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    67
				return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID,
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    68
						Messages.getString("UnifiedLaunchOptionsPage.SISFileMissingWarning")); //$NON-NLS-1$
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    69
			}
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    70
			// check launch file
2163
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    71
			if (debugRunProcessWizardData.getExeSelection().equals(EExeSelection.USE_PROJECT_EXECUTABLE) && 
f0a9f2d04d4a Refactor data model for new launch wizard
dadubrow
parents: 2160
diff changeset
    72
					!debugRunProcessWizardData.getExePath().toFile().exists()) {
1067
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    73
				return new Status(IStatus.WARNING, LaunchPlugin.PLUGIN_ID,
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    74
						Messages.getString("UnifiedLaunchOptionsPage.ExeFileMissingWarning")); //$NON-NLS-1$
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    75
			}
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    76
		}
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    77
		
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    78
		return Status.OK_STATUS;
856622c7b203 10809 - generating warning for missing sis file or missing exe
dadubrow
parents: 1013
diff changeset
    79
	}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    80
}