本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest.setLocation方法的具体用法?Java CreateRequest.setLocation怎么用?Java CreateRequest.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.CreateRequest
的用法示例。
在下文中一共展示了CreateRequest.setLocation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setComponentRequestParams
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private void setComponentRequestParams(CreateRequest componentRequest) {
componentRequest.setSize(genericComponent.getSize());
Point newCompDefaultLocation = getLocationForNewComponent();
defaultComponentLocation.setLocation(newCompDefaultLocation.x, newCompDefaultLocation.y);
componentRequest.setLocation(defaultComponentLocation);
}
示例2: createCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
public Command createCommand(List<?> objects) {
if (objects.isEmpty())
return null;
if (!(objects.get(0) instanceof EditPart))
return null;
CreateRequest createReq = new CreateRequest(RequestConstants.REQ_CREATE);
createReq.setLocation(location);
createReq.setFactory(creationFactory);
Map<Object, Object> map = new HashMap<Object, Object>();
if (!setExtendedData(map, objects))
return null;
createReq.setExtendedData(map);
JSSCompoundCommand jssCcmd = new JSSCompoundCommand(null);
for (int i = 0; i < objects.size(); i++) {
Object obj = objects.get(i);
if (obj instanceof EditPart) {
EditPart object = (EditPart) obj;
//Set the node if necessary to disable the refresh
jssCcmd.setReferenceNodeIfNull(object.getModel());
Command cmd = object.getCommand(createReq);
if (cmd != null) {
jssCcmd.add(cmd);
}
}
}
if(!jssCcmd.isEmpty()) {
//Append the command to refresh the column names
ANode tableNode = getTableNode(objects);
jssCcmd.addFirst(new RefreshColumnNamesCommand(tableNode, false, true));
jssCcmd.add(new RefreshColumnNamesCommand(tableNode, true, false));
return jssCcmd;
}
else {
return null;
}
}
示例3: createCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Create a command to create the selected objects.
*
* @param objects
* The objects to be deleted.
* @return The command to remove the selected objects.
*/
@Override
public Command createCommand() {
List<Object> objects = getSelectedObjects();
if (objects.isEmpty())
return null;
if (!(objects.get(0) instanceof EditPart))
return null;
CreateRequest createReq = new CreateRequest(RequestConstants.REQ_CREATE);
createReq.setLocation(location);
createReq.setFactory(creationFactory);
Map<Object, Object> map = new HashMap<Object, Object>();
if (!setExtendedData(map, objects))
return null;
createReq.setExtendedData(map);
JSSCompoundCommand jssCcmd = new JSSCompoundCommand(null);
for (int i = 0; i < objects.size(); i++) {
Object obj = objects.get(i);
if (obj instanceof EditPart) {
EditPart object = (EditPart) obj;
//Set the node if necessary to disable the refresh
jssCcmd.setReferenceNodeIfNull(object.getModel());
Command cmd = object.getCommand(createReq);
if (cmd != null) {
jssCcmd.add(cmd);
}
}
}
if(!jssCcmd.isEmpty()) {
return jssCcmd;
}
else {
return null;
}
}
示例4: updateTargetRequest
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Sets the location (and size if the user is performing size-on-drop) of
* the request.
*
* @see org.eclipse.gef.tools.TargetingTool#updateTargetRequest()
*/
protected void updateTargetRequest() {
CreateRequest createRequest = getCreateRequest();
if (isInState(STATE_DRAG_IN_PROGRESS)) {
Point loq = getStartLocation();
Rectangle bounds = new Rectangle(loq, loq);
bounds.union(loq.getTranslated(getDragMoveDelta()));
createRequest.setSize(bounds.getSize());
createRequest.setLocation(bounds.getLocation());
createRequest.getExtendedData().clear();
createRequest.setSnapToEnabled(!getCurrentInput().isModKeyDown(
MODIFIER_NO_SNAPPING));
if (helper != null && createRequest.isSnapToEnabled()) {
PrecisionRectangle baseRect = new PrecisionRectangle(bounds);
PrecisionRectangle result = baseRect.getPreciseCopy();
helper.snapRectangle(createRequest, PositionConstants.NSEW,
baseRect, result);
createRequest.setLocation(result.getLocation());
createRequest.setSize(result.getSize());
}
enforceConstraintsForSizeOnDropCreate(createRequest);
} else {
createRequest.setSize(null);
createRequest.setLocation(getLocation());
createRequest.setSnapToEnabled(false);
}
}
示例5: updateTargetRequest
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Assumes that the target request is a {@link CreateRequest}.
*/
protected void updateTargetRequest() {
CreateRequest request = getCreateRequest();
request.setLocation(getDropLocation());
}
示例6: performDrop
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
public boolean performDrop( Object transfer, Object target, int operation,
DNDLocation location )
{
if ( target instanceof EditPart )// drop on layout
{
EditPart editPart = (EditPart) target;
if ( editPart != null )
{
CreateRequest request = new CreateRequest( );
if ( transfer instanceof Object[] )
{
Object[] newObjs = (Object[]) transfer;
transfer = UIUtil.getInsertPamaterElements( newObjs );
}
try
{
if ( transfer instanceof ScalarParameterHandle )
{
transfer = InsertInLayoutUtil.performInsertParameter( (ScalarParameterHandle) transfer );
}
else if ( transfer instanceof Object[] )
{
Object[] objs = (Object[])transfer;
Object[] copys = new Object[objs.length];
for (int i=0; i<objs.length; i++)
{
if (objs[i] instanceof ScalarParameterHandle)
{
copys[i] = InsertInLayoutUtil.performInsertParameter( (ScalarParameterHandle) objs[i] );
}
else
{
// Return now , don't support the other type
return false;
}
}
transfer = copys;
}
}
catch ( SemanticException e )
{
// do nothing
return false;
}
request.getExtendedData( )
.put( DesignerConstants.KEY_NEWOBJECT, transfer );
request.setLocation( location.getPoint( ) );
Command command = editPart.getCommand( request );
if ( command != null && command.canExecute( ) )
{
CommandStack stack = SessionHandleAdapter.getInstance( )
.getCommandStack( );
stack.startTrans( Messages.getString( "LevelHandleDropAdapter.ActionText" ) ); //$NON-NLS-1$
editPart.getViewer( )
.getEditDomain( )
.getCommandStack( )
.execute( command );
stack.commit( );
return true;
}
else
return false;
}
}
return false;
}
示例7: performDrop
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
public boolean performDrop( Object transfer, Object target, int operation,
DNDLocation location )
{
if (transfer instanceof IAdaptable)
{
if (((IAdaptable)transfer).getAdapter( StructureHandle.class ) instanceof LevelAttributeHandle)
{
transfer = ((IAdaptable)transfer).getAdapter( StructureHandle.class );
}
}
if ( target instanceof EditPart )// drop on layout
{
EditPart editPart = (EditPart) target;
if ( editPart != null )
{
CreateRequest request = new CreateRequest( );
request.getExtendedData( )
.put( DesignerConstants.KEY_NEWOBJECT, transfer );
request.setLocation( location.getPoint( ) );
Command command = editPart.getCommand( request );
if ( command != null && command.canExecute( ) )
{
CommandStack stack = SessionHandleAdapter.getInstance( )
.getCommandStack( );
stack.startTrans( Messages.getString( "LevelHandleDropAdapter.ActionText" ) ); //$NON-NLS-1$
editPart.getViewer( )
.getEditDomain( )
.getCommandStack( )
.execute( command );
CrosstabReportItemHandle crosstab = getCrosstab( editPart );
if ( crosstab != null )
{
AggregationCellProviderWrapper providerWrapper = new AggregationCellProviderWrapper( crosstab );
providerWrapper.updateAllAggregationCells( AggregationCellViewAdapter.SWITCH_VIEW_TYPE );
}
stack.commit( );
return true;
}
else
return false;
}
}
return false;
}
示例8: performDrop
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
public boolean performDrop( Object transfer, Object target, int operation,
DNDLocation location )
{
if ( target instanceof EditPart )//drop on layout
{
EditPart editPart = (EditPart) target;
if ( editPart != null )
{
CreateRequest request = new CreateRequest( );
request.getExtendedData( )
.put( DesignerConstants.KEY_NEWOBJECT, transfer );
request.setLocation( location.getPoint( ) );
Command command = editPart.getCommand( request );
if ( command != null && command.canExecute( ) )
{
CommandStack stack = SessionHandleAdapter.getInstance( )
.getCommandStack( );
stack.startTrans( Messages.getString( "LevelHandleDropAdapter.ActionText" ) ); //$NON-NLS-1$
editPart.getViewer( )
.getEditDomain( )
.getCommandStack( )
.execute( command );
CrosstabReportItemHandle crosstab = getCrosstab( editPart );
if ( crosstab != null )
{
AggregationCellProviderWrapper providerWrapper = new AggregationCellProviderWrapper( crosstab );
providerWrapper.updateAllAggregationCells( AggregationCellViewAdapter.SWITCH_VIEW_TYPE );
}
stack.commit( );
return true;
}
else
return false;
}
}
return false;
}
示例9: performDrop
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
public boolean performDrop( Object transfer, Object target, int operation,
DNDLocation location )
{
EditPart editPart = (EditPart) target;
VariableElementHandle variable = (VariableElementHandle) transfer;
DataItemHandle dataHandle = DesignElementFactory.getInstance( )
.newDataItem( null );
try
{
ComputedColumn bindingColumn = StructureFactory.newComputedColumn( dataHandle,
variable.getName( ) );
// FIXME currently variable does not support data type, so just set
// string
bindingColumn.setDataType( "string" );
ExpressionUtility.setBindingColumnExpression( variable,
bindingColumn,
true );
bindingColumn.setDisplayName( variable.getDisplayLabel( ) );
dataHandle.addColumnBinding( bindingColumn, false );
dataHandle.setResultSetColumn( bindingColumn.getName( ) );
}
catch ( Exception e )
{
ExceptionHandler.handle( e );
}
CreateRequest request = new CreateRequest( );
request.getExtendedData( ).put( DesignerConstants.KEY_NEWOBJECT,
dataHandle );
request.setLocation( location.getPoint( ) );
Command command = editPart.getCommand( request );
if ( command != null && command.canExecute( ) )
{
CommandStack stack = SessionHandleAdapter.getInstance( )
.getCommandStack( );
stack.startTrans( TRANS_NAME ); //$NON-NLS-1$
editPart.getViewer( )
.getEditDomain( )
.getCommandStack( )
.execute( command );
stack.commit( );
return true;
}
else
return false;
}