List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry
public static ColorRegistry getColorRegistry()
From source file:org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView.java
License:Open Source License
/** * Creates the source viewer to be used by this view. * * @param parent the parent control/*from w w w . j a va2 s.com*/ * @param ruler the vertical ruler * @param styles style bits * @return the source viewer */ private SourceViewer createSourceViewer(Composite parent, IVerticalRuler vertRuler, IOverviewRuler ovRuler) { DisassemblyViewer viewer = new DisassemblyViewer(parent, vertRuler, ovRuler); viewer.setRangeIndicator(new DefaultRangeIndicator()); JFaceResources.getFontRegistry().addListener(this); JFaceResources.getColorRegistry().addListener(this); return viewer; }
From source file:org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView.java
License:Open Source License
public void dispose() { getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); JFaceResources.getFontRegistry().removeListener(this); JFaceResources.getColorRegistry().removeListener(this); getEditorPreferenceStore().removePropertyChangeListener(this); CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); if (fSourceViewerDecorationSupport != null) { fSourceViewerDecorationSupport.dispose(); fSourceViewerDecorationSupport = null; }//from w w w .j a va 2s . c o m if (fDocumentProvider != null) { fDocumentProvider.dispose(); fDocumentProvider = null; } if (fActions != null) { fActions.clear(); fActions = null; } super.dispose(); }
From source file:org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser.java
License:Open Source License
private CTabFolder createTabFolder(Composite parent) { final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$ c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$ folder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true); folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$ folder.setSimple(PlatformUI.getPreferenceStore() .getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); folder.setBorderVisible(true);/*from ww w. j ava2s .co m*/ // listener to dispose rendering resources for each closed tab folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { event.doit = true; CTabItem item = (CTabItem) event.item; disposeTab(item); } }); // listener to dispose rendering resources for all tab items when view part is closed folder.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for (CTabItem tab : folder.getItems()) { disposeTab(tab); } folder.removeDisposeListener(this); } }); return folder; }
From source file:org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelBackground.java
License:Open Source License
@Override public RGB getBackground() { return JFaceResources.getColorRegistry().getRGB(IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_BACKGROUND); }
From source file:org.eclipse.cdt.dsf.ui.viewmodel.update.StaleDataLabelForeground.java
License:Open Source License
@Override public RGB getForeground() { return JFaceResources.getColorRegistry().getRGB(IDsfDebugUIConstants.PREF_COLOR_STALE_DATA_FOREGROUND); }
From source file:org.eclipse.cdt.internal.ui.viewsupport.ExcludedFileDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof IFile || element instanceof IFolder) { IResource resource = (IResource) element; ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); ICProjectDescription desc = mngr.getProjectDescription(resource.getProject(), ICProjectDescriptionManager.GET_IF_LOADDED); if (desc == null) return; ICConfigurationDescription conf = desc.getDefaultSettingConfiguration(); ICSourceEntry[] entries = conf.getSourceEntries(); boolean isUnderSourceRoot = false; IPath fullPath = resource.getFullPath(); for (ICSourceEntry icSourceEntry : entries) { if (icSourceEntry.getFullPath().isPrefixOf(fullPath)) { isUnderSourceRoot = true; break; }//from w ww . j a v a 2 s . c o m } // Only bother to mark items that would be included otherwise if (isUnderSourceRoot && CDataUtil.isExcluded(fullPath, entries)) { decoration.addOverlay(CPluginImages.DESC_OVR_INACTIVE); decoration.setForegroundColor( JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR)); } } }
From source file:org.eclipse.cdt.internal.ui.viewsupport.IncludeFolderDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { boolean isAccesible = true; if (element instanceof IncludeReferenceProxy) { IIncludeReference reference = ((IncludeReferenceProxy) element).getReference(); IPath path = reference.getPath(); IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(path); if (container != null) { isAccesible = container.isAccessible(); } else {/*from ww w. jav a2 s. c o m*/ isAccesible = path.toFile().exists(); } } else if (element instanceof IIncludeReference) { IPath path = ((IIncludeReference) element).getPath(); isAccesible = path.toFile().exists(); } if (!isAccesible) { decoration.addOverlay(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OVR_WARNING)); // JFacePreferences.QUALIFIER_COLOR colors label in gray decoration.setForegroundColor(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR)); } }
From source file:org.eclipse.cdt.launchbar.ui.internal.dialogs.NewLaunchConfigEditPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout(2, false)); Label label = new Label(comp, SWT.NONE); label.setLayoutData(new GridData()); label.setText("Name:"); nameText = new Text(comp, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$ c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$ tabFolder = new CTabFolder(comp, SWT.BORDER | SWT.NO_REDRAW_RESIZE | SWT.FLAT); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2;/* ww w .ja v a2s. c o m*/ tabFolder.setLayoutData(gridData); tabFolder.setSimple(false); tabFolder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true); tabFolder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$ setControl(comp); nameText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String name = nameText.getText().trim(); workingCopy.rename(name); String errMessage = checkName(name); if (errMessage == null) { validateFields(); } else { setErrorMessage(errMessage); } } }); validateFields(); }
From source file:org.eclipse.cdt.managedbuilder.ui.properties.CPropertyVarsTab.java
License:Open Source License
@Override public void createControls(Composite parent) { super.createControls(parent); initButtons(new String[] { ADD_STR, EDIT_STR, DEL_STR }); usercomp.setLayout(new GridLayout(2, true)); createTableControl();// www .j a v a 2 s .co m // Create a "show parent levels" button final Button b = new Button(usercomp, SWT.CHECK); b.setFont(usercomp.getFont()); b.setText(Messages.CPropertyVarsTab_0); b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); b.setSelection(fShowSysMacros); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fShowSysMacros = b.getSelection(); updateData(getResDesc()); } }); stringListModeControl = new StringListModeControl(page, usercomp, 1); stringListModeControl.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { updateData(); } }); fStatusLabel = new Label(usercomp, SWT.LEFT); fStatusLabel.setFont(usercomp.getFont()); fStatusLabel.setText(EMPTY_STR); fStatusLabel.setLayoutData(new GridData(GridData.BEGINNING)); fStatusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR)); }
From source file:org.eclipse.cdt.managedbuilder.ui.properties.NewBuildConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); composite.setFont(parent.getFont()); composite.setLayout(new GridLayout(3, false)); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create a group for the name & description final Group group1 = new Group(composite, SWT.NONE); group1.setFont(composite.getFont()); GridLayout layout1 = new GridLayout(3, false); group1.setLayout(layout1);/*from ww w .j av a 2 s . c o m*/ GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; group1.setLayoutData(gd); // Add a label and a text widget for Configuration's name final Label nameLabel = new Label(group1, SWT.LEFT); nameLabel.setFont(parent.getFont()); nameLabel.setText(Messages.NewConfiguration_label_name); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 1; gd.grabExcessHorizontalSpace = false; nameLabel.setLayoutData(gd); configName = new Text(group1, SWT.SINGLE | SWT.BORDER); configName.setFont(group1.getFont()); configName.setText(getNewName()); configName.setFocus(); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; configName.setLayoutData(gd); configName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateState(); } }); // Add a label and a text widget for Configuration's description final Label descriptionLabel = new Label(group1, SWT.LEFT); descriptionLabel.setFont(parent.getFont()); descriptionLabel.setText(Messages.NewConfiguration_label_description); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 1; gd.grabExcessHorizontalSpace = false; descriptionLabel.setLayoutData(gd); configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER); configDescription.setFont(group1.getFont()); configDescription.setText(getNewDescription()); configDescription.setFocus(); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; configDescription.setLayoutData(gd); // Create a group for the radio buttons final Group group = new Group(composite, SWT.NONE); group.setFont(composite.getFont()); group.setText(Messages.NewConfiguration_label_group); GridLayout layout = new GridLayout(3, false); group.setLayout(layout); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; group.setLayoutData(gd); SelectionListener radioListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { clone = btnClone.getSelection(); updateComboState(); } }; // Add a radio button and combo box to copy from default config btnCopy = new Button(group, SWT.RADIO); btnCopy.setFont(group.getFont()); btnCopy.setText(Messages.NewConfiguration_label_copy); setButtonLayoutData(btnCopy); btnCopy.addSelectionListener(radioListener); copyConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); copyConfigSelector.setFont(group.getFont()); int index = copyConfigSelector.indexOf(newName); copyConfigSelector.select(index < 0 ? 0 : index); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; copyConfigSelector.setLayoutData(gd); copyConfigSelector.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { validateState(); } }); copyConfigSelector.setEnabled(false); // Create a radio button and combo for clonable configs btnClone = new Button(group, SWT.RADIO); btnClone.setFont(group.getFont()); btnClone.setText(Messages.NewConfiguration_label_clone); setButtonLayoutData(btnClone); btnClone.addSelectionListener(radioListener); btnClone.setSelection(true); cloneConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); cloneConfigSelector.setFont(group.getFont()); cloneConfigSelector.setItems(getDefinedConfigNamesAndDescriptions()); index = cloneConfigSelector.indexOf(newName); cloneConfigSelector.select(index < 0 ? 0 : index); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; cloneConfigSelector.setLayoutData(gd); cloneConfigSelector.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { validateState(); } }); updateComboState(); updateDefaultConfigs(); statusLabel = new Label(composite, SWT.CENTER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; statusLabel.setLayoutData(gd); statusLabel.setFont(composite.getFont()); statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR)); return composite; }