Bug 511712 - Run cleanup action on eclipse.platform.ui/bundles to use
enhanced for loop - Part7
Change-Id: I85f39b2bea00ffdea0c47134f3509060eb5d5144
Signed-off-by: David Weiser <david.weiser@vogella.com>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
index f70c4f2..03cae8a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
@@ -93,10 +93,9 @@
*/
public void dispose() {
synchronized (fListeners) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- fListeners.remove(listeners[i]);
- postListeners.remove(listeners[i]);
+ for (Object listener : fListeners.getListeners()) {
+ fListeners.remove(listener);
+ postListeners.remove(listener);
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
index abebe68..f7ad163 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
@@ -147,8 +147,8 @@
"Working set elements array must not be null"); //$NON-NLS-1$
elements = new ArrayList(newElements.length);
- for (int i = 0; i < newElements.length; i++) {
- elements.add(newElements[i]);
+ for (IAdaptable newElement : newElements) {
+ elements.add(newElement);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
index 41f6423..ce8b524 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
@@ -145,8 +145,8 @@
return registry.getNewPageWorkingSetDescriptors();
}
List<WorkingSetDescriptor> result = new ArrayList<>(supportedWorkingSetIds.length);
- for (int i = 0; i < supportedWorkingSetIds.length; i++) {
- WorkingSetDescriptor desc = registry.getWorkingSetDescriptor(supportedWorkingSetIds[i]);
+ for (String supportedWorkingSetId : supportedWorkingSetIds) {
+ WorkingSetDescriptor desc = registry.getWorkingSetDescriptor(supportedWorkingSetId);
if (desc != null && desc.isEditable()) {
result.add(desc);
}
@@ -366,13 +366,13 @@
final PropertyChangeEvent event = new PropertyChangeEvent(this,
changeId, oldValue, newValue);
Runnable notifier = () -> {
- for (int i = 0; i < listeners.length; i++) {
- final IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i];
+ for (Object listener : listeners) {
+ final IPropertyChangeListener propertyChangeListener = (IPropertyChangeListener) listener;
ISafeRunnable safetyWrapper = new ISafeRunnable() {
@Override
public void run() throws Exception {
- listener.propertyChange(event);
+ propertyChangeListener.propertyChange(event);
}
@Override
@@ -477,10 +477,8 @@
* @param memento the persistence store
*/
protected void restoreWorkingSetState(IMemento memento) {
- IMemento[] children = memento.getChildren(IWorkbenchConstants.TAG_WORKING_SET);
-
- for (int i = 0; i < children.length; i++) {
- AbstractWorkingSet workingSet = (AbstractWorkingSet) restoreWorkingSet(children[i]);
+ for (IMemento child : memento.getChildren(IWorkbenchConstants.TAG_WORKING_SET)) {
+ AbstractWorkingSet workingSet = (AbstractWorkingSet) restoreWorkingSet(child);
if (workingSet != null) {
internalAddWorkingSet(workingSet);
}
@@ -660,8 +658,7 @@
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
synchronized (updaters) {
- for (int i = 0; i < descriptors.length; i++) {
- WorkingSetDescriptor descriptor = descriptors[i];
+ for (WorkingSetDescriptor descriptor : descriptors) {
List workingSets = getWorkingSetsForId(descriptor
.getId());
if (workingSets.size() == 0) {
@@ -694,8 +691,7 @@
private List getWorkingSetsForId(String id) {
List result= new ArrayList();
- for (Iterator iter= workingSets.iterator(); iter.hasNext();) {
- IWorkingSet ws= (IWorkingSet)iter.next();
+ for (IWorkingSet ws : workingSets) {
if (id.equals(ws.getId())) {
result.add(ws);
}
@@ -800,8 +796,7 @@
@Override
public void removeExtension(IExtension extension, Object[] objects) {
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
+ for (Object object : objects) {
if (object instanceof IWorkingSetUpdater) {
removeUpdater((IWorkingSetUpdater)object);
@@ -859,8 +854,7 @@
// ideally this method would be in a static util class of some kind but
// we dont have any such beast for working sets and making one for one
// method is overkill.
- for (int i = 0; i < workingSets.length; i++) {
- final IWorkingSet workingSet = workingSets[i];
+ for (final IWorkingSet workingSet : workingSets) {
SafeRunner.run(new WorkingSetRunnable() {
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
index c14675a..fc6b486 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
@@ -163,9 +163,9 @@
}
list = new ArrayList(children.length);
- for (int i = 0; i < children.length; i++) {
- String tag = children[i].getName();
- AbstractExpression expr = createExpression(children[i]);
+ for (IConfigurationElement configElement : children) {
+ String tag = configElement.getName();
+ AbstractExpression expr = createExpression(configElement);
if (EXP_TYPE_OBJECT_CLASS.equals(tag)) {
list.add(0, expr);
} else {
@@ -185,8 +185,8 @@
if (classNames == null) {
classNames = new ArrayList();
}
- for (int i = 0; i < objectClasses.length; i++) {
- classNames.add(objectClasses[i]);
+ for (String objectClass : objectClasses) {
+ classNames.add(objectClass);
}
}
}
@@ -328,8 +328,8 @@
return true;
}
Class[] superInterfaces = interfaceToCheck.getInterfaces();
- for (int i = 0; i < superInterfaces.length; i++) {
- if (checkInterfaceHierarchy(superInterfaces[i])) {
+ for (Class superInterface : superInterfaces) {
+ if (checkInterfaceHierarchy(superInterface)) {
return true;
}
}
@@ -389,8 +389,8 @@
// test all the interfaces the class implements
Class[] interfaces = clazz.getInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- if (checkInterfaceHierarchy(interfaces[i])) {
+ for (Class currentInterface : interfaces) {
+ if (checkInterfaceHierarchy(currentInterface)) {
return true;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
index a17c9c0..5e2b638 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
@@ -16,7 +16,6 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
import org.eclipse.ui.SubActionBars;
@@ -97,9 +96,7 @@
// Convert array to list.
HashSet newList = new HashSet();
- for (int i = 0; i < newArray.length; i++) {
- IActionSetDescriptor descriptor = newArray[i];
-
+ for (IActionSetDescriptor descriptor : newArray) {
newList.add(descriptor);
}
List oldList = new ArrayList(mapDescToRec.keySet());
@@ -126,9 +123,7 @@
// Add new actions.
ArrayList sets = new ArrayList();
- for (int i = 0; i < newArray.length; i++) {
- IActionSetDescriptor desc = newArray[i];
-
+ for (IActionSetDescriptor desc : newArray) {
if (!mapDescToRec.containsKey(desc)) {
try {
SetRec rec;
@@ -199,8 +194,8 @@
* @since 3.1
*/
private boolean containsRegistration(Object[] existingRegistrations, IActionSetDescriptor set) {
- for (int i = 0; i < existingRegistrations.length; i++) {
- if (existingRegistrations[i] == set) {
+ for (Object existingRegistration : existingRegistrations) {
+ if (existingRegistration == set) {
return true;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
index d7a464a..a7fe1b2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.Iterator;
-
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
@@ -84,12 +83,10 @@
if (coolItemToolBarMgr == null) {
return;
}
- IContributionItem[] items = coolItemToolBarMgr.getItems();
// remove the action set's items from its action bar, don't use
// removeAll since other items from other actions sets may be in
// the action bar's cool item
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : coolItemToolBarMgr.getItems()) {
if (item instanceof PluginActionCoolBarContributionItem) {
PluginActionCoolBarContributionItem actionSetItem = (PluginActionCoolBarContributionItem) item;
if (actionSetItem.getActionSetId().equals(actionSetId)) {
@@ -284,9 +281,7 @@
// 1. Need to set visibility for all non-adjunct actions
if (coolItemToolBarMgr != null) {
- IContributionItem[] items = coolItemToolBarMgr.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : coolItemToolBarMgr.getItems()) {
if (item instanceof PluginActionCoolBarContributionItem) {
PluginActionCoolBarContributionItem actionSetItem = (PluginActionCoolBarContributionItem) item;
// Only if the action set id for this contribution item is
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
index bc8aa70..a9c0203 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
@@ -178,11 +178,8 @@
memento.putString(AbstractWorkingSet.TAG_AGGREGATE, Boolean.TRUE
.toString());
- IWorkingSet[] localComponents = getComponentsInternal();
- for (int i = 0; i < localComponents.length; i++) {
- IWorkingSet componentSet = localComponents[i];
- memento.createChild(IWorkbenchConstants.TAG_WORKING_SET,
- componentSet.getName());
+ for (IWorkingSet workingSet : getComponentsInternal()) {
+ memento.createChild(IWorkbenchConstants.TAG_WORKING_SET, workingSet.getName());
}
}
}
@@ -240,8 +237,7 @@
} else if (property
.equals(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
IWorkingSet[] localComponents = getComponentsInternal();
- for (int i = 0; i < localComponents.length; i++) {
- IWorkingSet set = localComponents[i];
+ for (IWorkingSet set : localComponents) {
if (set.equals(event.getNewValue())) {
constructElements(true);
break;
@@ -260,9 +256,8 @@
.getChildren(IWorkbenchConstants.TAG_WORKING_SET);
ArrayList list = new ArrayList(workingSetReferences.length);
- for (int i = 0; i < workingSetReferences.length; i++) {
- IMemento setReference = workingSetReferences[i];
- String setId = setReference.getID();
+ for (IMemento memento : workingSetReferences) {
+ String setId = memento.getID();
IWorkingSet set = manager.getWorkingSet(setId);
if (set != null) {
list.add(set);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
index f1c2938..b75b024 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
@@ -84,9 +84,7 @@
.getExtensionRegistry().getConfigurationElementsFor(
PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_SYSTEM_SUMMARY_SECTIONS));
- for (int i = 0; i < configElements.length; ++i) {
- IConfigurationElement element = configElements[i];
-
+ for (IConfigurationElement element : configElements) {
Object obj = null;
try {
obj = WorkbenchPlugin.createExtension(element,
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
index 312b44c..82bd528 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
@@ -394,9 +394,7 @@
}
this.enabledAllowed = enabledAllowed;
if (coolItemToolBarMgr != null) {
- IContributionItem[] items = coolItemToolBarMgr.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : coolItemToolBarMgr.getItems()) {
if (item != null) {
item.update(IContributionManagerOverrides.P_ENABLED);
}
@@ -464,9 +462,7 @@
ICoolBarManager coolBarManager = getCastedParent().getCoolBarManager();
if ((coolItemToolBarMgr != null) && (coolBarManager != null)) {
- IContributionItem[] items = coolItemToolBarMgr.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : coolItemToolBarMgr.getItems()) {
item.setVisible(visible || !forceVisibility);
coolItemToolBarMgr.markDirty();
if (!coolBarManager.isDirty()) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
index 424e894..70b4172 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
@@ -13,7 +13,6 @@
import java.util.ArrayList;
import java.util.Iterator;
-
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IEditorDescriptor;
@@ -128,9 +127,8 @@
* @param memento the memento to restore the mru history from
*/
public IStatus restoreState(IMemento memento) {
- IMemento[] mementos = memento.getChildren(IWorkbenchConstants.TAG_FILE);
- for (int i = 0; i < mementos.length; i++) {
- EditorHistoryItem item = new EditorHistoryItem(mementos[i]);
+ for (IMemento childMemento : memento.getChildren(IWorkbenchConstants.TAG_FILE)) {
+ EditorHistoryItem item = new EditorHistoryItem(childMemento);
if (!"".equals(item.getName()) || !"".equals(item.getToolTipText())) { //$NON-NLS-1$ //$NON-NLS-2$
add(item, fifoList.size());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
index c4b0f58..b2e8c2a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
@@ -38,9 +38,7 @@
*/
public void updateEnabledAllowed() {
// update the items in the map
- IContributionItem[] items = EditorMenuManager.super.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
+ for (IContributionItem item : EditorMenuManager.super.getItems()) {
item.update(IContributionManagerOverrides.P_ENABLED);
}
// update the wrapped menus
@@ -201,9 +199,8 @@
}
protected void getAllContributedActions(HashSet set) {
- IContributionItem[] items = super.getItems();
- for (int i = 0; i < items.length; i++) {
- getAllContributedActions(set, items[i]);
+ for (IContributionItem item : super.getItems()) {
+ getAllContributedActions(set, item);
}
if (wrappers == null) {
return;
@@ -216,9 +213,8 @@
protected void getAllContributedActions(HashSet set, IContributionItem item) {
if (item instanceof MenuManager) {
- IContributionItem subItems[] = ((MenuManager) item).getItems();
- for (int j = 0; j < subItems.length; j++) {
- getAllContributedActions(set, subItems[j]);
+ for (IContributionItem subItem : ((MenuManager) item).getItems()) {
+ getAllContributedActions(set, subItem);
}
} else if (item instanceof ActionContributionItem) {
set.add(((ActionContributionItem) item).getAction());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
index d124f0a..1ffacce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
@@ -87,11 +87,11 @@
// Combine the two sets of transfers into one array
Transfer[] allTransfers = new Transfer[secondaryTransfers.length+primaryTransfers.length];
int curTransfer = 0;
- for (int i = 0; i < primaryTransfers.length; i++) {
- allTransfers[curTransfer++] = primaryTransfers[i];
+ for (Transfer primaryTransfer : primaryTransfers) {
+ allTransfers[curTransfer++] = primaryTransfer;
}
- for (int i = 0; i < secondaryTransfers.length; i++) {
- allTransfers[curTransfer++] = secondaryTransfers[i];
+ for (Transfer secondaryTransfer : secondaryTransfers) {
+ allTransfers[curTransfer++] = secondaryTransfer;
}
realDropTarget.setTransfer(allTransfers);
@@ -139,8 +139,8 @@
}
private boolean isSupportedType(Transfer[] transfers, TransferData transferType) {
- for (int i = 0; i < transfers.length; i++) {
- if (transfers[i].isSupportedType(transferType))
+ for (Transfer transfer : transfers) {
+ if (transfer.isSupportedType(transferType))
return true;
}
return false;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
index 920989f..0c618f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
@@ -16,7 +16,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionDelta;
@@ -74,28 +73,28 @@
// push action sets and perspectives to the top because incoming
// actionSetPartAssociations and perspectiveExtensions may depend upon
// them for their bindings.
- for (int i = 0; i < delta.length; i++) {
- id = delta[i].getExtensionPoint().getSimpleIdentifier();
- if (delta[i].getKind() == IExtensionDelta.ADDED) {
+ for (IExtensionDelta extensionDelta : delta) {
+ id = extensionDelta.getExtensionPoint().getSimpleIdentifier();
+ if (extensionDelta.getKind() == IExtensionDelta.ADDED) {
if (id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
- appearList.add(0, delta[i]);
+ appearList.add(0, extensionDelta);
} else if (!id.equals(IWorkbenchRegistryConstants.PL_PERSPECTIVES)
&& !id.equals(IWorkbenchRegistryConstants.PL_VIEWS)
&& !id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
appearList.add(appearList.size() - numPerspectives,
- delta[i]);
+ extensionDelta);
}
} else {
- if (delta[i].getKind() == IExtensionDelta.REMOVED) {
+ if (extensionDelta.getKind() == IExtensionDelta.REMOVED) {
if (id
.equals(IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) {
- revokeList.add(0, delta[i]);
+ revokeList.add(0, extensionDelta);
numActionSetPartAssoc++;
} else if (id
.equals(IWorkbenchRegistryConstants.PL_PERSPECTIVES)) {
- revokeList.add(numActionSetPartAssoc, delta[i]);
+ revokeList.add(numActionSetPartAssoc, extensionDelta);
} else {
- revokeList.add(delta[i]);
+ revokeList.add(extensionDelta);
}
}
}
@@ -150,9 +149,8 @@
ThemeRegistryReader reader = new ThemeRegistryReader();
reader.setRegistry((ThemeRegistry) WorkbenchPlugin.getDefault()
.getThemeRegistry());
- IConfigurationElement[] elements = ext.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- reader.readElement(elements[i]);
+ for (IConfigurationElement configElement : ext.getConfigurationElements()) {
+ reader.readElement(configElement);
}
Collection fonts = reader.getFontDefinitions();
@@ -169,9 +167,8 @@
ThemeRegistry registry = (ThemeRegistry) WorkbenchPlugin.getDefault()
.getThemeRegistry();
reader.setRegistry(registry);
- IConfigurationElement[] elements = ext.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- reader.readElement(elements[i]);
+ for (IConfigurationElement configElement : ext.getConfigurationElements()) {
+ reader.readElement(configElement);
}
Collection colors = reader.getColorDefinitions();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
index 9ba743e..2c29959 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
@@ -340,8 +340,8 @@
* @since 3.1
*/
public static boolean isResourceType(String objectClassName) {
- for (int i = 0; i < resourceClassNames.length; i++) {
- if (resourceClassNames[i].equals(objectClassName)) {
+ for (String resourceClassName : resourceClassNames) {
+ if (resourceClassName.equals(objectClassName)) {
return true;
}
}
@@ -376,8 +376,8 @@
return true;
}
Class[] interfaces= clazz.getInterfaces();
- for (int i= 0; i < interfaces.length; i++) {
- if (isInstanceOf(interfaces[i], type)) {
+ for (Class currentInterface : interfaces) {
+ if (isInstanceOf(currentInterface, type)) {
return true;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
index 7dc7463..42e6131 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
@@ -898,8 +898,8 @@
private void disposeHistoryForTabs() {
Object[] keys = perTabHistoryMap.keySet().toArray();
- for (int i = 0; i < keys.length; i++) {
- disposeHistoryForTab(keys[i]);
+ for (Object key : keys) {
+ disposeHistoryForTab(key);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
index f83a1a4..5b4bebe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
@@ -76,8 +76,8 @@
if (recreateMenu) {
Menu m = (Menu) e.widget;
MenuItem[] items = m.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu(m);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
index 32be10f..bf5ec37 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
@@ -387,8 +387,7 @@
public String toString() {
StringBuffer buffer = new StringBuffer();
IConfigurationElement[] children = config.getChildren();
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement element = children[i];
+ for (IConfigurationElement element : children) {
String label = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
if(label != null) {
buffer.append(label);
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 9c79c98..08e7eb9 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
@@ -271,9 +271,7 @@
}
final Collection parameters = new ArrayList();
- for (int i = 0; i < parameterMementos.length; i++) {
- final IMemento parameterMemento = parameterMementos[i];
-
+ for (final IMemento parameterMemento : parameterMementos) {
// Read out the id.
final String id = parameterMemento.getString(ATT_ID);
if ((id == null) || (id.length() == 0)) {
@@ -287,8 +285,7 @@
try {
final IParameter[] commandParameters = command.getParameters();
if (parameters != null) {
- for (int j = 0; j < commandParameters.length; j++) {
- final IParameter currentParameter = commandParameters[j];
+ for (final IParameter currentParameter : commandParameters) {
if (Util.equals(currentParameter.getId(), id)) {
parameter = currentParameter;
break;
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 ac38787..4e66fea 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
@@ -385,9 +385,7 @@
}
final Collection parameters = new ArrayList();
- for (int i = 0; i < parameterElements.length; i++) {
- final IConfigurationElement parameterElement = parameterElements[i];
-
+ for (final IConfigurationElement parameterElement : parameterElements) {
// Read out the id.
final String id = parameterElement.getAttribute(ATT_ID);
if ((id == null) || (id.length() == 0)) {
@@ -402,8 +400,7 @@
try {
final IParameter[] commandParameters = command.getParameters();
if (parameters != null) {
- for (int j = 0; j < commandParameters.length; j++) {
- final IParameter currentParameter = commandParameters[j];
+ for (final IParameter currentParameter : commandParameters) {
if (Util.equals(currentParameter.getId(), id)) {
parameter = currentParameter;
break;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
index e3130f1..0736e71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
@@ -13,7 +13,6 @@
import java.util.ArrayList;
import java.util.Collection;
-
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -125,26 +124,21 @@
@Override
public void dispose() {
if (!evaluationReferences.isEmpty()) {
- Object[] array = evaluationReferences.toArray();
- for (int i = 0; i < array.length; i++) {
- parentService
- .removeEvaluationListener((IEvaluationReference) array[i]);
+ for (Object evaluationListener : evaluationReferences.toArray()) {
+ parentService.removeEvaluationListener((IEvaluationReference) evaluationListener);
}
}
if (!serviceListeners.isEmpty()) {
- Object[] array = serviceListeners.toArray();
- for (int i = 0; i < array.length; i++) {
- parentService
- .removeServiceListener((IPropertyChangeListener) array[i]);
+ for (Object serviceListener : serviceListeners.toArray()) {
+ parentService.removeServiceListener((IPropertyChangeListener) serviceListener);
}
serviceListeners.clear();
}
// Remove any "resource", like listeners, that were associated
// with this service.
if (!sourceProviders.isEmpty()) {
- Object[] array = sourceProviders.toArray();
- for (int i = 0; i < array.length; i++) {
- parentService.removeSourceProvider((ISourceProvider) array[i]);
+ for (Object sourceProvider : sourceProviders.toArray()) {
+ parentService.removeSourceProvider((ISourceProvider) sourceProvider);
}
sourceProviders.clear();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
index eea1826..17296ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
@@ -149,8 +149,7 @@
// Add all of the reference variables.
final String[] sourceNames = info.getAccessedVariableNames();
- for (int i = 0; i < sourceNames.length; i++) {
- final String sourceName = sourceNames[i];
+ for (final String sourceName : sourceNames) {
sourcePriority |= getMapping(sourceName);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
index d64291e..0ce8fbe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
@@ -16,7 +16,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-
import org.eclipse.ui.AbstractSourceProvider;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.services.IDisposable;
@@ -84,9 +83,7 @@
throw new NullPointerException("The source provider cannot be null"); //$NON-NLS-1$
}
- final String[] sourceNames = sourceProvider.getProvidedSourceNames();
- for (int i = 0; i < sourceNames.length; i++) {
- final String sourceName = sourceNames[i];
+ for (final String sourceName : sourceProvider.getProvidedSourceNames()) {
sourceProvidersByName.put(sourceName, sourceProvider);
}
sourceProviders.add(sourceProvider);
@@ -97,18 +94,16 @@
throw new NullPointerException("The source provider cannot be null"); //$NON-NLS-1$
}
- final String[] sourceNames = sourceProvider.getProvidedSourceNames();
- for (int i = 0; i < sourceNames.length; i++) {
- sourceProvidersByName.remove(sourceNames[i]);
+ for (String sourceName : sourceProvider.getProvidedSourceNames()) {
+ sourceProvidersByName.remove(sourceName);
}
sourceProviders.remove(sourceProvider);
}
public final void readRegistry() {
- AbstractSourceProvider[] sp = WorkbenchServiceRegistry.getRegistry().getSourceProviders();
- for (int i = 0; i < sp.length; i++) {
- sp[i].initialize(locator);
- registerProvider(sp[i]);
+ for (AbstractSourceProvider sourceProvider : WorkbenchServiceRegistry.getRegistry().getSourceProviders()) {
+ sourceProvider.initialize(locator);
+ registerProvider(sourceProvider);
}
}
}
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 992fb2a..0abd1da 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
@@ -136,8 +136,8 @@
handle, IExtensionTracker.REF_WEAK);
List serviceNames = new ArrayList();
- for (int j = 0; j < serviceNameElements.length; j++) {
- String serviceName = serviceNameElements[j].getAttribute(IWorkbenchRegistryConstants.ATTR_SERVICE_CLASS);
+ for (IConfigurationElement configElement : serviceNameElements) {
+ String serviceName = configElement.getAttribute(IWorkbenchRegistryConstants.ATTR_SERVICE_CLASS);
if (factories.containsKey(serviceName)) {
WorkbenchPlugin.log("Factory already exists for " //$NON-NLS-1$
+ serviceName);
@@ -166,27 +166,23 @@
public AbstractSourceProvider[] getSourceProviders() {
ArrayList providers = new ArrayList();
IExtensionPoint ep = getExtensionPoint();
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i].getName().equals(
+ for (IConfigurationElement configElement : ep.getConfigurationElements()) {
+ if (configElement.getName().equals(
IWorkbenchRegistryConstants.TAG_SOURCE_PROVIDER)) {
try {
- Object sourceProvider = elements[i]
+ Object sourceProvider = configElement
.createExecutableExtension(IWorkbenchRegistryConstants.ATTR_PROVIDER);
if (!(sourceProvider instanceof AbstractSourceProvider)) {
- String attributeName = elements[i]
- .getAttribute(IWorkbenchRegistryConstants.ATTR_PROVIDER);
+ String attributeName = configElement.getAttribute(IWorkbenchRegistryConstants.ATTR_PROVIDER);
final String message = "Source Provider '" + //$NON-NLS-1$
attributeName
+ "' should extend AbstractSourceProvider"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, message);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, message);
WorkbenchPlugin.log(status);
continue;
}
providers.add(sourceProvider);
- processVariables(elements[i]
- .getChildren(IWorkbenchRegistryConstants.TAG_VARIABLE));
+ processVariables(configElement.getChildren(IWorkbenchRegistryConstants.TAG_VARIABLE));
} catch (CoreException e) {
StatusManager.getManager().handle(e.getStatus());
}
@@ -205,14 +201,12 @@
};
private void processVariables(IConfigurationElement[] children) {
- for (int i = 0; i < children.length; i++) {
- String name = children[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ for (IConfigurationElement configElement : children) {
+ String name = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
if (name == null || name.length() == 0) {
continue;
}
- String level = children[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_PRIORITY_LEVEL);
+ String level = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_PRIORITY_LEVEL);
if (level == null || level.length() == 0) {
level = WORKBENCH_LEVEL;
} else {
@@ -241,8 +235,7 @@
@Override
public void removeExtension(IExtension extension, Object[] objects) {
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
+ for (Object object : objects) {
if (object instanceof ServiceFactoryHandle) {
ServiceFactoryHandle handle = (ServiceFactoryHandle) object;
Set locatorSet = handle.serviceLocators.keySet();
@@ -252,15 +245,14 @@
int l2 = loc2.getService(IWorkbenchLocationService.class).getServiceLevel();
return l1 < l2 ? -1 : (l1 > l2 ? 1 : 0);
});
- for (int j = 0; j < locators.length; j++) {
- ServiceLocator serviceLocator = locators[j];
+ for (ServiceLocator locator : locators) {
+ ServiceLocator serviceLocator = locator;
if (!serviceLocator.isDisposed()) {
serviceLocator.unregisterServices(handle.serviceNames);
}
}
handle.factory = null;
- for (int j = 0; j < handle.serviceNames.length; j++) {
- String serviceName = handle.serviceNames[j];
+ for (String serviceName : handle.serviceNames) {
if (factories.get(serviceName) == handle) {
factories.remove(serviceName);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
index 6a429cc..40aea16 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
@@ -13,7 +13,6 @@
import java.util.HashMap;
import java.util.Map;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -55,12 +54,10 @@
IExtension[] extensions = point.getExtensions();
Map idToSplash = new HashMap(); // String->ConfigurationElement
String[] targetId = new String[1];
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] children = extensions[i]
- .getConfigurationElements();
- for (int j = 0; j < children.length; j++) {
- AbstractSplashHandler handler = processElement(children[j],
- idToSplash, targetId, product);
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] children = extension.getConfigurationElements();
+ for (IConfigurationElement element : children) {
+ AbstractSplashHandler handler = processElement(element, idToSplash, targetId, product);
if (handler != null)
return handler;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
index 03500bc..c07fdb0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
@@ -144,17 +144,17 @@
keyList.add(ks);
KeySequence sequence = KeySequence.getInstance(keyList);
boolean partialMatch = false;
- for (int i = 0; i < ts.length; i++) {
- if (ts[i].equals(sequence)) {
+ for (TriggerSequence triggerSequence : ts) {
+ if (triggerSequence.equals(sequence)) {
copyToClipboard();
keyList.clear();
break;
}
- if (ts[i].startsWith(sequence, false)) {
+ if (triggerSequence.startsWith(sequence, false)) {
partialMatch = true;
}
- for (int j = 0; j < ts[i].getTriggers().length; j++) {
- if (ts[i].getTriggers()[j].equals(ks)) {
+ for (int j = 0; j < triggerSequence.getTriggers().length; j++) {
+ if (triggerSequence.getTriggers()[j].equals(ks)) {
partialMatch = true;
}
}
@@ -305,9 +305,8 @@
appendNewLine(text, message, nesting, lineNumber[0]++);
}
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- populateList(text, children[i], nesting + 1, lineNumber);
+ for (IStatus child : status.getChildren()) {
+ populateList(text, child, nesting + 1, lineNumber);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
index afa21d1..058ecb7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
@@ -150,9 +150,8 @@
return;
}
list.add(t.toString());
- StackTraceElement[] ste = t.getStackTrace();
- for (int i = 0; i < ste.length; i++) {
- list.add(ste[i].toString());
+ for (StackTraceElement stackTraceElement : t.getStackTrace()) {
+ list.add(stackTraceElement.toString());
}
if (t.getCause() != null) {
list.add(WorkbenchMessages.StackTraceSupportArea_CausedBy);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
index c078e9b..60f2250 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
@@ -13,7 +13,6 @@
import java.util.HashMap;
import java.util.Map;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.ui.IPluginContribution;
@@ -69,13 +68,9 @@
Map params = new HashMap();
- for (int i = 0; i < parameters.length; i++) {
- params
- .put(
- parameters[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME),
- parameters[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_VALUE));
+ for (IConfigurationElement configElement : parameters) {
+ params.put(configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME),
+ configElement.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE));
}
statusHandler.setParams(params);
@@ -90,15 +85,11 @@
* @return prefix parameter
*/
public String getPrefix() {
- IConfigurationElement parameters[] = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
+ IConfigurationElement parameters[] = configElement.getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
- for (int i = 0; i < parameters.length; i++) {
- if (parameters[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME).equals(
- PREFIX)) {
- prefix = parameters[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ for (IConfigurationElement configElement : parameters) {
+ if (configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME).equals(PREFIX)) {
+ prefix = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
}
}
return prefix;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
index 3defa44..78eafd6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
@@ -14,7 +14,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -65,8 +64,8 @@
statusHandlerDescriptorsMap = new StatusHandlerDescriptorsMap();
// initial population
- for (int i = 0; i < extensions.length; i++) {
- addExtension(tracker, extensions[i]);
+ for (IExtension extension : extensions) {
+ addExtension(tracker, extension);
}
tracker.registerHandler(this, ExtensionTracker
@@ -95,21 +94,17 @@
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- IConfigurationElement[] configElements = extension
- .getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- if (configElements[j].getName().equals(TAG_STATUSHANDLER)) {
- StatusHandlerDescriptor descriptor = new StatusHandlerDescriptor(
- configElements[j]);
- tracker.registerObject(extension, descriptor,
- IExtensionTracker.REF_STRONG);
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ if (configElement.getName().equals(TAG_STATUSHANDLER)) {
+ StatusHandlerDescriptor descriptor = new StatusHandlerDescriptor(configElement);
+ tracker.registerObject(extension, descriptor, IExtensionTracker.REF_STRONG);
statusHandlerDescriptors.add(descriptor);
- } else if (configElements[j].getName().equals(
+ } else if (configElement.getName().equals(
TAG_STATUSHANDLER_PRODUCTBINDING)) {
StatusHandlerProductBindingDescriptor descriptor = new StatusHandlerProductBindingDescriptor(
- configElements[j]);
- tracker.registerObject(extension, descriptor,
- IExtensionTracker.REF_STRONG);
+ configElement);
+ tracker.registerObject(extension, descriptor, IExtensionTracker.REF_STRONG);
productBindingDescriptors.add(descriptor);
}
}
@@ -118,11 +113,11 @@
@Override
public void removeExtension(IExtension extension, Object[] objects) {
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof StatusHandlerDescriptor) {
- statusHandlerDescriptors.remove(objects[i]);
- } else if (objects[i] instanceof StatusHandlerProductBindingDescriptor) {
- productBindingDescriptors.remove(objects[i]);
+ for (Object object : objects) {
+ if (object instanceof StatusHandlerDescriptor) {
+ statusHandlerDescriptors.remove(object);
+ } else if (object instanceof StatusHandlerProductBindingDescriptor) {
+ productBindingDescriptors.remove(object);
}
}
buildHandlersStructure();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
index 71d773c..f9f5c28 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
@@ -97,8 +97,8 @@
if (children == null || children.length == 0) {
return status.matches(mask) || (handleOKStatuses && status.isOK());
}
- for (int i = 0; i < children.length; i++) {
- if (children[i].matches(mask)) {
+ for (IStatus child : children) {
+ if (child.matches(mask)) {
return true;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
index 6ed9989..b5c4cc53 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
@@ -11,7 +11,6 @@
package org.eclipse.ui.internal.themes;
import java.util.Set;
-
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.FontRegistry;
@@ -51,9 +50,8 @@
* @param event
*/
protected void fire(PropertyChangeEvent event) {
- Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
+ for (Object listener : getListeners()) {
+ ((IPropertyChangeListener) listener).propertyChange(event);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
index 8887b6c..c6ca5a3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
@@ -153,14 +153,12 @@
defs = registry.getFonts();
}
- for (int i = 0; i < defs.length; i++) {
- if (id.equals(defs[i].getDefaultsTo())
+ for (IHierarchalThemeElementDefinition elementDefinition : defs) {
+ if (id.equals(elementDefinition.getDefaultsTo())
&& ColorsAndFontsPreferencePage.equals(
- ((ICategorizedThemeElementDefinition) def)
- .getCategoryId(),
- ((ICategorizedThemeElementDefinition) defs[i])
- .getCategoryId())) {
- list.add(defs[i]);
+ ((ICategorizedThemeElementDefinition) def).getCategoryId(),
+ ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
+ list.add(elementDefinition);
}
}
return list.toArray();
@@ -170,13 +168,11 @@
ArrayList list = new ArrayList();
if (categoryId != null) {
- ThemeElementCategory[] categories = registry.getCategories();
- for (int i = 0; i < categories.length; i++) {
- if (categoryId.equals(categories[i].getParentId())) {
- Set bindings = themeRegistry
- .getPresentationsBindingsFor(categories[i]);
+ for (ThemeElementCategory category : registry.getCategories()) {
+ if (categoryId.equals(category.getParentId())) {
+ Set bindings = themeRegistry.getPresentationsBindingsFor(category);
if (bindings == null) {
- list.add(categories[i]);
+ list.add(category);
}
}
}
@@ -224,10 +220,8 @@
private boolean parentIsInSameCategory(ColorDefinition definition) {
String defaultsTo = definition.getDefaultsTo();
- ColorDefinition[] defs = registry.getColors();
- for (int i = 0; i < defs.length; i++) {
- if (defs[i].getId().equals(defaultsTo)
- && ColorsAndFontsPreferencePage.equals(defs[i]
+ for (ColorDefinition colorDef : registry.getColors()) {
+ if (colorDef.getId().equals(defaultsTo) && ColorsAndFontsPreferencePage.equals(colorDef
.getCategoryId(), definition.getCategoryId())) {
return true;
}
@@ -237,10 +231,8 @@
private boolean parentIsInSameCategory(FontDefinition definition) {
String defaultsTo = definition.getDefaultsTo();
- FontDefinition[] defs = registry.getFonts();
- for (int i = 0; i < defs.length; i++) {
- if (defs[i].getId().equals(defaultsTo)
- && ColorsAndFontsPreferencePage.equals(defs[i]
+ for (FontDefinition fontDef : registry.getFonts()) {
+ if (fontDef.getId().equals(defaultsTo) && ColorsAndFontsPreferencePage.equals(fontDef
.getCategoryId(), definition.getCategoryId())) {
return true;
}
@@ -293,13 +285,11 @@
defs = registry.getFonts();
}
- for (int i = 0; i < defs.length; i++) {
- if (id.equals(defs[i].getDefaultsTo())
+ for (IHierarchalThemeElementDefinition elementDefinition : defs) {
+ if (id.equals(elementDefinition.getDefaultsTo())
&& ColorsAndFontsPreferencePage.equals(
- ((ICategorizedThemeElementDefinition) def)
- .getCategoryId(),
- ((ICategorizedThemeElementDefinition) defs[i])
- .getCategoryId())) {
+ ((ICategorizedThemeElementDefinition) def).getCategoryId(),
+ ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
return true;
}
}
@@ -312,16 +302,13 @@
ArrayList list = new ArrayList();
Object[] uncatChildren = getCategoryChildren(null);
list.addAll(Arrays.asList(uncatChildren));
- ThemeElementCategory[] categories = ((IThemeRegistry) inputElement)
- .getCategories();
- for (int i = 0; i < categories.length; i++) {
- if (categories[i].getParentId() == null) {
- Set bindings = themeRegistry
- .getPresentationsBindingsFor(categories[i]);
+ for (ThemeElementCategory category : ((IThemeRegistry) inputElement).getCategories()) {
+ if (category.getParentId() == null) {
+ Set bindings = themeRegistry.getPresentationsBindingsFor(category);
if (bindings == null) {
- Object[] children = getChildren(categories[i]);
+ Object[] children = getChildren(category);
if (children != null && children.length > 0) {
- list.add(categories[i]);
+ list.add(category);
}
}
}
@@ -428,8 +415,8 @@
Font font = (Font) fonts.get(baseFont);
if (font == null) {
FontData[] data = baseFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setHeight(parentHeight);
+ for (FontData fontData : data) {
+ fontData.setHeight(parentHeight);
}
font = new Font(display, data);
@@ -1127,9 +1114,9 @@
Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(colors));
- for (int i = 0; i < sorted.length; i++) {
- if (id.equals(sorted[i].getDefaultsTo()))
- list.add(sorted[i]);
+ for (ColorDefinition colorDefinition : sorted) {
+ if (id.equals(colorDefinition.getDefaultsTo()))
+ list.add(colorDefinition);
}
return (ColorDefinition[]) list.toArray(new ColorDefinition[list.size()]);
}
@@ -1144,9 +1131,9 @@
Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(fonts));
- for (int i = 0; i < sorted.length; i++) {
- if (id.equals(sorted[i].getDefaultsTo()))
- list.add(sorted[i]);
+ for (FontDefinition fontDefinition : sorted) {
+ if (id.equals(fontDefinition.getDefaultsTo()))
+ list.add(fontDefinition);
}
return (FontDefinition[]) list.toArray(new FontDefinition[list.size()]);
}
@@ -1466,8 +1453,8 @@
Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
- for (int i = 0; i < definitionsCopy.length; i++) {
- resetColor(definitionsCopy[i], true);
+ for (ColorDefinition colorDefinition : definitionsCopy) {
+ resetColor(colorDefinition, true);
}
}
@@ -1511,8 +1498,8 @@
Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
- for (int i = 0; i < definitionsCopy.length; i++) {
- resetFont(definitionsCopy[i], true);
+ for (FontDefinition fontDefinition : definitionsCopy) {
+ resetFont(fontDefinition, true);
}
}
@@ -1616,22 +1603,19 @@
* identifier.
*/
private void setDescendantRegistryValues(ColorDefinition definition, RGB newRGB) {
- ColorDefinition[] children = getDescendantColors(definition);
-
- for (int i = 0; i < children.length; i++) {
- if (isDefault(children[i])) {
- setDescendantRegistryValues(children[i], newRGB);
- setRegistryValue(children[i], newRGB);
- colorValuesToSet.put(children[i].getId(), newRGB);
+ for (ColorDefinition colorDefinition : getDescendantColors(definition)) {
+ if (isDefault(colorDefinition)) {
+ setDescendantRegistryValues(colorDefinition, newRGB);
+ setRegistryValue(colorDefinition, newRGB);
+ colorValuesToSet.put(colorDefinition.getId(), newRGB);
}
}
}
private void setDescendantRegistryValues(FontDefinition definition, FontData[] datas, boolean reset) {
- FontDefinition[] children = getDescendantFonts(definition);
- for (int i = 0; i < children.length; i++) {
- if (isDefault(children[i])) {
- setFontPreferenceValue(children[i], datas, reset);
+ for (FontDefinition fontDefinition : getDescendantFonts(definition)) {
+ if (isDefault(fontDefinition)) {
+ setFontPreferenceValue(fontDefinition, datas, reset);
}
}
}
@@ -1791,8 +1775,8 @@
return;
List elements = new ArrayList(expandedElementIDs.length);
- for (int i = 0; i < expandedElementIDs.length; i++) {
- IThemeElementDefinition def = findElementFromMarker(expandedElementIDs[i]);
+ for (String expandedElementID : expandedElementIDs) {
+ IThemeElementDefinition def = findElementFromMarker(expandedElementID);
if (def != null)
elements.add(def);
}
@@ -1838,8 +1822,7 @@
List elementIds = new ArrayList(elements.length);
StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
+ for (Object object : elements) {
appendMarkerToBuffer(buffer, object);
if (buffer.length() != 0) {
@@ -1975,12 +1958,12 @@
// recalculate sample text
StringBuffer tmp = new StringBuffer();
- for (int i = 0; i < fontData.length; i++) {
- tmp.append(fontData[i].getName());
+ for (FontData currentFontData : fontData) {
+ tmp.append(currentFontData.getName());
tmp.append(' ');
- tmp.append(fontData[i].getHeight());
+ tmp.append(currentFontData.getHeight());
- int style = fontData[i].getStyle();
+ int style = currentFontData.getStyle();
if ((style & SWT.BOLD) != 0) {
tmp.append(' ');
tmp.append(RESOURCE_BUNDLE.getString("boldFont")); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
index cc16d1b..83b977b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
@@ -149,18 +149,15 @@
* @param fd the new FontData for defaulted fonts
*/
private void processDefaultsTo(String key, FontData[] fd) {
- FontDefinition[] defs = WorkbenchPlugin.getDefault()
- .getThemeRegistry().getFontsFor(getId());
- for (int i = 0; i < defs.length; i++) {
- String defaultsTo = defs[i].getDefaultsTo();
+ FontDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getFontsFor(getId());
+ for (FontDefinition fontDefinition : defs) {
+ String defaultsTo = fontDefinition.getDefaultsTo();
if (defaultsTo != null && defaultsTo.equals(key)) {
- IPreferenceStore store = WorkbenchPlugin
- .getDefault().getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
if (store.isDefault(ThemeElementHelper
- .createPreferenceKey(Theme.this, defs[i]
- .getId()))) {
- getFontRegistry().put(defs[i].getId(), fd);
- processDefaultsTo(defs[i].getId(), fd);
+ .createPreferenceKey(Theme.this, fontDefinition.getId()))) {
+ getFontRegistry().put(fontDefinition.getId(), fd);
+ processDefaultsTo(fontDefinition.getId(), fd);
}
}
}
@@ -173,18 +170,15 @@
* @param rgb the new RGB value for defaulted colors
*/
private void processDefaultsTo(String key, RGB rgb) {
- ColorDefinition[] defs = WorkbenchPlugin.getDefault()
- .getThemeRegistry().getColorsFor(getId());
- for (int i = 0; i < defs.length; i++) {
- String defaultsTo = defs[i].getDefaultsTo();
+ ColorDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getColorsFor(getId());
+ for (ColorDefinition colorDefinition : defs) {
+ String defaultsTo = colorDefinition.getDefaultsTo();
if (defaultsTo != null && defaultsTo.equals(key)) {
- IPreferenceStore store = WorkbenchPlugin
- .getDefault().getPreferenceStore();
- if (store.isDefault(ThemeElementHelper
- .createPreferenceKey(Theme.this, defs[i]
- .getId()))) {
- getColorRegistry().put(defs[i].getId(), rgb);
- processDefaultsTo(defs[i].getId(), rgb);
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ if (store.isDefault(
+ ThemeElementHelper.createPreferenceKey(Theme.this, colorDefinition.getId()))) {
+ getColorRegistry().put(colorDefinition.getId(), rgb);
+ processDefaultsTo(colorDefinition.getId(), rgb);
}
}
}
@@ -255,10 +249,9 @@
}
private void firePropertyChange(PropertyChangeEvent event) {
- Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
+ for (Object listener : getListeners()) {
+ ((IPropertyChangeListener) listener).propertyChange(event);
+ }
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
index 9d5dc90..efbaa7f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
@@ -64,14 +64,13 @@
Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(
definitions));
- for (int i = 0; i < copyOfDefinitions.length; i++) {
- FontDefinition definition = copyOfDefinitions[i];
+ for (FontDefinition definition : copyOfDefinitions) {
installFont(definition, theme, store, true);
}
if (defaults != null) {
- for (int i = 0; i < defaults.length; i++) {
- installFont(defaults[i], theme, store, false);
+ for (FontDefinition fontDef : defaults) {
+ installFont(fontDef, theme, store, false);
}
}
}
@@ -124,11 +123,8 @@
//If in high contrast, ignore the defaults in jface and use the default (system) font.
//This is a hack to address bug #205474. See bug #228207 for a future fix.
- FontData[] fontData = JFaceResources.getFontRegistry().getFontData(
- display.getHighContrast()
- ? JFaceResources.DEFAULT_FONT
- : id
- );
+ FontData[] fontData = JFaceResources.getFontRegistry()
+ .getFontData(display.getHighContrast() ? JFaceResources.DEFAULT_FONT : id);
defaultFont = registry.bestDataArray(fontData, display);
}
@@ -188,14 +184,13 @@
Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(
definitions));
- for (int i = 0; i < copyOfDefinitions.length; i++) {
- ColorDefinition definition = copyOfDefinitions[i];
+ for (ColorDefinition definition : copyOfDefinitions) {
installColor(definition, theme, store, true);
}
if (defaults != null) {
- for (int i = 0; i < defaults.length; i++) {
- installColor(defaults[i], theme, store, false);
+ for (ColorDefinition colorDef : defaults) {
+ installColor(colorDef, theme, store, false);
}
}
}
@@ -264,8 +259,7 @@
System.arraycopy(allDefs, 0, copy, 0, allDefs.length);
Arrays.sort(allDefs, new IThemeRegistry.HierarchyComparator(copy));
- for (int i = 0; i < allDefs.length; i++) {
- IHierarchalThemeElementDefinition def = allDefs[i];
+ for (IHierarchalThemeElementDefinition def : allDefs) {
if (def.getDefaultsTo() != null) {
if (set.contains(def.getDefaultsTo())) {
set.add(def);
@@ -367,8 +361,7 @@
public static String[] splitPropertyName(Theme theme, String property) {
IThemeDescriptor[] descriptors = WorkbenchPlugin.getDefault()
.getThemeRegistry().getThemes();
- for (int i = 0; i < descriptors.length; i++) {
- IThemeDescriptor themeDescriptor = descriptors[i];
+ for (IThemeDescriptor themeDescriptor : descriptors) {
String id = themeDescriptor.getId();
if (property.startsWith(id + '.')) { // the property starts with
// a known theme ID -
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
index 230b889..92ae00b 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
@@ -172,11 +172,10 @@
*/
private IThemeElementDefinition[] overlay(IThemeElementDefinition[] defs,
IThemeElementDefinition[] overrides) {
- for (int i = 0; i < overrides.length; i++) {
- int idx = Arrays.binarySearch(defs, overrides[i],
- IThemeRegistry.ID_COMPARATOR);
+ for (IThemeElementDefinition override : overrides) {
+ int idx = Arrays.binarySearch(defs, override, IThemeRegistry.ID_COMPARATOR);
if (idx >= 0) {
- defs[idx] = overlay(defs[idx], overrides[i]);
+ defs[idx] = overlay(defs[idx], override);
}
}
return defs;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
index 0eb5d17..78e2805 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
@@ -210,8 +210,7 @@
String osname = Platform.getOS();
String wsname = Platform.getWS();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String elementOs = element.getAttribute(IWorkbenchRegistryConstants.ATT_OS);
String elementWs = element.getAttribute(IWorkbenchRegistryConstants.ATT_WS);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
index 54f1ad0..9731913 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
@@ -133,8 +133,8 @@
// copy the font values from preferences.
FontRegistry jfaceFonts = JFaceResources.getFontRegistry();
- for (Iterator i = jfaceFonts.getKeySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Object fontRegistryKey : jfaceFonts.getKeySet()) {
+ String key = (String) fontRegistryKey;
defaultThemeFontRegistry.put(key, jfaceFonts.getFontData(key));
}
@@ -181,9 +181,8 @@
IThemeDescriptor[] themeDescriptors = getThemeRegistry().getThemes();
- for (int i=0; i < themeDescriptors.length; i++) {
- IThemeDescriptor themeDescriptor = themeDescriptors[i];
- ITheme theme = (ITheme) themes.get(themeDescriptor);
+ for (IThemeDescriptor themeDescriptor : themeDescriptors) {
+ ITheme theme = (ITheme) themes.get(themeDescriptor);
//If theme is in our themes table then its already been populated
if (theme != null) {
ColorDefinition[] colorDefinitions = themeDescriptor.getColors();
@@ -228,10 +227,8 @@
}
protected void firePropertyChange(PropertyChangeEvent event) {
- Object[] listeners = getListeners();
-
- for (int i = 0; i < listeners.length; i++) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
+ for (Object listener : getListeners()) {
+ ((IPropertyChangeListener) listener).propertyChange(event);
}
}
@@ -352,18 +349,16 @@
{
ColorRegistry jfaceColors = JFaceResources.getColorRegistry();
ColorRegistry themeColors = currentTheme.getColorRegistry();
- for (Iterator i = themeColors.getKeySet().iterator(); i
- .hasNext();) {
- String key = (String) i.next();
+ for (Object themeColorKey : themeColors.getKeySet()) {
+ String key = (String) themeColorKey;
jfaceColors.put(key, themeColors.getRGB(key));
}
}
{
FontRegistry jfaceFonts = JFaceResources.getFontRegistry();
FontRegistry themeFonts = currentTheme.getFontRegistry();
- for (Iterator i = themeFonts.getKeySet().iterator(); i
- .hasNext();) {
- String key = (String) i.next();
+ for (Object themeFontKey : themeFonts.getKeySet()) {
+ String key = (String) themeFontKey;
jfaceFonts.put(key, themeFonts.getFontData(key));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
index 17dc542..287062a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
@@ -123,8 +123,8 @@
public Font createInvisibleEditorsFont(Display display, Font originalFont) {
FontData fontData[] = originalFont.getFontData();
// Adding the bold attribute
- for (int i = 0; i < fontData.length; i++) {
- fontData[i].setStyle(fontData[i].getStyle() | SWT.BOLD);
+ for (FontData element : fontData) {
+ element.setStyle(element.getStyle() | SWT.BOLD);
}
return new Font(display, fontData);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
index 70f65b2..01db412 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
@@ -52,16 +52,16 @@
List<IEditorReference> keep = new ArrayList<>(Arrays.asList(editors));
int extra = length - page.getEditorReuseThreshold();
// look for extra editors that should be closed
- for (int i = 0; i < editors.length; i++) {
+ for (IEditorReference editor : editors) {
if (extra == 0) {
break;
}
- if (editors[i].isPinned() || editors[i].isDirty()) {
+ if (editor.isPinned() || editor.isDirty()) {
continue;
}
- refs.add(editors[i]);
+ refs.add(editor);
extra--;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
index 6d2d266..cdaff9b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
@@ -100,17 +100,16 @@
IConfigurationElement[] elements = Platform
.getExtensionRegistry()
.getConfigurationElementsFor("org.eclipse.ui.internalTweaklets"); //$NON-NLS-1$
- for (int i = 0; i < elements.length; i++) {
+ for (IConfigurationElement element : elements) {
if (definition.tweakClass.getName().equals(
- elements[i].getAttribute("definition"))) { //$NON-NLS-1$
+ element.getAttribute("definition"))) { //$NON-NLS-1$
try {
- Object tweaklet = elements[i].createExecutableExtension("implementation"); //$NON-NLS-1$
+ Object tweaklet = element.createExecutableExtension("implementation"); //$NON-NLS-1$
tweaklets.put(definition, tweaklet);
return tweaklet;
} catch (CoreException e) {
StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Error with extension " + elements[i], e), //$NON-NLS-1$
+ StatusUtil.newStatus(IStatus.ERROR, "Error with extension " + element, e), //$NON-NLS-1$
StatusManager.LOG);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
index a2932e2..1d8f017 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Descriptors.java
@@ -282,9 +282,7 @@
ResourceMethod[] data = (ResourceMethod[]) list.toArray(new ResourceMethod[list.size()]);
// Clear out the images
- for (int i = 0; i < data.length; i++) {
- ResourceMethod method = data[i];
-
+ for (ResourceMethod method : data) {
method.dispose();
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
index 0aa55eb..2f4b1ef 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
@@ -644,11 +644,11 @@
*/
public static String createList(Object[] items) {
String list = null;
- for (int i = 0; i < items.length; i++) {
+ for (Object item : items) {
if(list == null) {
- list = items[i].toString();
+ list = item.toString();
} else {
- list = createList(list, items[i].toString());
+ list = createList(list, item.toString());
}
}
return safeString(list);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
index 1ccb6c6..c452541 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
@@ -46,8 +46,8 @@
reader.setInitialCollection(getWizardElements());
IConfigurationElement[] configurationElements = extension
.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- reader.readElement(configurationElements[i]);
+ for (IConfigurationElement configurationElement : configurationElements) {
+ reader.readElement(configurationElement);
}
// no need to reset the wizard elements - getWizardElements will parse
// the
@@ -133,16 +133,13 @@
private void registerWizards(WizardCollectionElement collection) {
registerWizards(collection.getWorkbenchWizardElements());
- WizardCollectionElement[] collections = collection
- .getCollectionElements();
- for (int i = 0; i < collections.length; i++) {
- IConfigurationElement configurationElement = collections[i]
- .getConfigurationElement();
+ for (WizardCollectionElement wizardCollectionElement : collection.getCollectionElements()) {
+ IConfigurationElement configurationElement = wizardCollectionElement.getConfigurationElement();
if (configurationElement != null) {
register(configurationElement.getDeclaringExtension(),
- collections[i]);
+ wizardCollectionElement);
}
- registerWizards(collections[i]);
+ registerWizards(wizardCollectionElement);
}
}
@@ -153,9 +150,9 @@
* the wizards to register
*/
private void registerWizards(WorkbenchWizardElement[] wizards) {
- for (int i = 0; i < wizards.length; i++) {
- register(wizards[i].getConfigurationElement()
- .getDeclaringExtension(), wizards[i]);
+ for (WorkbenchWizardElement wizard : wizards) {
+ register(wizard.getConfigurationElement()
+ .getDeclaringExtension(), wizard);
}
}
@@ -165,8 +162,7 @@
getExtensionPointFilter().getUniqueIdentifier())) {
return;
}
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
+ for (Object object : objects) {
if (object instanceof WizardCollectionElement) {
// TODO: should we move child wizards to the "other" node?
WizardCollectionElement collection = (WizardCollectionElement) object;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
index 68d91c0..51e3f4d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
@@ -86,10 +86,8 @@
IPreferenceFilter[] matches = service.matches(prefs, filters);
PreferenceTransferElement[] returnTransfers = new PreferenceTransferElement[matches.length];
int index = 0;
- for (int i = 0; i < matches.length; i++) {
- IPreferenceFilter filter = matches[i];
- for (int j = 0; j < transfers.length; j++) {
- PreferenceTransferElement element = transfers[j];
+ for (IPreferenceFilter filter : matches) {
+ for (PreferenceTransferElement element : transfers) {
if (element.getFilter().equals(filter)) {
returnTransfers[index++] = element;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
index 90eb9c1..0fa8ca3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
@@ -859,10 +859,10 @@
.getArray(TRANSFER_PREFERENCES_NAMES_ID);
if (preferenceIds != null) {
PreferenceTransferElement[] transfers = getTransfers();
- for (int i = 0; i < transfers.length; i++) {
- for (int j = 0; j < preferenceIds.length; j++) {
- if (transfers[i].getID().equals(preferenceIds[j])) {
- viewer.setChecked(transfers[i], true);
+ for (PreferenceTransferElement transfer : transfers) {
+ for (String preferenceId : preferenceIds) {
+ if (transfer.getID().equals(preferenceId)) {
+ viewer.setChecked(transfer, true);
break;
}
}
@@ -880,8 +880,8 @@
if (directoryNames != null) {
// destination
setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++) {
- addDestinationItem(directoryNames[i]);
+ for (String directoryName : directoryNames) {
+ addDestinationItem(directoryName);
}
String current = settings.get(STORE_DESTINATION_ID);