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

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

Introduction

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

Prototype

int TOP_RIGHT

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

Click Source Link

Document

Constant for the top right quadrant.

Usage

From source file:gov.nasa.ensemble.core.plan.advisor.provider.ActivityAdvisorLabelDecorator.java

License:Open Source License

public ActivityAdvisorLabelDecorator() {
    if (badgeLocation == null) {
        return;/*from  w w w . j  av  a  2  s. c o  m*/
    }

    if (badgeLocation.equalsIgnoreCase("TOP_LEFT")) {
        quadrant = IDecoration.TOP_LEFT;
    }

    else if (badgeLocation.equalsIgnoreCase("TOP_RIGHT")) {
        quadrant = IDecoration.TOP_RIGHT;
    }

    else if (badgeLocation.equalsIgnoreCase("BOTTOM_LEFT")) {
        quadrant = IDecoration.BOTTOM_LEFT;
    }

    else if (badgeLocation.equalsIgnoreCase("BOTTOM_RIGHT")) {
        quadrant = IDecoration.BOTTOM_RIGHT;
    }

    else if (badgeLocation.equalsIgnoreCase("REPLACE")) {
        quadrant = IDecoration.BOTTOM_LEFT;
    }

    else if (badgeLocation.equalsIgnoreCase("UNDERLAY")) {
        quadrant = IDecoration.UNDERLAY;
    }

    else {
        LogUtil.warn("unsupported value entered for " + propertyKey + ", using default value instead");
    }
}

From source file:gov.redhawk.sca.model.provider.refresh.internal.ui.RefreshDataProviderDecorator.java

License:Open Source License

/**
 * {@inheritDoc}/*from   w w  w  .  ja  v a  2s  . c  o m*/
 */
@Override
public void decorate(final Object element, final IDecoration decoration) {
    if (element instanceof DataProviderObject) {
        final DataProviderObject dataProvider = (DataProviderObject) element;
        final RefreshTasker task = ScaModelCommandWithResult.execute(dataProvider,
                new ScaModelCommandWithResult<RefreshTasker>() {

                    @Override
                    public void execute() {
                        for (final IScaDataProvider provider : dataProvider.getDataProviders()) {
                            if (provider instanceof RefreshTasker) {
                                final RefreshTasker job = (RefreshTasker) provider;
                                setResult(job);
                                return;
                            }
                        }
                    }
                });
        if (task != null) {
            if (!task.isActive()) {
                decoration.addOverlay(RefreshProviderUIActivator.getDefault()
                        .getImageDescriptor("icons/stock-media-pause.png"), IDecoration.TOP_RIGHT);
            }
            // Don't add a second listener if we have already added one
            for (PropertyChangeListener l : task.getPropertyChangeListeners()) {
                if (l instanceof PropertyListener && ((PropertyListener) l).element == dataProvider) {
                    return;
                }
            }
            task.addPropertyChangeListener(new PropertyListener(dataProvider));
        }
    }
}

From source file:info.limpet.ui.decorators.LimpetDecorator.java

License:Open Source License

private void decorateInOut(IDecoration decoration, boolean in, boolean out) {
    if (in && out) {
        decoration.addOverlay(TWO_WAY_ARROW, IDecoration.TOP_RIGHT);
    } else if (out) {
        decoration.addOverlay(LEFT_ARROW, IDecoration.TOP_RIGHT);
    } else if (in) {
        decoration.addOverlay(RIGHT_ARROW, IDecoration.TOP_RIGHT);
    }/*from   w ww . j  a  v a 2s.  c  o  m*/
}

From source file:metabest.ui.decorators.TestcaseFolderDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    /**/*from   w  ww  .  j a  va2  s .c  om*/
     * Checks that the element is an IResource with the 'Read-only' attribute
     * and adds the decorator based on the specified image description and the
     * integer representation of the placement option.
     */
    IResource resource = (IResource) element;
    if (resource instanceof IFolder) {
        IFolder folder = (IFolder) resource;
        try {
            if (folder.getPersistentProperty(MetaBestPersistentProperties.FOLDER_KEY) != null
                    && folder.getPersistentProperty(MetaBestPersistentProperties.FOLDER_KEY)
                            .equals(MetaBestPersistentProperties.FOLDER_KEY_TESTCASE)) {
                URL url = FileLocator.find(Platform.getBundle("metabest"), new Path(iconPath), null); //NON-NLS-1

                if (url == null)
                    return;
                descriptor = ImageDescriptor.createFromURL(url);
                quadrant = IDecoration.TOP_RIGHT;
                decoration.addOverlay(descriptor, quadrant);
            }
        } catch (CoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:metabup.decorators.MetaBupProjectDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    /**//w  ww  .j a  v a2s .  c o  m
     * Checks that the element is an IResource with the 'Read-only' attribute
     * and adds the decorator based on the specified image description and the
     * integer representation of the placement option.
     */
    IResource resource = (IResource) element;
    if (resource instanceof IProject) {
        IProject project = (IProject) resource;
        boolean mbupProject = false;

        try {
            for (String nature : project.getDescription().getNatureIds())
                if (nature.equals(MetaBupProjectNature.NATURE_ID))
                    mbupProject = true;
        } catch (CoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        if (mbupProject) {
            URL url = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path(iconPath), null); //NON-NLS-1

            if (url == null)
                return;
            descriptor = ImageDescriptor.createFromURL(url);
            quadrant = IDecoration.TOP_RIGHT;
            decoration.addOverlay(descriptor, quadrant);
        }
    }
}

From source file:metabup.sketches.decorators.LegendFolderDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    /**//  w  w  w.  j  a  v  a2s  .  c o  m
     * Checks that the element is an IResource with the 'Read-only' attribute
     * and adds the decorator based on the specified image description and the
     * integer representation of the placement option.
     */
    IResource resource = (IResource) element;
    if (resource instanceof IFolder) {
        IFolder folder = (IFolder) resource;
        try {
            if (folder.getPersistentProperty(SketchPersistentProperties.FOLDER_KEY) != null
                    && folder.getPersistentProperty(SketchPersistentProperties.FOLDER_KEY)
                            .equals(SketchPersistentProperties.FOLDER_KEY_LEGEND)) {
                URL url = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path(iconPath), null); //NON-NLS-1

                if (url == null)
                    return;
                descriptor = ImageDescriptor.createFromURL(url);
                quadrant = IDecoration.TOP_RIGHT;
                decoration.addOverlay(descriptor, quadrant);
            }
        } catch (CoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:net.bhl.cdt.ui.decorators.IsStartableDecorator.java

License:Open Source License

@Override
public void decorate(Object resource, IDecoration decoration) {
    try {//  w w  w.  ja  v  a  2  s.  co  m
        if (resource instanceof ProcessElement) {
            ProcessElement processElement = (ProcessElement) resource;

            if (processElement.isStartable()) {
                decoration.addOverlay(
                        ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/ready.gif"),
                        IDecoration.TOP_RIGHT);
            } else
                decoration.addOverlay(
                        ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/nogo.gif"),
                        IDecoration.TOP_RIGHT);

            /**
             * Dummy Notification to get the Containment (the parent) refreshed so that decorate is called. The
             * containment sets a notification that itself has changed.
             */
            processElement.eContainer()
                    .eNotify(new ENotificationImpl((InternalEObject) processElement.eContainer(),
                            Notification.UNSET, ProcessPackage.DESIGN_OPERATION___IS_STARTABLE, null, null));
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:net.sf.vex.editor.config.PluginProjectDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {

    if (this.vexIcon == null) {
        this.loadImageDescriptors();
    }/*w ww  .j a  va 2 s . c o m*/

    if (element instanceof IProject) {
        try {
            IProject project = (IProject) element;
            if (project.hasNature(PluginProjectNature.ID)) {
                decoration.addOverlay(this.vexIcon, IDecoration.TOP_RIGHT);
            }
        } catch (CoreException e) {
        }
    }
}

From source file:net.sourceforge.taggerplugin.preferences.PreferenceInitializer.java

License:Open Source License

public void initializeDefaultPreferences() {
    final IPreferenceStore store = TaggerActivator.getDefault().getPreferenceStore();
    store.setDefault(PreferenceConstants.CONFIRM_CLEAR_ASSOCIATIONS.getKey(), true);
    store.setDefault(PreferenceConstants.CONFIRM_DELETE_TAG.getKey(), true);
    store.setDefault(PreferenceConstants.POSITION_LABEL_DECORATION.getKey(),
            String.valueOf(IDecoration.TOP_RIGHT));
    store.setDefault(PreferenceConstants.TAGSET_FILE_LOCATION.getKey(),
            TaggerActivator.getDefault().getStateLocation().append("tags.xml").toFile().toString());
}

From source file:net.sourceforge.taggerplugin.preferences.TaggerPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.//from w w w.  j av a 2s . co m
 */
public void createFieldEditors() {
    addField(new BooleanFieldEditor(PreferenceConstants.CONFIRM_CLEAR_ASSOCIATIONS.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_ConfirmClear, getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.CONFIRM_DELETE_TAG.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_ConfirmDelete, getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(PreferenceConstants.POSITION_LABEL_DECORATION.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_LabelDecoration, 1,
            new String[][] {
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_TopRight,
                            String.valueOf(IDecoration.TOP_RIGHT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_TopLeft,
                            String.valueOf(IDecoration.TOP_LEFT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_BottomRight,
                            String.valueOf(IDecoration.BOTTOM_RIGHT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_BottomLeft,
                            String.valueOf(IDecoration.BOTTOM_LEFT) } },
            getFieldEditorParent()));

    //       FIXME: externalize
    addField(new FileFieldEditor(PreferenceConstants.TAGSET_FILE_LOCATION.getKey(), "TagSet Storage File:",
            true, getFieldEditorParent()));
}