/** * Returns the color of the given annotation type. * * @param annotationType the annotation type * @return the color of the annotation type */ private Color getAnnotationTypeColor(Object annotationType) { AnnotationPreference info= fAnnotationTypeKeyMap.get(annotationType); if (info != null) return getColor( info.getColorPreferenceKey()); return null; }
/** * Returns the color of the given annotation type. * * @param annotationType the annotation type * @return the color of the annotation type */ private Color getAnnotationTypeColor(Object annotationType) { AnnotationPreference info= fAnnotationTypeKeyMap.get(annotationType); if (info != null) return getColor( info.getColorPreferenceKey()); return null; }
/** * Returns the color of the given annotation type. * * @param annotationType the annotation type * @return the color of the annotation type */ private Color getAnnotationTypeColor(Object annotationType) { AnnotationPreference info= (AnnotationPreference) fAnnotationTypeKeyMap.get(annotationType); if (info != null) return getColor( info.getColorPreferenceKey()); return null; }
private String[][] createQuickDiffModel(MarkerAnnotationPreferences preferences) { String[][] items= new String[3][]; Iterator e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= (AnnotationPreference) e.next(); if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange")) //$NON-NLS-1$ items[0]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_changeColor }; else if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) //$NON-NLS-1$ items[1]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_additionColor }; else if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) //$NON-NLS-1$ items[2]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_deletionColor }; } return items; }
private String[][] createQuickDiffModel(MarkerAnnotationPreferences preferences) { String[][] items= new String[3][]; Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange")) //$NON-NLS-1$ items[0]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_changeColor }; else if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) //$NON-NLS-1$ items[1]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_additionColor }; else if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) //$NON-NLS-1$ items[2]= new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_deletionColor }; } return items; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList overlayKeys= new ArrayList(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER)); Iterator e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= (AnnotationPreference) e.next(); if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) //$NON-NLS-1$ ) { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey())); } } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList overlayKeys= new ArrayList(); Iterator e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= (AnnotationPreference) e.next(); if (isLinkedModeAnnotation(info)) { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey())); } } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList<OverlayKey> overlayKeys= new ArrayList<>(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER)); Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); if (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) //$NON-NLS-1$ ) { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey())); } } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList<OverlayKey> overlayKeys= new ArrayList<>(); Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); if (isLinkedModeAnnotation(info)) { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey())); } } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private ListItem[] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) { ArrayList<ListItem> listModelItems= new ArrayList<>(); Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); if (isLinkedModeAnnotation(info)) { String label= info.getPreferenceLabel(); List<String[]> styles= getStyles(info.getAnnotationType()); listModelItems.add(new ListItem(label, info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getHighlightPreferenceKey(), info.getTextStylePreferenceKey(), styles)); } } ListItem[] items= new ListItem[listModelItems.size()]; listModelItems.toArray(items); return items; }
/** * Checks if <code>spec</code> has all the attributes previously required * by the marker annotation preference extension point. These are: color, text * and overview ruler preference keys. * * @param spec the <code>AnnotationPreference</code> to check * @return <code>true</code> if <code>spec</code> is complete, <code>false</code> otherwise * @since 3.0 */ private static boolean isComplete(AnnotationPreference spec) { return spec.getColorPreferenceKey() != null && spec.getColorPreferenceValue() != null && spec.getTextPreferenceKey() != null && spec.getOverviewRulerPreferenceKey() != null; }
/** * Checks if <code>spec</code> has all the attributes previously required * by the marker annotation preference extension point. These are: color, text * and overview ruler preference keys. * * @param spec the <code>AnnotationPreference</code> to check * @return <code>true</code> if <code>spec</code> is complete, <code>false</code> otherwise * @since 3.0 */ private static boolean isComplete(AnnotationPreference spec) { return spec.getColorPreferenceKey() != null && spec.getColorPreferenceValue() != null && spec.getTextPreferenceKey() != null && spec.getOverviewRulerPreferenceKey() != null; }
private ListItem[] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) { ArrayList listModelItems= new ArrayList(); Iterator e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= (AnnotationPreference) e.next(); if (isLinkedModeAnnotation(info)) { String label= info.getPreferenceLabel(); List styles= getStyles(info.getAnnotationType()); listModelItems.add(new ListItem(label, null, info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getOverviewRulerPreferenceKey(), info.getHighlightPreferenceKey(), info.getVerticalRulerPreferenceKey(), info.getTextStylePreferenceKey(), styles)); } } ListItem[] items= new ListItem[listModelItems.size()]; listModelItems.toArray(items); return items; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList overlayKeys= new ArrayList(); Iterator e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= (AnnotationPreference) e.next(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey())); if (info.getHighlightPreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey())); if (info.getVerticalRulerPreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getVerticalRulerPreferenceKey())); if (info.getTextStylePreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey())); } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) { ArrayList<OverlayKey> overlayKeys= new ArrayList<>(); Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey())); if (info.getHighlightPreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey())); if (info.getVerticalRulerPreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getVerticalRulerPreferenceKey())); if (info.getTextStylePreferenceKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey())); if (info.getIsGoToNextNavigationTargetKey() != null) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getIsGoToNextNavigationTargetKey())); } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }
private ListItem[] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) { ArrayList<ListItem> listModelItems= new ArrayList<>(); Iterator<AnnotationPreference> e= preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info= e.next(); if (info.isIncludeOnPreferencePage()) { String label= info.getPreferenceLabel(); if (containsMoreThanOne(preferences.getAnnotationPreferences().iterator(), label)) label += " (" + info.getAnnotationType() + ")"; //$NON-NLS-1$//$NON-NLS-2$ Image image= getImage(info); listModelItems.add(new ListItem(label, image, info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getOverviewRulerPreferenceKey(), info.getHighlightPreferenceKey(), info .getVerticalRulerPreferenceKey(), info.getTextStylePreferenceKey(), info.getIsGoToNextNavigationTargetKey())); } } Comparator<ListItem> comparator= new Comparator<ListItem>() { @Override public int compare(ListItem o1, ListItem o2) { String label1= o1.label; String label2= o2.label; return Collator.getInstance().compare(label1, label2); } }; Collections.sort(listModelItems, comparator); ListItem[] items= new ListItem[listModelItems.size()]; listModelItems.toArray(items); return items; }
/** * Extracts the color preference for the given preference from the given store. * If the given store indicates that the default value is to be used, or * the value stored in the preferences store is <code>null</code>, * the value is taken from the <code>AnnotationPreference</code>'s default * color value. * <p> * The return value is * </p> * * @param store the preference store * @param pref the annotation preference * @return the RGB color preference, not <code>null</code> */ private static RGB getColorFromAnnotationPreference(IPreferenceStore store, AnnotationPreference pref) { String key= pref.getColorPreferenceKey(); RGB rgb= null; if (store.contains(key)) { if (store.isDefault(key)) rgb= pref.getColorPreferenceValue(); else rgb= PreferenceConverter.getColor(store, key); } if (rgb == null) rgb= pref.getColorPreferenceValue(); return rgb; }
/** * Extracts the color preference for the given preference from the given store. * If the given store indicates that the default value is to be used, or * the value stored in the preferences store is <code>null</code>, * the value is taken from the <code>AnnotationPreference</code>'s default * color value. * <p> * The return value is * </p> * * @param store the preference store * @param pref the annotation preference * @return the RGB color preference, not <code>null</code> */ private static RGB getColorFromAnnotationPreference(IPreferenceStore store, AnnotationPreference pref) { String key= pref.getColorPreferenceKey(); RGB rgb= null; if (store.contains(key)) { if (store.isDefault(key)) rgb= pref.getColorPreferenceValue(); else rgb= PreferenceConverter.getColor(store, key); } if (rgb == null) rgb= pref.getColorPreferenceValue(); return rgb; }
if (info.getVerticalRulerPreferenceKey() != null) store.setDefault(info.getVerticalRulerPreferenceKey(), info.getVerticalRulerPreferenceValue()); PreferenceConverter.setDefault(store, info.getColorPreferenceKey(), info.getColorPreferenceValue()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setDefault(info.getShowInNextPrevDropdownToolbarActionKey(), info.isShowInNextPrevDropdownToolbarAction());
if (info.getVerticalRulerPreferenceKey() != null) store.setDefault(info.getVerticalRulerPreferenceKey(), info.getVerticalRulerPreferenceValue()); PreferenceConverter.setDefault(store, info.getColorPreferenceKey(), info.getColorPreferenceValue()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setDefault(info.getShowInNextPrevDropdownToolbarActionKey(), info.isShowInNextPrevDropdownToolbarAction());