~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/EditorHighlightingSynchronizer.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 
 * All rights reserved. This program and the accompanying materials
4
 
 * are made available under the terms of the Eclipse Public License v1.0
5
 
 * which accompanies this distribution, and is available at
6
 
 * http://www.eclipse.org/legal/epl-v10.html
7
 
 *
8
 
 * Contributors:
9
 
 *     IBM Corporation - initial API and implementation
10
 
 *     Anton Leherbauer (Wind River Systems)
11
 
 *******************************************************************************/
12
 
package org.eclipse.cdt.internal.ui.editor;
13
 
 
14
 
import org.eclipse.core.runtime.Assert;
15
 
 
16
 
import org.eclipse.jface.text.link.ILinkedModeListener;
17
 
import org.eclipse.jface.text.link.LinkedModeModel;
18
 
 
19
 
 
20
 
/**
21
 
 * Turns off occurrences highlighting on a C editor until linked mode is
22
 
 * left.
23
 
 *
24
 
 * @since 5.0
25
 
 */
26
 
public class EditorHighlightingSynchronizer implements ILinkedModeListener {
27
 
 
28
 
        private final CEditor fEditor;
29
 
        private final boolean fWasOccurrencesOn;
30
 
 
31
 
        /**
32
 
         * Creates a new synchronizer.
33
 
         *
34
 
         * @param editor the editor the occurrences markers of which will be
35
 
         *        synchronized with the linked mode
36
 
         */
37
 
        public EditorHighlightingSynchronizer(CEditor editor) {
38
 
                Assert.isLegal(editor != null);
39
 
                fEditor= editor;
40
 
                fWasOccurrencesOn= fEditor.isMarkingOccurrences();
41
 
 
42
 
                if (fWasOccurrencesOn && !isEditorDisposed())
43
 
                        fEditor.uninstallOccurrencesFinder();
44
 
        }
45
 
 
46
 
        /*
47
 
         * @see org.eclipse.jface.text.link.ILinkedModeListener#left(org.eclipse.jface.text.link.LinkedModeModel, int)
48
 
         */
49
 
        public void left(LinkedModeModel environment, int flags) {
50
 
                if (fWasOccurrencesOn && !isEditorDisposed())
51
 
                        fEditor.installOccurrencesFinder(true);
52
 
        }
53
 
 
54
 
        private boolean isEditorDisposed() {
55
 
                return fEditor == null || fEditor.getSelectionProvider() == null;
56
 
        }
57
 
 
58
 
        /*
59
 
         * @see org.eclipse.jface.text.link.ILinkedModeListener#suspend(org.eclipse.jface.text.link.LinkedModeModel)
60
 
         */
61
 
        public void suspend(LinkedModeModel environment) {
62
 
        }
63
 
 
64
 
        /*
65
 
         * @see org.eclipse.jface.text.link.ILinkedModeListener#resume(org.eclipse.jface.text.link.LinkedModeModel, int)
66
 
         */
67
 
        public void resume(LinkedModeModel environment, int flags) {
68
 
        }
69
 
 
70
 
}