MCPcopy Create free account
hub / github.com/dorkbox/SystemTray / get

Method get

src/dorkbox/systemTray/Menu.java:283–308  ·  view source on GitHub ↗

Gets the menu entry or sub-menu for a specified index (zero-index), ignoring status and separators @param menuIndex the menu entry index to use to retrieve the menu entry.

(final int menuIndex)

Source from the content-addressed store, hash-verified

281 * @param menuIndex the menu entry index to use to retrieve the menu entry.
282 */
283 public
284 Entry get(final int menuIndex) {
285 if (menuIndex < 0) {
286 return null;
287 }
288
289 synchronized (menuEntries) {
290 // access on this object must be synchronized for object visibility
291 if (!menuEntries.isEmpty()) {
292 int count = 0;
293 for (Entry entry : menuEntries) {
294 if (entry instanceof Separator || entry instanceof Status) {
295 continue;
296 }
297
298 if (count == menuIndex) {
299 return entry;
300 }
301
302 count++;
303 }
304 }
305 }
306
307 return null;
308 }
309
310 /**
311 * @return a copy of all of the current menu entries. It is safe to modify any of the entries in this list without concerning yourself with synchronize.

Callers 7

getFirstMethod · 0.95
build.gradle.ktsFile · 0.45
setStatusMethod · 0.45
bindMethod · 0.45
addMethod · 0.45
getLastMethod · 0.45
removeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected