本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest.getNewObjectType方法的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest.getNewObjectType方法的具体用法?Java CreateRequest.getNewObjectType怎么用?Java CreateRequest.getNewObjectType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.requests.CreateRequest
的用法示例。
在下文中一共展示了CreateRequest.getNewObjectType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
if (request.getType() == REQ_CREATE) {
String newObjectType = (String) request.getNewObjectType();
FieldCreateCommand cmd = new FieldCreateCommand();
cmd.setParent((BaseElement) getHost().getModel());
cmd.setField(request.getNewObject());
cmd.setLabel(newObjectType);
Rectangle constraint = (Rectangle) getConstraintFor(request);
constraint.x = (constraint.x < 0) ? 0 : constraint.x;
constraint.y = (constraint.y < 0) ? 0 : constraint.y;
constraint.width = (constraint.width <= 0) ? 120 : constraint.width;
constraint.height = (constraint.height <= 0) ? 40
: constraint.height;
cmd.setLayout(constraint);
return cmd;
}
return null;
}
示例2: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Returns a command to be executed when the palette tries to create something
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
protected Command getCreateCommand(CreateRequest request) {
Object newObjectType = null;
if (request.getNewObject() != null)
newObjectType = request.getNewObjectType();
// converts relative to absolute positions (so that zooms work properly)
Rectangle constraint = (Rectangle) getConstraintFor(request);
Command createCommand = null;
if ((newObjectType == IntentionalElementRef.class) || (newObjectType == Belief.class) || (newObjectType == KPIInformationElementRef.class)) {
createCommand = handleCreateGrlNode(request, constraint);
} else if (newObjectType == ActorRef.class) {
createCommand = handleCreateActorRef(request, constraint);
} else if (newObjectType == Comment.class) {
createCommand = handleCreateComment(request, constraint);
}
return createCommand;
}
示例3: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
/**
* Returns a command to be executed when the palette tries to create something on the MapAndPathGraphEditPart.
*
* Extends path for PathTool and creates ComponentRefs. PathNodes are created on NodeConnections so are not handled here.
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
protected Command getCreateCommand(CreateRequest request) {
Object newObjectType = null;
if (request.getNewObject() != null)
newObjectType = request.getNewObjectType();
// converts relative to absolute positions (so that zooms work properly)
Rectangle constraint = (Rectangle) getConstraintFor(request);
Command createCommand = null;
// if PathTool
if (newObjectType == EndPoint.class || newObjectType == StartPoint.class) {
createCommand = handleCreateOrExtendPath(request, constraint);
} else if (newObjectType == ComponentRef.class) {
createCommand = handleCreateComponentRef(request, constraint);
} else if (newObjectType == Comment.class) {
createCommand = handleCreateComment(request, constraint);
}
return createCommand;
}
示例4: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command retVal = null;
Class clazz = (Class)request.getNewObjectType();
if(Vertex.class.isAssignableFrom(clazz)) {
VertexCreateCommand command = new VertexCreateCommand();
command.setLocation(request.getLocation());
Vertex vertex = (Vertex)(request.getNewObject());
vertex.setGraph((GWGraph)(getHost().getModel()));
command.setVertex(vertex);
retVal = command;
}
return retVal;
}
示例5: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
if (request.getNewObjectType() == Table.class && getHost().getModel() instanceof Schema) {
return new TableCreateCommand((Table) request.getNewObject(), (Schema) getHost().getModel(), request.getLocation());
}
return null;
}
示例6: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
if (request.getNewObjectType() == Column.class && getHost().getModel() instanceof Table) {
int index = getHost().getChildren().size();
return new ColumnCreateCommand((Column) request.getNewObject(), (Table) getHost().getModel(), index);
}
return null;
}
示例7: getCreateFieldCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
private static Command getCreateFieldCommand(CreateRequest request,
BaseElement parent) {
String newObjectType = (String) request.getNewObjectType();
FieldCreateCommand create = new FieldCreateCommand();
create.setField((Field) request.getNewObject());
create.setParent(parent);
create.setLabel(newObjectType);
return create;
}
示例8: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入方法依赖的package包/类
protected Command getCreateCommand(CreateRequest request) {
Object childClass = request.getNewObjectType();
if (childClass == EllipticalShape.class
|| childClass == RectangularShape.class) {
// return a command that can add a Shape to a ShapesDiagram
return new ShapeCreateCommand((Shape) request.getNewObject(),
(ShapesDiagram) getHost().getModel(),
(Rectangle) getConstraintFor(request));
}
return null;
}