diff options
author | Lars Vogel | 2019-06-14 09:20:16 +0000 |
---|---|---|
committer | Lars Vogel | 2019-06-14 09:28:57 +0000 |
commit | e88d686c1fc682507b0246d04249afa81bdb6146 (patch) | |
tree | e277717f5e273ac4d8175534cdf68c80527bba73 /org.eclipse.ui.editors | |
parent | 45c0a30d7027df909b78fa167cf3da83488581d9 (diff) | |
download | eclipse.platform.text-e88d686c1fc682507b0246d04249afa81bdb6146.tar.gz eclipse.platform.text-e88d686c1fc682507b0246d04249afa81bdb6146.tar.xz eclipse.platform.text-e88d686c1fc682507b0246d04249afa81bdb6146.zip |
Use isEmpty() instead of length() to check if collection is emptyI20190615-1800I20190614-1800
Change-Id: I0106dd0c2ddfa318375877d4562068d82aa9ac5f
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.ui.editors')
16 files changed, 62 insertions, 62 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java index 79ff070644f..01eb46f7207 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/EncodingActionGroup.java @@ -268,7 +268,7 @@ public class EncodingActionGroup extends ActionGroup { IInputValidator inputValidator = new IInputValidator() { @Override public String isValid(String newText) { - return (newText == null || newText.length() == 0) ? " " : null; //$NON-NLS-1$ + return (newText == null || newText.isEmpty()) ? " " : null; //$NON-NLS-1$ } }; @@ -354,7 +354,7 @@ public class EncodingActionGroup extends ActionGroup { public void fillActionBars(IActionBars actionBars) { IMenuManager menuManager= actionBars.getMenuManager(); IMenuManager editMenu= menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); - if (editMenu != null && fRetargetActions.size() > 0) { + if (editMenu != null && !fRetargetActions.isEmpty()) { MenuManager subMenu= new MenuManager(TextEditorMessages.Editor_ConvertEncoding_submenu_label); subMenu.addMenuListener(new IMenuListener() { @Override diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java index ca60027da1a..3c752f03644 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextSourceViewerConfiguration.java @@ -322,7 +322,7 @@ public class TextSourceViewerConfiguration extends SourceViewerConfiguration { if (modifiers == null) return -1; - if (modifiers.length() == 0) + if (modifiers.isEmpty()) return SWT.NONE; int stateMask= 0; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java index 5b81e1d3147..b5b6e80061b 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/templates/ContributionTemplateStore.java @@ -242,7 +242,7 @@ public class ContributionTemplateStore extends TemplateStore { } private static boolean isValidTemplateId(String id) { - return id != null && id.trim().length() != 0; // TODO test validity? + return id != null && !id.trim().isEmpty(); // TODO test validity? } @Override diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java index e3667a55c19..af158874609 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java @@ -161,7 +161,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -258,7 +258,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -286,7 +286,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -570,7 +570,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork page.setErrorMessage(null); break; default: - if (message.length() == 0) { + if (message.isEmpty()) { message= null; } page.setMessage(null); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java index 770021d8ab5..020c7e4982d 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java @@ -590,7 +590,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl if (modifiers == null) return -1; - if (modifiers.length() == 0) + if (modifiers.isEmpty()) return SWT.NONE; int stateMask= 0; @@ -663,7 +663,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl if (modifierString == null) modifierString= ""; //$NON-NLS-1$ String newModifierString= Action.findModifierString(modifier); - if (modifierString.length() == 0) + if (modifierString.isEmpty()) return newModifierString; return NLSUtility.format(TextEditorMessages.HyperlinkKeyModifier_concatModifierStrings, new String[] {modifierString, newModifierString}); } @@ -689,7 +689,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl fPreferencePage.setErrorMessage(null); break; default: - if (message.length() == 0) { + if (message.isEmpty()) { message= null; } fPreferencePage.setMessage(null); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java index dc429846b1d..cc409450fbb 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java @@ -549,7 +549,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList } //Update the list with the selections if there are any - if (checkedListItems.size() > 0) + if (!checkedListItems.isEmpty()) checkedStateStore.put(currentTreeSelection, checkedListItems); if (updatingFromSelection) grayUpdateHierarchy(currentTreeSelection); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusUtil.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusUtil.java index c9cd6b850f7..7fc514f771c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusUtil.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/StatusUtil.java @@ -84,7 +84,7 @@ public class StatusUtil { page.setErrorMessage(null); break; default: - if (message.length() == 0) { + if (message.isEmpty()) { message= null; } page.setMessage(null); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java index 43a5380a7bf..143f7825d58 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java @@ -208,7 +208,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -304,7 +304,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -339,7 +339,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements @Override public IStatus validate(Object value) { StatusInfo status= new StatusInfo(); - if (value instanceof String && ((String)value).length() == 0) { + if (value instanceof String && ((String)value).isEmpty()) { status.setError(TextEditorMessages.TextEditorPreferencePage_emptyInput); return status; } @@ -571,7 +571,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements public void setErrorMessage(String errorMessage) { if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " " : errorMessage); //$NON-NLS-1$ - boolean hasError= errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; + boolean hasError= errorMessage != null && !(StringConverter.removeWhiteSpaces(errorMessage)).isEmpty(); errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); @@ -1396,7 +1396,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements page.setErrorMessage(null); break; default: - if (message.length() == 0) { + if (message.isEmpty()) { message= null; } page.setMessage(null); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationTypeHierarchy.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationTypeHierarchy.java index b45d305610a..88c647be4d1 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationTypeHierarchy.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/AnnotationTypeHierarchy.java @@ -73,7 +73,7 @@ public final class AnnotationTypeHierarchy { } private void append(List<String> list, String string) { - if (string == null || string.trim().length() == 0) + if (string == null || string.trim().isEmpty()) return; if (!list.contains(string)) @@ -94,11 +94,11 @@ public final class AnnotationTypeHierarchy { IConfigurationElement[] elements= extensionPoint.getConfigurationElements(); for (IConfigurationElement element : elements) { String name= element.getAttribute("name"); //$NON-NLS-1$ - if (name == null || name.trim().length() == 0) + if (name == null || name.trim().isEmpty()) continue; String parent= element.getAttribute("super"); //$NON-NLS-1$ - if (parent == null || parent.trim().length() == 0) + if (parent == null || parent.trim().isEmpty()) parent= ""; //$NON-NLS-1$ allTypes.put(name, parent); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java index 96f2f1c404f..25f7c48640c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java @@ -782,7 +782,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants { if (modifiers == null) return -1; - if (modifiers.length() == 0) + if (modifiers.isEmpty()) return SWT.NONE; int stateMask= 0; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java index 4cecc2c9f8c..49612303d76 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java @@ -398,7 +398,7 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl @Override protected void removeAnnotations(List<? extends Annotation> annotations, boolean fireModelChanged, boolean modelInitiated) { - if (annotations != null && annotations.size() > 0) { + if (annotations != null && !annotations.isEmpty()) { List<Annotation> markerAnnotations= new ArrayList<>(); for (Annotation a : annotations) { @@ -409,7 +409,7 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl removeAnnotation(a, false); } - if (markerAnnotations.size() > 0) { + if (!markerAnnotations.isEmpty()) { if (modelInitiated) { // if model initiated also remove it from the marker manager @@ -620,7 +620,7 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl IAnnotationMap annotationMap= getAnnotationMap(); - if (annotationMap.size() == 0 && fDeletedAnnotations.isEmpty()) + if (annotationMap.isEmpty() && fDeletedAnnotations.isEmpty()) return; if (fMarkerUpdaterSpecifications == null) diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java index 988415a4d41..2161baf3f73 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AddMarkerAction.java @@ -182,7 +182,7 @@ public class AddMarkerAction extends TextEditorAction { IInputValidator inputValidator= new IInputValidator() { @Override public String isValid(String newText) { - return (newText == null || newText.trim().length() == 0) ? " " : null; //$NON-NLS-1$ + return (newText == null || newText.trim().isEmpty()) ? " " : null; //$NON-NLS-1$ } }; InputDialog dialog= new InputDialog(getTextEditor().getSite().getShell(), title, message, proposal, inputValidator); @@ -195,7 +195,7 @@ public class AddMarkerAction extends TextEditorAction { return false; label= label.trim(); - if (label.length() == 0) + if (label.isEmpty()) return false; attributes.put("message", label); //$NON-NLS-1$ diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java index 996737dc17f..29f5b8ece70 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AnnotationTypeLookup.java @@ -201,15 +201,15 @@ public final class AnnotationTypeLookup { AnnotationTypeMapping mapping= new AnnotationTypeMapping(); String s= element.getAttribute(typeAttributeName); - if (s == null || s.trim().length() == 0) return null; + if (s == null || s.trim().isEmpty()) return null; mapping.fAnnotationType= s; s= element.getAttribute("markerType"); //$NON-NLS-1$ - if (s == null || s.trim().length() == 0) return null; + if (s == null || s.trim().isEmpty()) return null; mapping.fMarkerType= s; s= element.getAttribute("markerSeverity"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) mapping.fMarkerSeverity= StringConverter.asInt(s, AnnotationTypeMapping.UNDEFINED); return mapping; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java index 1d467fd985a..36515a9e052 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChangeEncodingAction.java @@ -87,7 +87,7 @@ public class ChangeEncodingAction extends TextEditorAction { super(bundle, prefix, editor); String key= "dialog.title"; //$NON-NLS-1$; - if (prefix != null && prefix.length() > 0) + if (prefix != null && !prefix.isEmpty()) key= prefix + key; fDialogTitle= getString(bundle, key, null); @@ -161,7 +161,7 @@ public class ChangeEncodingAction extends TextEditorAction { fEncodingEditor.setPage(page); fEncodingEditor.load(); - if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0) + if (encoding == null || encoding.equals(defaultEncoding) || encoding.isEmpty()) fEncodingEditor.loadDefault(); } diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java index d2c66462ff8..52d70072eb1 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerAnnotationPreferences.java @@ -368,137 +368,137 @@ public class MarkerAnnotationPreferences { ReadOnlyAnnotationPreference info= new ReadOnlyAnnotationPreference(); s= element.getAttribute("annotationType"); //$NON-NLS-1$ - if (s == null || s.trim().length() == 0) return null; + if (s == null || s.trim().isEmpty()) return null; info.setAnnotationType(s); s= element.getAttribute("label"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setPreferenceLabel(s); s= element.getAttribute("markerType"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setMarkerType(s); s= element.getAttribute("markerSeverity"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { i= StringConverter.asInt(s, IMarker.SEVERITY_INFO); info.setSeverity(i); } s= element.getAttribute("textPreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setTextPreferenceKey(s); s= element.getAttribute("textPreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setTextPreferenceValue(b); } s= element.getAttribute("highlightPreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setHighlightPreferenceKey(s); s= element.getAttribute("highlightPreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setHighlightPreferenceValue(b); } s= element.getAttribute("overviewRulerPreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setOverviewRulerPreferenceKey(s); s= element.getAttribute("overviewRulerPreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setOverviewRulerPreferenceValue(b); } s= element.getAttribute("verticalRulerPreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setVerticalRulerPreferenceKey(s); s= element.getAttribute("verticalRulerPreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, true); info.setVerticalRulerPreferenceValue(b); } s= element.getAttribute("colorPreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setColorPreferenceKey(s); s= element.getAttribute("colorPreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { RGB rgb= StringConverter.asRGB(s); info.setColorPreferenceValue(rgb == null ? new RGB(0,0,0) : rgb); } s= element.getAttribute("presentationLayer"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { i= StringConverter.asInt(s, 0); info.setPresentationLayer(i); } s= element.getAttribute("contributesToHeader"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setContributesToHeader(b); } s= element.getAttribute("showInNextPrevDropdownToolbarActionKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setShowInNextPrevDropdownToolbarActionKey(s); s= element.getAttribute("showInNextPrevDropdownToolbarAction"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setShowInNextPrevDropdownToolbarAction(b); } s= element.getAttribute("isGoToNextNavigationTargetKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setIsGoToNextNavigationTargetKey(s); s= element.getAttribute("isGoToNextNavigationTarget"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setIsGoToNextNavigationTarget(b); } s= element.getAttribute("isGoToPreviousNavigationTargetKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setIsGoToPreviousNavigationTargetKey(s); s= element.getAttribute("isGoToPreviousNavigationTarget"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { b= StringConverter.asBoolean(s, false); info.setIsGoToPreviousNavigationTarget(b); } s= element.getAttribute("symbolicIcon"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setSymbolicImageName(s); s= element.getAttribute("icon"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setImageDescriptor(getImageDescriptor(s, element)); s= element.getAttribute("quickFixIcon"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setQuickFixImageDescriptor(getImageDescriptor(s, element)); s= element.getAttribute("annotationImageProvider"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setAnnotationImageProviderData(element, "annotationImageProvider"); //$NON-NLS-1$ s= element.getAttribute("textStylePreferenceKey"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) + if (s != null && !s.trim().isEmpty()) info.setTextStylePreferenceKey(s); s= element.getAttribute("textStylePreferenceValue"); //$NON-NLS-1$ - if (s != null && s.trim().length() > 0) { + if (s != null && !s.trim().isEmpty()) { if (AnnotationPreference.STYLE_BOX.equals(s) || AnnotationPreference.STYLE_DASHED_BOX.equals(s) diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java index 41aaed68b22..cee66714461 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerRulerAction.java @@ -409,7 +409,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate { IInputValidator inputValidator= new IInputValidator() { @Override public String isValid(String newText) { - return (newText == null || newText.trim().length() == 0) ? " " : null; //$NON-NLS-1$ + return (newText == null || newText.trim().isEmpty()) ? " " : null; //$NON-NLS-1$ } }; AddBookmarkDialog dialog= new AddBookmarkDialog(fTextEditor.getSite().getShell(), title, message, proposal, inputValidator, addButtonText); @@ -422,7 +422,7 @@ public class MarkerRulerAction extends ResourceAction implements IUpdate { return false; label= label.trim(); - if (label.length() == 0) + if (label.isEmpty()) return false; MarkerUtilities.setMessage(attributes, label); |