本文整理汇总了Java中org.eclipse.gef.requests.CreateRequest类的典型用法代码示例。如果您正苦于以下问题:Java CreateRequest类的具体用法?Java CreateRequest怎么用?Java CreateRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateRequest类属于org.eclipse.gef.requests包,在下文中一共展示了CreateRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ModuleInstancePropertyNode.class) && getHost().getModel() instanceof ModuleInstanceNode) {
ModuleInstancePropertyCreateCommand cmd = new ModuleInstancePropertyCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 2);
cmd.setNode((ModuleInstancePropertyNode) node);
cmd.setParent((ModuleInstanceNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ModuleInstancePropertyNode.DEF_WIDTH, ModuleInstancePropertyNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例2: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ModuleOperationParameterNode.class) && (getHost().getModel() instanceof ModuleOperationNode)) {
ModuleOperationNode par = (ModuleOperationNode) getHost().getModel();
if (!(par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_READ.name()) || par.getType().equalsIgnoreCase(Enums.ModuleOperationTypes.DATA_WRITE.name()))) {
ModuleOperationParameterCreateCommand cmd = new ModuleOperationParameterCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 2);
cmd.setNode((ModuleOperationParameterNode) node);
cmd.setParent((ModuleOperationNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ModuleOperationParameterNode.DEF_WIDTH, ModuleOperationParameterNode.DEF_HEIGHT));
ret = cmd;
}
}
return ret;
}
示例3: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ComputingNodeConfigurationNode.class) && (getHost().getModel() instanceof PlatformConfigurationNode)) {
ComputingNodeConfigurationCreateCommand cmd = new ComputingNodeConfigurationCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 1);
cmd.setNode((ComputingNodeConfigurationNode) node);
cmd.setParent((PlatformConfigurationNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ComputingNodeConfigurationNode.DEF_WIDTH, ComputingNodeConfigurationNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例4: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(LogicalComputingPlatformNode.class) && (getHost().getModel() instanceof LogicalSystemNode)) {
LogicalComputingPlatformCreateCommand cmd = new LogicalComputingPlatformCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
cmd.setNode((LogicalComputingPlatformNode) node);
cmd.setParent((LogicalSystemNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingPlatformNode.DEF_WIDTH, LogicalComputingPlatformNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例5: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(LogicalProcessorsNode.class) && (getHost().getModel() instanceof LogicalComputingNode)) {
LogicalProcessorsCreateCommand cmd = new LogicalProcessorsCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 2);
cmd.setNode((LogicalProcessorsNode) node);
cmd.setParent((LogicalComputingNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, LogicalProcessorsNode.DEF_WIDTH, LogicalProcessorsNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例6: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(LogicalComputingNode.class) && (getHost().getModel() instanceof LogicalComputingPlatformNode)) {
LogicalComputingCreateCommand cmd = new LogicalComputingCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 1);
cmd.setNode((LogicalComputingNode) node);
cmd.setParent((LogicalComputingPlatformNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, LogicalComputingNode.DEF_WIDTH, LogicalComputingNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例7: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
Command ret = null;
if (request.getNewObjectType().equals(ComponentPropertyNode.class) && (getHost().getModel() instanceof ComponentNode)) {
ComponentPropertyNodeCreateCommand cmd = new ComponentPropertyNodeCreateCommand();
Node node = (Node) request.getNewObject();
node.setParent((Node) getHost().getModel());
Viewport vp = ((FigureCanvas) getHost().getViewer().getControl()).getViewport();
Point viewSize = vp.getViewLocation();
Point p = request.getLocation();
p.setX(p.x + viewSize.x);
p.setY(p.y + viewSize.y);
p = node.getAnchor(p, 1);
cmd.setNode((ComponentPropertyNode) node);
cmd.setParent((ComponentNode) node.getParent());
cmd.setLocation(new Rectangle(p.x, p.y, ComponentPropertyNode.DEF_WIDTH, ComponentPropertyNode.DEF_HEIGHT));
ret = cmd;
}
return ret;
}
示例8: createEditPolicies
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
*/
@Override
protected void createEditPolicies() {
installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy() {
/**
* {@inheritDoc}
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
@Override
protected Command getCreateCommand(CreateRequest request) {
return null;
}
});
}
示例9: mouseDoubleClick
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
public void mouseDoubleClick(MouseEvent mouseEvent) {
CreateRequest componentRequest = getComponentRequest(mouseEvent);
placeComponentOnCanvasByDoubleClickOnPalette(componentRequest);
logger.info(
"Component is positioned at respective x and y location"
+ defaultComponentLocation.getCopy().x + 20 + " and "
+ defaultComponentLocation.getCopy().y + 20);
logger.info(
"Component is positioned at respective x and y location"
+ defaultComponentLocation.getCopy().x + 20 + " and "
+ defaultComponentLocation.getCopy().y + 20);
viewer.getEditDomain().loadDefaultTool();
graphicalViewer.getEditDomain().loadDefaultTool();
}
示例10: setGenericComponent
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
/**
*
* set genericComponent to selected/hovered component in palette
*
* @param paletteInternalController
* @return
*/
private CreateRequest setGenericComponent(EditPart paletteInternalController) {
CombinedTemplateCreationEntry addedPaletteTool = (CombinedTemplateCreationEntry) paletteInternalController
.getModel();
CreateRequest componentRequest = new CreateRequest();
componentRequest.setFactory(new SimpleFactory((Class) addedPaletteTool
.getTemplate()));
genericComponent = (Component) componentRequest
.getNewObject();
logger.debug("genericComponent - " + genericComponent.toString());
return componentRequest;
}
示例11: showSizeOnDropFeedback
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void showSizeOnDropFeedback(CreateRequest request) {
Point p = new Point(request.getLocation().getCopy());
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
IFigure feedback = getSizeOnDropFeedback(request);
Dimension size = request.getSize().getCopy();
feedback.translateToRelative(size);
feedback.setBounds(new Rectangle((int) (p.x * zoom),
(int) (p.y * zoom), size.width, size.height)
.expand(getCreationFeedbackOffset(request)));
}
示例12: createEditPolicies
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected void createEditPolicies() {
stackEditPolicy = new AddStackElementEditPolicy(validator);
installEditPolicy(AddStackElementEditPolicy.KEY, stackEditPolicy);
super.createEditPolicies();
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ContainerHighlightEditPolicy(){
@Override
public void showTargetFeedback(Request request) {
if (request instanceof CreateRequest) {
CreateRequest createRequest = (CreateRequest) request;
if (stackEditPolicy.acceptCreate(createRequest)){
eraseTargetFeedback(createRequest);
return;//this will be handled by the stackEditPolicy
}
}
super.showTargetFeedback(request);
}
});
installEditPolicy(ContainerEditPolicy.KEY, new TableViewSectionEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, NullEditPolicy.getInstance());
}
示例13: showLayoutTargetFeedback
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected void showLayoutTargetFeedback(Request request) {
eraseLayoutTargetFeedback(request);
if (request instanceof ChangeBoundsRequest || (request instanceof CreateRequest
&& acceptCreate((CreateRequest) request))){
targetFeedback = new RectangleFigure();
Rectangle parentBounds = ((ElementEditPart)getHost()).getBounds();
translateToAbsolute(getContainerFigure(), parentBounds);
Rectangle lineBounds = parentBounds.getCopy();
lineBounds.height = 4;
lineBounds.y--;
targetFeedback.setForegroundColor(ColorConstants.green);
targetFeedback.setBackgroundColor(ColorConstants.green);
if (isInsertAfter((DropRequest) request)){
lineBounds.y += parentBounds.height;
}
targetFeedback.setBounds(lineBounds);
addFeedback(targetFeedback);
} else if (request instanceof ChangeBoundsRequest){
}
}
示例14: getCreateCommand
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
@Override
protected Command getCreateCommand(CreateRequest request) {
// And then passed those to the validate facility.
Object newObject = request.getNewObject();
Object container = getHost().getModel();
if (!GUIEditorPlugin.getComponentValidator().validate(newObject, container))
return null;
if (request.getNewObject() instanceof TitleBar
&& getHost().getModel() instanceof Window) {
TitleBar titleBar = (TitleBar) request.getNewObject();
Window window = (Window)getHost().getModel();
if (window.getTitleBar() == null){
return new AddTitleBarCommand(window,
titleBar,
new Rectangle(0, 0, window.getDimension().width, -1));
}
} else if (request.getNewObject() instanceof TitaniumUIBaseElement
&& getHost().getModel() instanceof TitaniumUIContainer) {
return super.getCreateCommand(request);
}
return null;
}
示例15: showTargetFeedback
import org.eclipse.gef.requests.CreateRequest; //导入依赖的package包/类
public void showTargetFeedback(Request request) {
if (request.getType().equals(RequestConstants.REQ_MOVE)
|| request.getType().equals(RequestConstants.REQ_ADD)
//|| request.getType().equals(RequestConstants.REQ_CLONE)
|| request.getType().equals(RequestConstants.REQ_CREATE)) {
List<Element> children = new ArrayList<Element>();
if (request instanceof ChangeBoundsRequest) {
ChangeBoundsRequest req = (ChangeBoundsRequest)request;
List<?> editParts = req.getEditParts();
for (Object editPart : editParts) {
children.add((Element) ((EditPart)editPart).getModel());
}
} else if (request instanceof CreateRequest){
children.add((Element) ((CreateRequest)request).getNewObject());
} else {
//what is this???
}
showHighlight(children);
}
}