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
Expand Up @@ -12,13 +12,9 @@
*******************************************************************************/
package org.eclipse.wb.internal.draw2d;

import org.eclipse.wb.draw2d.FigureUtils;

import org.eclipse.draw2d.EventDispatcher;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.TraverseEvent;
Expand Down Expand Up @@ -221,17 +217,7 @@ private <T extends Object> void sendEvent(Runnable event,
m_targetFigure = m_captureFigure == null ? m_cursorFigure : m_captureFigure;
//
if (m_targetFigure != null) {
m_currentEvent = new MouseEvent(null, m_targetFigure, e);
//
Rectangle bounds = m_targetFigure.getBounds();
Point location = new Point(m_currentEvent.x - bounds.x, m_currentEvent.y - bounds.y);
location.x += m_canvas.getViewport().getHorizontalRangeModel().getValue();
location.y += m_canvas.getViewport().getVerticalRangeModel().getValue();
FigureUtils.translateAbsoluteToFigure(m_targetFigure, location);
//
m_currentEvent.x = location.x;
m_currentEvent.y = location.y;
//
m_currentEvent = new MouseEvent(this, m_targetFigure, e);
event.run();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,9 @@ protected void paintClientArea(Graphics graphics) {
* @return the {@link Rectangle} of title.
*/
private Rectangle getTitleRectangle() {
Rectangle r = getClientArea().getCopy();
translateToRelative(r);
Rectangle r = Rectangle.SINGLETON;
r.setBounds(getClientArea());
translateToParent(r);
r.height = m_titleHeight;
return r;
}
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 All @@ -17,6 +17,7 @@
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.MouseListener;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Image;
Expand Down Expand Up @@ -48,7 +49,12 @@ public StackLayoutNavigationFigure(StackLayoutSelectionEditPolicy<?> policy) {
@Override
public void mousePressed(MouseEvent event) {
event.consume();
if (event.x < WIDTH) {
//
Point location = Point.SINGLETON;
location.setLocation(event.x, event.y);
translateFromParent(location);
//
if (location.x < WIDTH) {
m_policy.showPrevComponent();
} else {
m_policy.showNextComponent();
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.wb.swing/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wb.swing;singleton:=true
Bundle-Version: 1.10.200.qualifier
Bundle-Version: 1.10.300.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.wb.internal.swing.Activator
Bundle-Vendor: %providerName
Expand Down Expand Up @@ -90,7 +90,7 @@ Import-Package: org.apache.commons.collections4;version="[4.4.0,5.0.0)",
Require-Bundle: org.eclipse.ui;bundle-version="[3.206.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.31.100,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.20.200,4.0.0)",
org.eclipse.wb.core;bundle-version="[1.20.0,2.0.0)";visibility:=reexport,
org.eclipse.wb.core;bundle-version="[1.21.0,2.0.0)";visibility:=reexport,
org.eclipse.wb.core.ui;bundle-version="[1.10.800,2.0.0)";visibility:=reexport,
org.eclipse.wb.core.java;bundle-version="[1.13.100,2.0.0)";visibility:=reexport,
org.eclipse.draw2d;bundle-version="[3.20.0,4.0.0)",
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 All @@ -17,6 +17,7 @@
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.MouseListener;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Image;

Expand Down Expand Up @@ -46,7 +47,12 @@ public CardNavigationFigure(CardLayoutSelectionEditPolicy policy) {
@Override
public void mousePressed(MouseEvent event) {
event.consume();
if (event.x < WIDTH) {
//
Point location = Point.SINGLETON;
location.setLocation(event.x, event.y);
translateFromParent(location);
//
if (location.x < WIDTH) {
m_policy.showPrevComponent();
} else {
m_policy.showNextComponent();
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 @@ -127,41 +127,41 @@ public String toString() {
{
m_sender.moveTo(15, 15);
//
expectedLogger.log("mouseMove = MouseEvent(5,5) to Figure: figure11");
expectedLogger.log("mouseMove = MouseEvent(15,15) to Figure: figure11");
actualLogger.assertEquals(expectedLogger);
}
// click over "figure11"
{
m_sender.click(20, 20, 3);
//
expectedLogger.log("mouseDown = MouseEvent(10,10) to Figure: figure11");
expectedLogger.log("mouseUp = MouseEvent(10,10) to Figure: figure11");
expectedLogger.log("mouseDown = MouseEvent(20,20) to Figure: figure11");
expectedLogger.log("mouseUp = MouseEvent(20,20) to Figure: figure11");
actualLogger.assertEquals(expectedLogger);
}
// double click over "figure21"
{
m_sender.doubleClick(60, 60, 2);
//
expectedLogger.log("mouseDown = MouseEvent(10,10) to Figure: figure21");
expectedLogger.log("mouseUp = MouseEvent(10,10) to Figure: figure21");
expectedLogger.log("mouseDown = MouseEvent(10,10) to Figure: figure21");
expectedLogger.log("mouseDoubleClick = MouseEvent(10,10) to Figure: figure21");
expectedLogger.log("mouseUp = MouseEvent(10,10) to Figure: figure21");
expectedLogger.log("mouseDown = MouseEvent(60,60) to Figure: figure21");
expectedLogger.log("mouseUp = MouseEvent(60,60) to Figure: figure21");
expectedLogger.log("mouseDown = MouseEvent(60,60) to Figure: figure21");
expectedLogger.log("mouseDoubleClick = MouseEvent(60,60) to Figure: figure21");
expectedLogger.log("mouseUp = MouseEvent(60,60) to Figure: figure21");
actualLogger.assertEquals(expectedLogger);
}
// move to "figure12"
{
m_sender.moveTo(420, 330);
//
expectedLogger.log("mouseMove = MouseEvent(20,30) to Figure: figure12");
expectedLogger.log("mouseMove = MouseEvent(420,330) to Figure: figure12");
actualLogger.assertEquals(expectedLogger);
}
// click over "figure22"
{
m_sender.click(200, 300, 5);
//
expectedLogger.log("mouseDown = MouseEvent(50,50) to Figure: figure22");
expectedLogger.log("mouseUp = MouseEvent(50,50) to Figure: figure22");
expectedLogger.log("mouseDown = MouseEvent(200,300) to Figure: figure22");
expectedLogger.log("mouseUp = MouseEvent(200,300) to Figure: figure22");
actualLogger.assertEquals(expectedLogger);
}
// move to point without figures
Expand Down
Loading