mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-93130
This commit is contained in:
+9
@@ -229,6 +229,9 @@ public abstract class InputTool {
|
||||
protected void handleDragInProgress() {
|
||||
}
|
||||
|
||||
protected void handlePopup() {
|
||||
}
|
||||
|
||||
protected void handleDoubleClick(int button) {
|
||||
}
|
||||
|
||||
@@ -275,6 +278,12 @@ public abstract class InputTool {
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePopup(MouseEvent event, EditableArea area) throws Exception {
|
||||
setArea(area);
|
||||
setEvent(event);
|
||||
handlePopup();
|
||||
}
|
||||
|
||||
public void mouseDoubleClick(MouseEvent event, EditableArea area) throws Exception {
|
||||
setArea(area);
|
||||
setEvent(event);
|
||||
|
||||
+17
-6
@@ -20,7 +20,6 @@ import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.designer.propertyTable.InplaceContext;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPopupMenu;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
@@ -88,6 +87,14 @@ public class SelectionTool extends InputTool {
|
||||
handleMove(); // hack: update cursor
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePopup() {
|
||||
ActionManager actionManager = ActionManager.getInstance();
|
||||
ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(myArea.getPopupPlace(), myArea.getPopupActions());
|
||||
MouseEvent event = (MouseEvent)myInputEvent;
|
||||
popupMenu.getComponent().show(myArea.getNativeComponent(), event.getX(), event.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleDoubleClick(int button) {
|
||||
if (button == MouseEvent.BUTTON1 && myToolProvider != null && !myArea.isTree()) {
|
||||
@@ -149,11 +156,6 @@ public class SelectionTool extends InputTool {
|
||||
myTracker.mouseUp(event, area);
|
||||
}
|
||||
super.mouseUp(event, area);
|
||||
if (event.isPopupTrigger() || (SystemInfo.isMac && event.getButton() == MouseEvent.BUTTON3)) {
|
||||
ActionManager actionManager = ActionManager.getInstance();
|
||||
ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(area.getPopupPlace(), area.getPopupActions());
|
||||
popupMenu.getComponent().show(area.getNativeComponent(), event.getX(), event.getY());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -172,6 +174,15 @@ public class SelectionTool extends InputTool {
|
||||
super.mouseDrag(event, area);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePopup(MouseEvent event, EditableArea area) throws Exception {
|
||||
if (myTracker != null) {
|
||||
myTracker.mousePopup(event, area);
|
||||
}
|
||||
super.mousePopup(event, area);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent event, EditableArea area) throws Exception {
|
||||
super.mouseDoubleClick(event, area);
|
||||
|
||||
+9
@@ -61,9 +61,15 @@ public abstract class ToolProvider {
|
||||
switch (event.getID()) {
|
||||
case MouseEvent.MOUSE_PRESSED:
|
||||
myTool.mouseDown(event, area);
|
||||
if (event.isPopupTrigger()) {
|
||||
myTool.mousePopup(event, area);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_RELEASED:
|
||||
myTool.mouseUp(event, area);
|
||||
if (event.isPopupTrigger()) {
|
||||
myTool.mousePopup(event, area);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_ENTERED:
|
||||
myTool.mouseEntered(event, area);
|
||||
@@ -75,6 +81,9 @@ public abstract class ToolProvider {
|
||||
if (event.getClickCount() == 2) {
|
||||
myTool.mouseDoubleClick(event, area);
|
||||
}
|
||||
if (event.isPopupTrigger()) {
|
||||
myTool.mousePopup(event, area);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
myTool.mouseMove(event, area);
|
||||
|
||||
Reference in New Issue
Block a user