public static StatusLineContributionItem getStatusLineCItem(final String statusLineId) {
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();

    if (win == null) return null;
    IWorkbenchPage page = win.getActivePage();

    if (page == null) return null;
    IWorkbenchPart part = page.getActivePart();
    if (part == null) return null;
    IWorkbenchPartSite site = part.getSite();

    IViewSite vSite = (IViewSite) site;

    IActionBars actionBars = vSite.getActionBars();

    if (actionBars == null) return null;

    IStatusLineManager statusLineManager = actionBars.getStatusLineManager();

    if (statusLineManager == null) return null;

    StatusLineContributionItem StatusLineCItem =
        (StatusLineContributionItem) statusLineManager.find(statusLineId);
    return StatusLineCItem;
  }
Exemple #2
0
 private void updateStatusLine() {
   final IStatusLineManager manager = getEditorSite().getActionBars().getStatusLineManager();
   final IContributionItem dimItem = manager.find("data.dimension");
   final int[] dimension = fTable.getTableDimension();
   if (dimItem != null) {
     ((StatusLineContributionItem) dimItem)
         .setText((dimension != null) ? ("Dim: " + dimension[0] + " × " + dimension[1]) : "");
   }
 }