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, 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 @@ -85,7 +85,10 @@ public boolean understandsRequest(Request request) {
@Override
//@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "BC_UNCONFIRMED_CAST")
public Command getCommand(Request request) {
return getResizeCommand((ChangeBoundsRequest) request);
if (REQ_RESIZE.equals(request.getType())) {
return getResizeCommand((ChangeBoundsRequest) request);
}
return null;
}

@Override
Expand Down
13 changes: 0 additions & 13 deletions org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -223,18 +222,6 @@ private List<EditPolicy> getUnderstandingPolicies(Request request) {
// Request/Command
//
////////////////////////////////////////////////////////////////////////////
/**
* Returns the {@link Command} to perform the specified {@link Request} or <code>null</code>.
*/
public Command getCommand(Request request) {
for (EditPolicy editPolicy : getUnderstandingPolicies(request)) {
Command command = editPolicy.getCommand(request);
if (command != null) {
return command;
}
}
return null;
}

/**
* Return the <code>{@link EditPart}</code> that should be used as the <i>target</i> for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,23 @@ public org.eclipse.wb.gef.core.EditPart getTargetEditPart(Request request) {
@Override
//@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "BC_UNCONFIRMED_CAST")
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
Object type = request.getType();
if (type == RequestConstants.REQ_CREATE) {
if (REQ_CREATE.equals(type)) {
return getCreateCommand((CreateRequest) request);
}
if (type == PasteRequest.REQ_PASTE) {
if (PasteRequest.REQ_PASTE.equals(type)) {
return getPasteCommand((PasteRequest) request);
}
if (type == RequestConstants.REQ_MOVE) {
if (REQ_MOVE.equals(type)) {
return getMoveCommand((ChangeBoundsRequest) request);
}
if (type == RequestConstants.REQ_ADD) {
if (REQ_ADD.equals(type)) {
return getAddCommand((ChangeBoundsRequest) request);
}
if (type == RequestConstants.REQ_ORPHAN) {
if (REQ_ORPHAN.equals(type)) {
return getOrphanCommand((GroupRequest) request);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ public org.eclipse.wb.gef.core.EditPart getTargetEditPart(Request request) {
*/
@Override
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
// prepare drop location
DropRequest dropRequest = (DropRequest) request;
Point location = dropRequest.getLocation();
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 @@ -102,6 +102,9 @@ private List<EditPart> getReferenceChildren(Request request) {
////////////////////////////////////////////////////////////////////////////
@Override
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
Command command = super.getCommand(request);
if (command == null) {
command = getCommand(request, getReferenceObject(request));
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 @@ -96,7 +96,10 @@ public boolean understandsRequest(Request request) {
@Override
//@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "BC_UNCONFIRMED_CAST")
public Command getCommand(Request request) {
return getResizeCommand((ChangeBoundsRequest) request);
if (REQ_RESIZE.equals(request.getType())) {
return getResizeCommand((ChangeBoundsRequest) request);
}
return null;
}

@Override
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, 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 @@ -173,6 +173,9 @@ private static double getOffset(int size, double offsetPercent) {
////////////////////////////////////////////////////////////////////////////
@Override
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
if (m_activeFeedback != null) {
Command command = getCommand(request, m_activeFeedback.getData());
if (command != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc.
* 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 @@ -59,6 +59,9 @@ protected final boolean isGoodReferenceChild(Request request, EditPart editPart)
////////////////////////////////////////////////////////////////////////////
@Override
public final Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
if (!isEmpty()) {
return null;
}
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, 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 @@ -89,6 +89,9 @@ protected void eraseLayoutTargetFeedback(Request request) {
////////////////////////////////////////////////////////////////////////////
@Override
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
if (!m_container.isEmpty()) {
return null;
}
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 @@ -275,20 +275,24 @@ private int[] setupResizeEdges(int direction) {
@Override
public Command getCommand(Request request) {
if (REQ_RESIZE.equals(request.getType())) {
// resizing multiple components is not supported by Matisse
if (((ChangeBoundsRequest) request).getEditParts().size() > 1) {
return null;
}
return new EditCommand(m_layout.getAdapter(JavaInfo.class)) {
@Override
protected void executeEdit() throws Exception {
m_layout.command_commit();
}
};
return getResizeCommand((ChangeBoundsRequest) request);
}
return null;
}

private Command getResizeCommand(ChangeBoundsRequest request) {
// resizing multiple components is not supported by Matisse
if (request.getEditParts().size() > 1) {
return null;
}
return new EditCommand(m_layout.getAdapter(JavaInfo.class)) {
@Override
protected void executeEdit() throws Exception {
m_layout.command_commit();
}
};
}

////////////////////////////////////////////////////////////////////////////
//
// Alignment figures
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.wb.rcp.nebula/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.rcp.nebula;singleton:=true
Bundle-Version: 1.12.0.qualifier
Bundle-Version: 1.12.100.qualifier
Bundle-Activator: org.eclipse.wb.internal.rcp.nebula.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui;bundle-version="[3.206.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc.
* 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 @@ -86,19 +86,23 @@ protected ILayoutRequestValidator getRequestValidator() {
////////////////////////////////////////////////////////////////////////////
@Override
protected Command getCommand(Request request, Object referenceObject) {
if (request instanceof final CollapsibleButtonDropRequest buttonRequest) {
final ControlInfo reference = (ControlInfo) referenceObject;
return new EditCommand(m_collButtons) {
@Override
protected void executeEdit() throws Exception {
ControlInfo newButton = CollapsibleButtonsInfo.createButton(m_collButtons, reference);
buttonRequest.setButton(newButton);
}
};
if (CollapsibleButtonDropRequest.TYPE.equals(request.getType())) {
return getDropCommand((CollapsibleButtonDropRequest) request, referenceObject);
}
return super.getCommand(request, referenceObject);
}

private Command getDropCommand(CollapsibleButtonDropRequest buttonRequest, Object referenceObject) {
final ControlInfo reference = (ControlInfo) referenceObject;
return new EditCommand(m_collButtons) {
@Override
protected void executeEdit() throws Exception {
ControlInfo newButton = CollapsibleButtonsInfo.createButton(m_collButtons, reference);
buttonRequest.setButton(newButton);
}
};
}

@Override
protected Command getMoveCommand(Object moveObject, Object referenceObject) {
final ControlInfo button = (ControlInfo) moveObject;
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, 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 @@ -78,6 +78,9 @@ protected void eraseLayoutTargetFeedback(Request request) {
////////////////////////////////////////////////////////////////////////////
@Override
public Command getCommand(Request request) {
if (!understandsRequest(request)) {
return null;
}
if (m_form.getHeadClient() != null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public boolean understandsRequest(Request request) {

@Override
public Command getCommand(final Request request) {
return getResizeCommand((ChangeBoundsRequest) request);
if (REQ_RESIZE.equals(request.getType())) {
return getResizeCommand((ChangeBoundsRequest) request);
}
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc.
* 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 @@ -89,19 +89,23 @@ protected ILayoutRequestValidator getRequestValidator() {
////////////////////////////////////////////////////////////////////////////
@Override
protected Command getCommand(Request request, Object referenceObject) {
if (request instanceof final DialogButtonDropRequest buttonRequest) {
final ControlInfo reference = (ControlInfo) referenceObject;
return new EditCommand(m_composite) {
@Override
protected void executeEdit() throws Exception {
ControlInfo newButton = DialogInfo.createButtonOnButtonBar(m_composite, reference);
buttonRequest.setButton(newButton);
}
};
if (DialogButtonDropRequest.TYPE.equals(request.getType())) {
return getDropCommand((DialogButtonDropRequest) request, referenceObject);
}
return super.getCommand(request, referenceObject);
}

private Command getDropCommand(DialogButtonDropRequest buttonRequest, Object referenceObject) {
final ControlInfo reference = (ControlInfo) referenceObject;
return new EditCommand(m_composite) {
@Override
protected void executeEdit() throws Exception {
ControlInfo newButton = DialogInfo.createButtonOnButtonBar(m_composite, reference);
buttonRequest.setButton(newButton);
}
};
}

@Override
protected Command getMoveCommand(Object moveObject, Object referenceObject) {
final ControlInfo button = (ControlInfo) moveObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2024 Google, Inc.
* 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 @@ -86,20 +86,24 @@ protected ILayoutRequestValidator getRequestValidator() {
////////////////////////////////////////////////////////////////////////////
@Override
protected Command getCommand(Request request, Object referenceObject) {
if (request instanceof final ActionDropRequest actionRequest) {
final ContributionItemInfo reference = (ContributionItemInfo) referenceObject;
return new EditCommand(m_manager) {
@Override
protected void executeEdit() throws Exception {
ActionContributionItemInfo newItem =
m_manager.command_CREATE(actionRequest.getAction(), reference);
actionRequest.setItem(newItem);
}
};
if (ActionDropRequest.TYPE.equals(request.getType())) {
return getDropCommand((ActionDropRequest) request, referenceObject);
}
return super.getCommand(request, referenceObject);
}

private Command getDropCommand(ActionDropRequest actionRequest, Object referenceObject) {
final ContributionItemInfo reference = (ContributionItemInfo) referenceObject;
return new EditCommand(m_manager) {
@Override
protected void executeEdit() throws Exception {
ActionContributionItemInfo newItem =
m_manager.command_CREATE(actionRequest.getAction(), reference);
actionRequest.setItem(newItem);
}
};
}

@Override
protected void command_CREATE(ContributionItemInfo newObject, ContributionItemInfo referenceObject)
throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ public boolean understandsRequest(Request request) {

@Override
public Command getCommand(final Request request) {
return getResizeCommand((ChangeBoundsRequest) request);
if (REQ_RESIZE.equals(request.getType())) {
return getResizeCommand((ChangeBoundsRequest) request);
}
return null;
}

@Override
Expand Down
Loading
Loading