Skip to content

Commit

Permalink
For Menu.wmTimer use Menu.indexOf instead of MenuItem.index
Browse files Browse the repository at this point in the history
- Remove MenuItem.index which is now unused.
- Remove unused MenuItem.MenuItem(Menu, Menu, int, int)

eclipse-platform/eclipse.platform.ui#2483
  • Loading branch information
merks authored and HeikoKlare committed Nov 7, 2024
1 parent a26b66a commit ad1e109
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ LRESULT wmTimer (long wParam, long lParam) {
OS.GetCursorPos (pt);
if (selectedMenuItem != null && selectedMenuItem.parent != null) {
RECT rect = new RECT ();
boolean success = OS.GetMenuItemRect (0, selectedMenuItem.parent.handle, selectedMenuItem.index, rect);
boolean success = OS.GetMenuItemRect (0, selectedMenuItem.parent.handle, indexOf(selectedMenuItem), rect);
if (!success) return null;
if (OS.PtInRect (rect, pt)) {
// Mouse cursor is within the bounds of menu item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class MenuItem extends Item {
Menu parent, menu;
long hBitmap;
int id, accelerator, userId, index;
int id, accelerator, userId;
ToolTip itemToolTip;
/* Image margin. */
final static int MARGIN_WIDTH = 1;
Expand Down Expand Up @@ -94,7 +94,7 @@ public class MenuItem extends Item {
public MenuItem (Menu parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
parent.createItem (this, (index = parent.getItemCount ()));
parent.createItem (this, parent.getItemCount ());
}

/**
Expand Down Expand Up @@ -136,16 +136,7 @@ public MenuItem (Menu parent, int style) {
public MenuItem (Menu parent, int style, int index) {
super (parent, checkStyle (style));
this.parent = parent;
parent.createItem (this, (this.index = index));
}

MenuItem (Menu parent, Menu menu, int style, int index) {
super (parent, checkStyle (style));
this.parent = parent;
this.menu = menu;
this.index = index;
if (menu != null) menu.cascade = this;
display.addMenuItem (this);
parent.createItem (this, index);
}

/**
Expand Down

0 comments on commit ad1e109

Please sign in to comment.