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