mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-21 07:05:58 +02:00
[223728] Replaced waitForRSEInit with RSECorePlugin#isInitComplete() API.
This commit is contained in:
parent
df8126c8aa
commit
49748fc346
1 changed files with 219 additions and 207 deletions
|
@ -14,6 +14,7 @@
|
||||||
* Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path
|
* Johann Draschwandtner (Wind River) - [231827][remotecdt]Auto-compute default for Remote path
|
||||||
* Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement
|
* Johann Draschwandtner (Wind River) - [233057][remotecdt]Fix button enablement
|
||||||
* Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
|
* Anna Dushistova (MontaVista) - [181517][usability] Specify commands to be run before remote application launch
|
||||||
|
* Anna Dushistova (MontaVista) - [223728] [remotecdt] connection combo is not populated until RSE is activated
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.remotecdt;
|
package org.eclipse.rse.internal.remotecdt;
|
||||||
|
@ -22,11 +23,7 @@ import org.eclipse.cdt.launch.ui.CMainTab;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
@ -50,13 +47,11 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
|
||||||
public class RemoteCMainTab extends CMainTab {
|
public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
/* Labels and Error Messages */
|
/* Labels and Error Messages */
|
||||||
|
@ -80,8 +75,6 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
protected Button skipDownloadButton;
|
protected Button skipDownloadButton;
|
||||||
protected Button useLocalPathButton;
|
protected Button useLocalPathButton;
|
||||||
|
|
||||||
private static int initializedRSE = 0; //0=not initialized; -1=initializing; 1=initialized
|
|
||||||
|
|
||||||
SystemNewConnectionAction action = null;
|
SystemNewConnectionAction action = null;
|
||||||
private Text preRunText;
|
private Text preRunText;
|
||||||
private Label preRunLabel;
|
private Label preRunLabel;
|
||||||
|
@ -92,6 +85,7 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* createControl
|
* createControl
|
||||||
|
*
|
||||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl
|
||||||
*/
|
*/
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
@ -125,12 +119,14 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
|
||||||
"org.eclipse.rse.internal.remotecdt.launchgroup"); //$NON-NLS-1$
|
"org.eclipse.rse.internal.remotecdt.launchgroup"); //$NON-NLS-1$
|
||||||
|
|
||||||
////No more needed according to https://bugs.eclipse.org/bugs/show_bug.cgi?id=178832
|
// //No more needed according to
|
||||||
|
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=178832
|
||||||
// LaunchUIPlugin.setDialogShell(parent.getShell());
|
// LaunchUIPlugin.setDialogShell(parent.getShell());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* isValid
|
* isValid
|
||||||
|
*
|
||||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid
|
||||||
*/
|
*/
|
||||||
public boolean isValid(ILaunchConfiguration config) {
|
public boolean isValid(ILaunchConfiguration config) {
|
||||||
|
@ -138,7 +134,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
if (retVal == true) {
|
if (retVal == true) {
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
int currentSelection = connectionCombo.getSelectionIndex();
|
int currentSelection = connectionCombo.getSelectionIndex();
|
||||||
String connection_name = currentSelection >= 0 ? connectionCombo.getItem(currentSelection) : ""; //$NON-NLS-1$
|
String connection_name = currentSelection >= 0 ? connectionCombo
|
||||||
|
.getItem(currentSelection) : ""; //$NON-NLS-1$
|
||||||
if (connection_name.equals("")) { //$NON-NLS-1$
|
if (connection_name.equals("")) { //$NON-NLS-1$
|
||||||
setErrorMessage(CONNECTION_TEXT_ERROR);
|
setErrorMessage(CONNECTION_TEXT_ERROR);
|
||||||
retVal = false;
|
retVal = false;
|
||||||
|
@ -185,7 +182,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
newRemoteConnectionButton = createPushButton(projComp, Messages.RemoteCMainTab_New, null);
|
newRemoteConnectionButton = createPushButton(projComp,
|
||||||
|
Messages.RemoteCMainTab_New, null);
|
||||||
newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
|
newRemoteConnectionButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent evt) {
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
@ -195,8 +193,10 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
remoteConnectionPropertiesButton = createPushButton(projComp, Messages.RemoteCMainTab_Properties, null);
|
remoteConnectionPropertiesButton = createPushButton(projComp,
|
||||||
remoteConnectionPropertiesButton.addSelectionListener(new SelectionAdapter() {
|
Messages.RemoteCMainTab_Properties, null);
|
||||||
|
remoteConnectionPropertiesButton
|
||||||
|
.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent evt) {
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
handleRemoteConnectionPropertiesSelected();
|
handleRemoteConnectionPropertiesSelected();
|
||||||
|
@ -207,8 +207,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* createTargetExePath
|
* createTargetExePath This creates the remote path user-editable textfield
|
||||||
* This creates the remote path user-editable textfield on the Main Tab.
|
* on the Main Tab.
|
||||||
*/
|
*/
|
||||||
protected void createTargetExePathGroup(Composite parent) {
|
protected void createTargetExePathGroup(Composite parent) {
|
||||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||||
|
@ -237,7 +237,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
remoteBrowseButton = createPushButton(mainComp, Messages.RemoteCMainTab_Remote_Path_Browse_Button, null);
|
remoteBrowseButton = createPushButton(mainComp,
|
||||||
|
Messages.RemoteCMainTab_Remote_Path_Browse_Button, null);
|
||||||
remoteBrowseButton.addSelectionListener(new SelectionAdapter() {
|
remoteBrowseButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent evt) {
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
@ -267,8 +268,7 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* createDownloadOption
|
* createDownloadOption This creates the skip download check button.
|
||||||
* This creates the skip download check button.
|
|
||||||
*/
|
*/
|
||||||
protected void createDownloadOption(Composite parent) {
|
protected void createDownloadOption(Composite parent) {
|
||||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||||
|
@ -279,7 +279,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
mainComp.setLayoutData(gd);
|
mainComp.setLayoutData(gd);
|
||||||
|
|
||||||
skipDownloadButton = createCheckButton(mainComp, SKIP_DOWNLOAD_BUTTON_TEXT);
|
skipDownloadButton = createCheckButton(mainComp,
|
||||||
|
SKIP_DOWNLOAD_BUTTON_TEXT);
|
||||||
skipDownloadButton.addSelectionListener(new SelectionAdapter() {
|
skipDownloadButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent evt) {
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
@ -291,18 +292,26 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* performApply
|
* performApply
|
||||||
|
*
|
||||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply
|
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply
|
||||||
*/
|
*/
|
||||||
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
||||||
|
|
||||||
int currentSelection = connectionCombo.getSelectionIndex();
|
int currentSelection = connectionCombo.getSelectionIndex();
|
||||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
|
config.setAttribute(
|
||||||
currentSelection >= 0 ? connectionCombo.getItem(currentSelection) : null);
|
IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
|
||||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
|
currentSelection >= 0 ? connectionCombo
|
||||||
|
.getItem(currentSelection) : null);
|
||||||
|
config.setAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
|
||||||
remoteProgText.getText());
|
remoteProgText.getText());
|
||||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
config
|
||||||
|
.setAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
||||||
skipDownloadButton.getSelection());
|
skipDownloadButton.getSelection());
|
||||||
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS, preRunText.getText());
|
config.setAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
|
||||||
|
preRunText.getText());
|
||||||
super.performApply(config);
|
super.performApply(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +321,9 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
public void initializeFrom(ILaunchConfiguration config) {
|
||||||
String remoteConnection = null;
|
String remoteConnection = null;
|
||||||
try {
|
try {
|
||||||
remoteConnection = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
|
remoteConnection = config
|
||||||
|
.getAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION,
|
||||||
""); //$NON-NLS-1$
|
""); //$NON-NLS-1$
|
||||||
} catch (CoreException ce) {
|
} catch (CoreException ce) {
|
||||||
// Ignore
|
// Ignore
|
||||||
|
@ -323,7 +334,10 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
for (i = 0; i < items.length; i++)
|
for (i = 0; i < items.length; i++)
|
||||||
if (items[i].equals(remoteConnection))
|
if (items[i].equals(remoteConnection))
|
||||||
break;
|
break;
|
||||||
/* Select the last used connection in the connecion pulldown if it still exists. */
|
/*
|
||||||
|
* Select the last used connection in the connecion pulldown if it still
|
||||||
|
* exists.
|
||||||
|
*/
|
||||||
if (i < items.length)
|
if (i < items.length)
|
||||||
connectionCombo.select(i);
|
connectionCombo.select(i);
|
||||||
else if (items.length > 0)
|
else if (items.length > 0)
|
||||||
|
@ -337,22 +351,22 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleNewRemoteConnectionSelected() {
|
protected void handleNewRemoteConnectionSelected() {
|
||||||
if (action == null)
|
if (action == null) {
|
||||||
{
|
action = new SystemNewConnectionAction(getControl().getShell(),
|
||||||
action = new SystemNewConnectionAction(getControl().getShell(), false, false, null);
|
false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
action.run();
|
action.run();
|
||||||
} catch (Exception e)
|
} catch (Exception e) {
|
||||||
{
|
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IHost getCurrentConnection() {
|
protected IHost getCurrentConnection() {
|
||||||
int currentSelection = connectionCombo.getSelectionIndex();
|
int currentSelection = connectionCombo.getSelectionIndex();
|
||||||
String remoteConnection = currentSelection >= 0 ? connectionCombo.getItem(currentSelection) : null;
|
String remoteConnection = currentSelection >= 0 ? connectionCombo
|
||||||
|
.getItem(currentSelection) : null;
|
||||||
if (remoteConnection == null)
|
if (remoteConnection == null)
|
||||||
return null;
|
return null;
|
||||||
IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts();
|
IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts();
|
||||||
|
@ -365,8 +379,10 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
protected void handleRemoteBrowseSelected() {
|
protected void handleRemoteBrowseSelected() {
|
||||||
IHost currentConnectionSelected = getCurrentConnection();
|
IHost currentConnectionSelected = getCurrentConnection();
|
||||||
SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl().getShell(),
|
SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl()
|
||||||
Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title, currentConnectionSelected);
|
.getShell(),
|
||||||
|
Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title,
|
||||||
|
currentConnectionSelected);
|
||||||
dlg.setBlockOnOpen(true);
|
dlg.setBlockOnOpen(true);
|
||||||
if (dlg.open() == Window.OK) {
|
if (dlg.open() == Window.OK) {
|
||||||
Object retObj = dlg.getSelectedObject();
|
Object retObj = dlg.getSelectedObject();
|
||||||
|
@ -385,7 +401,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
private Button fSkipDownloadBtn;
|
private Button fSkipDownloadBtn;
|
||||||
private Text fWSRoot;
|
private Text fWSRoot;
|
||||||
|
|
||||||
public RemoteConnectionPropertyDialog(Shell parentShell, String dialogTitle, IHost host) {
|
public RemoteConnectionPropertyDialog(Shell parentShell,
|
||||||
|
String dialogTitle, IHost host) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
parentShell.setText(dialogTitle);
|
parentShell.setText(dialogTitle);
|
||||||
fHost = host;
|
fHost = host;
|
||||||
|
@ -394,12 +411,14 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
// create composite
|
// create composite
|
||||||
Composite composite = (Composite) super.createDialogArea(parent);
|
Composite composite = (Composite) super
|
||||||
|
.createDialogArea(parent);
|
||||||
|
|
||||||
Label label = new Label(composite, SWT.WRAP);
|
Label label = new Label(composite, SWT.WRAP);
|
||||||
label.setText(Messages.RemoteCMainTab_Properties_Location);
|
label.setText(Messages.RemoteCMainTab_Properties_Location);
|
||||||
GridData data = new GridData(GridData.GRAB_HORIZONTAL
|
GridData data = new GridData(GridData.GRAB_HORIZONTAL
|
||||||
| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
|
| GridData.GRAB_VERTICAL
|
||||||
|
| GridData.HORIZONTAL_ALIGN_FILL
|
||||||
| GridData.VERTICAL_ALIGN_CENTER);
|
| GridData.VERTICAL_ALIGN_CENTER);
|
||||||
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
|
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
|
||||||
label.setLayoutData(data);
|
label.setLayoutData(data);
|
||||||
|
@ -409,15 +428,22 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
| GridData.HORIZONTAL_ALIGN_FILL));
|
| GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
|
||||||
fSkipDownloadBtn = new Button(composite, SWT.CHECK);
|
fSkipDownloadBtn = new Button(composite, SWT.CHECK);
|
||||||
fSkipDownloadBtn.setText(Messages.RemoteCMainTab_Properties_Skip_default);
|
fSkipDownloadBtn
|
||||||
|
.setText(Messages.RemoteCMainTab_Properties_Skip_default);
|
||||||
if (!fbLocalHost) {
|
if (!fbLocalHost) {
|
||||||
IPropertySet propertySet = fHost.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
IPropertySet propertySet = fHost
|
||||||
|
.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
||||||
if (propertySet != null) {
|
if (propertySet != null) {
|
||||||
String value = propertySet.getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
|
String value = propertySet
|
||||||
|
.getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
fWSRoot.setText(value);
|
fWSRoot.setText(value);
|
||||||
}
|
}
|
||||||
fSkipDownloadBtn.setSelection(Boolean.valueOf(propertySet.getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
|
fSkipDownloadBtn
|
||||||
|
.setSelection(Boolean
|
||||||
|
.valueOf(
|
||||||
|
propertySet
|
||||||
|
.getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
|
||||||
.booleanValue());
|
.booleanValue());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -430,76 +456,45 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
protected void buttonPressed(int buttonId) {
|
protected void buttonPressed(int buttonId) {
|
||||||
if (!fbLocalHost && (buttonId == IDialogConstants.OK_ID)) {
|
if (!fbLocalHost && (buttonId == IDialogConstants.OK_ID)) {
|
||||||
IPropertySet propertySet = fHost.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
IPropertySet propertySet = fHost
|
||||||
|
.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
||||||
if (propertySet == null) {
|
if (propertySet == null) {
|
||||||
propertySet = fHost.createPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
propertySet = fHost
|
||||||
|
.createPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
||||||
}
|
}
|
||||||
propertySet.addProperty(IRemoteConnectionHostConstants.REMOTE_WS_ROOT, fWSRoot.getText());
|
propertySet.addProperty(
|
||||||
propertySet.addProperty(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD, Boolean.toString(fSkipDownloadBtn.getSelection()));
|
IRemoteConnectionHostConstants.REMOTE_WS_ROOT,
|
||||||
|
fWSRoot.getText());
|
||||||
|
propertySet
|
||||||
|
.addProperty(
|
||||||
|
IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD,
|
||||||
|
Boolean.toString(fSkipDownloadBtn
|
||||||
|
.getSelection()));
|
||||||
fHost.commit();
|
fHost.commit();
|
||||||
}
|
}
|
||||||
super.buttonPressed(buttonId);
|
super.buttonPressed(buttonId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IHost currentConnectionSelected = getCurrentConnection();
|
IHost currentConnectionSelected = getCurrentConnection();
|
||||||
RemoteConnectionPropertyDialog dlg = new RemoteConnectionPropertyDialog(getControl().getShell(),
|
RemoteConnectionPropertyDialog dlg = new RemoteConnectionPropertyDialog(
|
||||||
Messages.RemoteCMainTab_Properties_title, currentConnectionSelected);
|
getControl().getShell(),
|
||||||
|
Messages.RemoteCMainTab_Properties_title,
|
||||||
|
currentConnectionSelected);
|
||||||
dlg.setBlockOnOpen(true);
|
dlg.setBlockOnOpen(true);
|
||||||
dlg.open();
|
dlg.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForRSEInit(final Runnable callback) {
|
|
||||||
Job initRSEJob = null;
|
|
||||||
Job[] jobs = Job.getJobManager().find(null);
|
|
||||||
for(int i=0; i<jobs.length; i++) {
|
|
||||||
if ("Initialize RSE".equals(jobs[i].getName())) { //$NON-NLS-1$
|
|
||||||
initRSEJob = jobs[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (initRSEJob == null) {
|
|
||||||
//Already initialized - we can continue right away
|
|
||||||
callback.run();
|
|
||||||
} else {
|
|
||||||
//Wait until model fully restored, then fire a callback to restore state.
|
|
||||||
//Remember current display, since we're definitely on the display thread here
|
|
||||||
final Display display = Display.getCurrent();
|
|
||||||
final Job fInitRSEJob = initRSEJob;
|
|
||||||
Job waitForRestoreCompleteJob = new Job("WaitForRestoreComplete") { //$NON-NLS-1$
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
|
||||||
try {
|
|
||||||
fInitRSEJob.join();
|
|
||||||
display.asyncExec(callback);
|
|
||||||
} catch(InterruptedException e) {
|
|
||||||
return Status.CANCEL_STATUS;
|
|
||||||
}
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
waitForRestoreCompleteJob.setSystem(true);
|
|
||||||
waitForRestoreCompleteJob.schedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateConnectionPulldown() {
|
protected void updateConnectionPulldown() {
|
||||||
if (initializedRSE==0) {
|
if (!RSECorePlugin.isInitComplete(RSECorePlugin.INIT_MODEL))
|
||||||
// start RSEUIPlugin to make sure the SystemRegistry is initialized.
|
try {
|
||||||
boolean isRegistryActive = RSECorePlugin.isTheSystemRegistryActive();
|
RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
|
||||||
if (isRegistryActive) {
|
} catch (InterruptedException e) {
|
||||||
initializedRSE = 1;
|
return;
|
||||||
waitForRSEInit(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
initializedRSE = 2;
|
|
||||||
updateConnectionPulldown();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (initializedRSE<0) {
|
|
||||||
//initializing: nothing to do, callback will come soon
|
|
||||||
} else {
|
|
||||||
// already initialized
|
// already initialized
|
||||||
connectionCombo.removeAll();
|
connectionCombo.removeAll();
|
||||||
IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationCategory("shells"); //$NON-NLS-1$
|
IHost[] connections = RSECorePlugin.getTheSystemRegistry()
|
||||||
|
.getHostsBySubSystemConfigurationCategory("shells"); //$NON-NLS-1$
|
||||||
for (int i = 0; i < connections.length; i++) {
|
for (int i = 0; i < connections.length; i++) {
|
||||||
IRSESystemType sysType = connections[i].getSystemType();
|
IRSESystemType sysType = connections[i].getSystemType();
|
||||||
if (sysType != null && sysType.isEnabled()) {
|
if (sysType != null && sysType.isEnabled()) {
|
||||||
|
@ -512,10 +507,10 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
updatePropertiesButton();
|
updatePropertiesButton();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePropertiesButton() {
|
private void updatePropertiesButton() {
|
||||||
if((remoteConnectionPropertiesButton == null) || remoteConnectionPropertiesButton.isDisposed()) {
|
if ((remoteConnectionPropertiesButton == null)
|
||||||
|
|| remoteConnectionPropertiesButton.isDisposed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean bEnableProperties = false;
|
boolean bEnableProperties = false;
|
||||||
|
@ -532,7 +527,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
protected void updateTargetProgFromConfig(ILaunchConfiguration config) {
|
protected void updateTargetProgFromConfig(ILaunchConfiguration config) {
|
||||||
String targetPath = null;
|
String targetPath = null;
|
||||||
try {
|
try {
|
||||||
targetPath = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
|
targetPath = config.getAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH,
|
||||||
REMOTE_PATH_DEFAULT);
|
REMOTE_PATH_DEFAULT);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
|
@ -541,7 +537,9 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
|
|
||||||
String prelaunchCmd = null;
|
String prelaunchCmd = null;
|
||||||
try {
|
try {
|
||||||
prelaunchCmd = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
|
prelaunchCmd = config
|
||||||
|
.getAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_PRERUN_COMMANDS,
|
||||||
""); //$NON-NLS-1$
|
""); //$NON-NLS-1$
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
|
@ -552,7 +550,9 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
protected void updateSkipDownloadFromConfig(ILaunchConfiguration config) {
|
protected void updateSkipDownloadFromConfig(ILaunchConfiguration config) {
|
||||||
boolean downloadToTarget = true;
|
boolean downloadToTarget = true;
|
||||||
try {
|
try {
|
||||||
downloadToTarget = config.getAttribute(IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
downloadToTarget = config
|
||||||
|
.getAttribute(
|
||||||
|
IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET,
|
||||||
SKIP_DOWNLOAD_TO_REMOTE_DEFAULT);
|
SKIP_DOWNLOAD_TO_REMOTE_DEFAULT);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// Ignore for now
|
// Ignore for now
|
||||||
|
@ -561,9 +561,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setLocalPathForRemotePath
|
* setLocalPathForRemotePath This function sets the remote path text field
|
||||||
* This function sets the remote path text field with the value of the
|
* with the value of the local executable path.
|
||||||
* local executable path.
|
|
||||||
*/
|
*/
|
||||||
private void setLocalPathForRemotePath() {
|
private void setLocalPathForRemotePath() {
|
||||||
String programName = fProgText.getText().trim();
|
String programName = fProgText.getText().trim();
|
||||||
|
@ -584,7 +583,8 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
exePath = project.getFile(programName).getLocation();
|
exePath = project.getFile(programName).getLocation();
|
||||||
|
|
||||||
IPath wsRoot = project.getWorkspace().getRoot().getLocation();
|
IPath wsRoot = project.getWorkspace().getRoot().getLocation();
|
||||||
exePath = makeRelativeToWSRootLocation(exePath, remoteWsRoot, wsRoot);
|
exePath = makeRelativeToWSRootLocation(exePath, remoteWsRoot,
|
||||||
|
wsRoot);
|
||||||
}
|
}
|
||||||
String path = exePath.toString();
|
String path = exePath.toString();
|
||||||
remoteProgText.setText(path);
|
remoteProgText.setText(path);
|
||||||
|
@ -599,8 +599,10 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
remoteProgText.setText(remoteWsRoot);
|
remoteProgText.setText(remoteWsRoot);
|
||||||
} else {
|
} else {
|
||||||
// try to use remote path
|
// try to use remote path
|
||||||
IPath wsRoot = getCProject().getProject().getWorkspace().getRoot().getLocation();
|
IPath wsRoot = getCProject().getProject().getWorkspace()
|
||||||
IPath remotePath = makeRelativeToWSRootLocation(new Path(remoteName), remoteWsRoot, wsRoot);
|
.getRoot().getLocation();
|
||||||
|
IPath remotePath = makeRelativeToWSRootLocation(new Path(
|
||||||
|
remoteName), remoteWsRoot, wsRoot);
|
||||||
remoteProgText.setText(remotePath.toString());
|
remoteProgText.setText(remotePath.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,11 +611,14 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath makeRelativeToWSRootLocation(IPath exePath, String remoteWsRoot, IPath wsRoot) {
|
private IPath makeRelativeToWSRootLocation(IPath exePath,
|
||||||
|
String remoteWsRoot, IPath wsRoot) {
|
||||||
if (remoteWsRoot.length() != 0) {
|
if (remoteWsRoot.length() != 0) {
|
||||||
// use remoteWSRoot instead of Workspace Root
|
// use remoteWSRoot instead of Workspace Root
|
||||||
if (wsRoot.isPrefixOf(exePath)) {
|
if (wsRoot.isPrefixOf(exePath)) {
|
||||||
return new Path(remoteWsRoot).append(exePath.removeFirstSegments(wsRoot.segmentCount()).setDevice(null));
|
return new Path(remoteWsRoot).append(exePath
|
||||||
|
.removeFirstSegments(wsRoot.segmentCount()).setDevice(
|
||||||
|
null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return exePath;
|
return exePath;
|
||||||
|
@ -622,9 +627,11 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
private String getRemoteWSRoot() {
|
private String getRemoteWSRoot() {
|
||||||
IHost host = getCurrentConnection();
|
IHost host = getCurrentConnection();
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
IPropertySet propertySet = host.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
IPropertySet propertySet = host
|
||||||
|
.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
||||||
if (propertySet != null) {
|
if (propertySet != null) {
|
||||||
String value = propertySet.getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
|
String value = propertySet
|
||||||
|
.getPropertyValue(IRemoteConnectionHostConstants.REMOTE_WS_ROOT);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -636,9 +643,14 @@ public class RemoteCMainTab extends CMainTab {
|
||||||
private boolean getDefaultSkipDownload() {
|
private boolean getDefaultSkipDownload() {
|
||||||
IHost host = getCurrentConnection();
|
IHost host = getCurrentConnection();
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
IPropertySet propertySet = host.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
IPropertySet propertySet = host
|
||||||
|
.getPropertySet(IRemoteConnectionHostConstants.PI_REMOTE_CDT);
|
||||||
if (propertySet != null) {
|
if (propertySet != null) {
|
||||||
return Boolean.valueOf(propertySet.getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD)).booleanValue();
|
return Boolean
|
||||||
|
.valueOf(
|
||||||
|
propertySet
|
||||||
|
.getPropertyValue(IRemoteConnectionHostConstants.DEFAULT_SKIP_DOWNLOAD))
|
||||||
|
.booleanValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
|
return SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue