1 /*******************************************************************************
2 * Copyright (c) 2007, 2009 Wind River Systems, Inc. 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
9 * Anton Leherbauer (Wind River Systems) - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.cdt.internal.ui.compare;
13 import org.eclipse.compare.CompareConfiguration;
14 import org.eclipse.jface.preference.IPreferenceStore;
15 import org.eclipse.jface.text.IDocumentPartitioner;
16 import org.eclipse.jface.text.source.SourceViewerConfiguration;
17 import org.eclipse.jface.util.PropertyChangeEvent;
18 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.cdt.ui.CDTUITools;
21 import org.eclipse.cdt.ui.CUIPlugin;
22 import org.eclipse.cdt.ui.text.AsmSourceViewerConfiguration;
23 import org.eclipse.cdt.ui.text.ICPartitions;
24 import org.eclipse.cdt.ui.text.IColorManager;
27 * A merge viewer for assembly code.
29 public class AsmMergeViewer extends AbstractMergeViewer {
31 private static final String TITLE= "AsmMergeViewer.title"; //$NON-NLS-1$
33 AsmSourceViewerConfiguration fSourceViewerConfiguration;
36 * Create a new assembly merge viewer.
40 * @param configuration
42 public AsmMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
43 super(parent, style, configuration);
47 protected SourceViewerConfiguration getSourceViewerConfiguration() {
48 if (fSourceViewerConfiguration == null) {
49 IPreferenceStore store= getPreferenceStore();
50 final IColorManager colorManager = CDTUITools.getColorManager();
51 fSourceViewerConfiguration= new AsmSourceViewerConfiguration(colorManager, store, null, ICPartitions.C_PARTITIONING);
53 return fSourceViewerConfiguration;
57 public String getTitle() {
58 return CUIPlugin.getResourceString(TITLE);
62 protected IDocumentPartitioner getDocumentPartitioner() {
63 return CDTUITools.createAsmDocumentPartitioner();
67 protected void handlePropertyChange(PropertyChangeEvent event) {
68 super.handlePropertyChange(event);
70 if (fSourceViewerConfiguration != null && fSourceViewerConfiguration.affectsTextPresentation(event)) {
71 fSourceViewerConfiguration.handlePropertyChangeEvent(event);
72 invalidateTextPresentation();