Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2009-04-01 00:56:21 +0000
committerMichael Rennie2009-04-01 00:56:21 +0000
commit092de63c409ccb28c55b51bc326052ab13f4ecce (patch)
treef928df37bdade274ff8bb4357d795b2dc280b0f8
parentefbf76de3c499822d6bb6ea2a689fedcfd5b129c (diff)
downloadeclipse.platform.debug-092de63c409ccb28c55b51bc326052ab13f4ecce.tar.gz
eclipse.platform.debug-092de63c409ccb28c55b51bc326052ab13f4ecce.tar.xz
eclipse.platform.debug-092de63c409ccb28c55b51bc326052ab13f4ecce.zip
Bug 267957 [launching] Prompted about text search when close is pressed
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties15
3 files changed, 52 insertions, 50 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
index f2fd65b89..9d4abfa22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
@@ -14,6 +14,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.ILaunchGroup;
@@ -45,7 +46,6 @@ public final class LaunchConfigurationFilteredTree extends FilteredTree {
private ViewerFilter[] fFilters = null;
private int fTreeStyle = -1;
private PatternFilter fPatternFilter = null;
- boolean filtertextchanging = false;
/**
* Constructor
@@ -123,36 +123,46 @@ public final class LaunchConfigurationFilteredTree extends FilteredTree {
* @see org.eclipse.ui.dialogs.FilteredTree#textChanged()
*/
protected void textChanged() {
- if(!filtertextchanging) {
- filtertextchanging = true;
- LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
- if(dialog != null) {
- LaunchConfigurationTabGroupViewer viewer = dialog.getTabViewer();
- if(viewer != null && viewer.isDirty()) {
- if(viewer.canSave()) {
- if(MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_discard_changes, LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_search_with_changes)) {
- viewer.handleApplyPressed();
- super.textChanged();
- }
- else {
- setFilterText(LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_type_filter_text);
- }
- }
- else {
- if(MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_discard_changes, LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_search_with_errors)) {
- viewer.handleRevertPressed();
- super.textChanged();
- }
- else {
- setFilterText(LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_type_filter_text);
- }
- }
+ LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
+ if(dialog == null) {
+ return;
+ }
+ LaunchConfigurationTabGroupViewer viewer = dialog.getTabViewer();
+ if(viewer == null) {
+ return;
+ }
+ if(viewer.isDirty()) {
+ String text = getFilterString();
+ if(text.equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
+ //we have removed the last char of select-all delete key, reset like the filter control does
+ getPatternFilter().setPattern(null);
+ getViewer().refresh();
+ return;
+ }
+ else if(text.equals(getInitialText())) {
+ //ignore, this is the default text set from losing focus
+ return;
+ }
+ String message = LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_search_with_errors;
+ boolean cansave = viewer.canSave();
+ if(cansave) {
+ message = LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_search_with_changes;
+ }
+ if(MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.LaunchConfigurationFilteredTree_discard_changes, message)) {
+ if(cansave) {
+ viewer.handleApplyPressed();
}
else {
- super.textChanged();
+ viewer.handleRevertPressed();
}
+ super.textChanged();
}
- filtertextchanging = false;
+ else {
+ clearText();
+ }
+ }
+ else {
+ super.textChanged();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
index e734046a1..aa2c4e65d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -51,18 +51,11 @@ public class LaunchConfigurationsMessages extends NLS {
public static String LaunchConfigurationDialog__Apply_17;
public static String LaunchConfigurationDialog__Name__16;
public static String LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20;
-
public static String LaunchConfigurationEditDialog_0;
-
public static String LaunchConfigurationEditDialog_1;
-
public static String LaunchConfigurationFilteredTree_discard_changes;
-
public static String LaunchConfigurationFilteredTree_search_with_changes;
-
public static String LaunchConfigurationFilteredTree_search_with_errors;
-
- public static String LaunchConfigurationFilteredTree_type_filter_text;
public static String LaunchConfigurationTabGroupViewer_0;
public static String LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8;
public static String LaunchConfigurationDialog_Discard_changes__38;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
index bed00409f..a3ec034a9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
@@ -1,11 +1,11 @@
###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
+# Copyright (c) 2000, 2009 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
@@ -84,7 +84,6 @@ LaunchConfigurationDialog_Save_changes__31=Save changes?
LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes. Do you wish to save them?
LaunchConfigurationDialog_The_configuration___35=The configuration "{0}" has unsaved changes that CANNOT be saved because of the following error:\n\n
LaunchConfigurationFilteredTree_discard_changes=Discard Changes?
-LaunchConfigurationFilteredTree_type_filter_text=type filter text
LaunchConfigurationDialog_unspecified_28=unspecified
LaunchConfigurationDialog_Yes_32=Yes
LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configurations__1=Do you wish to delete the selected launch configurations?

Back to the top