Example usage for org.eclipse.jface.action IContributionManager markDirty

List of usage examples for org.eclipse.jface.action IContributionManager markDirty

Introduction

In this page you can find the example usage for org.eclipse.jface.action IContributionManager markDirty.

Prototype

void markDirty();

Source Link

Document

Marks this contribution manager as dirty.

Usage

From source file:com.github.haixing_hu.swt.menu.MenuManagerEx.java

License:Open Source License

/**
 * The <code>MenuManagerEx</code> implementation of this
 * <code>ContributionManager</code> method also propagates the dirty flag up
 * the parent chain./* ww  w  . java2 s  .  co m*/
 *
 * @since 3.1
 */
@Override
public void markDirty() {
    super.markDirty();
    // Can't optimize by short-circuiting when the first dirty manager is
    // encountered,
    // since non-visible children are not even processed.
    // That is, it's possible to have a dirty sub-menu under a non-dirty parent
    // menu
    // even after the parent menu has been updated.
    // If items are added/removed in the sub-menu, we still need to propagate
    // the dirty flag up,
    // even if the sub-menu is already dirty, since the result of isVisible()
    // may change
    // due to the added/removed items.
    final IContributionManager parent = getParent();
    if (parent != null) {
        parent.markDirty();
    }
}

From source file:net.yatomiya.e4.ui.workbench.renderers.swt.AbstractContributionItem.java

License:Open Source License

protected void updateVisible() {
    setVisible((modelItem).isVisible());
    final IContributionManager parent = getParent();
    if (parent != null) {
        parent.markDirty();
    }//  w  w w. j  a va 2  s .c o m
}

From source file:org.eclipse.e4.ui.workbench.renderers.swt.DirectContributionItem.java

License:Open Source License

private void updateVisible() {
    setVisible((model).isVisible());/*from  ww  w.  j  a  va  2s.  com*/
    final IContributionManager parent = getParent();
    if (parent != null) {
        parent.markDirty();
    }
}

From source file:org.eclipse.ui.internal.ActionSetActionBars.java

License:Open Source License

/**
 * Activate / Deactivate the contributions.
 *//*from   w w  w .  j  a v  a 2s.co  m*/
protected void setActive(boolean set) {
    super.setActive(set);

    ICoolBarManager coolBarManager = getCastedParent().getCoolBarManager();
    if (coolBarManager == null) {
        return;
    }

    // 1. Need to set visibility for all non-adjunct actions
    if (coolItemToolBarMgr != null) {
        IContributionItem[] items = coolItemToolBarMgr.getItems();
        for (int i = 0; i < items.length; i++) {
            IContributionItem item = items[i];
            if (item instanceof PluginActionCoolBarContributionItem) {
                PluginActionCoolBarContributionItem actionSetItem = (PluginActionCoolBarContributionItem) item;
                // Only if the action set id for this contribution item is
                // the same
                // as this object
                if (actionSetItem.getActionSetId().equals(actionSetId)) {
                    item.setVisible(set);
                    coolItemToolBarMgr.markDirty();
                    if (!coolBarManager.isDirty()) {
                        coolBarManager.markDirty();
                    }
                }
            }
        }
        // Update the manager
        coolItemToolBarMgr.update(false);
        if (toolBarContributionItem != null) {
            toolBarContributionItem.update(ICoolBarManager.SIZE);
        }
    }

    // 2. Need to set visibility for all adjunct actions
    if (adjunctContributions.size() > 0) {
        for (Iterator i = adjunctContributions.iterator(); i.hasNext();) {
            IContributionItem item = (IContributionItem) i.next();
            if (item instanceof ContributionItem) {
                item.setVisible(set);
                IContributionManager manager = ((ContributionItem) item).getParent();
                manager.markDirty();
                manager.update(false);
                if (!coolBarManager.isDirty()) {
                    coolBarManager.markDirty();
                }
                item.update(ICoolBarManager.SIZE);
            }

        }

    }
}

From source file:org.eclipse.ui.internal.PluginActionContributionItem.java

License:Open Source License

/**
 * Mark the parent dirty if we have a parent.
 * //from   w w  w .j ava 2  s  . c om
 * @since 3.1
 */
private void invalidateParent() {
    IContributionManager parent = getParent();
    if (parent != null) {
        parent.markDirty();
    }
}

From source file:org.python.pydev.ui.MenuManagerCopiedToAddCreateMenuWithMenuParent.java

License:Open Source License

/**
 * The <code>MenuManager</code> implementation of this <code>ContributionManager</code> method
 * also propagates the dirty flag up the parent chain.
 * //from www .ja  v  a 2  s. co m
 * @since 3.1
 */
public void markDirty() {
    super.markDirty();
    // Can't optimize by short-circuiting when the first dirty manager is encountered,
    // since non-visible children are not even processed.
    // That is, it's possible to have a dirty sub-menu under a non-dirty parent menu
    // even after the parent menu has been updated. 
    // If items are added/removed in the sub-menu, we still need to propagate the dirty flag up,
    // even if the sub-menu is already dirty, since the result of isVisible() may change
    // due to the added/removed items.
    IContributionManager parent = getParent();
    if (parent != null) {
        parent.markDirty();
    }
}