當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。