本文整理汇总了Java中org.eclipse.gef.GraphicalViewer.setSelection方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicalViewer.setSelection方法的具体用法?Java GraphicalViewer.setSelection怎么用?Java GraphicalViewer.setSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.GraphicalViewer
的用法示例。
在下文中一共展示了GraphicalViewer.setSelection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void run() {
final GraphicalViewer viewer = part.getAdapter(GraphicalViewer.class);
if (viewer != null) {
final List<NodeElementEditPart> children = new ArrayList<NodeElementEditPart>();
for (final Object child : viewer.getContents().getChildren()) {
if (child instanceof NodeElementEditPart) {
final NodeElementEditPart editPart = (NodeElementEditPart) child;
if (editPart.getFigure().isVisible()) {
children.add(editPart);
}
}
}
viewer.setSelection(new StructuredSelection(children));
}
}
示例2: run
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void run() {
GraphicalViewer viewer = (GraphicalViewer) part
.getAdapter(GraphicalViewer.class);
if (viewer != null) {
List<NodeElementEditPart> children = new ArrayList<NodeElementEditPart>();
for (Object child : viewer.getContents().getChildren()) {
if (child instanceof NodeElementEditPart) {
NodeElementEditPart editPart = (NodeElementEditPart) child;
if (editPart.getFigure().isVisible()) {
children.add(editPart);
}
}
}
viewer.setSelection(new StructuredSelection(children));
}
}
示例3: run
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
GraphicalViewer viewer = (GraphicalViewer)part.getAdapter(GraphicalViewer.class);
List<Object> viewerChildren = viewer.getContents().getChildren();
List<Object> newChildren = new ArrayList<Object>();
for( Object obj : viewerChildren ) {
if( obj instanceof LabelNodeEditPart ) {
continue;
}
newChildren.add(obj);
}
if (viewer != null) {
viewer.setSelection(new StructuredSelection(newChildren));
}
}
示例4: run
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
public void run() {
final GraphicalViewer viewer = (GraphicalViewer) part.getAdapter(GraphicalViewer.class);
if (viewer != null) {
final List<DiagramWalkerEditPart> children = new ArrayList<>();
for (final Object child : viewer.getContents().getChildren()) {
if (child instanceof DiagramWalkerEditPart) {
final DiagramWalkerEditPart editPart = (DiagramWalkerEditPart) child;
if (editPart.getFigure().isVisible()) {
children.add(editPart);
}
}
}
viewer.setSelection(new StructuredSelection(children));
}
}
示例5: run
import org.eclipse.gef.GraphicalViewer; //导入方法依赖的package包/类
@Override
public void run() {
PasteCommand command = createCommand(getSelectedObjects());
execute(command);
// Select the pasted edit part
GraphicalViewer viewer = (GraphicalViewer) getWorkbenchPart().getAdapter(GraphicalViewer.class);
if (viewer != null) {
viewer.setSelection(new StructuredSelection(getSelectableEditParts(viewer, command.getPasteParent(),
command.getCreatedNodesNumber())));
}
}