Example usage for org.eclipse.jface.action IStatusLineManager appendToGroup

List of usage examples for org.eclipse.jface.action IStatusLineManager appendToGroup

Introduction

In this page you can find the example usage for org.eclipse.jface.action IStatusLineManager appendToGroup.

Prototype

void appendToGroup(String groupName, IAction action);

Source Link

Document

Adds a contribution item for the given action at the end of the group with the given name.

Usage

From source file:com.xored.glance.internal.ui.panels.SearchStatusLine.java

License:Open Source License

private void init() {
    item = new SearchItem();
    IStatusLineManager manager = getManager();
    if (manager != null) {
        manager.remove(item);//from   ww  w .  ja v a  2 s.  co  m
        manager.appendToGroup(StatusLineManager.BEGIN_GROUP, item);
        manager.update(true);
    }
}

From source file:net.refractions.udig.project.ui.internal.tool.display.ToolManager.java

License:Open Source License

/**
 * This method goes through the steps of deactivating the current tool option contribution and 
 * activating the new tool option contribution.
 * /*from  www  .  j ava 2s.  co  m*/
 * @param statusLine
 * @param modalToolProxy
 */
private void initToolOptionsContribution(IStatusLineManager statusLine, ToolProxy modalToolProxy) {
    if (statusLine != null) {

        if (preferencesShortcutToolOptions == null || preferencesShortcutToolOptions.isDisposed()) {
            preferencesShortcutToolOptions = new PreferencesShortcutToolOptionsContributionItem();
            statusLine.appendToGroup(StatusLineManager.BEGIN_GROUP, preferencesShortcutToolOptions);
            preferencesShortcutToolOptions.setVisible(true);
        }
        preferencesShortcutToolOptions.update(modalToolProxy);

        //TODO, cache contributions instead of destroying them and recreating them

        //remove old tool contribution
        for (ContributionItem contribution : optionsContribution) {
            statusLine.remove(contribution.getId());
        }

        //get the new contributions
        optionsContribution = modalToolProxy.getOptionsContribution();

        //set all new contributions
        for (ContributionItem contribution : optionsContribution) {
            statusLine.appendToGroup(StatusLineManager.BEGIN_GROUP, contribution);
            contribution.setVisible(true);
        }

        statusLine.update(true);
    }
}

From source file:net.refractions.udig.tools.internal.CursorPosition.java

License:Open Source License

LineItem getLabel() {
    if (getContext().getActionBars() == null)
        return null;
    IStatusLineManager bar = getContext().getActionBars().getStatusLineManager();
    if (bar == null) {
        return null;
    }/*from  w ww. j  a  v a 2s  .com*/
    LineItem item = (LineItem) bar.find(ID);
    if (item == null) {
        item = new LineItem(ID);
        bar.appendToGroup(StatusLineManager.END_GROUP, item);
        bar.update(true);
    }

    return item;
}

From source file:org.eclipse.pde.internal.ui.shared.target.TargetStatus.java

License:Open Source License

/**
 * Adds the target status contribution to the status line manager if the value of
 * preference {@link IPreferenceConstants#SHOW_TARGET_STATUS} is true.  Will not remove
 * an existing status contribution if the preference is false, to remove use
 * {@link #refreshTargetStatus()}./* www.  j a  va 2  s . c  o  m*/
 * <p>
 * Does not have to be called from a UI thread.
 * </p>
 */
public static void initializeTargetStatus() {
    PDEPreferencesManager prefs = PDEPlugin.getDefault().getPreferenceManager();
    boolean showStatus = prefs.getBoolean(IPreferenceConstants.SHOW_TARGET_STATUS);

    if (showStatus) {
        UIJob updateStatus = new UIJob("Refresh PDE Target Status") { //$NON-NLS-1$
            @Override
            public IStatus runInUIThread(IProgressMonitor monitor) {
                IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
                for (int i = 0; i < windows.length; i++) {
                    IStatusLineManager slManager = getStatusLineManager(windows[i]);
                    if (slManager != null) {
                        slManager.appendToGroup(StatusLineManager.BEGIN_GROUP, getContributionItem());
                        slManager.update(false);
                        break;
                    }
                }
                return Status.OK_STATUS;
            }
        };
        updateStatus.setSystem(true);
        updateStatus.setPriority(Job.DECORATE);
        updateStatus.schedule();
    }
}

From source file:org.eclipse.pde.internal.ui.shared.target.TargetStatus.java

License:Open Source License

/**
 * Adds or removes the target status contribution from the status line manager depending on the
 * value of preference {@link IPreferenceConstants#SHOW_TARGET_STATUS}.
 * <p>/*w ww. j a  v a 2  s.  c  om*/
 * Must be called from the UI Thread.
 * </p>
 */
public static void refreshTargetStatus() {
    PDEPreferencesManager prefs = PDEPlugin.getDefault().getPreferenceManager();
    boolean showStatus = prefs.getBoolean(IPreferenceConstants.SHOW_TARGET_STATUS);

    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    for (int i = 0; i < windows.length; i++) {
        IStatusLineManager manager = getStatusLineManager(windows[i]);
        if (manager != null) {
            if (showStatus) {
                manager.remove(TARGET_STATUS_ID);
                manager.appendToGroup(StatusLineManager.BEGIN_GROUP, getContributionItem());
            } else {
                manager.remove(TARGET_STATUS_ID);
            }
            manager.update(false);
            break;
        }
    }
}