Skip to content
Open
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 @@ -15,6 +15,7 @@
import org.eclipse.wb.core.gef.part.AbstractComponentEditPart;
import org.eclipse.wb.core.model.JavaInfo;
import org.eclipse.wb.draw2d.FigureUtils;
import org.eclipse.wb.gef.graphical.handles.DesignHandle;
import org.eclipse.wb.internal.core.DesignerPlugin;
import org.eclipse.wb.internal.core.editor.actions.errors.ErrorsAction;
import org.eclipse.wb.internal.core.utils.execution.ExecutionUtils;
Expand Down Expand Up @@ -114,7 +115,7 @@ public void relocate(IFigure target) {
target.setBounds(new Rectangle(5, componentArea.bottom() - 5 - 16, 16, 16));
}
};
m_figure = new org.eclipse.wb.gef.graphical.handles.Handle(m_editPart, locator) {
m_figure = new DesignHandle(m_editPart, locator) {
@Override
protected void paintClientArea(Graphics graphics) {
Image icon = DesignerPlugin.getImage("actions/errors/errors.gif");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2011, 2026 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
* https://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Google, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.gef.graphical.handles;

import org.eclipse.draw2d.Locator;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Tool;
import org.eclipse.gef.handles.AbstractHandle;

/**
* {@link Handle} will add an {@link IAncestorListener} to the owner's figure, and will
* automatically revalidate this handle whenever the owner's figure moves.
*
* @author lobas_av
* @coverage gef.graphical
*/
public abstract class DesignHandle extends AbstractHandle {

////////////////////////////////////////////////////////////////////////////
//
// Constructor
//
////////////////////////////////////////////////////////////////////////////
/**
* Creates a handle for the given <code>{@link GraphicalEditPart}</code> using the given
* <code>{@link Locator}</code>.
*/
public DesignHandle(GraphicalEditPart owner, Locator locator) {
super(owner, locator);
}

/**
* Creates a new drag tracker {@link Tool} to be returned by {@link #getDragTracker()}.
*/
@Override
protected final DragTracker createDragTracker() {
return null;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author lobas_av
* @coverage gef.graphical
*/
public class MoveHandle extends Handle {
public class MoveHandle extends DesignHandle {
////////////////////////////////////////////////////////////////////////////
//
// Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author lobas_av
* @coverage gef.graphical
*/
public class SideResizeHandle extends Handle {
public class SideResizeHandle extends DesignHandle {
////////////////////////////////////////////////////////////////////////////
//
// Constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author lobas_av
* @coverage gef.graphical
*/
public abstract class SquareHandle extends Handle {
public abstract class SquareHandle extends DesignHandle {
/**
* The default size for square handles.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.wb.core.gef.command.EditCommand;
import org.eclipse.wb.draw2d.FigureUtils;
import org.eclipse.wb.gef.graphical.handles.DesignHandle;
import org.eclipse.wb.gef.graphical.handles.MoveHandle;
import org.eclipse.wb.gef.graphical.policies.SelectionEditPolicy;
import org.eclipse.wb.gef.graphical.tools.ResizeTracker;
Expand Down Expand Up @@ -78,7 +79,7 @@ protected List<Handle> createStaticHandles() {
return Collections.emptyList();
}
// prepare handle
org.eclipse.wb.gef.graphical.handles.Handle resizeHandle = new org.eclipse.wb.gef.graphical.handles.Handle(getHost(), target -> {
DesignHandle resizeHandle = new DesignHandle(getHost(), target -> {
// prepare bounds (relative to page)
Rectangle bounds = m_line.getBounds().getCopy();
if (m_line.isHorizontal()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2025 Google, Inc. and others.
* Copyright (c) 2011, 2026 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 @@ -230,6 +230,10 @@ protected void fetchDesignViewers() {
ReflectionUtils.getFieldObject(designComposite, "m_viewersComposite");
m_viewerCanvas =
(GraphicalViewer) ReflectionUtils.getFieldObject(viewersComposite, "m_viewer");
m_viewerCanvas.addSelectionChangedListener(event -> {
// wait for handlers to update after selection
m_viewerCanvas.getControl().getLightweightSystem().getUpdateManager().performUpdate();
});
assertNotNull(m_viewerCanvas);
assertNotNull(m_viewerCanvas.getEditDomain());
// prepare sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public void setUp() throws Exception {
m_actualLogger = new CursorLogger();
m_viewer = new TestGraphicalViewer(m_shell, m_actualLogger);
m_viewer.getControl().setSize(500, 400);
m_viewer.addSelectionChangedListener(event -> {
// wait for handlers to update after selection
m_viewer.getControl().getLightweightSystem().getUpdateManager().performUpdate();
});
// set edit domain
m_domain = new EditDomain() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public void test_DragTracker_MoveHandle() throws Exception {
//
MoveHandle handle = new MoveHandle(childEditPart);
handle.setDragTracker(new RequestDragTracker(childEditPart));
handle.validate();
LayerManager.Helper.find(m_viewer).getLayer(LayerConstants.HANDLE_LAYER).add(handle);
//
RequestsLogger expectedLogger = new RequestsLogger();
Expand Down
Loading