~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/compare/CMergeViewer.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) 2005, 2009 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
 
 *     QNX Software System
11
 
 *     Anton Leherbauer (Wind River Systems)
12
 
 *******************************************************************************/
13
 
package org.eclipse.cdt.internal.ui.compare;
14
 
 
15
 
import org.eclipse.compare.CompareConfiguration;
16
 
import org.eclipse.jface.preference.IPreferenceStore;
17
 
import org.eclipse.jface.text.IDocumentPartitioner;
18
 
import org.eclipse.jface.text.source.SourceViewerConfiguration;
19
 
import org.eclipse.jface.util.PropertyChangeEvent;
20
 
import org.eclipse.swt.widgets.Composite;
21
 
 
22
 
import org.eclipse.cdt.ui.CUIPlugin;
23
 
import org.eclipse.cdt.ui.text.CSourceViewerConfiguration;
24
 
import org.eclipse.cdt.ui.text.ICPartitions;
25
 
import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
26
 
 
27
 
import org.eclipse.cdt.internal.ui.text.CTextTools;
28
 
import org.eclipse.cdt.internal.ui.text.doctools.DocCommentOwnerManager;
29
 
 
30
 
/**
31
 
 * A merge viewer for C/C++ code.
32
 
 */
33
 
public class CMergeViewer extends AbstractMergeViewer {
34
 
        
35
 
        private static final String TITLE= "CMergeViewer.title"; //$NON-NLS-1$
36
 
 
37
 
        CSourceViewerConfiguration fSourceViewerConfiguration;
38
 
                
39
 
        public CMergeViewer(Composite parent, int styles, CompareConfiguration mp) {
40
 
                super(parent, styles, mp);
41
 
        }
42
 
 
43
 
        @Override
44
 
        protected SourceViewerConfiguration getSourceViewerConfiguration() {
45
 
                if (fSourceViewerConfiguration == null) {
46
 
                        CTextTools tools= CUIPlugin.getDefault().getTextTools();
47
 
                        IPreferenceStore store = getPreferenceStore();
48
 
                        fSourceViewerConfiguration = new CSourceViewerConfiguration(tools.getColorManager(), store, null, ICPartitions.C_PARTITIONING);
49
 
                }
50
 
                return fSourceViewerConfiguration;
51
 
        }
52
 
 
53
 
        @Override
54
 
        protected IDocumentPartitioner getDocumentPartitioner() {
55
 
                // use workspace default for highlighting doc comments in compare viewer
56
 
                IDocCommentOwner owner= DocCommentOwnerManager.getInstance().getWorkspaceCommentOwner();
57
 
                return CUIPlugin.getDefault().getTextTools().createDocumentPartitioner(owner);
58
 
        }
59
 
 
60
 
        @Override
61
 
        public String getTitle() {
62
 
                return CUIPlugin.getResourceString(TITLE);
63
 
        }
64
 
 
65
 
        @Override
66
 
        protected void handlePropertyChange(PropertyChangeEvent event) {
67
 
                super.handlePropertyChange(event);
68
 
 
69
 
                if (fSourceViewerConfiguration != null && fSourceViewerConfiguration.affectsTextPresentation(event)) {
70
 
                        fSourceViewerConfiguration.handlePropertyChangeEvent(event);
71
 
                        invalidateTextPresentation();
72
 
                }
73
 
        }
74
 
}