debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/DebugRunProcessDialog.java
author Ed Swartz <ed.swartz@nokia.com>
Mon, 26 Apr 2010 15:40:54 -0500
changeset 1285 84caa86f9460
parent 1284 7ef1318ac801
child 2163 f0a9f2d04d4a
permissions -rw-r--r--
Merge PNP launch wizard changes from 2.6
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
*
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    12
* Contributors:     
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    13
*   
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    14
* Description: 
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    15
* 
956
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
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    20
import java.io.File;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    21
import java.text.MessageFormat;
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    22
import java.util.ArrayList;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    23
import java.util.LinkedHashSet;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    24
import java.util.List;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    25
import java.util.Set;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    26
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    27
import org.eclipse.cdt.core.model.CoreModel;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    28
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    29
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    30
import org.eclipse.core.resources.IProject;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    31
import org.eclipse.core.runtime.IPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    32
import org.eclipse.core.runtime.IStatus;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    33
import org.eclipse.core.runtime.Path;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    34
import org.eclipse.core.runtime.Status;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    35
import org.eclipse.jface.layout.GridDataFactory;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    36
import org.eclipse.jface.layout.GridLayoutFactory;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    37
import org.eclipse.jface.resource.JFaceResources;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    38
import org.eclipse.jface.viewers.ArrayContentProvider;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    39
import org.eclipse.jface.viewers.ComboViewer;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    40
import org.eclipse.jface.viewers.ISelectionChangedListener;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    41
import org.eclipse.jface.viewers.IStructuredSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    42
import org.eclipse.jface.viewers.LabelProvider;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    43
import org.eclipse.jface.viewers.SelectionChangedEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    44
import org.eclipse.jface.viewers.StructuredSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    45
import org.eclipse.swt.SWT;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    46
import org.eclipse.swt.events.ControlAdapter;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    47
import org.eclipse.swt.events.ControlEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    48
import org.eclipse.swt.events.DisposeEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    49
import org.eclipse.swt.events.DisposeListener;
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    50
import org.eclipse.swt.events.FocusAdapter;
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    51
import org.eclipse.swt.events.FocusEvent;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    52
import org.eclipse.swt.events.ModifyEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    53
import org.eclipse.swt.events.ModifyListener;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    54
import org.eclipse.swt.events.SelectionAdapter;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    55
import org.eclipse.swt.events.SelectionEvent;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    56
import org.eclipse.swt.layout.GridData;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    57
import org.eclipse.swt.widgets.Button;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    58
import org.eclipse.swt.widgets.Combo;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    59
import org.eclipse.swt.widgets.Composite;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    60
import org.eclipse.swt.widgets.Control;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    61
import org.eclipse.swt.widgets.FileDialog;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    62
import org.eclipse.swt.widgets.Label;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    63
import org.eclipse.swt.widgets.Link;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    64
import org.eclipse.swt.widgets.Shell;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    65
import org.eclipse.swt.widgets.Text;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    66
import org.eclipse.ui.dialogs.PreferencesUtil;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    67
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    68
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    69
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    70
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    71
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    72
import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    73
import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    74
import com.nokia.cpp.internal.api.utils.core.PathUtils;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    75
import com.nokia.cpp.internal.api.utils.core.TextUtils;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    76
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    77
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    78
/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    79
 *	This dialog allows in-depth configuration of the debug/run process options.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    80
 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    81
public class DebugRunProcessDialog extends AbstractLaunchSettingsDialog implements ICProjectDescriptionListener {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    82
	private ComboViewer projectExecutableViewer;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    83
	private ComboViewer remoteProgramViewer;
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    84
	private Button projectExecutableRadioButton;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    85
	private Button remoteExecutableRadioButton;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    86
	private Button attachToProcessRadioButton;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    87
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    88
	private Label packageInfoLabel;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    89
	private Button installPackageCheckbox;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    90
	private Combo sisFile;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    91
	private Text sisEdit;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    92
	private Button sisBrowse;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    93
	private Composite installPackageUI;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    94
	
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    95
	private List<IPath> remotePathEntries = new ArrayList<IPath>();
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
    96
	private List<IPath> projectGeneratedRemotePaths;
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
    97
	
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    98
	protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
    99
		super(shell, data);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   100
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   101
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   102
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   103
	/* (non-Javadoc)
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   104
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   105
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   106
	@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   107
	protected Control createDialogArea(Composite parent) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   108
		Composite composite = initDialogArea(parent, 
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   109
				MessageFormat.format(Messages.getString("DebugRunProcessDialog.ChangeProcessMsg"), data.getModeLabel()), //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   110
				data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS : 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   111
					LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   112
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   113
		loadRemoteProgramEntries();
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   114
		
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   115
		composite.addDisposeListener(new DisposeListener() {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   116
			
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   117
			public void widgetDisposed(DisposeEvent e) {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   118
				saveRemoteProgramEntries();
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   119
			}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   120
		});
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   121
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   122
		createProcessSelector(composite);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   123
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   124
		Label sep = new Label(composite, SWT.NONE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   125
		GridDataFactory.fillDefaults().applyTo(sep);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   126
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   127
		createPackageConfiguration(composite);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   128
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   129
		initUI();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   130
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   131
		validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   132
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   133
		return composite;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   134
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   135
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   136
	// pref key for paths the user has manually entered
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   137
	final static String USER_REMOTE_PATHS = "user.remote.paths"; //$NON-NLS-1$
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   138
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   139
	/**
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   140
	 * 
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   141
	 */
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   142
	protected void saveRemoteProgramEntries() {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   143
		// in case user was typing, ensure that entry is present
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   144
		if(remoteProgramViewer != null) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   145
			IPath currentPath = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim());
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   146
			remotePathEntries.remove(currentPath);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   147
			remotePathEntries.add(0, currentPath);	// MRU
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   148
		}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   149
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   150
		// make a set, removing user dupes, and also removing the entries we added
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   151
		Set<IPath> uniqueRemotePathEntries = new LinkedHashSet<IPath>(remotePathEntries);
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   152
		if (projectGeneratedRemotePaths != null)
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   153
			uniqueRemotePathEntries.removeAll(projectGeneratedRemotePaths);
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   154
		
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   155
		// truncate size, removing from end
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   156
		List<IPath> mruPathEntries = new ArrayList<IPath>(uniqueRemotePathEntries);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   157
		while (mruPathEntries.size() > 10) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   158
			mruPathEntries.remove(mruPathEntries.size() - 1);
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   159
		}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   160
		
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   161
		String pathSoup = TextUtils.catenateStrings(mruPathEntries.toArray(), "|"); //$NON-NLS-1$
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   162
		LaunchPlugin.getDefault().getPreferenceStore().setValue(USER_REMOTE_PATHS, pathSoup);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   163
	}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   164
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   165
	/**
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   166
	 * 
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   167
	 */
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   168
	protected void loadRemoteProgramEntries() {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   169
		String pathSoup = LaunchPlugin.getDefault().getPreferenceStore().getString(USER_REMOTE_PATHS);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   170
		if (pathSoup != null) {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   171
			String[] paths = pathSoup.split("\\|"); //$NON-NLS-1$
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   172
			for (String path : paths)
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   173
				remotePathEntries.add(PathUtils.createPath(path));
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   174
		}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   175
	}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   176
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   177
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   178
	private void createProcessSelector(Composite composite) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   179
		Label label;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   180
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   181
		label = new Label(composite, SWT.WRAP);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   182
		label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.ModeLabel"), data.getModeLabel())); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   183
		label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   184
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   185
		GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   186
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   187
		Composite radioGroup = new Composite(composite, SWT.NONE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   188
		GridDataFactory.fillDefaults().grab(true, false).applyTo(radioGroup);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   189
		GridLayoutFactory.fillDefaults().extendedMargins(INDENT, 0, 0, 0).numColumns(2).applyTo(radioGroup);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   190
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   191
		createProjectExecutableRadioButton(radioGroup);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   192
		createRemoteExecutableRadioButton(radioGroup);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   193
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   194
		label = new Label(radioGroup, SWT.SEPARATOR | SWT.HORIZONTAL);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   195
		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   196
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   197
		createAttachToProcessRadioButton(radioGroup);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   198
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   199
		String msg;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   200
		if (data.isDebug())
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   201
			msg = Messages.getString("DebugRunProcessDialog.DebugConfigureMsg"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   202
		else
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   203
			msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   204
		setMessage(msg);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   205
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   206
		switch (data.getExeSelection()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   207
		case USE_PROJECT_EXECUTABLE:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   208
			projectExecutableRadioButton.setSelection(true);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   209
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   210
		case USE_REMOTE_EXECUTABLE:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   211
			remoteExecutableRadioButton.setSelection(true);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   212
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   213
		case ATTACH_TO_PROCESS:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   214
			attachToProcessRadioButton.setSelection(true);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   215
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   216
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   217
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   218
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   219
	private void createPackageConfiguration(Composite composite) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   220
		Label label;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   221
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   222
		label = new Label(composite, SWT.WRAP);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   223
		label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.DeployLabel"), data.getModeLabel())); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   224
		label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   225
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   226
		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   227
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   228
		packageInfoLabel = new Label(composite, SWT.WRAP);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   229
		GridDataFactory.fillDefaults().grab(true, false).applyTo(packageInfoLabel);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   230
		composite.addControlListener(new ControlAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   231
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   232
			public void controlResized(ControlEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   233
				packageInfoLabel.pack();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   234
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   235
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   236
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   237
		installPackageCheckbox = new Button(composite, SWT.CHECK);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   238
		GridDataFactory.fillDefaults().applyTo(installPackageCheckbox);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   239
		
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   240
		installPackageCheckbox.setText(Messages.getString("DebugRunProcessDialog.InstallBeforeLaunchLabel")); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   241
		installPackageCheckbox.setToolTipText(Messages.getString("DebugRunProcessDialog.SISCheckboxTooltip")); //$NON-NLS-1$
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   242
		
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   243
		installPackageUI = new Composite(composite, SWT.NONE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   244
		GridDataFactory.fillDefaults().indent(INDENT, 0).applyTo(installPackageUI);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   245
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   246
		createSISContents(installPackageUI);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   247
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   248
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   249
		installPackageCheckbox.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   250
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   251
			public void widgetSelected(SelectionEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   252
				data.setInstallPackage(installPackageCheckbox.getSelection());
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   253
				updatePackageUI();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   254
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   255
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   256
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   257
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   258
		if (data.isInstallPackage()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   259
			installPackageCheckbox.setSelection(true);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   260
			updatePackageUI();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   261
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   262
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   263
		updateSisFile();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   264
		updatePackageUI();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   265
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   266
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   267
    protected void createSISContents(Composite composite) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   268
        GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(composite);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   269
            
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   270
		final IProject project = data.getProject();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   271
		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   272
		if (cpi != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   273
			final Label sisLabel = new Label(composite, SWT.NONE);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   274
			sisLabel.setText(Messages.getString("DebugRunProcessDialog.SISFileLabel")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   275
			GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(1, 1).applyTo(sisLabel);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   276
			sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   277
			sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   278
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   279
			sisFile = new Combo(composite, SWT.READ_ONLY);
1045
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   280
			GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(sisFile);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   281
			sisFile.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip"));  //$NON-NLS-1$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   282
			sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   283
			
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   284
			sisFile.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   285
				@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   286
				public void widgetSelected(SelectionEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   287
					updateSisFile();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   288
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   289
			});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   290
			
1045
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   291
			updateSisFileCombo(cpi);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   292
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   293
			// listen for events so we can detect if they click on the link below and add new sis info.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   294
			CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   295
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   296
			composite.addDisposeListener(new DisposeListener() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   297
				
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   298
				public void widgetDisposed(DisposeEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   299
					CoreModel.getDefault().getProjectDescriptionManager().removeCProjectDescriptionListener(DebugRunProcessDialog.this);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   300
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   301
			});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   302
			
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   303
			Link link = new Link(composite, SWT.NONE);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   304
			link.setText("<a>" + Messages.getString("DebugRunProcessDialog.SISConfigLinkText") + "...</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   305
			GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false).applyTo(link);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   306
			link.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   307
				public void widgetSelected(SelectionEvent e) {
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   308
					PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open(); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   309
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   310
			});
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   311
			link.setData(UID, "DebugRunProcessDialog.link"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   312
		} else {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   313
			// not a Carbide project, just an executable.  show a browse/edit combo
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   314
			// to let them select a sis file if they want to.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   315
			final Label sisLabel = new Label(composite, SWT.NONE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   316
			sisLabel.setText("SIS File to Install:"); //$NON-NLS-1$
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   317
			GridDataFactory.swtDefaults().span(2, 1).applyTo(sisLabel);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   318
			sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   319
			sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   320
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   321
			sisEdit = new Text(composite, SWT.BORDER);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   322
			GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sisEdit);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   323
			sisEdit.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   324
			sisEdit.addModifyListener(new ModifyListener() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   325
				public void modifyText(ModifyEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   326
					updateSisFile();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   327
					validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   328
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   329
			});
1045
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   330
			String sisPath = data.getSisPath();
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   331
			if (sisPath != null)
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   332
				sisEdit.setText(sisPath);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   333
			sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   334
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   335
			sisBrowse = new Button(composite, SWT.NONE);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   336
			sisBrowse.setText(Messages.getString("DebugRunProcessDialog.BrowseLabel")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   337
			sisBrowse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   338
			sisBrowse.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   339
				public void widgetSelected(SelectionEvent evt) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   340
					FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   341
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   342
					dialog.setText(Messages.getString("DebugRunProcessDialog.Title")); //$NON-NLS-1$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   343
					dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   344
					dialog.setFilterNames(new String[] {Messages.getString("DebugRunProcessDialog.InstallFilterName"), Messages.getString("DebugRunProcessDialog.AllFilterName")}); //$NON-NLS-1$ //$NON-NLS-2$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   345
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   346
					BrowseDialogUtils.initializeFrom(dialog, sisEdit);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   347
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   348
					String result = dialog.open();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   349
					if (result != null && new File(result).exists()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   350
						sisEdit.setText(result);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   351
						updateSisFile();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   352
						validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   353
					}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   354
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   355
			});
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   356
			sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   357
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   358
    }
1045
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   359
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   360
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   361
	private void updateSisFileCombo(ICarbideProjectInfo cpi) {
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   362
		sisFile.add(Messages.getString("DebugRunProcessDialog.NoneItem")); //$NON-NLS-1$
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   363
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   364
		ICarbideBuildConfiguration config = cpi.getDefaultConfiguration();
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   365
		for (ISISBuilderInfo info : config.getSISBuilderInfoList()) {
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   366
			IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath();
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   367
			sisFile.add(sisPath.toOSString());
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   368
		}
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   369
		
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   370
		// select the first sis file if any, otherwise select none
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   371
		if (sisFile.getItemCount() > 1) {
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   372
			sisFile.select(1);
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   373
		} else {
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   374
			sisFile.select(0);
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   375
		}
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   376
		updateSisFile();
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   377
	}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   378
    
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   379
    
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   380
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   381
	 * 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   382
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   383
	protected void updateSisFile() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   384
		String sisPath;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   385
    	if (sisFile != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   386
        	sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   387
        	data.setSisPath(sisPath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   388
    	} else if (sisEdit != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   389
    		sisPath = sisEdit.getText();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   390
    		data.setSisPath(sisPath);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   391
    	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   392
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   393
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   394
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   395
	private void updatePackageUI() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   396
		installPackageUI.setEnabled(data.isInstallPackage());
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   397
		for (Control kid : installPackageUI.getChildren())
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   398
			kid.setEnabled(data.isInstallPackage());
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   399
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   400
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   401
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   402
	public void handleEvent(CProjectDescriptionEvent event) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   403
		Shell shell = getShell();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   404
		if (shell == null || shell.isDisposed()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   405
			return;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   406
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   407
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   408
		IProject project = event.getProject() ;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   409
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   410
		if (project != data.getProject()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   411
			return;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   412
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   413
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   414
		if (sisFile != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   415
			ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   416
			if (cpi != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   417
				sisFile.removeAll();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   418
1045
7bd4eb5648d7 bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents: 969
diff changeset
   419
				updateSisFileCombo(cpi);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   420
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   421
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   422
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   423
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   424
	protected void initUI() {
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1045
diff changeset
   425
		List<IPath> exes = data.getLaunchableExes();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   426
		projectExecutableViewer.setInput(exes);
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   427
		
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   428
		// this path may either be a project-relative or remote path
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   429
		IPath exeSelectionPath = data.getExeSelectionPath();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   430
		if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty())
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   431
			exeSelectionPath = exes.get(0);
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   432
		
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1045
diff changeset
   433
		if (!Path.EMPTY.equals(exeSelectionPath)) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   434
			// keep previous path if possible...
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   435
			IPath remotePath = exeSelectionPath;
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   436
			if (data.getExes().contains(remotePath)) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   437
				// unless that was actually a host-side path, which should be converted
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   438
				remotePath = createSuggestedRemotePath(exeSelectionPath);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   439
			} else {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   440
				// selection is already a remote path; map back to project if possible
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   441
				IPath projPath = getHostFileForRemoteLocation(exeSelectionPath);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   442
				if (projPath != null) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   443
					exeSelectionPath = projPath;
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   444
				}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   445
				else {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   446
					// remote path does not correspond to anything; select some project exe so
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   447
					// the combo isn't empty
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   448
					exeSelectionPath = exes.get(0);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   449
				}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   450
			}
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1045
diff changeset
   451
			projectExecutableViewer.setSelection(new StructuredSelection(exeSelectionPath));
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   452
			
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   453
			if (remoteProgramViewer != null) {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   454
				if (!remotePathEntries.contains(remotePath)) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   455
					remotePathEntries.add(0, remotePath);	// MRU
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   456
					remoteProgramViewer.add(remotePath);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   457
				}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   458
				remoteProgramViewer.setSelection(new StructuredSelection(remotePath));
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   459
			}
1090
02cf64aef519 Fix 10861
dadubrow
parents: 1045
diff changeset
   460
		}
02cf64aef519 Fix 10861
dadubrow
parents: 1045
diff changeset
   461
		
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   462
		if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   463
			projectExecutableViewer.getControl().forceFocus();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   464
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   465
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   466
		if (data.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && exeSelectionPath != null) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   467
			remoteProgramViewer.getControl().forceFocus();
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   468
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   469
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   470
		if (data.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   471
			attachToProcessRadioButton.forceFocus();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   472
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   473
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   474
		handleProjectExecutableRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   475
		handleRemoteExecutableRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   476
		handleAttachToProcessRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   477
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   478
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   479
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   480
	private IPath createSuggestedRemotePath(IPath exeSelectionPath) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   481
		String filename = exeSelectionPath.lastSegment();
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   482
		return PathUtils.createPath("C:/sys/bin").append(filename); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   483
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   484
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   485
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   486
	/**
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   487
	 * Get the host-side file for a given remote location.  Opposite of
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   488
	 * {@link #createSuggestedRemotePath(IPath)}.
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   489
	 * @param path
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   490
	 * @return host path or <code>null</code>
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   491
	 */
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   492
	private IPath getHostFileForRemoteLocation(IPath path) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   493
		for (IPath exe : data.getExes()) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   494
			// no... we don't have any knowledge (yet) of the actual install path,
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   495
			// so comparing the exact path will fail if the user edited it.
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   496
			// IPath remoteSuggested = createSuggestedRemotePath(exe);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   497
			
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   498
			// be pretty loose in the matching for now 
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   499
			if (exe.lastSegment().equalsIgnoreCase(path.lastSegment())) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   500
				return exe;
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   501
			}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   502
		}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   503
		return null;
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   504
	}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   505
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   506
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   507
	 * Allow selecting an executable detected to be built by the program.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   508
	 * @param radioGroup
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   509
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   510
	private void createProjectExecutableRadioButton(Composite radioGroup) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   511
		projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   512
		GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   513
		projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   514
		projectExecutableRadioButton.setData(UID, "radio_project_executable"); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   515
		projectExecutableRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableRadioTooltip")); //$NON-NLS-1$
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   516
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   517
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   518
		projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   519
		GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl());
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   520
		projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   521
		projectExecutableViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableSelectorTooltip")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   522
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   523
		projectExecutableViewer.setContentProvider(new ArrayContentProvider());
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   524
		projectExecutableViewer.setLabelProvider(new LabelProvider() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   525
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   526
			public String getText(Object element) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   527
				if (element instanceof IPath)
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   528
					return ((IPath) element).lastSegment();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   529
				return super.getText(element);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   530
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   531
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   532
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   533
		projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   534
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   535
			public void widgetSelected(SelectionEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   536
				handleProjectExecutableRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   537
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   538
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   539
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   540
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   541
		projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   542
			
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   543
			public void selectionChanged(SelectionChangedEvent event) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   544
				Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   545
				if (sel instanceof IPath) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   546
					if (projectExecutableRadioButton.getSelection()) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   547
						data.setExeSelectionPath((IPath) sel);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   548
					}
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   549
					
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   550
					// track the default remote program from the executable, for easy editing
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   551
					if (remoteProgramViewer != null && !remoteExecutableRadioButton.getSelection()) {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   552
						IPath exeSelectionPath = createSuggestedRemotePath(data.getExeSelectionPath());
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   553
						// path should already be in model
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   554
						remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); 
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   555
					}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   556
					
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   557
					validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   558
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   559
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   560
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   561
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   562
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   563
	private void handleProjectExecutableRadioSelected() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   564
		if (projectExecutableRadioButton.getSelection()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   565
			projectExecutableViewer.getControl().setEnabled(true);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   566
			data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   567
			IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   568
			if (selectedPath != null) {
1185
02373fb1e121 Fix use of PathUtils: do not use new Path() on a Windows format path; this breaks in Linux.
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   569
				data.setExeSelectionPath(selectedPath);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   570
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   571
			validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   572
		} else {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   573
			projectExecutableViewer.getControl().setEnabled(false);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   574
			// another button becomes active and sets the new launch process
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   575
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   576
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   577
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   578
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   579
	 * Allow user to enter an executable path.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   580
	 * @param radioGroup
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   581
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   582
	private void createRemoteExecutableRadioButton(Composite radioGroup) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   583
		remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   584
		GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   585
		remoteExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgLabel")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   586
		
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   587
		remoteExecutableRadioButton.setData(UID, "radio_remote_program"); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   588
		remoteExecutableRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramRadioTooltip")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   589
		
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   590
		remoteProgramViewer = new ComboViewer(radioGroup, SWT.BORDER);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   591
		GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteProgramViewer.getControl());
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   592
		
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   593
		projectGeneratedRemotePaths = new ArrayList<IPath>();
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   594
		for (IPath launchable : data.getLaunchableExes()) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   595
			projectGeneratedRemotePaths.add(createSuggestedRemotePath(launchable));
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   596
		}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   597
		
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   598
		// add the entries before the user MRU entries
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   599
		remotePathEntries.addAll(0, projectGeneratedRemotePaths);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   600
		
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   601
		remoteProgramViewer.setContentProvider(new ArrayContentProvider());
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   602
		remoteProgramViewer.setLabelProvider(new LabelProvider() {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   603
			@Override
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   604
			public String getText(Object element) {
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   605
				if (element instanceof IPath)
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   606
					return PathUtils.convertPathToWindows((IPath) element);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   607
				return super.getText(element);
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   608
			}
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   609
		});
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   610
		remoteProgramViewer.setInput(remotePathEntries);
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   611
		remoteProgramViewer.getCombo().setVisibleItemCount(Math.min(10, remotePathEntries.size()));
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   612
		
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   613
		remoteProgramViewer.setData(UID, "combo_remote_program"); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   614
		remoteProgramViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramSelectorTooltip")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   615
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   616
		remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   617
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   618
			public void widgetSelected(SelectionEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   619
				handleRemoteExecutableRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   620
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   621
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   622
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   623
		
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   624
		remoteProgramViewer.getCombo().addModifyListener(new ModifyListener() {
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   625
			public void modifyText(ModifyEvent e) {
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   626
				IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim());
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   627
				if (remoteExecutableRadioButton.getSelection()) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   628
					data.setExeSelectionPath(path);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   629
				}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   630
				
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   631
				if (!projectExecutableRadioButton.getSelection()) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   632
					IPath projPath = getHostFileForRemoteLocation(path);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   633
					if (projPath != null) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   634
						projectExecutableViewer.setSelection(new StructuredSelection(projPath));
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   635
					}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   636
				}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   637
				
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   638
				validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   639
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   640
		});
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   641
		
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   642
		remoteProgramViewer.getCombo().addFocusListener(new FocusAdapter() {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   643
			/* (non-Javadoc)
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   644
			 * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   645
			 */
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   646
			@Override
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   647
			public void focusLost(FocusEvent e) {
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   648
				IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim());
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   649
				
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   650
				// MRU behavior
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   651
				remotePathEntries.remove(path);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   652
				remotePathEntries.add(0, path);
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   653
			}
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   654
		});
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   655
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   656
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   657
	private void handleRemoteExecutableRadioSelected() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   658
		if (remoteExecutableRadioButton.getSelection()) {
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   659
			remoteProgramViewer.getControl().setEnabled(true);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   660
			data.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE);
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   661
			IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText());
1185
02373fb1e121 Fix use of PathUtils: do not use new Path() on a Windows format path; this breaks in Linux.
Ed Swartz <ed.swartz@nokia.com>
parents: 1090
diff changeset
   662
			data.setExeSelectionPath(path);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   663
			validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   664
		} else {
1284
7ef1318ac801 PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents: 1185
diff changeset
   665
			remoteProgramViewer.getControl().setEnabled(false);
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   666
			// another button becomes active and sets the new launch process
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   667
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   668
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   669
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   670
	/**
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   671
	 * Allow user to attach to a process.
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   672
	 * @param radioGroup
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   673
	 */
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   674
	private void createAttachToProcessRadioButton(Composite radioGroup) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   675
		attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   676
		GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton);
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   677
		attachToProcessRadioButton.setText(Messages.getString("DebugRunProcessDialog.AttachLabel")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   678
		
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   679
		attachToProcessRadioButton.setData(UID, "radio_attach_to_process"); //$NON-NLS-1$
1285
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   680
		attachToProcessRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.AttachProcessRadioTooltip")); //$NON-NLS-1$
84caa86f9460 Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents: 1284
diff changeset
   681
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   682
		Label label = new Label(radioGroup, SWT.WRAP);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   683
		GridDataFactory.fillDefaults().grab(false, false).align(SWT.LEFT, SWT.CENTER).applyTo(label);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   684
		
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   685
		label.setText(Messages.getString("DebugRunProcessDialog.AttachAddlMsg")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   686
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   687
		attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   688
			@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   689
			public void widgetSelected(SelectionEvent e) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   690
				handleAttachToProcessRadioSelected();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   691
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   692
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   693
		});
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   694
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   695
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   696
	
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   697
	private void handleAttachToProcessRadioSelected() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   698
		if (attachToProcessRadioButton.getSelection()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   699
			data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   700
			data.setExeSelectionPath(null);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   701
			validate();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   702
		} else {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   703
			// another button becomes active and sets the new launch process
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   704
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   705
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   706
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   707
	@Override
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   708
	protected void validate() {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   709
		IStatus status = Status.OK_STATUS;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   710
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   711
		// check launch method
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   712
		IPath exePath = data.getExeSelectionPath(); 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   713
		switch (data.getExeSelection()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   714
		case USE_PROJECT_EXECUTABLE:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   715
			if (exePath.isEmpty()) {
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   716
				status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   717
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   718
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   719
		case USE_REMOTE_EXECUTABLE:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   720
			if (exePath.isEmpty()) {
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   721
				status = error(Messages.getString("DebugRunProcessDialog.EnterPathError")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   722
			} else {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   723
				String exePathString = exePath.toString();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   724
				char drive = exePathString.charAt(0);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   725
				char colon = exePathString.length() < 2 ? 0x0 : exePathString.charAt(1);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   726
				char root = exePathString.length() < 3 ? 0x0 : exePathString.charAt(2);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   727
				char lastChar = exePathString.charAt(exePathString.length() - 1);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   728
				if (!Character.isLetter(drive) || colon != ':' || (root != '\\' && root != '/') || 
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   729
						lastChar == '\\' || lastChar == '/' || lastChar == ':') { 
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   730
					status = error(Messages.getString("DebugRunProcessDialog.AbsolutePathError")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   731
				} else if (exePath.getFileExtension() == null) {
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   732
					status = warning(Messages.getString("DebugRunProcessDialog.FilePathError")); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   733
				}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   734
			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   735
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   736
		case ATTACH_TO_PROCESS:
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   737
			break;
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   738
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   739
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   740
		// check SIS selection
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   741
		if (data.isInstallPackage()) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   742
	    	if (sisEdit != null) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   743
	    		String text = sisEdit.getText().trim();
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   744
	    		if (text.length() > 0) {
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   745
	    			// empty is allowed, but if they specify something, make sure
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   746
	    			// it exists
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   747
	    			File file = new File(text);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   748
	    			if (!file.exists()) {
969
b0dd389735fb externalize strings
dadubrow
parents: 956
diff changeset
   749
	    				status = error(Messages.getString("DebugRunProcessDialog.SISFileExistError"), text); //$NON-NLS-1$
956
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   750
	    			}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   751
	    		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   752
	    	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   753
		}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   754
		
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   755
		updateStatus(status);
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   756
	}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   757
}
d1e221a2875f new launch wizard implementation
dadubrow
parents:
diff changeset
   758