modelxylayouteditpolicy.java
来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 134 行
JAVA
134 行
/*
* $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/gefmodule/edit/ModelXYLayoutEditPolicy.java,v 1.1.1.1 2004/07/01 09:07:47 wang_j Exp $
* $Revision: 1.1.1.1 $
* $Date: 2004/07/01 09:07:47 $
*
* ====================================================================
*
* The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
*
* Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
* IT Forest Corporation
* All rights reserved.
*
* This software is the confidential and proprietary information of
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into with
* HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
*/
package com.webpump.ui.gefmodule.edit;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.*;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import com.webpump.ui.gefmodule.command.CreateCommand;
import com.webpump.ui.gefmodule.command.SetConstraintCommand;
import com.webpump.ui.gefmodule.model.ModelSubpart;
import com.webpump.ui.gefmodule.model.Module;
import com.webpump.ui.gefmodule.model.Page;
/**
* Class for ModelXYLayoutEditPolicy
*
* @author shi_l
* @version 2.0.0 2004-5-30
*/
public class ModelXYLayoutEditPolicy extends org.eclipse.gef.editpolicies.XYLayoutEditPolicy {
/*
protected Command createAddCommand(EditPart childEditPart, Object constraint) {
LogicSubpart part = (LogicSubpart)childEditPart.getModel();
Rectangle rect = (Rectangle)constraint;
AddCommand add = new AddCommand();
add.setParent((LogicDiagram)getHost().getModel());
add.setChild(part);
add.setLabel(LogicMessages.LogicXYLayoutEditPolicy_AddCommandLabelText);
add.setDebugLabel("LogicXYEP add subpart");//$NON-NLS-1$
SetConstraintCommand setConstraint = new SetConstraintCommand();
setConstraint.setLocation(rect);
setConstraint.setPart(part);
setConstraint.setLabel(LogicMessages.LogicXYLayoutEditPolicy_AddCommandLabelText);
setConstraint.setDebugLabel("LogicXYEP setConstraint");//$NON-NLS-1$
return add.chain(setConstraint);
}*/
/*
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
SetConstraintCommand locationCommand = new SetConstraintCommand();
locationCommand.setPart((LogicSubpart)child.getModel());
locationCommand.setLocation((Rectangle)constraint);
return locationCommand;
}
*/
/**
* create child editpolicy
* @param child EditPart
* @return EditPolicy
*/
protected EditPolicy createChildEditPolicy(EditPart child) {
if (child instanceof PageEditPart) {
return new NonResizableEditPolicy();
}
return super.createChildEditPolicy(child);
}
/**
* get create command
* @param request CreateRequest
* @return command Command
*/
protected Command getCreateCommand(CreateRequest request) {
CreateCommand create = new CreateCommand();
create.setParent((Module) getHost().getModel());
create.setChild((ModelSubpart) request.getNewObject());
Rectangle constraint = (Rectangle) getConstraintFor(request);
create.setLocation(constraint);
create.setLabel("create command");
return create;
}
/**
* get delete command
* @param request Request
* @return null
*/
protected Command getDeleteDependantCommand(Request request) {
return null;
}
/**
* get OrphanChildren command
* @param request Request
* @return null
*/
protected Command getOrphanChildrenCommand(Request request) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand(org.eclipse.gef.EditPart, java.lang.Object)
*/
protected Command createAddCommand(EditPart child, Object constraint) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart, java.lang.Object)
*/
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
SetConstraintCommand locationCommand = new SetConstraintCommand();
locationCommand.setPart((Page) child.getModel());
locationCommand.setLocation((Rectangle) constraint);
return locationCommand;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?