Search in sources :

Example 6 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method clearStatusLine.

/**
     * Clears the status line.
     */
public void clearStatusLine() {
    IStatusLineManager manager = propertySheet.getViewSite().getActionBars().getStatusLineManager();
    IContributionItem[] items = manager.getItems();
    for (IContributionItem item : items) {
        if (item instanceof StatusLineContributionItem) {
            ((StatusLineContributionItem) item).setText(Util.ZERO_LENGTH_STRING);
        }
    }
}
Also used : StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IContributionItem(org.eclipse.jface.action.IContributionItem)

Example 7 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project tdi-studio-se by Talend.

the class SWTResourceFilteredTree method updateStatusLine.

/**
     * Updates the status line.
     * 
     * @param resourceElements The SWT resource elements
     */
public void updateStatusLine(ISWTResourceElement[] resourceElements) {
    IStatusLineManager manager = actionBars.getStatusLineManager();
    IContributionItem[] items = manager.getItems();
    StatusLineContributionItem resourceCountContributionItem = null;
    for (IContributionItem item : items) {
        if (item instanceof StatusLineContributionItem) {
            resourceCountContributionItem = (StatusLineContributionItem) item;
        }
    }
    // create the status line
    if (resourceCountContributionItem == null) {
        //$NON-NLS-1$
        resourceCountContributionItem = new StatusLineContributionItem("ResourceCountContributionItem");
        manager.add(resourceCountContributionItem);
    }
    if (resourceElements == null) {
        resourceCountContributionItem.setText(Util.ZERO_LENGTH_STRING);
        return;
    }
    Map<String, Integer> resources = new HashMap<String, Integer>();
    for (ISWTResourceElement resourceElement : resourceElements) {
        //$NON-NLS-1$
        String name = resourceElement.getName().split(" ")[0];
        Integer count = resources.get(name);
        resources.put(name, count == null ? 1 : ++count);
    }
    // set text on status line
    List<String> list = new ArrayList<String>(resources.keySet());
    Collections.sort(list);
    StringBuffer buffer = new StringBuffer();
    //$NON-NLS-1$
    buffer.append("Total: ").append(resourceElements.length);
    for (String name : list) {
        //$NON-NLS-1$
        buffer.append(", ").append(name);
        //$NON-NLS-1$
        buffer.append(": ").append(resources.get(name));
    }
    resourceCountContributionItem.setText(buffer.toString());
}
Also used : StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) HashMap(java.util.HashMap) IContributionItem(org.eclipse.jface.action.IContributionItem) ArrayList(java.util.ArrayList) ISWTResourceElement(org.talend.designer.runtime.visualization.ISWTResourceElement)

Aggregations

IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)7 IContributionItem (org.eclipse.jface.action.IContributionItem)3 StatusLineContributionItem (org.eclipse.jface.action.StatusLineContributionItem)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 AlarmSystemManager (cl.utfsm.acs.acg.core.AlarmSystemManager)1 UserAuthenticator (cl.utfsm.acs.acg.core.UserAuthenticator)1 Role (cl.utfsm.acs.acg.core.UserAuthenticator.Role)1 UserAuthenticatorException (cl.utfsm.acs.acg.core.UserAuthenticatorException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Status (org.eclipse.core.runtime.Status)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 ErrorDialog (org.eclipse.jface.dialogs.ErrorDialog)1 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 GLCanvas (org.eclipse.swt.opengl.GLCanvas)1