diff options
author | Carsten Hammer | 2019-11-21 19:07:25 +0000 |
---|---|---|
committer | Karsten Thoms | 2019-12-11 11:50:49 +0000 |
commit | a4b9f5d8135fb9afc09a07613feda0bbd99f2b11 (patch) | |
tree | 64cc749a4255c02dfaac04ce0178a9e300264e31 | |
parent | 3c309e67b6ae725db495158b3dbfd5b171862d28 (diff) | |
download | eclipse.platform.swt-a4b9f5d8135fb9afc09a07613feda0bbd99f2b11.tar.gz eclipse.platform.swt-a4b9f5d8135fb9afc09a07613feda0bbd99f2b11.tar.xz eclipse.platform.swt-a4b9f5d8135fb9afc09a07613feda0bbd99f2b11.zip |
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add
missing braces on loops as necessary.
Change-Id: I303b8d2ee1df2745dc47a49d7c33cd5078fd32df
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
5 files changed, 17 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java index 5bf14447ec..580fb693b4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleAutomation.java @@ -733,8 +733,8 @@ public boolean setProperty(int dispIdMember, Variant rgvarg) { public boolean setProperty(int dispIdMember, Variant[] rgvarg) { int[] rgdispidNamedArgs = new int[] {COM.DISPID_PROPERTYPUT}; int dwFlags = COM.DISPATCH_PROPERTYPUT; - for (int i = 0; i < rgvarg.length; i++) { - if ((rgvarg[i].getType() & COM.VT_BYREF) == COM.VT_BYREF) + for (Variant element : rgvarg) { + if ((element.getType() & COM.VT_BYREF) == COM.VT_BYREF) dwFlags = COM.DISPATCH_PROPERTYPUTREF; } Variant pVarResult = new Variant(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java index 3d3d0da62d..0de9c0fd1f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleControlSite.java @@ -480,8 +480,7 @@ protected void createCOMInterfaces () { } private void disconnectEventSinks() { - for (int i = 0; i < oleEventSink.length; i++) { - OleEventSink sink = oleEventSink[i]; + for (OleEventSink sink : oleEventSink) { sink.disconnect(); sink.Release(); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java index cb3e57c1b5..64971d17d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventSink.java @@ -128,8 +128,8 @@ private int Invoke(int dispIdMember, long riid, int lcid, int dwFlags, long pDis notifyListener(dispIdMember,event); if (eventInfo != null) { - for (int j = 0; j < eventInfo.length; j++){ - eventInfo[j].dispose(); + for (Variant element : eventInfo) { + element.dispose(); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java index 41947f4435..2b47969c11 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleEventTable.java @@ -45,8 +45,8 @@ void hook (int eventType, OleListener handler) { } boolean hooks (int eventType) { if (handlers == null) return false; - for (int i=0; i<types.length; i++) { - if (types [i] == eventType) return true; + for (int type : types) { + if (type == eventType) return true; } return false; } @@ -70,8 +70,8 @@ void unhook (int eventType, OleListener handler) { } } boolean hasEntries() { - for (int i=0; i<types.length; i++) { - if (types[i] != 0) return true; + for (int type : types) { + if (type != 0) return true; } return false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java index b6bd46ca49..c320ba5198 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java @@ -248,8 +248,8 @@ static long getMsgProc(long code, long wParam, long lParam) { if (mapKey != 0) { accentKey = (mapKey & 0x80000000) != 0; if (!accentKey) { - for (int i=0; i<ACCENTS.length; i++) { - int value = OS.VkKeyScan (ACCENTS [i]); + for (short element : ACCENTS) { + int value = OS.VkKeyScan (element); if (value != -1 && (value & 0xFF) == msg.wParam) { int state = value >> 8; if ((OS.GetKeyState (OS.VK_SHIFT) < 0) == ((state & 0x1) != 0) && @@ -472,8 +472,7 @@ private int InsertMenus(long hmenuShared, long lpMenuWidths) { int fileMenuCount = 0; int newindex = 0; if (this.fileMenuItems != null) { - for (int i = 0; i < this.fileMenuItems.length; i++) { - MenuItem item = this.fileMenuItems[i]; + for (MenuItem item : this.fileMenuItems) { if (item != null) { int index = item.getParent().indexOf(item); lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the @@ -497,8 +496,7 @@ private int InsertMenus(long hmenuShared, long lpMenuWidths) { // item from the OS. int containerMenuCount = 0; if (this.containerMenuItems != null) { - for (int i = 0; i < this.containerMenuItems.length; i++) { - MenuItem item = this.containerMenuItems[i]; + for (MenuItem item : this.containerMenuItems) { if (item != null) { int index = item.getParent().indexOf(item); lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the @@ -522,8 +520,7 @@ private int InsertMenus(long hmenuShared, long lpMenuWidths) { // item from the OS. int windowMenuCount = 0; if (this.windowMenuItems != null) { - for (int i = 0; i < this.windowMenuItems.length; i++) { - MenuItem item = this.windowMenuItems[i]; + for (MenuItem item : this.windowMenuItems) { if (item != null) { int index = item.getParent().indexOf(item); lpmii.cch = cch; // lpmii.cch gets updated by GetMenuItemInfo to indicate the @@ -633,8 +630,7 @@ private int RemoveMenus(long hmenuShared) { List<LONG> ids = new ArrayList<>(); if (this.fileMenuItems != null) { - for (int i = 0; i < this.fileMenuItems.length; i++) { - MenuItem item = this.fileMenuItems[i]; + for (MenuItem item : this.fileMenuItems) { if (item != null && !item.isDisposed()) { int index = item.getParent().indexOf(item); // get Id from original menubar @@ -644,8 +640,7 @@ private int RemoveMenus(long hmenuShared) { } } if (this.containerMenuItems != null) { - for (int i = 0; i < this.containerMenuItems.length; i++) { - MenuItem item = this.containerMenuItems[i]; + for (MenuItem item : this.containerMenuItems) { if (item != null && !item.isDisposed()) { int index = item.getParent().indexOf(item); long id = getMenuItemID(hMenu, index); @@ -654,8 +649,7 @@ private int RemoveMenus(long hmenuShared) { } } if (this.windowMenuItems != null) { - for (int i = 0; i < this.windowMenuItems.length; i++) { - MenuItem item = this.windowMenuItems[i]; + for (MenuItem item : this.windowMenuItems) { if (item != null && !item.isDisposed()) { int index = item.getParent().indexOf(item); long id = getMenuItemID(hMenu, index); |