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 @@ -21,7 +21,7 @@
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
Expand All @@ -45,19 +45,19 @@
public class ResizeTracker extends AbstractTool implements DragTracker {
private final List<EditPart> m_operationSet;
private final int m_direction;
private final Object m_requestType;
private final String m_requestType;
private ChangeBoundsRequest m_request;

////////////////////////////////////////////////////////////////////////////
//
// Constructors
//
////////////////////////////////////////////////////////////////////////////
public ResizeTracker(int direction, Object requestType) {
public ResizeTracker(int direction, String requestType) {
this(null, direction, requestType);
}

public ResizeTracker(EditPart selectionEditPart, int direction, Object requestType) {
public ResizeTracker(GraphicalEditPart selectionEditPart, int direction, String requestType) {
if (selectionEditPart == null) {
m_operationSet = null;
} else {
Expand All @@ -69,27 +69,20 @@ public ResizeTracker(EditPart selectionEditPart, int direction, Object requestTy
setDefaultCursor(Cursors.getDirectionalCursor(direction));
}

@Override
protected String getCommandName() {
return null;
}

////////////////////////////////////////////////////////////////////////////
//
// Access
//
////////////////////////////////////////////////////////////////////////////
/**
* @return the type of {@link Request} that is generated by this {@link ResizeTracker}. For tests.
*/
public Object getRequestType() {
@Override
protected String getCommandName() {
return m_requestType;
}

/**
* @return the resize direction. For tests.
*/
public int getDirection() {
protected int getResizeDirection() {
return m_direction;
}

Expand Down Expand Up @@ -212,7 +205,7 @@ protected List<? extends EditPart> createOperationSet() {
EditPart part = I.next();
// find target for current EditPart
while (part != null) {
EditPart newPart = part.getTargetEditPart(getRequest());
EditPart newPart = part.getTargetEditPart(getSourceRequest());
if (newPart == part) {
break;
}
Expand All @@ -237,14 +230,14 @@ protected List<? extends EditPart> createOperationSet() {
@SuppressWarnings("deprecation")
private void updateRequest() {
// create request
if (getRequest() == null) {
if (getSourceRequest() == null) {
setRequest(new ChangeBoundsRequest(m_requestType));
getRequest().setResizeDirection(m_direction);
getSourceRequest().setResizeDirection(m_direction);
}
// set EditPart's
getRequest().setEditParts(getOperationSet());
getSourceRequest().setEditParts(getOperationSet());
// set stateMask
getRequest().setSnapToEnabled(getCurrentInput().isControlKeyDown());
getSourceRequest().setSnapToEnabled(getCurrentInput().isControlKeyDown());
// update request
Point corner = new Point();
Dimension resize = new Dimension();
Expand All @@ -264,9 +257,9 @@ private void updateRequest() {
resize.width += dragMoveDelta.width;
}
// set request data
getRequest().setMoveDelta(corner);
getRequest().setSizeDelta(resize);
getRequest().setLocation(getLocation());
getSourceRequest().setMoveDelta(corner);
getSourceRequest().setSizeDelta(resize);
getSourceRequest().setLocation(getLocation());
}

/**
Expand All @@ -278,7 +271,7 @@ protected Command getCommand() {
CompoundCommand command = new CompoundCommand();
//
for (EditPart part : getOperationSet()) {
command.add(part.getCommand(getRequest()));
command.add(part.getCommand(getSourceRequest()));
}
//
return command.unwrap();
Expand All @@ -297,7 +290,7 @@ protected Command getCommand() {
*/
protected void showSourceFeedback() {
for (EditPart part : getOperationSet()) {
part.showSourceFeedback(getRequest());
part.showSourceFeedback(getSourceRequest());
}
setShowingFeedback(true);
}
Expand All @@ -310,7 +303,7 @@ protected void eraseSourceFeedback() {
if (isShowingFeedback()) {
setShowingFeedback(false);
for (EditPart part : getOperationSet()) {
part.eraseSourceFeedback(getRequest());
part.eraseSourceFeedback(getSourceRequest());
}
}
}
Expand All @@ -332,7 +325,7 @@ private void setRequest(ChangeBoundsRequest request) {
m_request = request;
}

protected final ChangeBoundsRequest getRequest() {
protected final ChangeBoundsRequest getSourceRequest() {
return m_request;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ private Handle createResizeHandle(int direction) {
handle.setDragTracker(new ResizeTracker(direction, REQ_RESIZE) {
@Override
protected Command getCommand() {
return getLayoutEditPolicy().getResizeCommandImpl(getRequest());
return getLayoutEditPolicy().getResizeCommandImpl(getSourceRequest());
}

@Override
protected void showSourceFeedback() {
getLayoutEditPolicy().showResizeFeedback(getRequest());
getLayoutEditPolicy().showResizeFeedback(getSourceRequest());
setShowingFeedback(true);
}

@Override
protected void eraseSourceFeedback() {
if (isShowingFeedback()) {
setShowingFeedback(false);
getLayoutEditPolicy().eraseResizeFeedback(getRequest());
getLayoutEditPolicy().eraseResizeFeedback(getSourceRequest());
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.wb.layout.group/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.layout.group;singleton:=true
Bundle-Version: 1.10.100.qualifier
Bundle-Version: 1.10.200.qualifier
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-ActivationPolicy: lazy
Expand All @@ -14,7 +14,7 @@ Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.20.200,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.31.100,4.0.0)",
org.eclipse.jface;bundle-version="[3.34.0,4.0.0)",
org.eclipse.wb.core;bundle-version="[1.21.0,2.0.0)",
org.eclipse.wb.core;bundle-version="[1.25.0,2.0.0)",
org.eclipse.wb.core.java;bundle-version="[1.13.100,2.0.0)",
org.eclipse.draw2d;bundle-version="[3.20.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.21.100,4.0.0)"
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.wb.swing.MigLayout/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wb.swing.MigLayout;singleton:=true
Bundle-Version: 1.12.100.qualifier
Bundle-Version: 1.12.200.qualifier
Bundle-Activator: org.eclipse.wb.internal.swing.MigLayout.Activator
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-ActivationPolicy: lazy
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.21.0,2.0.0)",
org.eclipse.wb.core;bundle-version="[1.25.0,2.0.0)",
org.eclipse.wb.swing;bundle-version="[1.10.200,2.0.0)",
org.eclipse.draw2d;bundle-version="[3.20.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.21.100,4.0.0)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ public GraphicalRobot toResizeHandle(Object object, final Object type, final int
Predicate<Handle> predicate = handle -> {
if (handle.getDragTracker() instanceof ResizeTracker) {
ResizeTracker resizeTracker = (ResizeTracker) handle.getDragTracker();
return resizeTracker.getDirection() == direction
&& Objects.equals(resizeTracker.getRequestType(), type);
return getResizeDirection(resizeTracker) == direction
&& Objects.equals(getCommandName(resizeTracker), type);
}
return false;
};
Expand All @@ -265,6 +265,14 @@ public GraphicalRobot toResizeHandle(Object object, final Object type, final int
return this;
}

private int getResizeDirection(ResizeTracker resizeTracker) {
return (int) ReflectionUtils.invokeMethodEx(resizeTracker, "getResizeDirection()");
}

private String getCommandName(ResizeTracker resizeTracker) {
return (String) ReflectionUtils.invokeMethodEx(resizeTracker, "getCommandName()");
}

/**
* Informs that RESIZE should be performed, using standard {@link ResizeHandle}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void setUp() throws Exception {
m_viewport = m_viewer.getControl().getViewport();
}

private void setUp(int direction, Object type) {
private void setUp(int direction, String type) {
m_direction = direction;
m_type = type;
m_domain.setActiveTool(new ResizeTracker(direction, type));
Expand Down
Loading