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 @@ -16,7 +16,6 @@
import org.eclipse.wb.core.gef.policy.PolicyUtils;
import org.eclipse.wb.core.model.JavaInfo;
import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator;
import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;
import org.eclipse.wb.gef.graphical.policies.LayoutEditPolicy;
import org.eclipse.wb.internal.core.DesignerPlugin;
Expand All @@ -36,6 +35,7 @@
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;

import org.apache.commons.lang3.ClassUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.eclipse.wb.core.model.JavaInfo;
import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator;
import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;
import org.eclipse.wb.internal.core.DesignerPlugin;
import org.eclipse.wb.internal.core.gef.part.nonvisual.NonVisualBeanEditPart;
Expand All @@ -27,6 +26,7 @@

import org.eclipse.gef.EditPart;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.eclipse.wb.core.model.JavaInfo;
import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator;
import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;
import org.eclipse.wb.internal.core.model.nonvisual.AbstractArrayObjectInfo;
import org.eclipse.wb.internal.core.model.variable.EmptyVariableSupport;
Expand All @@ -23,6 +22,7 @@

import org.eclipse.gef.EditPart;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;

/**
* Implementation of {@link ILayoutRequestValidator} for validate items for <i>array object</i>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*******************************************************************************/
package org.eclipse.wb.gef.core.policies;

import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;

/**
* Validator for known layout requests {@link Request#REQ_CREATE}, {@link Request#REQ_PASTE},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.eclipse.wb.gef.core.requests;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.DropRequest;
import org.eclipse.gef.requests.LocationRequest;

Expand Down Expand Up @@ -54,19 +53,4 @@ public Dimension getSize() {
public void setSize(Dimension size) {
m_size = size;
}

////////////////////////////////////////////////////////////////////////////
//
// State
//
////////////////////////////////////////////////////////////////////////////
/**
* Copies state from given {@link Request} into this one.
*/
public void copyStateFrom(Request _source) {
if (_source instanceof AbstractCreateRequest source) {
setLocation(source.getLocation());
setSize(source.getSize());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@
*******************************************************************************/
package org.eclipse.wb.gef.core.requests;

import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.requests.CreationFactory;

/**
* A {@link Request} to create a new object.
*
* @author lobas_av
* @coverage gef.core
* @deprecated Use {@link org.eclipse.gef.requests.CreateRequest CreateRequest}
* directly.
*/
public class CreateRequest extends AbstractCreateRequest {
private static final int SNAP_TO = 16;
private final CreationFactory m_factory;
private Object m_newObject;
private Object m_selectObject;
private int m_flags = 0;
@Deprecated(since = "2026-12", forRemoval = true)
public class CreateRequest extends org.eclipse.gef.requests.CreateRequest {

////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -36,66 +33,9 @@ public class CreateRequest extends AbstractCreateRequest {
/**
* Constructs a {@link CreateRequest} with the specified <i>type</i> and <i>factory</i>.
*/
@Deprecated(since="2026-12", forRemoval = true)
public CreateRequest(CreationFactory factory) {
super(RequestConstants.REQ_CREATE);
m_factory = factory;
}

////////////////////////////////////////////////////////////////////////////
//
// Access
//
////////////////////////////////////////////////////////////////////////////
/**
* Gets the new object from the factory and returns that object.
*/
public Object getNewObject() {
if (m_newObject == null) {
m_newObject = m_factory.getNewObject();
m_selectObject = m_newObject;
}
return m_newObject;
}

/**
* @return the object that should be selected after finishing create operation. By default return
* same as {@link #getNewObject()}.
*/
public Object getSelectObject() {
return m_selectObject;
}

/**
* Sets the object that should be selected after finishing create operation.
*/
public void setSelectObject(Object object) {
m_selectObject = object;
}

////////////////////////////////////////////////////////////////////////////
//
// Snap to horizontal axis
//
////////////////////////////////////////////////////////////////////////////

/**
* Used to set whether snap-to is being performed.
*
* @param value <code>true</code> if the request is for a creation with snap-to
* enabled
*/
public void setSnapToEnabled(boolean value) {
m_flags = value ? m_flags | SNAP_TO : m_flags & ~SNAP_TO;
}

/**
* Returns <code>true</code> if snap-to is enabled
*
* @return <code>true</code> if the request is for a creation with snap-to
* enabled
*/
public boolean isSnapToEnabled() {
return (m_flags & SNAP_TO) != 0;
setFactory(factory);
}

////////////////////////////////////////////////////////////////////////////
Expand All @@ -104,20 +44,19 @@ public boolean isSnapToEnabled() {
//
////////////////////////////////////////////////////////////////////////////
@Override
@Deprecated(since="2026-12", forRemoval = true)
public String toString() {
StringBuffer buffer = new StringBuffer("CreateRequest(type=");
buffer.append(getType());
buffer.append(", flags=");
buffer.append(m_flags);
buffer.append(", location=");
buffer.append(getLocation());
buffer.append(", size=");
buffer.append(getSize());
buffer.append(", factory=");
buffer.append(m_factory);
if (m_factory != null) {
buffer.append(getFactory());
if (getFactory() != null) {
buffer.append("[object=");
buffer.append(safeToString(m_factory.getNewObject()));
buffer.append(safeToString(getFactory().getNewObject()));
buffer.append("]");
}
buffer.append(")");
Expand All @@ -128,6 +67,7 @@ public String toString() {
* @return the string presentation of given {@link Object} or "<exception>" if
* any exception happened.
*/
@Deprecated(since="2026-12", forRemoval = true)
protected static String safeToString(Object o) {
try {
return o == null ? null : o.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ protected boolean handleButtonUp(int button) {
protected boolean handleMove() {
updateTargetRequest();
updateTargetUnderMouse();
showTargetFeedback();
setCurrentCommand(getCommand());
showTargetFeedback();
return true;
}

Expand All @@ -91,8 +91,8 @@ protected boolean handleDragStarted() {
protected boolean handleDragInProgress() {
if (isInState(STATE_DRAG_IN_PROGRESS)) {
updateTargetRequest();
showTargetFeedback();
setCurrentCommand(getCommand());
showTargetFeedback();
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
*******************************************************************************/
package org.eclipse.wb.gef.core.tools;

import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.DesignCreationFactory;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.CreationFactory;

/**
Expand All @@ -29,16 +26,15 @@
* @author lobas_av
* @coverage gef.core
*/
public class CreationTool extends AbstractCreationTool {
private final CreationFactory m_factory;
public class CreationTool extends org.eclipse.gef.tools.CreationTool {

////////////////////////////////////////////////////////////////////////////
//
// Constructor
//
////////////////////////////////////////////////////////////////////////////
public CreationTool(CreationFactory factory) {
m_factory = factory;
super(factory);
}

////////////////////////////////////////////////////////////////////////////
Expand All @@ -50,7 +46,7 @@ public CreationTool(CreationFactory factory) {
public void activate() {
super.activate();
try {
if (m_factory instanceof DesignCreationFactory factory) {
if (getFactory() instanceof DesignCreationFactory factory) {
factory.activate();
}
} catch (Throwable e) {
Expand All @@ -61,45 +57,8 @@ public void activate() {
/**
* @return the {@link CreationFactory} used to create the new {@link EditPart}'s.
*/
public final CreationFactory getFactory() {
return m_factory;
}

////////////////////////////////////////////////////////////////////////////
//
// Request
//
////////////////////////////////////////////////////////////////////////////
/**
* Creates a {@link CreateRequest} and sets this tool's factory on the request.
*/
@Override
protected Request createTargetRequest() {
return new CreateRequest(m_factory);
}

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

////////////////////////////////////////////////////////////////////////////
//
// Selection
//
////////////////////////////////////////////////////////////////////////////
@Override
protected void selectAddedObjects() {
CreateRequest request = (CreateRequest) getTargetRequest();
Object model = request.getSelectObject();
if (model != null) {
EditPartViewer viewer = getCurrentViewer();
if (viewer != null) {
EditPart editPart = viewer.getEditPartRegistry().get(model);
if (editPart != null) {
viewer.select(editPart);
}
}
}
public final CreationFactory getFactory() {
return super.getFactory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.eclipse.wb.gef.core.policies.DesignEditPolicy;
import org.eclipse.wb.gef.core.policies.IEditPartDecorationListener;
import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator;
import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;

import org.eclipse.gef.EditPart;
Expand All @@ -24,6 +23,7 @@
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.GroupRequest;

import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.eclipse.wb.core.gef.policy.PolicyUtils;
import org.eclipse.wb.gef.core.policies.ILayoutRequestValidator;
import org.eclipse.wb.gef.core.requests.CreateRequest;
import org.eclipse.wb.gef.core.requests.PasteRequest;
import org.eclipse.wb.internal.gef.tree.TreeViewer;

Expand All @@ -28,6 +27,7 @@
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.AbstractEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.DropRequest;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
Expand Down
Loading
Loading