本文整理汇总了Java中org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java DecoratingStyledCellLabelProvider类的具体用法?Java DecoratingStyledCellLabelProvider怎么用?Java DecoratingStyledCellLabelProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoratingStyledCellLabelProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了DecoratingStyledCellLabelProvider类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStatusLabelProvider
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider; //导入依赖的package包/类
private static CellLabelProvider createStatusLabelProvider() {
CommitStatusLabelProvider baseProvider = new CommitStatusLabelProvider();
ProblemLabelDecorator decorator = new ProblemLabelDecorator(null);
return new DecoratingStyledCellLabelProvider(baseProvider, decorator, null) {
@Override
public String getToolTipText(Object element) {
return ((ChangedFile) element).getChangeType();
}
};
}
示例2: initializeViewer
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider; //导入依赖的package包/类
private void initializeViewer(ColumnViewer viewer, boolean flat) {
this.viewer = viewer;
// set content provider
fContentProvider= new PlanSearchContentProvider(flat);
viewer.setContentProvider(fContentProvider);
// set label provider
IStyledLabelProvider styleLabel = getStyledLabelProvider();
ILabelDecorator labelDecorator = getLabelDecorator();
viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(styleLabel, labelDecorator, null));
viewer.setUseHashlookup(true);
// set listeners
viewer.addSelectionChangedListener(new ISelectionChangedListener(){
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection realSelect = (IStructuredSelection) event.getSelection();
if (realSelect == null || realSelect.size() == 0){
return;
}
Object elem = realSelect.getFirstElement();
if (elem instanceof EPlanElement){
EPlan selectedPlan = EPlanUtils.getPlan((EPlanElement)elem);
IWorkbench workbench = PlatformUI.getWorkbench();
for (IWorkbenchWindow w : workbench.getWorkbenchWindows()) {
for (IWorkbenchPage p : w.getPages()) {
for (IEditorPart part : p.getEditors()) {
EPlan plan = CommonUtils.getAdapter(part, EPlan.class);
if (selectedPlan.equals(plan)){
//PlanEditorUtil.openPlanEditor(plan, w, true);
ISelectionProvider provider = part.getSite().getSelectionProvider();
provider.setSelection(realSelect);
IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
if(activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if(activePage != null) {
IViewPart searchView = activePage.findView("org.eclipse.search.ui.views.SearchView");
if(searchView != null) {
IWorkbenchPartSite site = searchView.getSite();
Shell shell = site.getShell();
shell.moveAbove(part.getSite().getShell());
}
}
}
return;
}
}
}
}
}
}
});
}