本文整理汇总了Java中org.eclipse.jface.viewers.StructuredViewer.getSelection方法的典型用法代码示例。如果您正苦于以下问题:Java StructuredViewer.getSelection方法的具体用法?Java StructuredViewer.getSelection怎么用?Java StructuredViewer.getSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.StructuredViewer
的用法示例。
在下文中一共展示了StructuredViewer.getSelection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelection
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
/**
* Returns the current selection.
* @return selection
*/
protected ISelection getSelection() {
StructuredViewer viewerInFocus= fSelectionProviderMediator.getViewerInFocus();
if (viewerInFocus != null) {
return viewerInFocus.getSelection();
}
return StructuredSelection.EMPTY;
}
示例2: switchViewer
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
private void switchViewer(int state) {
//Indicate which viewer is to be used
if (fCurrViewState == state)
return;
else {
fCurrViewState= state;
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
store.setValue(getViewSite().getId() + TAG_VIEW_STATE, state);
}
//get the information from the existing viewer
StructuredViewer viewer= fWrappedViewer.getViewer();
Object object= viewer.getInput();
ISelection selection= viewer.getSelection();
// create and set up the new viewer
Control control= createViewer(fWrappedViewer.getControl().getParent()).getControl();
setUpViewer(fWrappedViewer);
createSelectAllAction();
// add the selection information from old viewer
fWrappedViewer.setViewerInput(object);
fWrappedViewer.getControl().setFocus();
fWrappedViewer.setSelection(selection, true);
// dispose old viewer
viewer.getContentProvider().dispose();
viewer.getControl().dispose();
// layout the new viewer
if (control != null && !control.isDisposed()) {
control.setVisible(true);
control.getParent().layout(true);
}
}
示例3: getSelection
import org.eclipse.jface.viewers.StructuredViewer; //导入方法依赖的package包/类
private List<IJiveEvent> getSelection(final StructuredViewer viewer)
{
final ISelection selection = viewer.getSelection();
final List<IJiveEvent> result = new ArrayList<IJiveEvent>();
if (selection != null && selection instanceof IStructuredSelection)
{
final IStructuredSelection sel = (IStructuredSelection) selection;
for (@SuppressWarnings("unchecked")
final Iterator<IJiveEvent> iterator = sel.iterator(); iterator.hasNext();)
{
result.add(iterator.next());
}
}
return result;
}