List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry
public static ColorRegistry getColorRegistry()
From source file:net.tourbook.map3.ui.DialogSelectMap3Color.java
License:Open Source License
private Composite createUI(final Composite parent) { _shellContainer = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults()// .margins(SHELL_MARGIN, SHELL_MARGIN).spacing(0, 0).applyTo(_shellContainer); // _shellContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); {/* ww w . j a v a 2s . c o m*/ createUI_10_ColorViewer(_shellContainer); createUI_20_Actions(_shellContainer); } // set color for all controls final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); net.tourbook.common.UI.setChildColors(_shellContainer, fgColor, bgColor); _shellContainer.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { onDispose(); } }); return _shellContainer; }
From source file:net.tourbook.photo.internal.gallery.MT20.FullScreenPhotoGallery.java
License:Open Source License
private void updateColors(final boolean isRestore) { final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); _photoGallery.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, isRestore); _containerFooter.setBackground(bgColor); }
From source file:net.tourbook.photo.internal.PicDirFolder.java
License:Open Source License
private void updateColors(final boolean isRestore) { _isStateShowFileFolderInFolderItem = _prefStore.getBoolean(// IPhotoPreferences.PHOTO_VIEWER_IS_SHOW_FILE_FOLDER); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); final Tree tree = _folderViewer.getTree(); tree.setForeground(fgColor);//from w ww .j av a 2 s.co m tree.setBackground(bgColor); _picDirImages.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, isRestore); }
From source file:net.tourbook.photo.PhotoUI.java
License:Open Source License
/** * Set photo colors in the JFace color registry from the pref store *//* www . j a v a 2 s .c om*/ public static void setPhotoColorsFromPrefStore() { // pref store var cannot be set from a static field because it can be null !!! final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore(); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOLDER, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FOLDER)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FILE, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FILE)); }
From source file:net.tourbook.preferences.PrefPageMap3Color.java
License:Open Source License
private void createUI_22_ColorViewer_Table(final Composite parent) { /*/*from w w w. j av a 2s. co m*/ * Create tree */ final Tree tree = new Tree(parent, // SWT.CHECK // | SWT.H_SCROLL | SWT.V_SCROLL // | SWT.BORDER | SWT.FULL_SELECTION); GridDataFactory.fillDefaults().grab(true, true).applyTo(tree); tree.setHeaderVisible(true); // tree.setLinesVisible(false); // tree.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN)); /* * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. Therefore, it is * critical for performance that these methods be as efficient as possible. */ final Listener paintListener = new Listener() { @Override public void handleEvent(final Event event) { if (event.type == SWT.MeasureItem || event.type == SWT.PaintItem) { onViewerPaint(event); } } }; tree.addListener(SWT.MeasureItem, paintListener); tree.addListener(SWT.PaintItem, paintListener); /* * Create tree viewer */ _colorProfileViewer = new CheckboxTreeViewer(tree); _columnManager.createColumns(_colorProfileViewer); _tcProfileImage = _colDefProfileImage.getTreeColumn(); _columnIndexProfileImage = _colDefProfileImage.getCreateIndex(); _columnIndexGraphImage = _colDefGraphImage.getCreateIndex(); _colorProfileViewer.setContentProvider(new ContentProvider()); _colorProfileViewer.setComparator(new Map3ProfileComparator()); _colorProfileViewer.setUseHashlookup(true); _colorProfileViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { onViewerSelectColor(); } }); _colorProfileViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { onViewerDoubleClick(); } }); _colorProfileViewer.setCheckStateProvider(new ICheckStateProvider() { @Override public boolean isChecked(final Object element) { return onViewerIsChecked(element); } @Override public boolean isGrayed(final Object element) { return onViewerIsGrayed(element); } }); _colorProfileViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(final CheckStateChangedEvent event) { onViewerCheckStateChange(event); } }); createContextMenu(); // set color for all controls final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); net.tourbook.common.UI.setChildColors(tree, fgColor, bgColor); }
From source file:net.tourbook.tour.photo.DialogPhotoProperties.java
License:Open Source License
@Override protected Composite createToolTipContentArea(final Composite parent) { final Composite container = createUI(parent); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); _fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); _bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); updateUI();// ww w . j a v a 2 s . co m net.tourbook.common.UI.setChildColors(parent, _fgColor, _bgColor); if (_oldMapFilterData != null) { /* * _oldMapFilterData can be set before the UI is created */ updateFilterUI(_oldMapFilterData); } enableActions(); return container; }
From source file:net.tourbook.tour.photo.PhotoToolTipUI.java
License:Open Source License
private void updateUI_Colors(final Composite parent) { final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); // final Color fgColor = Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA); // final Color bgColor = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); _galleryContainer.setForeground(fgColor); _galleryContainer.setBackground(bgColor); _photoGallery.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, true); }
From source file:net.tourbook.tour.photo.TourPhotosView.java
License:Open Source License
private void updateColors(final boolean isRestore) { final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); _photoGallery.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, isRestore); }
From source file:net.tourbook.ui.UI.java
License:Open Source License
/** * Set tag colors in the JFace color registry from the pref store */// ww w . j ava 2 s.c o m public static void setViewColorsFromPrefStore() { // pref store var cannot be set from a static field because it can be null !!! final IPreferenceStore prefStore = TourbookPlugin.getDefault().getPreferenceStore(); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); colorRegistry.put(VIEW_COLOR_CATEGORY, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_CATEGORY)); colorRegistry.put(VIEW_COLOR_TITLE, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_TITLE)); colorRegistry.put(VIEW_COLOR_SUB, // year PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB)); colorRegistry.put(VIEW_COLOR_SUB_SUB, // month PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB_SUB)); colorRegistry.put(VIEW_COLOR_TOUR, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_TOUR)); colorRegistry.put(VIEW_COLOR_BG_HISTORY_TOUR, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_BG_HISTORY_TOUR)); }
From source file:net.tourbook.ui.views.tagging.TaggingView.java
License:Open Source License
/** * tree column: category/tag/year/month/tour *//*from www . j av a2 s . c o m*/ private void defineColumn_1stColumn() { final TreeColumnDefinition colDef = TreeColumnFactory.TOUR_TAG_AND_TAGS.createColumn(_columnManager, _pc); colDef.setIsDefaultColumn(); colDef.setCanModifyVisibility(false); colDef.setLabelProvider(new TourInfoToolTipStyledCellLabelProvider() { @Override public Long getTourId(final ViewerCell cell) { if (_isToolTipInTag == false) { return null; } final Object element = cell.getElement(); final TVITagViewItem viewItem = (TVITagViewItem) element; if (viewItem instanceof TVITagViewTour) { return ((TVITagViewTour) viewItem).tourId; } return null; } @Override public void update(final ViewerCell cell) { final Object element = cell.getElement(); final TVITagViewItem viewItem = (TVITagViewItem) element; final StyledString styledString = new StyledString(); if (viewItem instanceof TVITagViewTour) { styledString.append(viewItem.treeColumn); cell.setImage(UI.getInstance().getTourTypeImage(((TVITagViewTour) viewItem).tourTypeId)); setCellColor(cell, element); } else if (viewItem instanceof TVITagViewTag) { final TVITagViewTag tagItem = (TVITagViewTag) viewItem; styledString.append(viewItem.treeColumn, UI.TAG_STYLER); styledString.append(" " + viewItem.colTourCounter, StyledString.QUALIFIER_STYLER); //$NON-NLS-1$ cell.setImage(tagItem.isRoot ? _imgTagRoot : _imgTag); } else if (viewItem instanceof TVITagViewTagCategory) { styledString.append(viewItem.treeColumn, UI.TAG_CATEGORY_STYLER); cell.setImage(_imgTagCategory); } else if (viewItem instanceof TVITagViewYear || viewItem instanceof TVITagViewMonth) { styledString.append(viewItem.treeColumn); styledString.append(" " + viewItem.colTourCounter, StyledString.QUALIFIER_STYLER); //$NON-NLS-1$ if (viewItem instanceof TVITagViewMonth) { cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_SUB_SUB)); } else { cell.setForeground(JFaceResources.getColorRegistry().get(UI.VIEW_COLOR_SUB)); } } else { styledString.append(viewItem.treeColumn); } cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); } }); }