Replace Equality Check with isEmpty in Platform UI ui.workbench internal

The time complexity of any isEmpty() method implementation should be
O(1) whereas some implementations of size() can be O(n). Thus, using
this rule provides performance benefits.

The cleanup in this bundle was split into two commits.
jSparrow Cleanup

Change-Id: Idf049f636786d2ff82c6c3b6f4430b52dc9bc11c
Signed-off-by: Ardit Ymeri <ardit.ymeri@splendit.at>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
index 1f8a5cf..b94b88f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
@@ -677,7 +677,7 @@
 	private TextMatcher matcher;
 
 	public void setPattern(String searchPattern) {
-		if (searchPattern == null || searchPattern.length() == 0) {
+		if (searchPattern == null || searchPattern.isEmpty()) {
 			this.matcher = null;
 		} else {
 			String pattern = "*" + searchPattern + "*"; //$NON-NLS-1$//$NON-NLS-2$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
index f6126c8..f03e778 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
@@ -93,7 +93,7 @@
 		try {
 			clipboard = new Clipboard(text.getShell().getDisplay());
 			String contents = text.getSelectionText();
-			if (contents.length() == 0)
+			if (contents.isEmpty())
 				contents = text.getText();
 			clipboard.setContents(new Object[] { contents }, new Transfer[] { TextTransfer.getInstance() });
 		} finally {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
index 1b77b4b..5b741fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
@@ -95,7 +95,7 @@
 	}
 
 	private void doSearch(String phrase, boolean updateList) {
-		if (phrase.length() == 0) {
+		if (phrase.isEmpty()) {
 			window.getWorkbench().getHelpSystem().displaySearch();
 			return;
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
index 74fadb4..1a68402 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
@@ -261,7 +261,7 @@
 			ActivityDefinition activityDefinition = iterator.next();
 			String name = activityDefinition.getName();
 
-			if (name == null || name.length() == 0) {
+			if (name == null || name.isEmpty()) {
 				iterator.remove();
 			}
 		}
@@ -275,7 +275,7 @@
 			CategoryDefinition categoryDefinition = iterator.next();
 			String name = categoryDefinition.getName();
 
-			if (name == null || name.length() == 0) {
+			if (name == null || name.isEmpty()) {
 				iterator.remove();
 			}
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
index c5e7f40..688a004 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
@@ -158,9 +158,9 @@
 
 			// Read out the category id.
 			String categoryId = configurationElement.getAttribute(ATT_CATEGORY_ID);
-			if ((categoryId == null) || (categoryId.length() == 0)) {
+			if ((categoryId == null) || (categoryId.isEmpty())) {
 				categoryId = configurationElement.getAttribute(ATT_CATEGORY);
-				if ((categoryId != null) && (categoryId.length() == 0)) {
+				if ((categoryId != null) && (categoryId.isEmpty())) {
 					categoryId = null;
 				}
 			}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
index 80498d7..fcf7920 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
@@ -81,13 +81,13 @@
 
 			// Read out the parent id.
 			String parentId = configurationElement.getAttribute(ATT_PARENT_ID);
-			if ((parentId == null) || (parentId.length() == 0)) {
+			if ((parentId == null) || (parentId.isEmpty())) {
 				parentId = configurationElement.getAttribute(ATT_PARENT);
-				if ((parentId == null) || (parentId.length() == 0)) {
+				if ((parentId == null) || (parentId.isEmpty())) {
 					parentId = configurationElement.getAttribute(ATT_PARENT_SCOPE);
 				}
 			}
-			if ((parentId != null) && (parentId.length() == 0)) {
+			if ((parentId != null) && (parentId.isEmpty())) {
 				parentId = null;
 			}
 
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
index aae60ee..f38ad2a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
@@ -974,7 +974,7 @@
 		// Force an update if there is a text already
 		boolean force = true;
 		// If not then do not force as the undecorated value is fine
-		if (originalText == null || originalText.length() == 0) {
+		if (originalText == null || originalText.isEmpty()) {
 			force = false;
 		}
 
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
index f684d4b..69f4364 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
@@ -144,7 +144,7 @@
 		// We need kernel api to validate the extension or a filename
 
 		// check for empty name and extension
-		if (filename.length() == 0) {
+		if (filename.isEmpty()) {
 			setErrorMessage(null);
 			return false;
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
index ec7dea6..f8c95b4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
@@ -440,7 +440,7 @@
 		setButton.addSelectionListener(widgetSelectedAdapter(e -> {
 			try {
 				String text = charsetField.getText().trim();
-				if (text.length() == 0) {
+				if (text.isEmpty()) {
 					text = null;
 				}
 				getSelectedContentType().setDefaultCharset(text);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
index d2052f6..fbdd51e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
@@ -211,7 +211,7 @@
 			return;
 		}
 		String text = definition.getDescription();
-		if (text == null || text.length() == 0) {
+		if (text == null || text.isEmpty()) {
 			descriptionText.setText(WorkbenchMessages.PreferencePage_noDescription);
 		} else {
 			descriptionText.setText(text);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
index 5f0eb2b..0d5e8b7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
@@ -114,7 +114,7 @@
 		}
 
 		// Find the index at which to insert the new entry.
-		String newFilename = (newName + (newExtension == null || newExtension.length() == 0 ? "" : "." + newExtension)) //$NON-NLS-1$ //$NON-NLS-2$
+		String newFilename = (newName + (newExtension == null || newExtension.isEmpty() ? "" : "." + newExtension)) //$NON-NLS-1$ //$NON-NLS-2$
 				.toUpperCase();
 		IFileEditorMapping resourceType;
 		TableItem[] items = resourceTypeTable.getItems();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
index 70c31f2..8963c2b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
@@ -147,7 +147,7 @@
 		// We need kernel api to validate the extension or a filename
 
 		// check for empty name and extension
-		if (filename.length() == 0) {
+		if (filename.isEmpty()) {
 			setErrorMessage(null);
 			return false;
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
index c3f53d2..0ed7043 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
@@ -299,7 +299,7 @@
 				Object o = selection.getFirstElement();
 				if (o instanceof IPerspectiveDescriptor) {
 					String description = ((IPerspectiveDescriptor) o).getDescription();
-					if (description.length() == 0) {
+					if (description.isEmpty()) {
 						description = WorkbenchMessages.SelectPerspective_noDesc;
 					}
 					popUp(description);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
index f8ef8cf..9837c0d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
@@ -421,7 +421,7 @@
 				if (o instanceof MPartDescriptor) {
 					String description = ((MPartDescriptor) o).getTooltip();
 					description = LocalizationHelper.getLocalized(description, (MPartDescriptor) o, context);
-					if (description != null && description.length() == 0)
+					if (description != null && description.isEmpty())
 						description = WorkbenchMessages.ShowView_noDesc;
 					popUp(description);
 				}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index bd5e01d..38359a8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -585,7 +585,7 @@
 		IConfigurationElement[] elements = extPoint.getConfigurationElements();
 		for (IConfigurationElement configElement : elements) {
 			String commandId = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND_ID);
-			if (commandId == null || commandId.length() == 0) {
+			if (commandId == null || commandId.isEmpty()) {
 				continue;
 			}
 			String defaultHandler = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
@@ -650,7 +650,7 @@
 		IConfigurationElement[] elements = extPoint.getConfigurationElements();
 		for (IConfigurationElement configElement : elements) {
 			String id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
-			if (id == null || id.length() == 0) {
+			if (id == null || id.isEmpty()) {
 				continue;
 			}
 			String defaultHandler = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULT_HANDLER);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
index a242756..aadd13f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
@@ -818,7 +818,7 @@
 	 */
 	private static String readNonEmptyAttribute(IConfigurationElement configurationElement, String attribute) {
 		String attributeValue = configurationElement.getAttribute(attribute);
-		if ((attributeValue != null) && (attributeValue.length() == 0)) {
+		if ((attributeValue != null) && (attributeValue.isEmpty())) {
 			attributeValue = null;
 		}
 		return attributeValue;
@@ -828,13 +828,13 @@
 		String contextId = configurationElement.getAttribute(ATT_CONTEXT_ID);
 		if (LEGACY_DEFAULT_SCOPE.equals(contextId)) {
 			contextId = null;
-		} else if ((contextId == null) || (contextId.length() == 0)) {
+		} else if ((contextId == null) || (contextId.isEmpty())) {
 			contextId = configurationElement.getAttribute(ATT_SCOPE);
 			if (LEGACY_DEFAULT_SCOPE.equals(contextId)) {
 				contextId = null;
 			}
 		}
-		if ((contextId == null) || (contextId.length() == 0)) {
+		if ((contextId == null) || (contextId.isEmpty())) {
 			contextId = IContextIds.CONTEXT_ID_WINDOW;
 		}
 		return contextId;
@@ -844,11 +844,11 @@
 			String commandId) {
 
 		String schemeId = configurationElement.getAttribute(ATT_SCHEME_ID);
-		if ((schemeId == null) || (schemeId.length() == 0)) {
+		if ((schemeId == null) || (schemeId.isEmpty())) {
 			schemeId = configurationElement.getAttribute(ATT_KEY_CONFIGURATION_ID);
-			if ((schemeId == null) || (schemeId.length() == 0)) {
+			if ((schemeId == null) || (schemeId.isEmpty())) {
 				schemeId = configurationElement.getAttribute(ATT_CONFIGURATION);
-				if ((schemeId == null) || (schemeId.length() == 0)) {
+				if ((schemeId == null) || (schemeId.isEmpty())) {
 					// The scheme id should never be null. This is invalid.
 					addWarning(warningsToLog, "Key bindings need a scheme", //$NON-NLS-1$
 							configurationElement, commandId);
@@ -860,17 +860,17 @@
 
 	private static String readCommandId(final IConfigurationElement configurationElement) {
 		String commandId = configurationElement.getAttribute(ATT_COMMAND_ID);
-		if ((commandId == null) || (commandId.length() == 0)) {
+		if ((commandId == null) || (commandId.isEmpty())) {
 			commandId = configurationElement.getAttribute(ATT_COMMAND);
 		}
-		if ((commandId != null) && (commandId.length() == 0)) {
+		if ((commandId != null) && (commandId.isEmpty())) {
 			commandId = null;
 		}
 		return commandId;
 	}
 
 	private static boolean isEmpty(String string) {
-		return string == null || string.length() == 0;
+		return string == null || string.isEmpty();
 	}
 
 	/**
@@ -913,9 +913,9 @@
 			final String description = readOptional(configurationElement, ATT_DESCRIPTION);
 
 			String parentId = configurationElement.getAttribute(ATT_PARENT_ID);
-			if ((parentId != null) && (parentId.length() == 0)) {
+			if ((parentId != null) && (parentId.isEmpty())) {
 				parentId = configurationElement.getAttribute(ATT_PARENT);
-				if ((parentId != null) && (parentId.length() == 0)) {
+				if ((parentId != null) && (parentId.isEmpty())) {
 					parentId = null;
 				}
 			}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
index 76dfa6f..c6d761d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
@@ -2189,7 +2189,7 @@
 			}
 
 			// Ignore items with a meaningless command name.
-			if ((commandName == null) || (commandName.length() == 0)) {
+			if ((commandName == null) || (commandName.isEmpty())) {
 				continue;
 			}
 
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
index 2f26e66..3f4b5ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
@@ -121,7 +121,7 @@
 				return;
 			}
 		}
-		if (location.getPath() == null || location.getPath().length() == 0) {
+		if (location.getPath() == null || location.getPath().isEmpty()) {
 			WorkbenchPlugin.log("MenuAdditionCacheEntry.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
 			return;
 		}
@@ -131,7 +131,7 @@
 			} else {
 				String query = location.getQuery();
 				hasAdditions = AFTER_ADDITIONS.equals(query);
-				if (query == null || query.length() == 0) {
+				if (query == null || query.isEmpty()) {
 					query = AFTER_ADDITIONS;
 				}
 				processToolbarChildren(toolBarContributions, configElement, location.getPath(), query, hasAdditions);
@@ -151,7 +151,7 @@
 			menuContribution.setParentId(location.getPath());
 			hasAdditions = AFTER_ADDITIONS.equals(query);
 		}
-		if (query == null || query.length() == 0) {
+		if (query == null || query.isEmpty()) {
 			query = AFTER_ADDITIONS;
 		}
 		menuContribution.setPositionInParent(query);
@@ -339,7 +339,7 @@
 	}
 
 	private boolean isUndefined(String query) {
-		if (query == null || query.length() == 0) {
+		if (query == null || query.isEmpty()) {
 			return true;
 		}
 
@@ -357,7 +357,7 @@
 			contribution.setPositionInParent(query);
 		} else {
 			contribution.setParentId(location.getPath());
-			if (query == null || query.length() == 0) {
+			if (query == null || query.isEmpty()) {
 				query = AFTER_ADDITIONS;
 			}
 			contribution.setPositionInParent(query);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
index 18f7759..1a2b978 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
@@ -53,7 +53,7 @@
 
 	public void mergeIntoModel(ArrayList<MMenuContribution> menuContributions,
 			ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) {
-		if (location.getPath() == null || location.getPath().length() == 0) {
+		if (location.getPath() == null || location.getPath().isEmpty()) {
 			WorkbenchPlugin.log("MenuFactoryGenerator.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
 			return;
 		}
@@ -63,7 +63,7 @@
 				// configElement);
 			} else {
 				String query = location.getQuery();
-				if (query == null || query.length() == 0) {
+				if (query == null || query.isEmpty()) {
 					query = "after=additions"; //$NON-NLS-1$
 				}
 				processToolbarChildren(toolBarContributions, configElement, location.getPath(), query);
@@ -82,7 +82,7 @@
 			menuContribution.setParentId(location.getPath());
 		}
 		String query = location.getQuery();
-		if (query == null || query.length() == 0) {
+		if (query == null || query.isEmpty()) {
 			query = "after=additions"; //$NON-NLS-1$
 		}
 		menuContribution.setPositionInParent(query);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
index ee50cd8..9b5dd46 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
@@ -237,10 +237,10 @@
 		// For sub-menu management -all- items must be id'd so enforce this
 		// here (we could optimize by checking the 'name' of the config
 		// element == "menu"
-		if (id == null || id.length() == 0) {
+		if (id == null || id.isEmpty()) {
 			id = getCommandId(element);
 		}
-		if (id == null || id.length() == 0) {
+		if (id == null || id.isEmpty()) {
 			id = getConfigurationHandleId(element);
 		}
 		return id;
@@ -319,7 +319,7 @@
 
 	public static ItemType getStyle(IConfigurationElement element) {
 		String style = element.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
-		if (style == null || style.length() == 0) {
+		if (style == null || style.isEmpty()) {
 			return ItemType.PUSH;
 		}
 		if (IWorkbenchRegistryConstants.STYLE_TOGGLE.equals(style)) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
index 0a106d7..0721f7e 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
@@ -117,7 +117,7 @@
 	@Override
 	public void addContributionFactory(final AbstractContributionFactory factory) {
 		MenuLocationURI location = new MenuLocationURI(factory.getLocation());
-		if (location.getPath() == null || location.getPath().length() == 0) {
+		if (location.getPath() == null || location.getPath().isEmpty()) {
 			WorkbenchPlugin.log("WorkbenchMenuService.addContributionFactory: Invalid menu URI: " + location); //$NON-NLS-1$
 			return;
 		}
@@ -128,7 +128,7 @@
 				// configElement);
 			} else {
 				String query = location.getQuery();
-				if (query == null || query.length() == 0) {
+				if (query == null || query.isEmpty()) {
 					query = "after=additions"; //$NON-NLS-1$
 				}
 				processToolbarChildren(factory, location, location.getPath(), query);
@@ -146,7 +146,7 @@
 			menuContribution.setParentId(location.getPath());
 		}
 		String query = location.getQuery();
-		if (query == null || query.length() == 0) {
+		if (query == null || query.isEmpty()) {
 			query = "after=additions"; //$NON-NLS-1$
 		}
 		menuContribution.setPositionInParent(query);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
index b3be088..7ca56aa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
@@ -125,7 +125,7 @@
 	public static IStatus newStatus(int severity, String message, Throwable exception) {
 
 		String statusMessage = message;
-		if (message == null || message.trim().length() == 0) {
+		if (message == null || message.trim().isEmpty()) {
 			if (exception.getMessage() == null) {
 				statusMessage = exception.toString();
 			} else {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
index 05e341e..e03c6ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
@@ -423,7 +423,7 @@
 	@Override
 	public boolean nodeExists(String pathName) throws BackingStoreException {
 		// short circuit for this node
-		if (pathName.length() == 0) {
+		if (pathName.isEmpty()) {
 			return removed ? false : getOriginal().nodeExists(pathName);
 		}
 		return getOriginal().nodeExists(pathName);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
index e709606..96ade08 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
@@ -72,7 +72,7 @@
 
 		@Override
 		String getDisplayString() {
-			if (blockedTaskName == null || blockedTaskName.length() == 0) {
+			if (blockedTaskName == null || blockedTaskName.isEmpty()) {
 				return ProgressMessages.BlockedJobsDialog_UserInterfaceTreeElement;
 			}
 			return blockedTaskName;
@@ -134,7 +134,7 @@
 		}
 		singleton = new BlockedJobsDialog(parentShell, blockedMonitor, reason);
 
-		if (taskName == null || taskName.length() == 0) {
+		if (taskName == null || taskName.isEmpty()) {
 			singleton.setBlockedTaskName(ProgressMessages.BlockedJobsDialog_UserInterfaceTreeElement);
 		} else {
 			singleton.setBlockedTaskName(taskName);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
index 1828d5f..a889546 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
@@ -224,7 +224,7 @@
 					if (action != null && action.isEnabled()) {
 						// green arrow with exclamation mark
 						String tt = action.getToolTipText();
-						if (tt == null || tt.trim().length() == 0) {
+						if (tt == null || tt.trim().isEmpty()) {
 							tt = NLS.bind(ProgressMessages.ProgressAnimationItem_ok, job.getName());
 						}
 						initButton(okImage, tt);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
index 45356d8..3906676 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
@@ -512,7 +512,7 @@
 				}
 
 				if (subTaskString != null) {
-					if (taskString == null || taskString.length() == 0) {
+					if (taskString == null || taskString.isEmpty()) {
 						taskString = subTaskString;
 					} else {
 						taskString = NLS.bind(ProgressMessages.JobInfo_DoneNoProgressMessage, taskString,
@@ -526,7 +526,7 @@
 				Job job = jobInfo.getJob();
 				IStatus result = job.getResult();
 
-				if (result == null || result.getMessage().length() == 0 && !info.isJobInfo()) {
+				if (result == null || result.getMessage().isEmpty() && !info.isJobInfo()) {
 					setLinkText(job, getJobNameAndStatus(jobInfo), i);
 				} else {
 					setLinkText(job, result.getMessage(), i);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
index 29b64a0..77eba2f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
@@ -588,7 +588,7 @@
 	 * @param defaultEditors the default editors to set
 	 */
 	private void setProductDefaults(String defaultEditors) {
-		if (defaultEditors == null || defaultEditors.length() == 0) {
+		if (defaultEditors == null || defaultEditors.isEmpty()) {
 			return;
 		}
 
@@ -637,7 +637,7 @@
 		try {
 			// Get the editors defined in the preferences store
 			String xmlString = store.getString(IPreferenceConstants.EDITORS);
-			if (xmlString == null || xmlString.length() == 0) {
+			if (xmlString == null || xmlString.isEmpty()) {
 				stream = new FileInputStream(
 						workbenchStatePath.append(IWorkbenchConstants.EDITOR_FILE_NAME).toOSString());
 				reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
@@ -846,7 +846,7 @@
 		try {
 			// Get the resource types
 			String xmlString = store.getString(IPreferenceConstants.RESOURCES);
-			if (xmlString == null || xmlString.length() == 0) {
+			if (xmlString == null || xmlString.isEmpty()) {
 				stream = new FileInputStream(
 						workbenchStatePath.append(IWorkbenchConstants.RESOURCE_TYPE_FILE_NAME).toOSString());
 				reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
@@ -906,7 +906,7 @@
 	 */
 	private String mappingKeyFor(FileEditorMapping mapping) {
 		return mappingKeyFor(
-				mapping.getName() + (mapping.getExtension().length() == 0 ? "" : "." + mapping.getExtension())); //$NON-NLS-1$ //$NON-NLS-2$
+				mapping.getName() + (mapping.getExtension().isEmpty() ? "" : "." + mapping.getExtension())); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
index 6647f0e..ccd0030 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
@@ -177,7 +177,7 @@
 
 	@Override
 	public String getLabel() {
-		return TextProcessor.process(name + (extension.length() == 0 ? "" : DOT + extension), STAR + DOT); //$NON-NLS-1$
+		return TextProcessor.process(name + (extension.isEmpty() ? "" : DOT + extension), STAR + DOT); //$NON-NLS-1$
 	}
 
 	@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
index a5885fe..f86a5ae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
@@ -212,7 +212,7 @@
 				.getString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
 		// empty string may be returned but we want to return null if nothing
 		// found
-		if (defaultId.length() == 0 || findPerspectiveWithId(defaultId) == null) {
+		if (defaultId.isEmpty() || findPerspectiveWithId(defaultId) == null) {
 			Workbench instance = Workbench.getInstance();
 			return instance == null ? null : instance.getDefaultPerspectiveId();
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
index b234751..ec6f2d2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
@@ -172,7 +172,7 @@
 	 */
 	protected static final String readOptional(final IMemento memento, final String attribute) {
 		String value = memento.getString(attribute);
-		if ((value != null) && (value.length() == 0)) {
+		if ((value != null) && (value.isEmpty())) {
 			value = null;
 		}
 
@@ -237,7 +237,7 @@
 		for (final IMemento parameterMemento : parameterMementos) {
 			// Read out the id.
 			final String id = parameterMemento.getString(ATT_ID);
-			if ((id == null) || (id.length() == 0)) {
+			if ((id == null) || (id.isEmpty())) {
 				// The name should never be null. This is invalid.
 				addWarning(warningsToLog, "Parameters need a name"); //$NON-NLS-1$
 				continue;
@@ -267,7 +267,7 @@
 
 			// Read out the value.
 			final String value = parameterMemento.getString(ATT_VALUE);
-			if ((value == null) || (value.length() == 0)) {
+			if ((value == null) || (value.isEmpty())) {
 				// The name should never be null. This is invalid.
 				addWarning(warningsToLog, "Parameters need a value", id); //$NON-NLS-1$
 				continue;
@@ -316,7 +316,7 @@
 	protected static final String readRequired(final IMemento memento, final String attribute,
 			final List<IStatus> warningsToLog, final String message, final String id) {
 		final String value = memento.getString(attribute);
-		if ((value == null) || (value.length() == 0)) {
+		if ((value == null) || (value.isEmpty())) {
 			addWarning(warningsToLog, message, id);
 			return null;
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
index 0c1403b..5caf8e5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
@@ -271,7 +271,7 @@
 	protected static final String readOptional(final IConfigurationElement configurationElement,
 			final String attribute) {
 		String value = configurationElement.getAttribute(attribute);
-		if ((value != null) && (value.length() == 0)) {
+		if ((value != null) && (value.isEmpty())) {
 			value = null;
 		}
 
@@ -341,7 +341,7 @@
 		for (final IConfigurationElement parameterElement : parameterElements) {
 			// Read out the id.
 			final String id = parameterElement.getAttribute(ATT_ID);
-			if ((id == null) || (id.length() == 0)) {
+			if ((id == null) || (id.isEmpty())) {
 				// The name should never be null. This is invalid.
 				addWarning(warningsToLog, "Parameters need a name", //$NON-NLS-1$
 						configurationElement);
@@ -373,7 +373,7 @@
 
 			// Read out the value.
 			final String value = parameterElement.getAttribute(ATT_VALUE);
-			if ((value == null) || (value.length() == 0)) {
+			if ((value == null) || (value.isEmpty())) {
 				// The name should never be null. This is invalid.
 				addWarning(warningsToLog, "Parameters need a value", //$NON-NLS-1$
 						configurationElement, id);
@@ -428,7 +428,7 @@
 	protected static final String readRequired(final IConfigurationElement configurationElement, final String attribute,
 			final List<IStatus> warningsToLog, final String message, final String id) {
 		final String value = configurationElement.getAttribute(attribute);
-		if ((value == null) || (value.length() == 0)) {
+		if ((value == null) || (value.isEmpty())) {
 			addWarning(warningsToLog, message, configurationElement, id);
 			return null;
 		}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
index e6c87a7..5199eeb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
@@ -193,11 +193,11 @@
 	private void processVariables(IConfigurationElement[] children) {
 		for (IConfigurationElement configElement : children) {
 			String name = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
-			if (name == null || name.length() == 0) {
+			if (name == null || name.isEmpty()) {
 				continue;
 			}
 			String level = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_PRIORITY_LEVEL);
-			if (level == null || level.length() == 0) {
+			if (level == null || level.isEmpty()) {
 				level = WORKBENCH_LEVEL;
 			} else {
 				boolean found = false;