本文整理汇总了Java中org.eclipse.gef.requests.DirectEditRequest类的典型用法代码示例。如果您正苦于以下问题:Java DirectEditRequest类的具体用法?Java DirectEditRequest怎么用?Java DirectEditRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DirectEditRequest类属于org.eclipse.gef.requests包,在下文中一共展示了DirectEditRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performCreation
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
@Override protected void performCreation(int button) {
super.performCreation(button);
EditPartViewer viewer = getCurrentViewer();
final Object model = getCreateRequest().getNewObject();
if (model == null || viewer == null) {
return;
}
final Object o = getCurrentViewer().getEditPartRegistry().get(model);
if(o instanceof EditPart) {
Display.getCurrent().asyncExec(new Runnable() {
@Override public void run() {
EditPart part = (EditPart)o;
Request request = new DirectEditRequest();
part.performRequest(request);
}
});
}
}
示例2: getTargetEditPart
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public EditPart getTargetEditPart(final Request request) {
if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_COLUMN_GROUP.equals(request.getType()) || ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN_GROUP.equals(request.getType())) {
final DirectEditRequest editRequest = (DirectEditRequest) request;
final TableView tableView = (TableView) getHost().getModel();
final ColumnGroup columnGroup = (ColumnGroup) ((Map) editRequest.getDirectEditFeature()).get("group");
if (!tableView.getColumns().contains(columnGroup)) {
return getHost();
}
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_WORD.equals(request.getType())) {
return getHost();
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN.equals(request.getType())) {
return getHost();
}
return super.getTargetEditPart(request);
}
示例3: getColumnIndex
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
private int getColumnIndex(final DirectEditRequest editRequest) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final ColumnEditPart columnEditPart = (ColumnEditPart) getHost();
Column column = (Column) columnEditPart.getModel();
final TableView newTableView = (TableView) getHost().getParent().getModel();
final List<Column> columns = newTableView.getColumns();
if (column.getColumnHolder() instanceof ColumnGroup) {
column = (ColumnGroup) column.getColumnHolder();
}
int index = columns.indexOf(column);
final Rectangle columnRectangle = getColumnRectangle();
final int center = (int) ((columnRectangle.y + (columnRectangle.height / 2)) * zoom);
if (editRequest.getLocation().y >= center) {
index++;
}
return index;
}
示例4: getDirectEditCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getDirectEditCommand(final DirectEditRequest request) {
final CompoundCommand command = new CompoundCommand();
final String text = (String) request.getCellEditor().getValue();
final Note note = (Note) getHost().getModel();
final NoteEditCommand noteEditCommand = new NoteEditCommand(note, text);
command.add(noteEditCommand);
final MoveElementCommand autoResizeCommand = new MoveElementCommand((ERDiagram) getHost().getRoot().getContents().getModel(), getHostFigure().getBounds(), note.getX(), note.getY(), -1, -1, note);
command.add(autoResizeCommand);
return command.unwrap();
}
示例5: getColumnIndex
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
private int getColumnIndex(DirectEditRequest editRequest) {
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
IFigure figure = ((TableViewEditPart) this.getHost()).getFigure();
int center = (int) (figure.getBounds().y + (figure.getBounds().height / 2)
* zoom);
int index = 0;
if (editRequest.getLocation().y >= center) {
TableView newTableView = (TableView) this.getHost().getModel();
index = newTableView.getColumns().size();
}
return index;
}
示例6: getDirectEditCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
CompoundCommand command = new CompoundCommand();
String text = (String) request.getCellEditor().getValue();
Note note = (Note) getHost().getModel();
NoteEditCommand noteEditCommand = new NoteEditCommand(note, text);
command.add(noteEditCommand);
ERDiagram diagram = (ERDiagram) this.getHost().getRoot().getContents().getModel();
Category currentCategory = diagram.getCurrentCategory();
MoveElementCommand autoResizeCommand = new MoveElementCommand(
diagram,
this.getHostFigure().getBounds(),
note.getX(currentCategory),
note.getY(currentCategory),
-1,
-1,
note);
command.add(autoResizeCommand);
return command.unwrap();
}
示例7: getTargetEditPart
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
@Override
public EditPart getTargetEditPart(Request request) {
if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_COLUMN_GROUP.equals(request.getType())
|| ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN_GROUP.equals(request.getType())) {
final DirectEditRequest editRequest = (DirectEditRequest) request;
final TableView tableView = (TableView) getHost().getModel();
final ColumnGroup columnGroup = (ColumnGroup) ((Map<?, ?>) editRequest.getDirectEditFeature()).get("group");
if (!tableView.getColumns().contains(columnGroup)) {
return getHost();
}
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_WORD.equals(request.getType())) {
return getHost();
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN.equals(request.getType())) {
return getHost();
}
return super.getTargetEditPart(request);
}
示例8: getTargetEditPart
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
@Override
public EditPart getTargetEditPart(Request request) {
if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_COLUMN_GROUP.equals(request.getType())
|| ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN_GROUP.equals(request.getType())) {
final DirectEditRequest editRequest = (DirectEditRequest) request;
final TableView tableView = (TableView) getHost().getParent().getModel();
final ColumnGroup columnGroup =
(ColumnGroup) ((Map<?, ?>) editRequest.getDirectEditFeature())
.get(ERDiagramTransferDragSourceListener.MOVE_COLUMN_GROUP_PARAM_GROUP);
final Object parent =
((Map<?, ?>) editRequest.getDirectEditFeature())
.get(ERDiagramTransferDragSourceListener.MOVE_COLUMN_GROUP_PARAM_PARENT);
if (parent == tableView || !tableView.getColumns().contains(columnGroup)) {
return getHost();
}
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_ADD_WORD.equals(request.getType())) {
return getHost();
} else if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_MOVE_COLUMN.equals(request.getType())) {
return getHost();
}
return super.getTargetEditPart(request);
}
示例9: createMoveColumnGroupCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
public static Command createMoveColumnGroupCommand(DirectEditRequest editRequest, TableView newTableView, int index) {
final ColumnGroup columnGroup =
(ColumnGroup) ((Map<?, ?>) editRequest.getDirectEditFeature())
.get(ERDiagramTransferDragSourceListener.MOVE_COLUMN_GROUP_PARAM_GROUP);
final TableView oldTableView =
(TableView) ((Map<?, ?>) editRequest.getDirectEditFeature())
.get(ERDiagramTransferDragSourceListener.MOVE_COLUMN_GROUP_PARAM_PARENT);
if (newTableView == oldTableView) {
return new ChangeColumnOrderCommand(newTableView, columnGroup, index);
}
final CompoundCommand command = new CompoundCommand();
final TableView copyOldTableView = oldTableView.copyData();
for (final ERColumn column : copyOldTableView.getColumns()) {
if (column == columnGroup) {
copyOldTableView.removeColumn(column);
break;
}
}
final ChangeTableViewPropertyCommand sourceTableCommand = new ChangeTableViewPropertyCommand(oldTableView, copyOldTableView);
command.add(sourceTableCommand);
if (!newTableView.getColumns().contains(columnGroup)) {
command.add(new AddColumnGroupCommand(newTableView, columnGroup, index));
}
return command.unwrap();
}
示例10: getColumnIndex
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
private int getColumnIndex(DirectEditRequest editRequest) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final ColumnEditPart columnEditPart = (ColumnEditPart) getHost();
ERColumn column = (ERColumn) columnEditPart.getModel();
final TableView newTableView = (TableView) getHost().getParent().getModel();
final List<ERColumn> columns = newTableView.getColumns();
if (column.getColumnHolder() instanceof ColumnGroup) {
column = (ColumnGroup) column.getColumnHolder();
}
int index = columns.indexOf(column);
final Rectangle columnRectangle = getColumnRectangle();
final int center = (int) ((columnRectangle.y + (columnRectangle.height / 2)) * zoom);
if (editRequest.getLocation().y >= center) {
index++;
}
return index;
}
示例11: getCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
@Override
public Command getCommand(Request request) {
if (ERDiagramTransferDragSourceListener.REQUEST_TYPE_PLACE_TABLE.equals(request.getType())) {
final DirectEditRequest editRequest = (DirectEditRequest) request;
final Object feature = editRequest.getDirectEditFeature();
if (feature instanceof ERTable) {
final ERTable ertable = (ERTable) feature;
return new PlaceTableCommand(ertable);
}
if (feature instanceof List) {
@SuppressWarnings("unchecked")
final List<ERTable> list = (List<ERTable>) feature;
return new PlaceTableCommand(list);
}
}
return super.getCommand(request);
}
示例12: getDirectEditCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
CompoundCommand command = new CompoundCommand();
String text = (String) request.getCellEditor().getValue();
Note note = (Note) getHost().getModel();
NoteEditCommand noteEditCommand = new NoteEditCommand(note, text);
command.add(noteEditCommand);
MoveElementCommand autoResizeCommand = new MoveElementCommand(
(ERDiagram) this.getHost().getRoot().getContents().getModel(), this
.getHostFigure().getBounds(), note.getX(), note.getY(),
-1, -1, note);
command.add(autoResizeCommand);
return command.unwrap();
}
示例13: createDirectEditPolicy
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
@Override
protected EditableElementDirectEditPolicy createDirectEditPolicy()
{
return new EditableElementDirectEditPolicy() {
@Override
protected String getDirectEditValue(DirectEditRequest edit)
{
String text = super.getDirectEditValue(edit);
if(getInstallOptionsEditableElement().getTypeDef().getFlags().contains(InstallOptionsModel.FLAGS_MULTILINE) &&
getInstallOptionsEditableElement().getFlags().contains(InstallOptionsModel.FLAGS_MULTILINE)) {
text = TypeConverter.ESCAPED_STRING_CONVERTER.asType(text);
}
return text;
}
};
}
示例14: performCreation
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* After the creation of a {@link NamedElement} through a pallet entry this method is called. This method
* send a {@link DirectEditRequest} to the edit part of the just created {@link NamedElement}. Through the
* request can the user edit the name of the NamedElement direct after the creation of the NamedElement.
*
* */
@Override
protected void performCreation(final int button) {
super.performCreation(button);
final EditPartViewer viewer = getCurrentViewer();
final Object model = getCreateRequest().getNewObject();
if (model == null || viewer == null) {
return;
}
final Object o = getCurrentViewer().getEditPartRegistry().get(model);
if (o instanceof EditPart) {
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
final EditPart part = (EditPart) o;
final Request request = new DirectEditRequest();
part.performRequest(request);
}
});
}
}
示例15: getDirectEditCommand
import org.eclipse.gef.requests.DirectEditRequest; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
CompoundCommand command = new CompoundCommand();
String text = (String) request.getCellEditor().getValue();
NoteModel note = (NoteModel) getHost().getModel();
NoteEditCommand noteEditCommand = new NoteEditCommand(note, text);
command.add(noteEditCommand);
Rectangle rectangle=new Rectangle(note.getX(),note.getY(),-1,-1);
MoveElementCommand scommand = new MoveElementCommand();
scommand.setElement(note);
scommand.setRectangle(rectangle);
command.add(scommand);
return command.unwrap();
}