Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis Windatt2010-05-18 14:33:52 -0400
committerCurtis Windatt2010-05-18 14:33:52 -0400
commitfdbc9b08c8f68d038595bdd42d9ba7ad1238a2b9 (patch)
treeb643d2e683db8a36a57942e1ca2c5d6a9e1e8d2e
parent67db6a9d2d99178942a0c1602282b0ab624aa9e7 (diff)
downloadeclipse.platform.debug-fdbc9b08c8f68d038595bdd42d9ba7ad1238a2b9.tar.gz
eclipse.platform.debug-fdbc9b08c8f68d038595bdd42d9ba7ad1238a2b9.tar.xz
eclipse.platform.debug-fdbc9b08c8f68d038595bdd42d9ba7ad1238a2b9.zip
Bug 312949: switching between configs & typing in name field of LCD is slow
https://bugs.eclipse.org/bugs/show_bug.cgi?id=312949
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java91
1 files changed, 79 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index 920b662df..6b6c3a020 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -59,6 +60,7 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.WorkbenchJob;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -172,6 +174,11 @@ public class LaunchConfigurationTabGroupViewer {
private ViewForm fViewform;
/**
+ * Job to update the dialog after a delay.
+ */
+ private Job fRefreshJob;
+
+ /**
* Constructs a viewer in the given composite, contained by the given
* launch configuration dialog.
*
@@ -664,17 +671,21 @@ public class LaunchConfigurationTabGroupViewer {
if(config1 == null || config2 == null) {
return false;
}
- Set modes = getCurrentModeSet();
- ILaunchDelegate d1 = config1.getPreferredDelegate(modes);
- if(d1 == null) {
- d1 = config1.getType().getPreferredDelegate(modes);
- }
- ILaunchDelegate d2 = config2.getPreferredDelegate(modes);
- if(d2 == null) {
- d2 = config2.getType().getPreferredDelegate(modes);
- }
- if(d1 != null) {
- return d1.equals(d2);
+ if (config1.getType().equals(config2.getType())) {
+ Set modes = getCurrentModeSet();
+ ILaunchDelegate d1 = config1.getPreferredDelegate(modes);
+ if(d1 == null) {
+ d1 = config1.getType().getPreferredDelegate(modes);
+ }
+ ILaunchDelegate d2 = config2.getPreferredDelegate(modes);
+ if(d2 == null) {
+ d2 = config2.getType().getPreferredDelegate(modes);
+ }
+ if (d1 == null) {
+ return d2 == null;
+ } else {
+ return d1.equals(d2);
+ }
}
}
catch(CoreException ce) {DebugUIPlugin.log(ce);}
@@ -922,6 +933,62 @@ public class LaunchConfigurationTabGroupViewer {
}
/**
+ * Returns the job to update the launch configuration dialog.
+ *
+ * @return update job
+ */
+ private Job getUpdateJob() {
+ if (fRefreshJob == null) {
+ fRefreshJob = createUpdateJob();
+ fRefreshJob.setSystem(true);
+ }
+ return fRefreshJob;
+ }
+
+ /**
+ * Schedules the update job to run for this tab based on this tab's delay.
+ *
+ * @since 3.6
+ */
+ protected void scheduleUpdateJob() {
+ Job job = getUpdateJob();
+ job.cancel(); // cancel existing job
+ job.schedule(getUpdateJobDelay());
+ }
+
+ /**
+ * Return the time delay that should be used when scheduling the
+ * update job. Subclasses may override.
+ *
+ * @return a time delay in milliseconds before the job should run
+ * @since 3.6
+ */
+ protected long getUpdateJobDelay() {
+ return 200;
+ }
+
+ /**
+ * Creates and returns a job used to update the launch configuration dialog
+ * for this tab. Subclasses may override.
+ *
+ * @return job to update the launch dialog for this tab
+ * @since 3.6
+ */
+ protected Job createUpdateJob() {
+ return new WorkbenchJob(getControl().getDisplay(), "Update LCD") { //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!getControl().isDisposed()) {
+ refreshStatus();
+ }
+ return Status.OK_STATUS;
+ }
+ public boolean shouldRun() {
+ return !getControl().isDisposed();
+ }
+ };
+ }
+
+ /**
* Update apply & revert buttons, as well as buttons and message on the
* launch config dialog.
*/
@@ -1255,7 +1322,7 @@ public class LaunchConfigurationTabGroupViewer {
*/
protected void handleNameModified() {
getWorkingCopy().rename(fNameWidget.getText().trim());
- refreshStatus();
+ scheduleUpdateJob();
}
/**

Back to the top