/** * Adapts the behavior of the contained components to the change * encoded in the given event. * * @param event the event to which to adapt * @see PropertiesFileSourceViewerConfiguration#PropertiesFileSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String) */ public void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPropertyKeyScanner.affectsBehavior(event)) fPropertyKeyScanner.adaptToPreferenceChange(event); if (fCommentScanner.affectsBehavior(event)) fCommentScanner.adaptToPreferenceChange(event); if (fPropertyValueScanner.affectsBehavior(event)) fPropertyValueScanner.adaptToPreferenceChange(event); }
public void adaptToPreferenceChange(PropertyChangeEvent event) { String p= event.getProperty(); int index= indexOf(p); Token token= getToken(fPropertyNamesColor[index]); if (fPropertyNamesColor[index].equals(p)) adaptToColorChange(token, event); else if (fPropertyNamesBold[index].equals(p)) adaptToStyleChange(token, event, SWT.BOLD); else if (fPropertyNamesItalic[index].equals(p)) adaptToStyleChange(token, event, SWT.ITALIC); else if (fPropertyNamesStrikethrough[index].equals(p)) adaptToStyleChange(token, event, TextAttribute.STRIKETHROUGH); else if (fPropertyNamesUnderline[index].equals(p)) adaptToStyleChange(token, event, TextAttribute.UNDERLINE); }
/** * Must be called after the constructor has been called. */ public final void initialize() { fPropertyNamesColor= getTokenProperties(); int length= fPropertyNamesColor.length; fPropertyNamesBold= new String[length]; fPropertyNamesItalic= new String[length]; fPropertyNamesStrikethrough= new String[length]; fPropertyNamesUnderline= new String[length]; for (int i= 0; i < length; i++) { fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); fPropertyNamesStrikethrough[i]= getStrikethroughKey(fPropertyNamesColor[i]); fPropertyNamesUnderline[i]= getUnderlineKey(fPropertyNamesColor[i]); } fNeedsLazyColorLoading= Display.getCurrent() == null; for (int i= 0; i < length; i++) { if (fNeedsLazyColorLoading) addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } initializeRules(); }
private void initializeRules() { List<IRule> rules= createRules(); if (rules != null) { IRule[] result= new IRule[rules.size()]; rules.toArray(result); setRules(result); } }
/** * Determines whether the preference change encoded by the given event * changes the behavior of one of its contained components. * * @param event the event to be investigated * @return <code>true</code> if event causes a behavioral change */ public boolean affectsTextPresentation(PropertyChangeEvent event) { return fPropertyKeyScanner.affectsBehavior(event) || fCommentScanner.affectsBehavior(event) || fPropertyValueScanner.affectsBehavior(event); }
private void addTokenWithProxyAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey, italicKey, strikethroughKey, underlineKey))); }
@Override protected String getBoldKey(String colorKey) { if ((ANNOTATION_COLOR_KEY).equals(colorKey)) return ANNOTATION_BASE_KEY + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX; return super.getBoldKey(colorKey); }
private void resolveProxyAttributes() { if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i= 0; i < fPropertyNamesColor.length; i++) { addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } fNeedsLazyColorLoading= false; } }
@Override protected String getItalicKey(String colorKey) { if ((ANNOTATION_COLOR_KEY).equals(colorKey)) return ANNOTATION_BASE_KEY + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX; return super.getItalicKey(colorKey); }
/** * Determines whether the preference change encoded by the given event * changes the behavior of one of its contained components. * * @param event the event to be investigated * @return <code>true</code> if event causes a behavioral change */ public boolean affectsTextPresentation(PropertyChangeEvent event) { return fPropertyKeyScanner.affectsBehavior(event) || fCommentScanner.affectsBehavior(event) || fPropertyValueScanner.affectsBehavior(event); }
private void initializeRules() { List rules= createRules(); if (rules != null) { IRule[] result= new IRule[rules.size()]; rules.toArray(result); setRules(result); } }
private void addTokenWithProxyAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey, italicKey, strikethroughKey, underlineKey))); }
@Override protected String getBoldKey(String colorKey) { if ((ANNOTATION_COLOR_KEY).equals(colorKey)) return ANNOTATION_BASE_KEY + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX; return super.getBoldKey(colorKey); }
private void resolveProxyAttributes() { if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i= 0; i < fPropertyNamesColor.length; i++) { addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } fNeedsLazyColorLoading= false; } }
@Override protected String getItalicKey(String colorKey) { if ((ANNOTATION_COLOR_KEY).equals(colorKey)) return ANNOTATION_BASE_KEY + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX; return super.getItalicKey(colorKey); }
/** * Must be called after the constructor has been called. */ public final void initialize() { fPropertyNamesColor= getTokenProperties(); int length= fPropertyNamesColor.length; fPropertyNamesBold= new String[length]; fPropertyNamesItalic= new String[length]; fPropertyNamesStrikethrough= new String[length]; fPropertyNamesUnderline= new String[length]; for (int i= 0; i < length; i++) { fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); fPropertyNamesStrikethrough[i]= getStrikethroughKey(fPropertyNamesColor[i]); fPropertyNamesUnderline[i]= getUnderlineKey(fPropertyNamesColor[i]); } fNeedsLazyColorLoading= Display.getCurrent() == null; for (int i= 0; i < length; i++) { if (fNeedsLazyColorLoading) addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } initializeRules(); }
/** * Adapts the behavior of the contained components to the change * encoded in the given event. * * @param event the event to which to adapt * @see PropertiesFileSourceViewerConfiguration#PropertiesFileSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String) */ public void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPropertyKeyScanner.affectsBehavior(event)) fPropertyKeyScanner.adaptToPreferenceChange(event); if (fCommentScanner.affectsBehavior(event)) fCommentScanner.adaptToPreferenceChange(event); if (fPropertyValueScanner.affectsBehavior(event)) fPropertyValueScanner.adaptToPreferenceChange(event); }
public void adaptToPreferenceChange(PropertyChangeEvent event) { String p= event.getProperty(); int index= indexOf(p); Token token= getToken(fPropertyNamesColor[index]); if (fPropertyNamesColor[index].equals(p)) adaptToColorChange(token, event); else if (fPropertyNamesBold[index].equals(p)) adaptToStyleChange(token, event, SWT.BOLD); else if (fPropertyNamesItalic[index].equals(p)) adaptToStyleChange(token, event, SWT.ITALIC); else if (fPropertyNamesStrikethrough[index].equals(p)) adaptToStyleChange(token, event, TextAttribute.STRIKETHROUGH); else if (fPropertyNamesUnderline[index].equals(p)) adaptToStyleChange(token, event, TextAttribute.UNDERLINE); }
/** * Determines whether the preference change encoded by the given event * changes the behavior of one of its contained components. * * @param event the event to be investigated * @return <code>true</code> if event causes a behavioral change */ public boolean affectsTextPresentation(PropertyChangeEvent event) { return fPropertyKeyScanner.affectsBehavior(event) || fCommentScanner.affectsBehavior(event) || fPropertyValueScanner.affectsBehavior(event); }
private void initializeRules() { List<IRule> rules= createRules(); if (rules != null) { IRule[] result= new IRule[rules.size()]; rules.toArray(result); setRules(result); } }