Changeset 3874 for devel-tools/trunk


Ignore:
Timestamp:
Jul 23, 2008, 9:28:24 PM (12 years ago)
Author:
yura
Message:
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.ui
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/preferences.ini

    r3742 r3874  
    1 org.refal.rfpdt.editor.Symbol.color=42,0,255
    2 org.refal.rfpdt.editor.Keyword.color=127,0,85
    3 org.refal.rfpdt.editor.Keyword.bold=true
    4 org.refal.rfpdt.editor.Identifier_definition.color=0,0,192
    5 org.refal.rfpdt.editor.Identifier_use.color=0,0,0
    6 org.refal.rfpdt.editor.Variable_type.color=127,0,85
    7 org.refal.rfpdt.editor.Variable_type.italic=true
    8 org.refal.rfpdt.editor.Variable_definition.color=0,0,192
    9 org.refal.rfpdt.editor.Variable_definition.italic=true
    10 org.refal.rfpdt.editor.Variable_use.color=0,0,0
    11 org.refal.rfpdt.editor.Variable_use.italic=true
    12 org.refal.rfpdt.editor.Comment.color=63,127,95
    13 org.refal.rfpdt.editor.Other_symbols.color=0,0,0
     1org.refal.rfpdt.editor.symbol.color=42,0,255
     2org.refal.rfpdt.editor.keyword.color=127,0,85
     3org.refal.rfpdt.editor.keyword.bold=true
     4org.refal.rfpdt.editor.identifierDefinition.color=0,0,192
     5org.refal.rfpdt.editor.identifierUse.color=0,0,0
     6org.refal.rfpdt.editor.variableType.color=127,0,85
     7org.refal.rfpdt.editor.variableType.italic=true
     8org.refal.rfpdt.editor.variableDefinition.color=0,0,192
     9org.refal.rfpdt.editor.variableDefinition.italic=true
     10org.refal.rfpdt.editor.variableUse.color=0,0,0
     11org.refal.rfpdt.editor.variableUse.italic=true
     12org.refal.rfpdt.editor.comment.color=63,127,95
     13org.refal.rfpdt.editor.otherSymbols.color=0,0,0
    1414org.refal.rfpdt.editor.autoCloseBraces=true
    1515org.refal.rfpdt.editor.autoCloseBrackets=true
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/PresentationVisitor.java

    r3873 r3874  
    33import java.util.ArrayList;
    44
    5 import org.eclipse.jface.preference.IPreferenceStore;
    65import org.eclipse.jface.text.Position;
    76import org.eclipse.jface.text.TextAttribute;
     
    5049import org.refal.rfpdt.compiler.SrcPosition;
    5150import org.refal.rfpdt.ui.preferences.IPreferenceConstants;
    52 import org.refal.rfpdt.ui.scanner.ColorScanner;
     51import org.refal.rfpdt.ui.preferences.RfpPreferences;
    5352
    5453public class PresentationVisitor implements ProgramVisitor, SentenceVisitor, ExprVisitor {
     
    6362        }
    6463
    65         public void updateStyleRange (IPreferenceStore store) {
    66             textAttribute = ColorScanner.getTextAttribute(store, key);
     64        public void updateStyleRange (RfpPreferences preferences) {
     65            textAttribute = preferences.getTextAttribute(key);
    6766        }
    6867
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/RfpEditor.java

    r3870 r3874  
    4444import org.refal.rfpdt.ui.RfpUI;
    4545import org.refal.rfpdt.ui.preferences.IPreferenceConstants;
     46import org.refal.rfpdt.ui.preferences.RfpPreferences;
    4647
    4748public class RfpEditor extends TextEditor {
     
    106107    private RfpSourceViewerConfiguration rfpSourceViewerConfiguration;
    107108    private IPreferenceStore store;
     109    RfpPreferences preferences;
    108110    public final AstInfo astInfo;
    109111
     
    133135        store = new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
    134136        setPreferenceStore(store);
     137        preferences = new RfpPreferences(store);
    135138
    136139        rfpSourceViewerConfiguration = new RfpSourceViewerConfiguration(this, store);
     
    143146                if (stylePositionList != null) {
    144147                    for (StylePosition position : stylePositionList)
    145                         position.updateStyleRange(store);
     148                        position.updateStyleRange(preferences);
    146149                    redrawTextAsync();
    147150                }
     
    159162                document.removePosition(position);
    160163        for (StylePosition position : stylePositionList)
    161             position.updateStyleRange(store);
     164            position.updateStyleRange(preferences);
    162165        this.stylePositionList = stylePositionList;
    163166        if (this.stylePositionList != null)
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/RfpPresentationReconciler.java

    r3873 r3874  
    11package org.refal.rfpdt.editor;
    22
    3 import org.eclipse.jface.preference.IPreferenceStore;
    43import org.eclipse.jface.text.IDocument;
    54import org.eclipse.jface.text.ITextViewer;
     
    98import org.eclipse.jface.util.PropertyChangeEvent;
    109import org.refal.rfpdt.ui.preferences.IPreferenceConstants;
     10import org.refal.rfpdt.ui.preferences.RfpPreferences;
    1111import org.refal.rfpdt.ui.scanner.ColorScanner;
    1212
    1313public final class RfpPresentationReconciler extends PresentationReconciler implements IPropertyChangeListener {
    14     private final IPreferenceStore store;
     14    private final RfpPreferences preferences;
    1515    private final ColorScanner defaultContentScanner;
    1616    private final NonRuleBasedDamagerRepairer multiLineComment;
     
    1919    private final NonRuleBasedDamagerRepairer character;
    2020
    21     public RfpPresentationReconciler (String partitioning, IPreferenceStore prefStore) {
    22         store = prefStore;
     21    public RfpPresentationReconciler (String partitioning, RfpPreferences preferences) {
     22        this.preferences = preferences;
    2323        setDocumentPartitioning(partitioning);
    24         defaultContentScanner = new ColorScanner(store);
     24        defaultContentScanner = new ColorScanner(preferences);
    2525        DefaultDamagerRepairer dr = new DefaultDamagerRepairer(defaultContentScanner);
    2626        setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    2727        setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    28         multiLineComment = new NonRuleBasedDamagerRepairer(ColorScanner.getTextAttribute(store,
    29                 IPreferenceConstants.COMMENT));
     28        multiLineComment = new NonRuleBasedDamagerRepairer(preferences.getTextAttribute(IPreferenceConstants.COMMENT));
    3029        setDamager(multiLineComment, IRfpPartitions.MULTI_LINE_COMMENT);
    3130        setRepairer(multiLineComment, IRfpPartitions.MULTI_LINE_COMMENT);
    32         singleLineComment = new NonRuleBasedDamagerRepairer(ColorScanner.getTextAttribute(store,
    33                 IPreferenceConstants.COMMENT));
     31        singleLineComment = new NonRuleBasedDamagerRepairer(preferences.getTextAttribute(IPreferenceConstants.COMMENT));
    3432        setDamager(singleLineComment, IRfpPartitions.SINGLE_LINE_COMMENT);
    3533        setRepairer(singleLineComment, IRfpPartitions.SINGLE_LINE_COMMENT);
    36         word = new NonRuleBasedDamagerRepairer(ColorScanner.getTextAttribute(store, IPreferenceConstants.SYMBOL));
     34        word = new NonRuleBasedDamagerRepairer(preferences.getTextAttribute(IPreferenceConstants.SYMBOL));
    3735        setDamager(word, IRfpPartitions.WORD);
    3836        setRepairer(word, IRfpPartitions.WORD);
    39         character = new NonRuleBasedDamagerRepairer(ColorScanner.getTextAttribute(store, IPreferenceConstants.SYMBOL));
     37        character = new NonRuleBasedDamagerRepairer(preferences.getTextAttribute(IPreferenceConstants.SYMBOL));
    4038        setDamager(character, IRfpPartitions.CHARACTER);
    4139        setRepairer(character, IRfpPartitions.CHARACTER);
     
    4543    public void install (ITextViewer viewer) {
    4644        super.install(viewer);
    47         store.addPropertyChangeListener(this);
     45        preferences.addPropertyChangeListener(this);
    4846    }
    4947
     
    5149    public void uninstall () {
    5250        super.uninstall();
    53         store.removePropertyChangeListener(this);
     51        preferences.removePropertyChangeListener(this);
    5452    }
    5553
    5654    public void propertyChange (PropertyChangeEvent event) {
    5755        defaultContentScanner.setTokens();
    58         multiLineComment.setDefaultTextAttribute(ColorScanner.getTextAttribute(store, IPreferenceConstants.COMMENT));
    59         singleLineComment.setDefaultTextAttribute(ColorScanner.getTextAttribute(store, IPreferenceConstants.COMMENT));
    60         word.setDefaultTextAttribute(ColorScanner.getTextAttribute(store, IPreferenceConstants.SYMBOL));
    61         character.setDefaultTextAttribute(ColorScanner.getTextAttribute(store, IPreferenceConstants.SYMBOL));
     56        multiLineComment.setDefaultTextAttribute(preferences.getTextAttribute(IPreferenceConstants.COMMENT));
     57        singleLineComment.setDefaultTextAttribute(preferences.getTextAttribute(IPreferenceConstants.COMMENT));
     58        word.setDefaultTextAttribute(preferences.getTextAttribute(IPreferenceConstants.SYMBOL));
     59        character.setDefaultTextAttribute(preferences.getTextAttribute(IPreferenceConstants.SYMBOL));
    6260    }
    6361}
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/RfpSourceViewerConfiguration.java

    r3870 r3874  
    6363
    6464    public IPresentationReconciler getPresentationReconciler (ISourceViewer sourceViewer) {
    65         return new RfpPresentationReconciler(getConfiguredDocumentPartitioning(sourceViewer), fPreferenceStore);
     65        return new RfpPresentationReconciler(getConfiguredDocumentPartitioning(sourceViewer), editor.preferences);
    6666    }
    6767
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/scanner/ColorScanner.java

    r3873 r3874  
    33import java.util.ArrayList;
    44
    5 import org.eclipse.jface.preference.IPreferenceStore;
    6 import org.eclipse.jface.preference.PreferenceConverter;
    75import org.eclipse.jface.text.BadLocationException;
    86import org.eclipse.jface.text.IDocument;
    9 import org.eclipse.jface.text.TextAttribute;
    107import org.eclipse.jface.text.rules.IRule;
    118import org.eclipse.jface.text.rules.IToken;
     
    1512import org.eclipse.jface.text.rules.WhitespaceRule;
    1613import org.eclipse.jface.text.rules.WordRule;
    17 import org.eclipse.swt.SWT;
    18 import org.eclipse.swt.graphics.Color;
    19 import org.refal.rfpdt.editor.ColorManager;
    20 import org.refal.rfpdt.editor.RfpEditor;
    2114import org.refal.rfpdt.ui.preferences.IPreferenceConstants;
     15import org.refal.rfpdt.ui.preferences.RfpPreferences;
    2216
    2317public class ColorScanner implements ITokenScanner {
     
    3428    }
    3529
    36     /** May return <code>null</code>! */
    37     public static TextAttribute getTextAttribute (IPreferenceStore store, String key) {
    38         ColorManager colorManager = RfpEditor.getColorManager();
    39         if (colorManager == null)
    40             return null;
    41         Color color = colorManager.getColor(PreferenceConverter.getColor(store, key + ".color"));
    42         int style = store.getBoolean(key + ".bold") ? SWT.BOLD : SWT.NORMAL;
    43         if (store.getBoolean(key + ".italic"))
    44             style |= SWT.ITALIC;
    45         if (store.getBoolean(key + ".strikethrough"))
    46             style |= TextAttribute.STRIKETHROUGH;
    47         if (store.getBoolean(key + ".underlined"))
    48             style |= TextAttribute.UNDERLINE;
    49         return new TextAttribute(color, null, style);
    50     }
    51 
    52     private final IPreferenceStore store;
     30    private final RfpPreferences preferences;
    5331    private final RuleBasedScanner scanner;
    5432    private final ArrayList<TokenWrapper> tokens;
     
    6139    private IToken other = null;
    6240
    63     public ColorScanner (IPreferenceStore store) {
    64         this.store = store;
     41    public ColorScanner (RfpPreferences preferences) {
     42        this.preferences = preferences;
    6543        scanner = new RuleBasedScanner();
    6644        tokens = new ArrayList<TokenWrapper>(3);
     
    6947
    7048    public void setTokens () {
    71         symbol = new Token(getTextAttribute(store, IPreferenceConstants.SYMBOL));
    72         keyword = new Token(getTextAttribute(store, IPreferenceConstants.KEYWORD));
    73         identifier = new Token(getTextAttribute(store, IPreferenceConstants.IDENTIFIER_USE));
    74         variable_type = new Token(getTextAttribute(store, IPreferenceConstants.VARIABLE_TYPE));
    75         variable = new Token(getTextAttribute(store, IPreferenceConstants.VARIABLE_USE));
    76         other = new Token(getTextAttribute(store, IPreferenceConstants.OTHER_SYMBOLS));
     49        symbol = new Token(preferences.getTextAttribute(IPreferenceConstants.SYMBOL));
     50        keyword = new Token(preferences.getTextAttribute(IPreferenceConstants.KEYWORD));
     51        identifier = new Token(preferences.getTextAttribute(IPreferenceConstants.IDENTIFIER_USE));
     52        variable_type = new Token(preferences.getTextAttribute(IPreferenceConstants.VARIABLE_TYPE));
     53        variable = new Token(preferences.getTextAttribute(IPreferenceConstants.VARIABLE_USE));
     54        other = new Token(preferences.getTextAttribute(IPreferenceConstants.OTHER_SYMBOLS));
    7755        ArrayList<IRule> rules = new ArrayList<IRule>();
    7856        rules.add(new WhitespaceRule(new WhitespaceDetector()));
Note: See TracChangeset for help on using the changeset viewer.