blob: 896adbf7cabc019094b1f968af2e2892897ed372 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.qt.ui.editor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
import org.eclipse.jface.text.source.ICharacterPairMatcher;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
public class QtProjectFileEditor extends TextEditor {
public static final String EDITOR_ID = "org.eclipse.cdt.qt.ui.QtProjectFileEditor"; //$NON-NLS-1$
public static final String BRACKET_MATCHING_COLOR_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBracketsColor"; //$NON-NLS-1$
private static final String BRACKET_MATCHING_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBrackets"; //$NON-NLS-1$
private static final char[] BRACKETS = { '{', '}', '(', ')', '[', ']' };
public QtProjectFileEditor() {
setSourceViewerConfiguration(new QtProjectFileSourceViewerConfiguration());
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
// Setup bracket matching with default color being gray
ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, BRACKET_MATCHING_COLOR_PREFERENCE);
IPreferenceStore store = getPreferenceStore();
store.setDefault(BRACKET_MATCHING_PREFERENCE, true);
store.setDefault(BRACKET_MATCHING_COLOR_PREFERENCE, "155,155,155"); //$NON-NLS-1$
}
}
|