diff options
author | Chris Goldthorpe | 2011-01-21 23:11:09 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2011-01-21 23:11:09 +0000 |
commit | 9770411bd45afca7da34ad8e5bdffd5e84afce2c (patch) | |
tree | f7fbfa74bff24d325408c4ce02d99005863f2a2d /org.eclipse.help.ui/src | |
parent | 24e8a48d36b3b7419ad20b4d9fe430490516e254 (diff) | |
download | eclipse.platform.ua-9770411bd45afca7da34ad8e5bdffd5e84afce2c.tar.gz eclipse.platform.ua-9770411bd45afca7da34ad8e5bdffd5e84afce2c.tar.xz eclipse.platform.ua-9770411bd45afca7da34ad8e5bdffd5e84afce2c.zip |
Diffstat (limited to 'org.eclipse.help.ui/src')
3 files changed, 21 insertions, 8 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java index 22a6a7d2e..96ec41590 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java @@ -92,6 +92,7 @@ public final class Messages extends NLS { public static String NewDialog_wtitle; public static String RenameDialog_label; public static String RenameDialog_validationError; + public static String RenameDialog_emptyName; public static String EngineResultSection_progress2; public static String EngineResultSection_canceling; public static String EngineResultSection_progressError; diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties index b42e3e58a..aad239529 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties @@ -110,6 +110,7 @@ RenameDialog_wtitle = Rename Scope Set NewDialog_wtitle = New Scope Set RenameDialog_label = Scope Set &Name: RenameDialog_validationError = Name has already been used. +RenameDialog_emptyName = Name may not be empty. EngineResultSection_progress2=Search in progress... EngineResultSection_canceling=Canceling... diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java index 3dbdaf5e8..bd9851e56 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -116,24 +116,35 @@ public class RenameDialog extends SelectionStatusDialog { if((isCaseSensitive && text.equals(oldNames.get(i))) || (!isCaseSensitive && text.equalsIgnoreCase(oldNames.get(i).toString()))){ if (setStatus) { - status = new Status( - IStatus.ERROR, - HelpUIPlugin.PLUGIN_ID, - IStatus.ERROR, - Messages.RenameDialog_validationError, - null); - updateStatus(status); + setErrorStatus(Messages.RenameDialog_validationError); } okButton.setEnabled(false); return; } } + if (text.length() == 0 ) { + if (setStatus) { + setErrorStatus(Messages.RenameDialog_emptyName); + } + okButton.setEnabled(false); + return; + } okButton.setEnabled(true); if (setStatus) { setOkStatus(); } } + private void setErrorStatus(String errorMessage) { + status = new Status( + IStatus.ERROR, + HelpUIPlugin.PLUGIN_ID, + IStatus.ERROR, + errorMessage, + null); + updateStatus(status); + } + private void setOkStatus() { status = new Status( IStatus.OK, |