当前位置: 首页>>代码示例>>Java>>正文


Java EditPart.getModel方法代码示例

本文整理汇总了Java中org.eclipse.gef.EditPart.getModel方法的典型用法代码示例。如果您正苦于以下问题:Java EditPart.getModel方法的具体用法?Java EditPart.getModel怎么用?Java EditPart.getModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.gef.EditPart的用法示例。


在下文中一共展示了EditPart.getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCopyCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
private Command createCopyCommand(List<Object> selectedObjects) {
	if (selectedObjects == null || selectedObjects.isEmpty()) {
		return null;
	}

	CopyNodeCommand cmd = new CopyNodeCommand();
	Iterator<Object> it = selectedObjects.iterator();
	while (it.hasNext()) {
		Object obj =  it.next();
		if (!(obj instanceof EditPart)) continue;
		EditPart ep = (EditPart) obj;
		if (!(ep.getModel() instanceof GWNode)) continue;
		GWNode gWNode = (GWNode) ep.getModel();
		if (!cmd.isCopyableNode(gWNode))
			return null;
		cmd.addElement(ep);
	}
	return cmd;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:CopyNodeAction.java

示例2: mouseHover

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
@Override
public void mouseHover(MouseEvent e) {
	final java.awt.Point mouseLocation1 = MouseInfo.getPointerInfo().getLocation();
	EditPart paletteInternalController = viewer.findObjectAt(new Point(
			e.x, e.y));

	if(paletteInternalController.getModel() instanceof CombinedTemplateCreationEntry){

		setGenericComponent(paletteInternalController);

		// Hide tooltip if already showing
		hidePaletteToolTip();
		
		showToolTipWithDelay(mouseLocation1);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:PaletteContainerListener.java

示例3: setGenericComponent

import org.eclipse.gef.EditPart; //导入方法依赖的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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:PaletteContainerListener.java

示例4: createMoveChildCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
@Override
protected Command createMoveChildCommand(EditPart child, EditPart after) {
	if (child == after || getHost().getChildren().size() == 1) {
		return null;
	}
	int index = getHost().getChildren().indexOf(child);
	if (index == 0) {
		if (after == null)
			return null;
	} else {
		if (after == getHost().getChildren().get(index - 1))
			return null;
	}
	ColumnReorderCommand cmd = new ColumnReorderCommand((Table) getHost().getModel(), (Column) child.getModel());
	if (after != null) {
		cmd.setAfterColumn((Column) after.getModel());
	}
	return cmd;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:20,代码来源:ColumnOrderedLayoutEditPolicy.java

示例5: execute

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void execute(final Event event) {

    final ERDiagram diagram = getDiagram();

    final List selectedEditParts = getTreeViewer().getSelectedEditParts();
    final EditPart editPart = (EditPart) selectedEditParts.get(0);
    final ERTable table = (ERTable) editPart.getModel();

    final IndexDialog dialog = new IndexDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, table);

    if (dialog.open() == IDialogConstants.OK_ID) {
        final CreateIndexCommand command = new CreateIndexCommand(diagram, dialog.getResultIndex());

        this.execute(command);
    }
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:21,代码来源:CreateIndexAction.java

示例6: getCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected List<Command> getCommand(EditPart editPart, Event event) {
	List<Command> commandList = new ArrayList<Command>();

	if (editPart instanceof IResizable) {
		NodeElement nodeElement = (NodeElement) editPart.getModel();

		Category currentCategory = this.getDiagram().getCurrentCategory();
		MoveElementCommand command = new MoveElementCommand(this
				.getDiagram(), ((NodeElementEditPart) editPart).getFigure()
				.getBounds(), nodeElement.getX(currentCategory), nodeElement.getY(currentCategory), -1,
				-1, nodeElement);

		commandList.add(command);
	}

	return commandList;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:22,代码来源:AutoResizeModelAction.java

示例7: getTargetModel

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
private Object getTargetModel(DragSourceEvent event) {
	List editParts = dragSourceViewer.getSelectedEditParts();
	if (editParts.size() != 1) {
		// ドラッグアンドドロップは選択されているオブジェクトが1つのときのみ可能とする
		return null;
	}

	EditPart editPart = (EditPart) editParts.get(0);

	Object model = editPart.getModel();
	if (model instanceof NormalColumn || model instanceof ColumnGroup
			|| model instanceof Word) {
		return model;
	}

	return null;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:18,代码来源:ERDiagramTransferDragSourceListener.java

示例8: getCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected List<Command> getCommand(EditPart editPart, Event event) {
	List<Command> commandList = new ArrayList<Command>();

	if (editPart instanceof IResizable) {
		NodeElement nodeElement = (NodeElement) editPart.getModel();

		Category currentCategory = getDiagram().getCurrentCategory();
		MoveElementCommand command = new MoveElementCommand(
				this.getDiagram(),
				((NodeElementEditPart) editPart).getFigure()
				.getBounds(),
				nodeElement.getX(currentCategory),
				nodeElement.getY(currentCategory),
				-1,
				-1,
				nodeElement);

		commandList.add(command);
	}

	return commandList;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:27,代码来源:ResizeModelAction.java

示例9: addElement

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
public boolean addElement(EditPart part) {
	GWNode gWNode = (GWNode) part.getModel();
	if (map.get(gWNode)==null) {
		map.put(gWNode,part);
		return true;
	}
	return false;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:CopyNodeCommand.java

示例10: createChangeConstraintCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
/**
 * Creates the command which is used to move and/or resize a shape
 */
@Override
protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
	if (child instanceof ComponentEditPart && constraint instanceof Rectangle) {
		//return a command that can move and/or resize a Shape
		return new ComponentSetConstraintCommand((Component) child.getModel(),
				request, (Rectangle) constraint);
	}
	else if (child instanceof CommentBoxEditPart && constraint instanceof Rectangle){
		return new CommentBoxSetConstraintCommand((CommentBox) child.getModel(), request , (Rectangle) constraint);
	}
	return super.createChangeConstraintCommand(request, child,
			constraint);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:ShapesXYLayoutEditPolicy.java

示例11: setInput

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
	super.setInput(part, selection);
	Object obj=((IStructuredSelection)selection).getFirstElement();
	if(obj instanceof EditPart){
		EditPart editPart=(EditPart)obj;
		target=editPart.getModel();
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:10,代码来源:AbstractGraphicalPropertySection.java

示例12: createChangeConstraintCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
@Override
protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
	if (child instanceof TableEditPart && constraint instanceof Rectangle) {
		return new TableLayoutCommand((Table) child.getModel(), request, (Rectangle) constraint);
	}
	return super.createChangeConstraintCommand(request, child, constraint);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:SchemaXYLayoutEditPolicy.java

示例13: getSelectedModel

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private BaseModel getSelectedModel() {
	List obj = getSelectedObjects();
	if (!obj.isEmpty() && obj.get(0) instanceof EditPart) {
		EditPart editPart = (EditPart) obj.get(0);
		return (BaseModel) editPart.getModel();
	}
	return null;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:10,代码来源:ModelModifyAction.java

示例14: setRGB

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
public void setRGB() {
	EditPart editPart = ((ERDiagramEditor) this.getWorkbenchPart())
			.getGraphicalViewer().getContents();
	ERDiagram diagram = (ERDiagram) editPart.getModel();
	
	this.rgb = diagram.getDefaultColorAsGRB();
	
	this.setColorToImage();		
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:10,代码来源:ChangeBackgroundColorAction.java

示例15: createCommand

import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
private Command createCommand() {

        if (!calculateEnabled()) {
            return null;
        }

        final EditPart editPart = editor.getGraphicalViewer().getContents();
        final ERDiagram diagram = (ERDiagram) editPart.getModel();

        final NodeSet pasteList = CopyManager.paste(diagram);

        final int numberOfCopy = CopyManager.getNumberOfCopy();

        boolean first = true;
        int x = 0;
        int y = 0;

        for (final NodeElement nodeElement : pasteList) {
            if (first || x > nodeElement.getX()) {
                x = nodeElement.getX();
            }
            if (first || y > nodeElement.getY()) {
                y = nodeElement.getY();
            }

            first = false;
        }

        final Command command = new PasteCommand(editor, pasteList, diagram.mousePoint.x - x + (numberOfCopy - 1) * 20, diagram.mousePoint.y - y + (numberOfCopy - 1) * 20);

        return command;
    }
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:33,代码来源:PasteAction.java


注:本文中的org.eclipse.gef.EditPart.getModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。