当前位置: 首页>>代码示例>>Java>>正文


Java SelectionManager类代码示例

本文整理汇总了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])));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:27,代码来源:TimelineViewer.java

示例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());
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:17,代码来源:AbstractEditPartViewer.java

示例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));
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:10,代码来源:DefaultBrowserPart.java

示例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));
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:41,代码来源:DefaultBrowserPart.java

示例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();
    }
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:44,代码来源:ERDiagramEditPart.java

示例6: AbstractEditPartViewer

import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
 * Constructs the viewer and calls {@link #init()}.
 */
public AbstractEditPartViewer() {
	setSelectionManager(SelectionManager.createDefault());
	init();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:8,代码来源:AbstractEditPartViewer.java

示例7: getSelectionManager

import org.eclipse.gef.SelectionManager; //导入依赖的package包/类
/**
 * @see EditPartViewer#getSelectionManager()
 */
public SelectionManager getSelectionManager() {
	return selectionModel;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:7,代码来源:AbstractEditPartViewer.java


注:本文中的org.eclipse.gef.SelectionManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。