Example usage for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT

List of usage examples for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT.

Prototype

int BOTTOM_RIGHT

To view the source code for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT.

Click Source Link

Document

Constant for the bottom right quadrant.

Usage

From source file:org.nabucco.testautomation.config.ui.rcp.multipage.config.maintenance.masterdetails.TreeNodeDecorator.java

License:Open Source License

public static void decorateNode(MasterDetailTreeNode node, Datatype datatype) {

    // Reused PropertyLists and ConfigElements should be decorated
    if (datatype instanceof TestConfigElementContainer) {
        TestConfigElement newTestConfigElement = ((TestConfigElementContainer) datatype).getElement();
        Map<Integer, String> decorations = node.getDecorations();

        if (newTestConfigElement.getReused() != null && newTestConfigElement.getReused().getValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }/*from  w  w w  .java2 s.co  m*/
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    }

    if (datatype instanceof TestConfigElement) {
        TestConfigElement newTestConfigElement = (TestConfigElement) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (newTestConfigElement.getReused() != null && newTestConfigElement.getReused().getValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    } else if (datatype instanceof PropertyList) {
        PropertyList propertyList = (PropertyList) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (propertyList.getReused() != null && propertyList.getReused().getValue() != null
                && propertyList.getReused().getValue().booleanValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    }

    // Decorate "skip" and "executionType"
    if (datatype instanceof TestConfigElement) {
        TestConfigElement testConfigElement = (TestConfigElement) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (testConfigElement.getSkip() != null && testConfigElement.getSkip().getValue() != null
                && testConfigElement.getSkip().getValue()) {
            if (!decorations.containsKey(IDecoration.TOP_LEFT)) {
                decorations.put(IDecoration.TOP_LEFT, ConfigImageRegistry.ICON_SKIP_8X8.getId());
            }
        } else if (decorations.containsKey(IDecoration.TOP_LEFT)) {
            decorations.remove(IDecoration.TOP_LEFT);
        }

        if (testConfigElement.getExecutionType() != null
                && testConfigElement.getExecutionType() == ExecutionType.MANUAL) {
            if (!decorations.containsKey(IDecoration.TOP_RIGHT)) {
                decorations.put(IDecoration.TOP_RIGHT, ConfigImageRegistry.ICON_MANUAL.getId());
            }
        } else if (decorations.containsKey(IDecoration.TOP_RIGHT)) {
            decorations.remove(IDecoration.TOP_RIGHT);
        }
    }
}

From source file:org.nabucco.testautomation.result.ui.rcp.multipage.result.maintenance.masterdetail.TreeNodeDecorator.java

License:Open Source License

public static void decorateNode(MasterDetailTreeNode node, Datatype datatype) {
    // Reused PropertyLists and ConfigElements should be decorated
    if (datatype instanceof ManualTestResult) {
        Map<Integer, String> decorations = node.getDecorations();
        decorations.put(IDecoration.BOTTOM_RIGHT, ICON_USER_8X8);
    }//from w  ww  .ja v a2s . c om
}

From source file:org.nabucco.testautomation.script.ui.rcp.multipage.metadata.masterdetail.TreeNodeDecorator.java

License:Open Source License

public static void decorateNode(MasterDetailTreeNode node, Datatype datatype) {

    if (datatype instanceof PropertyList) {
        PropertyList propertyList = (PropertyList) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (propertyList.getReused() != null && propertyList.getReused().getValue() != null
                && propertyList.getReused().getValue().booleanValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ScriptImageRegistry.ICON_REUSED.getId());
            }/*from  w  w w  .ja v a 2 s  . com*/
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    }
}

From source file:org.netxms.ui.eclipse.objectbrowser.ObjectDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    ObjectStatus status = ((AbstractObject) element).getStatus();
    decoration.addOverlay(statusImages[status.getValue()], IDecoration.BOTTOM_RIGHT);
    if (((AbstractObject) element).isInMaintenanceMode()) {
        decoration.addOverlay(maintModeImage, IDecoration.TOP_RIGHT);
        decoration.addSuffix(Messages.get().ObjectDecorator_MaintenanceSuffix);
        decoration.setForegroundColor(maintColor);
    }/*from   www .  j  av a 2s  .c o  m*/
    if (element instanceof Interface) {
        if ((((Interface) element).getOperState() == Interface.OPER_STATE_DOWN)
                && (((Interface) element).getAdminState() == Interface.ADMIN_STATE_UP)
                && (((Interface) element).getExpectedState() == Interface.EXPECTED_STATE_IGNORE))
            decoration.addOverlay(statusImages[ObjectStatus.CRITICAL.getValue()], IDecoration.TOP_LEFT);
    }
}

From source file:org.netxms.ui.eclipse.usermanager.UserDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    if ((((AbstractUserObject) element).getFlags() & AbstractUserObject.DISABLED) != 0) {
        decoration.addOverlay(imageDisabled, IDecoration.BOTTOM_RIGHT);
    } else if ((((AbstractUserObject) element).getFlags() & AbstractUserObject.SYNC_EXCEPTION) != 0) {
        decoration.addOverlay(imageError, IDecoration.BOTTOM_RIGHT);
    }//from  w  w  w  .  j a va 2 s .co m
}

From source file:org.polymap.core.operation.actions.SaveChangesAction.java

License:Open Source License

public void historyNotification(OperationHistoryEvent ev) {
    log.debug("History changed: ev= " + ev);

    if (action != null) {
        Polymap.getSessionDisplay().asyncExec(new Runnable() {
            public void run() {
                if (operationSupport.undoHistorySize() > 0) {
                    Image image = CorePlugin.getDefault().imageForDescriptor(origImage, "_saveActionOrig");
                    ImageDescriptor ovr = CorePlugin.getDefault().imageDescriptor("icons/ovr16/dirty_ovr2.png");
                    action.setImageDescriptor(new DecorationOverlayIcon(image, ovr, IDecoration.BOTTOM_RIGHT));
                    //action.setToolTipText( "Operations: " + operationSupport.undoHistorySize() );
                } else {
                    action.setImageDescriptor(origImage);
                    //action.setToolTipText( "Save (including open editors)" );                        
                }//from  w  w  w.j  av  a 2s .  c  om
            }
        });
    }
}

From source file:org.polymap.core.project.ui.EntityModificationDecorator.java

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    try {/*ww w.j ava  2s.c  o m*/
        ModelChangeSupport entity = (ModelChangeSupport) elm;
        EntityChangeStatus entityState = EntityChangeStatus.forEntity(entity);

        boolean dirty = entityState.isDirty();
        boolean pendingConflict = entityState.isConcurrentlyDirty();
        boolean conflicting = entityState.isConflicting();

        if (dirty && conflicting) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(conflictImage);
            decoration.addOverlay(ovr, IDecoration.BOTTOM_RIGHT);
            //decoration.addPrefix( "# " );
        } else if (!dirty && conflicting) {
            //ImageDescriptor ovr = ProjectPlugin.imageDescriptorFromPlugin( ProjectPlugin.PLUGIN_ID, warningImage );
            //decoration.addOverlay( ovr, IDecoration.BOTTOM_RIGHT );
            //decoration.addPrefix( "< " );
        } else if (dirty) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(dirtyImage);
            decoration.addOverlay(ovr, IDecoration.BOTTOM_RIGHT);
            //decoration.addSuffix( "*" );
        }

        // register
        decorated.put(entity.id(), entity);
    } catch (NoSuchEntityException e) {
        decoration.addSuffix(" (removed)");
    }
}

From source file:org.reuseware.sokan.resource.ui.StoreDecorator.java

License:Open Source License

/**
 * Calculates decorations based on element. 
 * /* ww w  .j a  v a2s . co  m*/
 * @param element the element to decorate
 * @param decoration the decoration to set
 */
public void decorate(Object element, IDecoration decoration) {
    IResource res = null;
    if (element instanceof IResource) {
        res = (IResource) element;
    } else if (element instanceof IAdaptable) {
        res = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
    }

    if (res == null) {
        return;
    }
    if (StoreUtil.INSTANCE.isStore(res)) {
        descriptor = SokanResourcePlugin.getImageDescriptor(iconPath);
        if (descriptor == null) {
            return;
        }
        quadrant = IDecoration.BOTTOM_RIGHT;
        decoration.addOverlay(descriptor, quadrant);
    }
}

From source file:org.rssowl.ui.internal.ApplicationActionBarAdvisor.java

License:Open Source License

private static ImageDescriptor getImageDescriptor(IFolderChild child) {
        boolean hasNewNews = hasNewsWithState(child, EnumSet.of(INews.State.NEW));

        /* Bookmark */
        if (child instanceof IBookMark) {
            ImageDescriptor favicon = OwlUI.getFavicon((IBookMark) child);
            if (!hasNewNews)
                return (favicon != null) ? favicon : OwlUI.BOOKMARK;

            /* Overlay if News are *new* */
            Image base = (favicon != null) ? OwlUI.getImage(fgResources, favicon)
                    : OwlUI.getImage(fgResources, OwlUI.BOOKMARK);
            DecorationOverlayIcon overlay = new DecorationOverlayIcon(base,
                    OwlUI.getImageDescriptor("icons/ovr16/new.gif"), IDecoration.BOTTOM_RIGHT); //$NON-NLS-1$
            return overlay;
        }//  w  ww  . j a  v  a2 s. co  m

        /* Saved Search */
        else if (child instanceof ISearchMark) {
            if (hasNewNews)
                return OwlUI.SEARCHMARK_NEW;
            else if (((INewsMark) child).getNewsCount(INews.State.getVisible()) != 0)
                return OwlUI.SEARCHMARK;

            return OwlUI.SEARCHMARK_EMPTY;
        }

        /* News Bin */
        else if (child instanceof INewsBin) {
            boolean isArchive = child.getProperty(DefaultPreferences.ARCHIVE_BIN_MARKER) != null;

            if (hasNewNews)
                return isArchive ? OwlUI.ARCHIVE_NEW : OwlUI.NEWSBIN_NEW;
            else if (isArchive)
                return OwlUI.ARCHIVE;
            else if (((INewsMark) child).getNewsCount(INews.State.getVisible()) != 0)
                return OwlUI.NEWSBIN;

            return OwlUI.NEWSBIN_EMPTY;
        }

        /* Folder */
        else if (child instanceof IFolder)
            return hasNewNews ? OwlUI.FOLDER_NEW : OwlUI.FOLDER;

        return null;
    }

From source file:org.rssowl.ui.internal.views.explorer.BookMarkLabelProvider.java

License:Open Source License

private Image getIconForBookMark(IBookMark bookmark, boolean hasNew) {

    /* Load the FavIcon (if enabled) */
    ImageDescriptor favicon = fUseFavicons ? OwlUI.getFavicon(bookmark) : null;

    /* Indicate Error */
    if (bookmark.isErrorLoading()) {

        /* Overlay with Error Icon if required */
        if (favicon != null) {
            Image faviconImg = OwlUI.getImage(fResources, favicon);
            DecorationOverlayIcon overlay = new DecorationOverlayIcon(faviconImg,
                    OwlUI.getImageDescriptor("icons/ovr16/error.gif"), IDecoration.BOTTOM_RIGHT); //$NON-NLS-1$
            return OwlUI.getImage(fResources, overlay);
        }/* w  ww .ja  v a  2 s .c o  m*/

        /* Default Error Icon */
        return fBookMarkErrorIcon;
    }

    /* Use normal Icon */
    Image icon = favicon != null ? OwlUI.getImage(fResources, favicon) : fBookMarkIcon;

    /* Overlay if News are *new* */
    if (hasNew) {
        DecorationOverlayIcon overlay = new DecorationOverlayIcon(icon,
                OwlUI.getImageDescriptor("icons/ovr16/new.gif"), IDecoration.BOTTOM_RIGHT); //$NON-NLS-1$
        return OwlUI.getImage(fResources, overlay);
    }

    /* Don't overlay */
    return icon;
}