MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / triggerPopupMenu

Method triggerPopupMenu

ij/src/main/java/ij/gui/Toolbar.java:1161–1234  ·  view source on GitHub ↗
(int newTool, MouseEvent e, boolean isRightClick, boolean isLongPress)

Source from the content-addressed store, hash-verified

1159 }
1160
1161 public void triggerPopupMenu(int newTool, MouseEvent e, boolean isRightClick, boolean isLongPress) {
1162 mpPrevious = current;
1163 if (isMacroTool(newTool)) {
1164 String name = names[newTool];
1165 if (newTool==UNUSED || name.contains("Unused Tool"))
1166 return;
1167 if (name.indexOf("Action Tool")!=-1) {
1168 if (e.isPopupTrigger()||e.isMetaDown()) {
1169 name = name.endsWith(" ")?name:name+" ";
1170 tools[newTool].runMacroTool(name+"Options");
1171 } else {
1172 //drawTool(newTool, true);
1173 //IJ.wait(50);
1174 drawTool(newTool, false);
1175 runMacroTool(newTool);
1176 }
1177 return;
1178 } else {
1179 name = name.endsWith(" ")?name:name+" ";
1180 tools[newTool].runMacroTool(name+"Selected");
1181 }
1182 }
1183 if (!isLongPress)
1184 setTool2(newTool);
1185 int x = e.getX();
1186 int y = e.getY();
1187 if (current==RECTANGLE && isRightClick) {
1188 rectItem.setState(rectType==RECT_ROI);
1189 roundRectItem.setState(rectType==ROUNDED_RECT_ROI);
1190 rotatedRectItem.setState(rectType==ROTATED_RECT_ROI);
1191 if (IJ.isMacOSX()) IJ.wait(10);
1192 rectPopup.show(e.getComponent(),x,y);
1193 mouseDownTime = 0L;
1194 }
1195 if (current==OVAL && isRightClick) {
1196 ovalItem.setState(ovalType==OVAL_ROI);
1197 ellipseItem.setState(ovalType==ELLIPSE_ROI);
1198 brushItem.setState(ovalType==BRUSH_ROI);
1199 if (IJ.isMacOSX()) IJ.wait(10);
1200 ovalPopup.show(e.getComponent(),x,y);
1201 mouseDownTime = 0L;
1202 }
1203 if (current==POINT && isRightClick) {
1204 pointItem.setState(!multiPointMode);
1205 multiPointItem.setState(multiPointMode);
1206 if (IJ.isMacOSX()) IJ.wait(10);
1207 pointPopup.show(e.getComponent(),x,y);
1208 mouseDownTime = 0L;
1209 }
1210 if (isLine(current) && isRightClick) {
1211 straightLineItem.setState(lineType==LINE&&!arrowMode);
1212 polyLineItem.setState(lineType==POLYLINE);
1213 freeLineItem.setState(lineType==FREELINE);
1214 arrowItem.setState(lineType==LINE&&arrowMode);
1215 if (IJ.isMacOSX()) IJ.wait(10);
1216 linePopup.show(e.getComponent(),x,y);
1217 mouseDownTime = 0L;
1218 }

Callers 2

mousePressedMethod · 0.95
runMethod · 0.95

Calls 15

isMacroToolMethod · 0.95
runMacroToolMethod · 0.95
drawToolMethod · 0.95
setTool2Method · 0.95
isMacOSXMethod · 0.95
waitMethod · 0.95
isLineMethod · 0.95
isPlugInToolMethod · 0.95
setStateMethod · 0.80
showPopupMenuMethod · 0.80
getXMethod · 0.65
getYMethod · 0.65

Tested by

no test coverage detected