[416426] - fixed revert bug for Resources tab and Performance tab
Change-Id: I6285eab8e47a35e9f7c9172e67f4ed0538702baa
Signed-off-by: Chris Navarro <cmnavarr@illinois.edu>
diff --git a/core/org.eclipse.ptp.launch/META-INF/MANIFEST.MF b/core/org.eclipse.ptp.launch/META-INF/MANIFEST.MF
index 0eb182f..54b515e 100644
--- a/core/org.eclipse.ptp.launch/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.ptp.launch/META-INF/MANIFEST.MF
@@ -35,4 +35,4 @@
org.eclipse.ptp.launch.rulesengine;x-internal:=true,
org.eclipse.ptp.launch.ui;x-friends:="org.eclipse.ptp.rcp.sysmon",
org.eclipse.ptp.launch.ui.extensions;x-friends:="org.eclipse.ptp.etfw.launch",
- org.eclipse.ptp.launch.ui.tabs;x-friends:="org.eclipse.ptp.etfw.parallel,org.eclipse.ptp.rcp.sysmon"
+ org.eclipse.ptp.launch.ui.tabs;x-friends:="org.eclipse.ptp.etfw.parallel,org.eclipse.ptp.rcp.sysmon,org.eclipse.ptp.etfw.launch"
diff --git a/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/LaunchConfigurationTab.java b/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/LaunchConfigurationTab.java
index 3278a25..7a2eb9b 100644
--- a/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/LaunchConfigurationTab.java
+++ b/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/LaunchConfigurationTab.java
@@ -57,7 +57,7 @@
// cache the launch configuration for updates
setLaunchConfiguration(configuration);
}
-
+
/**
* Cache the launch configuration
*
diff --git a/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/ResourcesTab.java b/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/ResourcesTab.java
index e3830d0..6e92b74 100644
--- a/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/ResourcesTab.java
+++ b/core/org.eclipse.ptp.launch/src/org/eclipse/ptp/launch/ui/tabs/ResourcesTab.java
@@ -475,26 +475,28 @@
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
super.initializeFrom(configuration);
- if (!fIsInitialized) {
- final String rmType = LaunchUtils.getTemplateName(configuration);
- final String remId = LaunchUtils.getRemoteServicesId(configuration);
- final String remName = LaunchUtils.getConnectionName(configuration);
+ final String rmType = LaunchUtils.getTemplateName(configuration);
+ final String remId = LaunchUtils.getRemoteServicesId(configuration);
+ final String remName = LaunchUtils.getConnectionName(configuration);
+
+ boolean fControlChanged = fLaunchControl != null
+ && (!fLaunchControl.getConfiguration().getName().equals(rmType)
+ || !fLaunchControl.getRemoteServicesId().equals(remId) || !fLaunchControl.getConnectionName()
+ .equals(remName));
+ if (!fIsInitialized || fControlChanged) {
if (rmType != null && remId != null && remName != null) {
fSystemTypeCombo.select(fProviders.lastIndexOf(rmType) + 1);
updateEnablement();
/*
* Only stop the controller if something has changed.
*/
- if (fLaunchControl != null
- && (!fLaunchControl.getConfiguration().getName().equals(rmType)
- || !fLaunchControl.getRemoteServicesId().equals(remId) || !fLaunchControl.getConnectionName()
- .equals(remName))) {
+ if (fControlChanged) {
stopController(fLaunchControl);
fLaunchControl = null;
}
/*
- * Set the connection and see if the user wants to open it. If yes, create a new controller if one doesn't already
- * exist. If no, revert to no connection selected.
+ * Set the connection and see if the user wants to open it. If yes, create a new controller if one doesn't
+ * already exist. If no, revert to no connection selected.
*/
fRemoteConnectionWidget.setConnection(remId, remName);
IRemoteConnection conn = fRemoteConnectionWidget.getConnection();
@@ -514,8 +516,21 @@
fLaunchControl = null;
fRemoteConnection = null;
updateEnablement();
+
+ // Undo selection made if there is one
+ if (rmType == null) {
+ fSystemTypeCombo.select(0);
+
+ // select the default message; thus if user types a filter string immediately, it will replace it
+ fSystemTypeCombo.setSelection(new Point(0, Messages.ResourcesTab_pleaseSelectTargetSystem.length()));
+ }
+ updateLaunchAttributeControls(fLaunchControl, getLaunchConfiguration(), false);
+ updateLaunchConfigurationDialog();
}
fIsInitialized = true;
+ } else {
+ updateLaunchAttributeControls(fLaunchControl, getLaunchConfiguration(), true);
+ updateLaunchConfigurationDialog();
}
}
diff --git a/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java b/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
index 109e738..efc684e 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
+++ b/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.ptp.core.util.LaunchUtils;
@@ -38,6 +37,7 @@
import org.eclipse.ptp.internal.rm.jaxb.core.JAXBCoreConstants;
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationContentsChangedListener;
import org.eclipse.ptp.launch.ui.extensions.IRMLaunchConfigurationDynamicTab;
+import org.eclipse.ptp.launch.ui.tabs.LaunchConfigurationTab;
import org.eclipse.ptp.rm.jaxb.control.core.ILaunchController;
import org.eclipse.ptp.rm.jaxb.control.core.LaunchControllerManager;
import org.eclipse.ptp.rm.jaxb.core.IVariableMap;
@@ -62,15 +62,13 @@
import org.eclipse.swt.widgets.Text;
/**
- * Notes: This class is a re-implementation of ParallelToolSelectionTab using JAXB to dynamically build the UI.
- * TODO Review this class to see if some of what is done could be replaced with the JAXB provided classes or done as an extension of
- * the JAXB parent classes instead of what has been done with Some of the functionality in this class belongs in
- * ETFWParentLaunchConfiguration
+ * This class is a re-implementation of ParallelToolSelectionTab using JAXB to dynamically build the UI for setting up performance
+ * analysis tools to run on the application
*
* @author Chris Navarro
*
*/
-public class PerformanceAnalysisTab extends AbstractLaunchConfigurationTab implements IToolLaunchConfigurationConstants,
+public class PerformanceAnalysisTab extends LaunchConfigurationTab implements IToolLaunchConfigurationConstants,
IExecutableExtension {
private static final String TAB_ID = "org.eclipse.ptp.internal.etfw.launch.PerformanceAnalysisTab"; //$NON-NLS-1$
@@ -353,11 +351,21 @@
return subTabs;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// Do nothing
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
launchConfiguration = configuration;
@@ -402,6 +410,11 @@
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
if (noPTP) {
@@ -441,21 +454,14 @@
}
protected class WidgetListener extends SelectionAdapter {
- private String prevToolName;
- private String prevLaunchConfig;
-
@Override
public void widgetSelected(SelectionEvent e) {
int selection = toolCombo.getSelectionIndex();
- String toolName = toolCombo.getItem(selection);
-
- if (!toolName.equals(prevToolName) || !launchConfiguration.getName().equals(prevLaunchConfig)) {
- prevToolName = toolName;
- prevLaunchConfig = launchConfiguration.getName();
+ if(selection != -1) {
+ String toolName = toolCombo.getItem(selection);
rebuildTab(toolName);
+ updateLaunchConfigurationDialog();
}
-
- updateLaunchConfigurationDialog();
}
}
@@ -465,27 +471,39 @@
}
}
- /**
- * @see ILaunchConfigurationTab#getName()
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
@Override
public String getName() {
return Messages.PerformanceAnalysisTab_Tab_Name;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId()
+ */
@Override
public String getId() {
return TAB_ID;
}
- /**
- * @see ILaunchConfigurationTab#setLaunchConfigurationDialog (ILaunchConfigurationDialog)
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog)
*/
@Override
public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) {
super.setLaunchConfigurationDialog(dialog);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
@Override
public boolean isValid(ILaunchConfiguration configuration) {
setErrorMessage(null);