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