本文整理匯總了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}