Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc. and others.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -197,17 +197,17 @@ protected void updateTargetUnderMouse() {
// find on clickable layer
EditPart editPart =
getCurrentViewer().findTargetEditPart(
getCurrentInput().getMouseLocation().x,
getCurrentInput().getMouseLocation().y,
getLocation().x,
getLocation().y,
getExclusionSet(),
getTargetingConditional(),
IEditPartViewer.CLICKABLE_LAYER);
// common find target part
if (editPart == null) {
editPart =
getCurrentViewer().findTargetEditPart(
getCurrentInput().getMouseLocation().x,
getCurrentInput().getMouseLocation().y,
getLocation().x,
getLocation().y,
getExclusionSet(),
getTargetingConditional());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2023 Google, Inc.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -47,7 +47,7 @@ protected boolean handleButtonDown(int button) {
if (button == 1) {
if (m_state == STATE_INITIAL) {
m_state = STATE_DRAG;
((AbstractCreateRequest) getTargetRequest()).setLocation(getLocation());
((AbstractCreateRequest) getTargetRequest()).setLocation(getAbsoluteLocation());
lockTargetEditPart(getTargetEditPart());
}
} else {
Expand Down Expand Up @@ -117,13 +117,13 @@ protected void updateTargetRequest() {
super.updateTargetRequest();
AbstractCreateRequest request = (AbstractCreateRequest) getTargetRequest();
if (m_state == STATE_DRAG_IN_PROGRESS) {
Point start = getStartLocation();
Point start = getAbsoluteStartLocation();
Rectangle bounds = new Rectangle(start, getDragMoveDelta());
request.setLocation(bounds.getLocation());
request.setSize(bounds.getSize());
} else {
request.setSize(null);
request.setLocation(getLocation());
request.setLocation(getAbsoluteLocation());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected void updateTargetRequest() {
ChangeBoundsRequest request = (ChangeBoundsRequest) getTargetRequest();
request.setEditParts(getOperationSet());
request.setMoveDelta(new Point(getDragMoveDelta()));
request.setLocation(getLocation());
request.setLocation(getAbsoluteLocation());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2023 Google, Inc.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -111,7 +111,7 @@ protected boolean handleDoubleClick(int button) {
if (button == 1) {
SelectionRequest request = new SelectionRequest();
request.setType(RequestConstants.REQ_OPEN);
request.setLocation(getLocation());
request.setLocation(getAbsoluteLocation());
m_sourceEditPart.performRequest(request);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ protected void updateTargetUnderMouse() {
if (!m_isLockTarget) {
org.eclipse.wb.gef.core.EditPart editPart =
getCurrentViewer().findTargetEditPart(
getCurrentInput().getMouseLocation().x,
getCurrentInput().getMouseLocation().y,
getLocation().x,
getLocation().y,
getExclusionSet(),
getTargetingConditional());
if (editPart != null) {
Expand Down
22 changes: 11 additions & 11 deletions org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/tools/Tool.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc. and others.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -105,8 +105,8 @@ protected void handleFinished() {
event.display = Display.getCurrent();
event.widget = getCurrentViewer().getControl();
event.type = SWT.MouseMove;
event.x = getCurrentInput().getMouseLocation().x;
event.y = getCurrentInput().getMouseLocation().y;
event.x = getLocation().x;
event.y = getLocation().y;
event.button = m_button;
event.stateMask = m_stateMask;
}
Expand Down Expand Up @@ -242,8 +242,8 @@ private void setEvent(MouseEvent event) {

protected boolean movedPastThreshold() {
if (!getFlag(FLAG_PAST_THRESHOLD)) {
Point start = getStartLocation();
Point end = getLocation();
Point start = getAbsoluteStartLocation();
Point end = getAbsoluteLocation();
setFlag(FLAG_PAST_THRESHOLD, Math.abs(start.x - end.x) > DRAG_THRESHOLD || Math.abs(start.y - end.y) > DRAG_THRESHOLD);
}
return getFlag(FLAG_PAST_THRESHOLD);
Expand Down Expand Up @@ -351,19 +351,19 @@ public void viewerExited(MouseEvent event, EditPartViewer viewer) {
/**
* Returns the current x, y <b>*absolute*</b> position of the mouse cursor.
*/
public final Point getLocation() {
return new Point(getCurrentInput().getMouseLocation().x + getCurrentViewer().getHOffset(),
getCurrentInput().getMouseLocation().y + getCurrentViewer().getVOffset());
public final Point getAbsoluteLocation() {
return new Point(getLocation().x + getCurrentViewer().getHOffset(),
getLocation().y + getCurrentViewer().getVOffset());
}

/**
* Returns the starting mouse <b>*absolute*</b> location for the current tool operation. This is
* typically the mouse location where the user first pressed a mouse button. This is important for
* tools that interpret mouse drags.
*/
protected Point getStartLocation() {
return new Point(super.getStartLocation().x + getCurrentViewer().getHOffset(),
super.getStartLocation().y + getCurrentViewer().getVOffset());
protected Point getAbsoluteStartLocation() {
return new Point(getStartLocation().x + getCurrentViewer().getHOffset(),
getStartLocation().y + getCurrentViewer().getVOffset());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private IFigure getFeedbackPane() {
* bottom-right corner <code>(m_currentX, m_currentY)</code>.
*/
private Rectangle getMarqueeSelectionRectangle() {
return new Rectangle(getStartLocation(), getLocation());
return new Rectangle(getAbsoluteStartLocation(), getAbsoluteLocation());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc. and others.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -260,7 +260,7 @@ private void updateRequest() {
// set request data
getRequest().setMoveDelta(corner);
getRequest().setSizeDelta(resize);
getRequest().setLocation(getLocation());
getRequest().setLocation(getAbsoluteLocation());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected boolean handleButtonDown(int button) {
return true;
}
//
Point current = getCurrentInput().getMouseLocation();
Point current = getLocation();
if (getCurrentViewer() instanceof GraphicalViewer gv) {
Handle handle = (Handle) gv.findHandleAt(current);
if (handle != null) {
Expand Down Expand Up @@ -187,8 +187,8 @@ protected boolean handleViewerExited() {
if (m_state == STATE_DRAG || m_state == STATE_DRAG_IN_PROGRESS) {
// send low level event to give current tracker a chance to process 'mouse up' event.
Event event = new Event();
event.x = getCurrentInput().getMouseLocation().x;
event.y = getCurrentInput().getMouseLocation().y;
event.x = getLocation().x;
event.y = getLocation().y;
event.stateMask = m_stateMask;
event.button = m_button;
event.widget = getCurrentViewer().getControl();
Expand Down Expand Up @@ -220,7 +220,7 @@ protected Request createTargetRequest() {
protected void updateTargetRequest() {
super.updateTargetRequest();
SelectionRequest request = (SelectionRequest) getTargetRequest();
request.setLocation(getLocation());
request.setLocation(getAbsoluteLocation());
}

////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2023 Google, Inc.
* Copyright (c) 2011, 2025 Google, Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -48,7 +48,7 @@ protected boolean handleDoubleClick(int button) {
if (button == 1) {
SelectionRequest request = new SelectionRequest();
request.setType(RequestConstants.REQ_OPEN);
request.setLocation(getLocation());
request.setLocation(getAbsoluteLocation());
m_sourceEditPart.performRequest(request);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static Point getOffset(Figure containerFigure, ICompositeInfo composite)
public void buildContextMenu(IMenuManager manager) {
IEditPartViewer viewer = getHost().getViewer();
Tool tool = viewer.getEditDomain().getActiveTool();
Point location = tool.getLocation().getCopy();
Point location = tool.getAbsoluteLocation().getCopy();
final int percent = calcPercent(location);
// add actions
if (percent > 0) {
Expand Down
Loading