?? diagramxylayouteditpolicy.java
字號(hào):
/*******************************************************************************
* $Header: /cvsroot/EOS6/work_dir/niegy/com.primeton.studio.gef.ui/src/com/primeton/studio/gef/ui/ui/policy/DiagramXYLayoutEditPolicy.java,v 1.2 2006/12/30 02:45:03 niegy Exp $
* $Revision: 1.2 $
* $Date: 2006/12/30 02:45:03 $
*
*==============================================================================
*
* Copyright (c) 2001-2006 Primeton Technologies, Ltd.
* All rights reserved.
*
* Created on 2006-11-27
*******************************************************************************/
package com.primeton.studio.gef.ui.ui.policy;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.CreateRequest;
import com.primeton.studio.gef.core.Node;
import com.primeton.studio.gef.core.Diagram;
import com.primeton.studio.gef.core.NodeElement;
import com.primeton.studio.gef.core.TNodeType;
import com.primeton.studio.gef.ui.commands.NodeCreateCommand;
/**
* TODO 此處填寫(xiě) class 信息
*
* @author niegy (mailto:niegy@primeton.com)
*/
/*
* 修改歷史
* $Log: DiagramXYLayoutEditPolicy.java,v $
* Revision 1.2 2006/12/30 02:45:03 niegy
* 重構(gòu)代碼
*
* Revision 1.1 2006/12/05 05:18:59 niegy
* 修改模型,增加連線的擴(kuò)展點(diǎn)
*
*/
public class DiagramXYLayoutEditPolicy extends NodeXYLayoutEditPolicy {
private String pluginId;
/**
* @param node
*/
public DiagramXYLayoutEditPolicy(Node node,String id) {
super(node);
// TODO Auto-generated constructor stub
pluginId = id;
}
protected Command getCreateCommand(CreateRequest request) {
Object childClass = request.getNewObject();
if(((NodeElement)childClass).getNodeType().equals(TNodeType.CHILD_LITERAL) &&
model instanceof Diagram)
return null;
if(((NodeElement)childClass).getNodeType().equals(TNodeType.COMMON_LITERAL) &&
!(model instanceof Diagram))
return null;
boolean isAttri = ((NodeElement)childClass).getNodeType().equals(TNodeType.ATTRICOLUMN_LITERAL);
boolean isOper = ((NodeElement)childClass).getNodeType().equals(TNodeType.OPERATIONCOLUMN_LITERAL);
if(isAttri || isOper){
if(model instanceof Diagram)
return null;
else if(model instanceof NodeElement && !((NodeElement)model).getNodeType().equals(TNodeType.TABLE_LITERAL)){
return null;
}
}
Rectangle constraint = (Rectangle) getConstraintFor(request);
if (childClass instanceof NodeElement){
// return a command that can add a Shape to a ShapesDiagram
return new NodeCreateCommand(model, request, constraint,pluginId,true);
}
return null;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -