Example usage for org.eclipse.jface.resource JFaceResources getResources

List of usage examples for org.eclipse.jface.resource JFaceResources getResources

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getResources.

Prototype

public static ResourceManager getResources() 

Source Link

Document

Returns the ResourceManager for the current display.

Usage

From source file:org.eclipse.jpt.common.ui.tests.internal.jface.DelegatingTreeContentProviderUiTest.java

License:Open Source License

private void buildViewTreePanel(Composite parent) {
    this.viewTree = this.buildTreePanel(parent, "View tree", new ItemTreeStateProviderManager(
            new ViewItemTreeContentProviderFactory(), JFaceResources.getResources()), new LabelProvider());
}

From source file:org.eclipse.jpt.jaxb.ui.internal.navigator.JaxbNavigatorContentProvider.java

License:Open Source License

protected ResourceManager getParentResourceManager() {
    return JFaceResources.getResources();
}

From source file:org.eclipse.m2e.core.ui.internal.components.WorkingSetGroup.java

License:Open Source License

private void createControl(Composite container) {
    addToWorkingSetButton = new Button(container, SWT.CHECK);
    GridData gd_addToWorkingSetButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
    gd_addToWorkingSetButton.verticalIndent = 12;
    addToWorkingSetButton.setLayoutData(gd_addToWorkingSetButton);
    addToWorkingSetButton.setSelection(true);
    addToWorkingSetButton.setData("name", "addToWorkingSetButton"); //$NON-NLS-1$ //$NON-NLS-2$
    addToWorkingSetButton.setText(Messages.WorkingSetGroup_btnAddSet);
    addToWorkingSetButton.setSelection(false);

    final Label workingsetLabel = new Label(container, SWT.NONE);
    GridData gd_workingsetLabel = new GridData();
    gd_workingsetLabel.horizontalIndent = 10;
    workingsetLabel.setLayoutData(gd_workingsetLabel);
    workingsetLabel.setEnabled(false);//from  ww  w  . ja v  a2  s  .com
    workingsetLabel.setData("name", "workingsetLabel"); //$NON-NLS-1$ //$NON-NLS-2$
    workingsetLabel.setText(Messages.WorkingSetGroup_lblSet);

    Combo workingsetCombo = new Combo(container, SWT.READ_ONLY);
    workingsetCombo.setEnabled(false);
    workingsetCombo.setData("name", "workingsetCombo"); //$NON-NLS-1$ //$NON-NLS-2$
    workingsetCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    workingsetComboViewer = new ComboViewer(workingsetCombo);
    workingsetComboViewer.setContentProvider(new IStructuredContentProvider() {
        public Object[] getElements(Object input) {
            if (input instanceof IWorkingSet[]) {
                return (IWorkingSet[]) input;
            } else if (input instanceof List<?>) {
                return new Object[] { input };
            } else if (input instanceof Set<?>) {
                return ((Set<?>) input).toArray();
            }
            return new IWorkingSet[0];
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        public void dispose() {
        }
    });
    workingsetComboViewer.setLabelProvider(new LabelProvider() {
        private ResourceManager images = new LocalResourceManager(JFaceResources.getResources());

        @SuppressWarnings("deprecation")
        public Image getImage(Object element) {
            if (element instanceof IWorkingSet) {
                ImageDescriptor imageDescriptor = ((IWorkingSet) element).getImage();
                if (imageDescriptor != null) {
                    try {
                        return (Image) images.create(imageDescriptor);
                    } catch (DeviceResourceException ex) {
                        return null;
                    }
                }
            }
            return super.getImage(element);
        }

        public String getText(Object element) {
            if (element instanceof IWorkingSet) {
                return ((IWorkingSet) element).getLabel();
            } else if (element instanceof List<?>) {
                StringBuffer sb = new StringBuffer();
                for (Object o : (List<?>) element) {
                    if (o instanceof IWorkingSet) {
                        if (sb.length() > 0) {
                            sb.append(", "); //$NON-NLS-1$
                        }
                        sb.append(((IWorkingSet) o).getLabel());
                    }
                }
                return sb.toString();
            }
            return super.getText(element);
        }

        public void dispose() {
            images.dispose();
            super.dispose();
        }
    });

    workingsetComboViewer.setComparator(new ViewerComparator());

    final Button newWorkingSetButton = new Button(container, SWT.NONE);
    newWorkingSetButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    newWorkingSetButton.setData("name", "configureButton"); //$NON-NLS-1$ //$NON-NLS-2$
    newWorkingSetButton.setText(Messages.WorkingSetGroup_btnMore);
    newWorkingSetButton.setEnabled(false);
    newWorkingSetButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(final SelectionEvent e) {
            IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
            IWorkingSetSelectionDialog dialog = workingSetManager.createWorkingSetSelectionDialog(shell, true,
                    WORKING_SET_IDS.toArray(new String[0]));
            if (dialog.open() == Window.OK) {
                IWorkingSet[] workingSets = dialog.getSelection();
                selectWorkingSets(Arrays.asList(workingSets));
            }
        }
    });

    if (selectWorkingSets(workingSets)) {
        addToWorkingSetButton.setSelection(true);
        workingsetLabel.setEnabled(true);
        workingsetComboViewer.getCombo().setEnabled(true);
        newWorkingSetButton.setEnabled(true);
    }

    addToWorkingSetButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            boolean addToWorkingingSet = addToWorkingSetButton.getSelection();
            workingsetLabel.setEnabled(addToWorkingingSet);
            workingsetComboViewer.getCombo().setEnabled(addToWorkingingSet);
            newWorkingSetButton.setEnabled(addToWorkingingSet);
            if (addToWorkingingSet) {
                updateConfiguration();
            } else {
                workingSets.clear();
            }
        }
    });

    workingsetComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateConfiguration();
        }
    });
}

From source file:org.eclipse.mylyn.commons.ui.GradientToolTip.java

License:Open Source License

private void initResources(Control control) {
    resourceManager = new LocalResourceManager(JFaceResources.getResources());
    colors = new GradientColors(control.getDisplay(), resourceManager);
}

From source file:org.eclipse.mylyn.internal.github.ui.gist.GistAttachmentTableLabelProvider.java

License:Open Source License

public GistAttachmentTableLabelProvider(TaskDataModel model, AttributeEditorToolkit attributeEditorToolkit) {
    this.model = model;
    this.attributeEditorToolkit = attributeEditorToolkit;
    this.imageManager = new LocalResourceManager(JFaceResources.getResources());
}

From source file:org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup.java

License:Open Source License

public AbstractNotificationPopup(Display display, int style, float percentTime, long delayClose) {
    super(new Shell(display));
    setShellStyle(style);/*  w  w w. ja v a  2 s  .  co  m*/
    this.percentTime = percentTime;
    this.delayClose = delayClose;
    this.display = display;
    resources = new LocalResourceManager(JFaceResources.getResources());
    initResources();

    closeJob.setSystem(true);
}

From source file:org.eclipse.mylyn.internal.tasks.ui.views.TaskListSearchHistoryPopupDialog.java

License:Open Source License

@Override
protected void createAdditionalSearchRegion(Composite composite) {
    if (!SearchUtil.supportsTaskSearch()) {
        return;//ww w.j  a va2 s .  co  m
    }

    resourceManager = new LocalResourceManager(JFaceResources.getResources());
    colors = new GradientColors(composite.getDisplay(), resourceManager);

    GradientCanvas gradient = new GradientCanvas(composite, SWT.NONE);

    gradient.setBackgroundGradient(new Color[] { colors.getGradientBegin(), colors.getGradientEnd() },
            new int[] { 100 }, true);

    GridLayout headLayout = new GridLayout();
    headLayout.marginHeight = 5;
    headLayout.marginWidth = 5;
    headLayout.horizontalSpacing = 0;
    headLayout.verticalSpacing = 0;
    gradient.setLayout(headLayout);
    gradient.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));

    gradient.setSeparatorVisible(true);
    gradient.setSeparatorAlignment(SWT.TOP);

    Composite editContainer = new Composite(gradient, SWT.NONE);
    GridLayout editLayout = new GridLayout();
    editLayout.marginHeight = 0;
    editLayout.marginWidth = 0;
    editContainer.setLayout(editLayout);
    editContainer.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, true));

    ImageHyperlink advancedSearchButton = new ImageHyperlink(editContainer, SWT.NONE);
    advancedSearchButton.setUnderlined(true);
    advancedSearchButton.setForeground(CommonColors.HYPERLINK_WIDGET);
    advancedSearchButton.setText(TaskListFilteredTree.LABEL_SEARCH);
    advancedSearchButton.addHyperlinkListener(new HyperlinkAdapter() {
        @Override
        public void linkActivated(HyperlinkEvent e) {
            SearchUtil.openSearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
        }
    });
    GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(advancedSearchButton);
}

From source file:org.eclipse.nebula.widgets.suggestbox.canvas.ClosableSuggestBoxCanvas.java

License:Open Source License

public ClosableSuggestBoxCanvas(Composite parent, int style, Object input, ILabelProvider labelProvider) {
    super(parent, style, input, labelProvider);
    resourceManager = new LocalResourceManager(JFaceResources.getResources(), this);
    Bundle bundle = FrameworkUtil.getBundle(getClass());

    closeImgDescActive = ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path("icons/close.png"), null));
    closeImgDescInactive = ImageDescriptor.createWithFlags(closeImgDescActive, SWT.IMAGE_DISABLE);

    addListener();//  ww w .j a v a 2s. co  m
}

From source file:org.eclipse.nebula.widgets.suggestbox.SuggestBox.java

License:Open Source License

public SuggestBox(Composite parent, int style) {
    super(parent, style | SWT.BORDER);
    resourceManager = new LocalResourceManager(JFaceResources.getResources(), this);
    suggestBoxEntries = new ArrayList<SuggestBoxEntry<T>>();
    createWidgets();//from  www.  j ava 2s.c  o  m
    initListener();
}

From source file:org.eclipse.net4j.util.ui.ManagedLabelProvider.java

License:Open Source License

protected LocalResourceManager createResourceManager() {
    return new LocalResourceManager(JFaceResources.getResources());
}