本文整理汇总了Java中org.eclipse.draw2d.FigureCanvas类的典型用法代码示例。如果您正苦于以下问题:Java FigureCanvas类的具体用法?Java FigureCanvas怎么用?Java FigureCanvas使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FigureCanvas类属于org.eclipse.draw2d包,在下文中一共展示了FigureCanvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TextController
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
public TextController ( final FigureCanvas canvas, final SymbolController controller, final Text element, final ResourceManager manager )
{
super ( controller, manager );
this.canvas = canvas;
this.figure = new Label ( element.getText ()) {
@Override
public void addNotify ()
{
super.addNotify ();
start ();
}
@Override
protected void paintFigure ( final Graphics graphics )
{
final Double alpha = getAlpha ();
if ( alpha != null )
{
graphics.setAlpha ( (int) ( Math.max ( 0.0, Math.min ( 1.0, alpha ) ) * 255.0 ) );
}
super.paintFigure ( graphics );
}
@Override
public void removeNotify ()
{
stop ();
super.removeNotify ( );
}
};
controller.addElement ( element, this );
applyCommon ( element );
}
示例2: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例3: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例4: getMoveBendpointCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
@Override
protected Command getMoveBendpointCommand(BendpointRequest request) {
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);
BendpointMoveCommand cmd = new BendpointMoveCommand();
cmd.setLink((Link) request.getSource().getModel());
cmd.setIndex(request.getIndex());
cmd.setNewLocation(p);
return cmd;
}
示例5: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例6: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例7: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例8: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例9: getCreateCommand
import org.eclipse.draw2d.FigureCanvas; //导入依赖的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;
}
示例10: configureGraphicalViewer
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
EditPartFactory factory = new EditPartFactory();
FileEditorInput inp = (FileEditorInput) getEditorInput();
factory.setContainerName(inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setEditPartFactory(factory);
((FigureCanvas) getGraphicalControl()).setScrollBarVisibility(FigureCanvas.ALWAYS);
getActionRegistry().registerAction(new ExportImageAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new ExportAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateAPIAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateINTAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateUIDAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new ClearTargetAction(this, inp.getFile().getProject().getFullPath()));
getGraphicalViewer().setContextMenu(new ContextMenuProvider(getGraphicalViewer(), getActionRegistry()));
}
示例11: configureGraphicalViewer
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
EditPartFactory factory = new EditPartFactory();
FileEditorInput inp = (FileEditorInput) getEditorInput();
factory.setContainerName(inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setEditPartFactory(factory);
((FigureCanvas) getGraphicalControl()).setScrollBarVisibility(FigureCanvas.ALWAYS);
getActionRegistry().registerAction(new ExportImageAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new ExportAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateAPIAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateINTAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new GenerateUIDAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new ClearTargetAction(this, inp.getFile().getProject().getFullPath()));
getActionRegistry().registerAction(new RefreshAction(this, inp.getFile().getProject().getFullPath(), inp.getFile()));
getGraphicalViewer().setContextMenu(new ContextMenuProvider(getGraphicalViewer(), getActionRegistry()));
}
示例12: isMessageOnLifeLineName
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
/**
* @param lnEditparts
* @return
*/
private boolean isMessageOnLifeLineName() {
Viewport viewport = ((FigureCanvas) getViewer().getControl()).getViewport();
int verticalValue = viewport.getVerticalRangeModel().getValue();
// System.out.println(verticalValue);
if (verticalValue < getFigure().getBounds().y && verticalValue + 75 > getFigure().getBounds().y) {
// System.out.println("Figure Location false : " +
// getFigure().getBounds().y);
return false;
} else if (getFigure().getBounds().y < verticalValue) {
return false;
}
// System.out.println("Figure Location true : " +
// getFigure().getBounds().y);
return true;
}
示例13: dropCommandForNode
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
/**
* @see nexcore.tool.uml.ui.core.diagram.editor.DiagramDropTargetListener#dropCommandForNode(org.eclipse.swt.dnd.DropTargetEvent,
* org.eclipse.gef.commands.CompoundCommand,
* nexcore.tool.uml.ui.core.project.ITreeNode, int)
*/
@Override
protected void dropCommandForNode(DropTargetEvent event, CompoundCommand commpoundCommand, ITreeNode next, int count) {
Element treeElement = (Element) next.getEObject();
int horizontalScrollPoint = 0;
int verticalScrollPoint = 0;
Point eventPoint = null;
Command command = null;
org.eclipse.draw2d.geometry.Point where = null;
horizontalScrollPoint = ((FigureCanvas) diagramEditor.getDiagramGraphicalViewer().getControl()).getHorizontalBar()
.getSelection();
verticalScrollPoint = ((FigureCanvas) diagramEditor.getDiagramGraphicalViewer().getControl()).getVerticalBar()
.getSelection();
eventPoint = diagramEditor.getDiagramGraphicalViewer().getControl().toControl(event.x + horizontalScrollPoint,
event.y + verticalScrollPoint);
// y좌표에 +100은 여러개를 Dorp했을때 대각선 아래로 위치하도록 한다.
where = new org.eclipse.draw2d.geometry.Point(eventPoint.x + (count * 160), eventPoint.y);//20);
command = new DropLifeLineNotationCommand(UMLMessage.LABEL_ADD_DROP, diagramEditor, treeElement, where);
((DropLifeLineNotationCommand) command).setDiagram(this.diagramEditor.getDiagram());
commpoundCommand.add(command);
}
示例14: execute
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
@Override
public void execute(Event event) throws Exception {
final ERDiagram diagram = getDiagram();
final List<ERTable> input = new ArrayList<>();
input.addAll(diagram.getDiagramContents().getDiagramWalkers().getTableSet().getList());
final NodeSelectionDialog dialog =
new NodeSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), diagram);
final FigureCanvas canvas = (FigureCanvas) oneEditor.getGraphicalViewer().getControl();
final Point point =
new Point(canvas.getHorizontalBar().getSelection() + canvas.getClientArea().width / 2, canvas.getVerticalBar()
.getSelection() + canvas.getClientArea().height / 2);
if (dialog.open() == IDialogConstants.OK_ID) {
final Object[] results = dialog.getResult();
for (final Object result : results) {
final ERTable curTable = (ERTable) result;
final ERVirtualTable virtualTable = new ERVirtualTable(oneEditor.getVirtualDiagram(), curTable);
virtualTable.setPoint(point.x, point.y);
getDiagram().addWalkerPlainly(virtualTable);
}
}
}
示例15: disposeRulerViewer
import org.eclipse.draw2d.FigureCanvas; //导入依赖的package包/类
private void disposeRulerViewer(GraphicalViewer viewer) {
if (viewer == null)
return;
/*
* There's a tie from the editor's range model to the RulerViewport (via
* a listener) to the RulerRootEditPart to the RulerViewer. Break this
* tie so that the viewer doesn't leak and can be garbage collected.
*/
dockLayoutPanel.remove(northPanel);
dockLayoutPanel.remove(westPanel);
dockLayoutPanel.forceLayout();
RangeModel rModel = new DefaultRangeModel();
Viewport port = ((FigureCanvas) viewer.getControl()).getViewport();
port.setHorizontalRangeModel(rModel);
port.setVerticalRangeModel(rModel);
rulerEditDomain.removeViewer(viewer);
viewer.getRootEditPart().deactivate();
// viewer.getControl().dispose();
}