本文整理汇总了Java中org.eclipse.gef.SelectionManager类的典型用法代码示例。如果您正苦于以下问题:Java SelectionManager类的具体用法?Java SelectionManager怎么用?Java SelectionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectionManager类属于org.eclipse.gef包,在下文中一共展示了SelectionManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendSelection
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
* Given and edit part model, we want to expand the selection to
* include all the edit parts that reference that model, as well
* as query the edit part for additional selections
*/
@Override
@SuppressWarnings("unchecked")
public void appendSelection(EditPart ep) {
super.appendSelection(ep);
Set<Object> models = new LinkedHashSet<Object>();
models.add(ep.getModel());
SelectionManager selectionManager = getSelectionManager();
for (Object o : ((IStructuredSelection)selectionManager.getSelection()).toArray()) {
models.add(((EditPart)o).getModel());
}
Set<EditPart> editParts = new LinkedHashSet<EditPart>(getSelectableEditParts(models));
ISelection epSelection = CommonUtils.getAdapter(ep, ISelection.class);
if (epSelection != null) {
editParts.remove(ep);
editParts.addAll(((IStructuredSelection)epSelection).toList());
} else {
editParts.remove(ep); // move the primary selection to the end of the list
editParts.add(ep);
}
selectionManager.setSelection(new StructuredSelection(editParts.toArray(new EditPart[0])));
}
示例2: setSelectionManager
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
* @see EditPartViewer#setSelectionManager(SelectionManager)
*/
public void setSelectionManager(SelectionManager model) {
Assert.isNotNull(model);
if (selectionModel != null)
selectionModel.internalUninstall();
selectionModel = model;
model.internalInitialize(this, selection, new Runnable() {
public void run() {
fireSelectionChanged();
}
});
if (getControl() != null)
model.internalHookControl(getControl());
}
示例3: setSelectedDefault
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
private void setSelectedDefault() {
final SelectionManager lSelectionManager = viewer.getSelectionManager();
if (model == null) {
lSelectionManager.setSelection(StructuredSelection.EMPTY);
} else {
selectedObject = (ItemEditPart) viewer.getEditPartRegistry().get(model.getCenter());
lSelectionManager.setSelection(new StructuredSelection(selectedObject));
}
}
示例4: selectionChanged
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
@Override
public void selectionChanged(final SelectionChangedEvent inEvent) {
if (isSelectionChangeHandling()) {
endSelectionChangeHandling();
return;
}
if (inEvent.getSelection().isEmpty()) {
return;
}
// prevent multi selection by deselecting all selected items except
// the last
final SelectionManager lManager = viewer.getSelectionManager();
final Object[] lSelections = ((IStructuredSelection) inEvent.getSelection()).toArray();
for (int i = 0; i < lSelections.length - 1; i++) {
if (lSelections[i] instanceof EditPart) {
lManager.deselect((EditPart) lSelections[i]);
}
}
final Object lSelection = lSelections[lSelections.length - 1];
if (lSelection instanceof ItemEditPart) {
if (model != null) {
selectedObject = (ItemEditPart) lSelection;
eventBroker.post(RelationsConstants.TOPIC_TO_BROWSER_MANAGER_SET_SELECTED,
new SelectedItemChangeEvent((ItemAdapter) selectedObject.getModel(),
DefaultBrowserPart.this));
}
}
if (lSelection instanceof RelationEditPart) {
eventBroker.post(RelationsConstants.TOPIC_TO_BROWSER_MANAGER_SET_SELECTED,
((RelationEditPart) lSelection).getModel());
}
if (lSelection instanceof RelationsEditPart) {
// this ensures that clicking the background doesn't deselect
// the selected object
lManager.setSelection(new StructuredSelection(selectedObject));
}
}
示例5: doPropertyChange
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void doPropertyChange(PropertyChangeEvent event) {
if ("consumed".equals(event.getPropagationId())) {
return;
}
if (event.getPropertyName().equals(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER)) {
refreshChildren();
} else if (event.getPropertyName().equals(ERVirtualDiagram.PROPERTY_CHANGE_VTABLES)) {
refresh();
refreshRelations();
} else if (event.getPropertyName().equals(ERDiagram.PROPERTY_CHANGE_ALL)) {
refresh();
refreshRelations();
final List<DiagramWalker> nodeElementList = (List<DiagramWalker>) event.getNewValue();
if (nodeElementList != null) {
getViewer().deselectAll();
final SelectionManager selectionManager = getViewer().getSelectionManager();
final Map<DiagramWalker, EditPart> modelToEditPart = getModelToEditPart();
for (final DiagramWalker walker : nodeElementList) {
selectionManager.appendSelection(modelToEditPart.get(walker));
}
}
} else if (event.getPropertyName().equals(ERDiagram.PROPERTY_CHANGE_ADD)) {
final Object newValue = event.getNewValue();
if (newValue instanceof ERVirtualDiagram) {
refresh();
refreshVisuals();
}
} else if (event.getPropertyName().equals(ERDiagram.PROPERTY_CHANGE_TABLE)) {
final TableView newTable = (TableView) event.getNewValue();
internalRefreshTable(newTable);
} else if (event.getPropertyName().equals(ViewableModel.PROPERTY_CHANGE_COLOR)) {
refreshVisuals();
} else if (event.getPropertyName().equals(ERDiagram.PROPERTY_CHANGE_DATABASE)) {
changeDatabase(event);
} else if (event.getPropertyName().equals(ERDiagramPropertySource.PROPERTY_INIT_DATABASE)) {
final ERDiagram diagram = (ERDiagram) getModel();
diagram.restoreDatabase(DBManagerFactory.getAllDBList().get(0));
} else if (event.getPropertyName().equals(ERDiagram.PROPERTY_CHANGE_SETTINGS)) {
changeSettings();
}
}
示例6: AbstractEditPartViewer
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
* Constructs the viewer and calls {@link #init()}.
*/
public AbstractEditPartViewer() {
setSelectionManager(SelectionManager.createDefault());
init();
}
示例7: getSelectionManager
import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
* @see EditPartViewer#getSelectionManager()
*/
public SelectionManager getSelectionManager() {
return selectionModel;
}