mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 20:25:46 +02:00
Fix for 194198: No syntax highlighting when comparing makefiles
This commit is contained in:
parent
f4cfd28736
commit
1cba2fab4e
9 changed files with 294 additions and 41 deletions
|
@ -7,6 +7,7 @@ Bundle-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.cdt.make.internal.ui,
|
Export-Package: org.eclipse.cdt.make.internal.ui,
|
||||||
|
org.eclipse.cdt.make.internal.ui.compare,
|
||||||
org.eclipse.cdt.make.internal.ui.editor,
|
org.eclipse.cdt.make.internal.ui.editor,
|
||||||
org.eclipse.cdt.make.internal.ui.part,
|
org.eclipse.cdt.make.internal.ui.part,
|
||||||
org.eclipse.cdt.make.internal.ui.preferences,
|
org.eclipse.cdt.make.internal.ui.preferences,
|
||||||
|
@ -32,5 +33,6 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.cdt.make.core;bundle-version="[4.0.0,5.0.0)",
|
org.eclipse.cdt.make.core;bundle-version="[4.0.0,5.0.0)",
|
||||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional
|
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
||||||
|
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)"
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
|
|
|
@ -361,10 +361,7 @@
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<!-- Makefile Editor extensions. -->
|
<!-- Makefile Editor extensions. -->
|
||||||
<extension
|
<extension point="org.eclipse.ui.editors">
|
||||||
id="org.eclipse.cdt.make.editor"
|
|
||||||
name="MakefileEditor"
|
|
||||||
point="org.eclipse.ui.editors">
|
|
||||||
<editor
|
<editor
|
||||||
name="%MakefileEditor.name"
|
name="%MakefileEditor.name"
|
||||||
icon="icons/etool16/makefile.gif"
|
icon="icons/etool16/makefile.gif"
|
||||||
|
@ -374,10 +371,7 @@
|
||||||
<contentTypeBinding contentTypeId="org.eclipse.cdt.make.core.makefile"/>
|
<contentTypeBinding contentTypeId="org.eclipse.cdt.make.core.makefile"/>
|
||||||
</editor>
|
</editor>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension point="org.eclipse.core.filebuffers.documentSetup">
|
||||||
id="org.eclipse.cdt.make.ui.MakefileDocumentSetupParticipant"
|
|
||||||
name="%MakefileDocumentSetupParticipant.name"
|
|
||||||
point="org.eclipse.core.filebuffers.documentSetup">
|
|
||||||
<participant
|
<participant
|
||||||
contentTypeId="org.eclipse.cdt.make.core.makefile"
|
contentTypeId="org.eclipse.cdt.make.core.makefile"
|
||||||
class="org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentSetupParticipant">
|
class="org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentSetupParticipant">
|
||||||
|
@ -481,4 +475,18 @@
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
<!-- Compare viewer -->
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.compare.contentMergeViewers">
|
||||||
|
<viewer
|
||||||
|
class="org.eclipse.cdt.make.internal.ui.compare.MakefileContentViewerCreator"
|
||||||
|
extensions="mk2"
|
||||||
|
id="org.eclipse.cdt.make.ui.compare.MakefileContentViewerCreator">
|
||||||
|
</viewer>
|
||||||
|
<contentTypeBinding
|
||||||
|
contentTypeId="org.eclipse.cdt.make.core.makefile"
|
||||||
|
contentMergeViewerId="org.eclipse.cdt.make.ui.compare.MakefileContentViewerCreator">
|
||||||
|
</contentTypeBinding>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2003, 2006 QNX Software Systems and others.
|
# Copyright (c) 2003, 2007 QNX Software Systems and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# QNX Software Systems - initial API and implementation
|
# QNX Software Systems - initial API and implementation
|
||||||
# Wind River Systems - fix for bugzilla 135150
|
# Wind River Systems - fix for bugzilla 135150 and 194198
|
||||||
# Tianchao Li (tianchao.li@gmail.com) - arbitrary build directory (bug #136136)
|
# Tianchao Li (tianchao.li@gmail.com) - arbitrary build directory (bug #136136)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
@ -279,3 +279,6 @@ CopyDiscoveredPathAction.tooltip=Copy as text
|
||||||
MultipleInputDialog.0=&Browse...
|
MultipleInputDialog.0=&Browse...
|
||||||
MultipleInputDialog.1=Select a file:
|
MultipleInputDialog.1=Select a file:
|
||||||
MultipleInputDialog.2=Varia&bles...
|
MultipleInputDialog.2=Varia&bles...
|
||||||
|
|
||||||
|
# --- Compare ---
|
||||||
|
MakefileMergeViewer.title=Make Compare Viewer
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.make.internal.ui;
|
package org.eclipse.cdt.make.internal.ui;
|
||||||
|
|
||||||
|
@ -26,13 +27,16 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.preference.PreferenceConverter;
|
import org.eclipse.jface.preference.PreferenceConverter;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
import org.eclipse.ui.editors.text.EditorsUI;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,7 +255,19 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
||||||
return fWorkingCopyManager;
|
return fWorkingCopyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a combined preference store, this store is read-only.
|
||||||
|
*
|
||||||
|
* @return the combined preference store
|
||||||
|
*/
|
||||||
|
public IPreferenceStore getCombinedPreferenceStore() {
|
||||||
|
IPreferenceStore[] stores = new IPreferenceStore[2];
|
||||||
|
stores[0] = getPreferenceStore();
|
||||||
|
stores[1] = EditorsUI.getPreferenceStore();
|
||||||
|
ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(stores);
|
||||||
|
return chainedStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2005 IBM Corporation 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:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
* QNX Software System
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.make.internal.ui.compare;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.compare.CompareConfiguration;
|
||||||
|
import org.eclipse.compare.IViewerCreator;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required when creating a MakefileMergeViewer from the plugin.xml file.
|
||||||
|
*/
|
||||||
|
public class MakefileContentViewerCreator implements IViewerCreator {
|
||||||
|
|
||||||
|
public Viewer createViewer(Composite parent, CompareConfiguration mp) {
|
||||||
|
return new MakefileMergeViewer(parent, SWT.NULL, mp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 Wind River Systems, Inc. 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:
|
||||||
|
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.make.internal.ui.compare;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentSetupParticipant;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.editor.MakefileSourceConfiguration;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.text.ColorManager;
|
||||||
|
import org.eclipse.cdt.make.internal.ui.text.makefile.MakefilePartitionScanner;
|
||||||
|
import org.eclipse.compare.CompareConfiguration;
|
||||||
|
import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
import org.eclipse.jface.preference.PreferenceConverter;
|
||||||
|
import org.eclipse.jface.text.IDocumentPartitioner;
|
||||||
|
import org.eclipse.jface.text.TextViewer;
|
||||||
|
import org.eclipse.jface.text.rules.FastPartitioner;
|
||||||
|
import org.eclipse.jface.text.source.SourceViewer;
|
||||||
|
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A merge viewer for Makefiles.
|
||||||
|
*/
|
||||||
|
public class MakefileMergeViewer extends TextMergeViewer {
|
||||||
|
|
||||||
|
private MakefileSourceConfiguration fSourceViewerConfiguration;
|
||||||
|
private IPropertyChangeListener fPreferenceChangeListener;
|
||||||
|
private IPreferenceStore fPreferenceStore;
|
||||||
|
|
||||||
|
protected boolean fUseSystemColors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a color from the information stored in the given preference store.
|
||||||
|
* Returns <code>null</code> if there is no such information available.
|
||||||
|
*/
|
||||||
|
protected static RGB createColor(IPreferenceStore store, String key) {
|
||||||
|
if (!store.contains(key))
|
||||||
|
return null;
|
||||||
|
if (store.isDefault(key))
|
||||||
|
return PreferenceConverter.getDefaultColor(store, key);
|
||||||
|
return PreferenceConverter.getColor(store, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new merge viewer.
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* @param style
|
||||||
|
* @param configuration
|
||||||
|
*/
|
||||||
|
public MakefileMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
|
||||||
|
super(parent, style | SWT.LEFT_TO_RIGHT, configuration);
|
||||||
|
|
||||||
|
IPreferenceStore store = getPreferenceStore();
|
||||||
|
|
||||||
|
fUseSystemColors= store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
|
||||||
|
if (!fUseSystemColors) {
|
||||||
|
RGB bg= createColor(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
|
||||||
|
setBackgroundColor(bg);
|
||||||
|
RGB fg= createColor(store, ColorManager.MAKE_DEFAULT_COLOR);
|
||||||
|
setForegroundColor(fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IPreferenceStore getPreferenceStore() {
|
||||||
|
if (fPreferenceStore == null) {
|
||||||
|
fPreferenceStore= MakeUIPlugin.getDefault().getCombinedPreferenceStore();
|
||||||
|
fPreferenceChangeListener= new IPropertyChangeListener() {
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
handlePropertyChange(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
}
|
||||||
|
return fPreferenceStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleDispose(DisposeEvent event) {
|
||||||
|
if (fPreferenceChangeListener != null) {
|
||||||
|
fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
fPreferenceChangeListener= null;
|
||||||
|
}
|
||||||
|
super.handleDispose(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handlePropertyChange(PropertyChangeEvent event) {
|
||||||
|
|
||||||
|
String key= event.getProperty();
|
||||||
|
|
||||||
|
if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) {
|
||||||
|
if (!fUseSystemColors) {
|
||||||
|
RGB bg= createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
|
||||||
|
setBackgroundColor(bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
|
||||||
|
fUseSystemColors= fPreferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
|
||||||
|
if (fUseSystemColors) {
|
||||||
|
setBackgroundColor(null);
|
||||||
|
setForegroundColor(null);
|
||||||
|
} else {
|
||||||
|
RGB bg= createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
|
||||||
|
setBackgroundColor(bg);
|
||||||
|
RGB fg= createColor(fPreferenceStore, ColorManager.MAKE_DEFAULT_COLOR);
|
||||||
|
setForegroundColor(fg);
|
||||||
|
}
|
||||||
|
} else if (key.equals(ColorManager.MAKE_DEFAULT_COLOR)) {
|
||||||
|
if (!fUseSystemColors) {
|
||||||
|
RGB fg= createColor(fPreferenceStore, ColorManager.MAKE_DEFAULT_COLOR);
|
||||||
|
setForegroundColor(fg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fSourceViewerConfiguration != null && fSourceViewerConfiguration.affectsBehavior(event)) {
|
||||||
|
fSourceViewerConfiguration.adaptToPreferenceChange(event);
|
||||||
|
invalidateTextPresentation();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDocumentPartitioning() {
|
||||||
|
return MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IDocumentPartitioner getDocumentPartitioner() {
|
||||||
|
return new FastPartitioner(new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void configureTextViewer(TextViewer textViewer) {
|
||||||
|
if (textViewer instanceof SourceViewer) {
|
||||||
|
((SourceViewer)textViewer).configure(getSourceViewerConfiguration());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer#getTitle()
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return MakeUIPlugin.getResourceString("MakefileMergeViewer.title"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a source configuration for the viewer
|
||||||
|
*/
|
||||||
|
protected SourceViewerConfiguration getSourceViewerConfiguration() {
|
||||||
|
if (fSourceViewerConfiguration == null) {
|
||||||
|
fSourceViewerConfiguration= new MakefileSourceConfiguration(getPreferenceStore(), null);
|
||||||
|
}
|
||||||
|
return fSourceViewerConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,17 +22,34 @@ import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.text.*;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.jface.text.IRegion;
|
||||||
|
import org.eclipse.jface.text.ITextOperationTarget;
|
||||||
|
import org.eclipse.jface.text.ITextViewerExtension;
|
||||||
import org.eclipse.jface.text.rules.IWordDetector;
|
import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
import org.eclipse.jface.text.source.*;
|
import org.eclipse.jface.text.source.IOverviewRuler;
|
||||||
import org.eclipse.jface.text.source.projection.*;
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
|
import org.eclipse.jface.text.source.IVerticalRuler;
|
||||||
|
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||||
|
import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
|
||||||
|
import org.eclipse.jface.text.source.projection.ProjectionSupport;
|
||||||
|
import org.eclipse.jface.text.source.projection.ProjectionViewer;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.*;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.ui.*;
|
import org.eclipse.ui.IPartService;
|
||||||
import org.eclipse.ui.editors.text.EditorsUI;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
import org.eclipse.ui.texteditor.*;
|
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
||||||
|
import org.eclipse.ui.texteditor.TextOperationAction;
|
||||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
||||||
|
|
||||||
public class MakefileEditor extends TextEditor implements ISelectionChangedListener, IReconcilingParticipant {
|
public class MakefileEditor extends TextEditor implements ISelectionChangedListener, IReconcilingParticipant {
|
||||||
|
@ -107,10 +124,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
||||||
setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
|
setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
|
||||||
setRulerContextMenuId("#MakefileRulerContext"); //$NON-NLS-1$
|
setRulerContextMenuId("#MakefileRulerContext"); //$NON-NLS-1$
|
||||||
setDocumentProvider(MakeUIPlugin.getDefault().getMakefileDocumentProvider());
|
setDocumentProvider(MakeUIPlugin.getDefault().getMakefileDocumentProvider());
|
||||||
IPreferenceStore[] stores = new IPreferenceStore[2];
|
IPreferenceStore chainedStore = MakeUIPlugin.getDefault().getCombinedPreferenceStore();
|
||||||
stores[0] = MakeUIPlugin.getDefault().getPreferenceStore();
|
|
||||||
stores[1] = EditorsUI.getPreferenceStore();
|
|
||||||
ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(stores);
|
|
||||||
setPreferenceStore(chainedStore);
|
setPreferenceStore(chainedStore);
|
||||||
setSourceViewerConfiguration(new MakefileSourceConfiguration(chainedStore, this));
|
setSourceViewerConfiguration(new MakefileSourceConfiguration(chainedStore, this));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,23 +82,26 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
|
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
|
||||||
*/
|
*/
|
||||||
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
||||||
ContentAssistant assistant = new ContentAssistant();
|
if (fEditor != null && fEditor.isEditable()) {
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE);
|
ContentAssistant assistant = new ContentAssistant();
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE);
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
|
||||||
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
|
||||||
|
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
|
||||||
|
|
||||||
|
assistant.enableAutoActivation(true);
|
||||||
|
assistant.setAutoActivationDelay(500);
|
||||||
|
|
||||||
|
assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
|
||||||
|
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
|
||||||
|
//Set to Carolina blue
|
||||||
|
assistant.setContextInformationPopupBackground(colorManager.getColor(new RGB(0, 191, 255)));
|
||||||
|
|
||||||
assistant.enableAutoActivation(true);
|
return assistant;
|
||||||
assistant.setAutoActivationDelay(500);
|
}
|
||||||
|
return null;
|
||||||
assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
|
|
||||||
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
|
|
||||||
//Set to Carolina blue
|
|
||||||
assistant.setContextInformationPopupBackground(colorManager.getColor(new RGB(0, 191, 255)));
|
|
||||||
|
|
||||||
return assistant;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MakefileCodeScanner getCodeScanner() {
|
protected MakefileCodeScanner getCodeScanner() {
|
||||||
|
@ -167,13 +170,19 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
|
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
||||||
return new MakefileTextHover(fEditor);
|
if (fEditor != null) {
|
||||||
|
return new MakefileTextHover(fEditor);
|
||||||
|
}
|
||||||
|
return super.getTextHover(sourceViewer, contentType);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
|
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
|
||||||
*/
|
*/
|
||||||
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
||||||
return new MakefileAnnotationHover(fEditor);
|
if (fEditor != null) {
|
||||||
|
return new MakefileAnnotationHover(fEditor);
|
||||||
|
}
|
||||||
|
return super.getAnnotationHover(sourceViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -171,6 +171,7 @@ CElementProperties.elf_needed=needed
|
||||||
|
|
||||||
CMergeViewer.title=C Compare Viewer
|
CMergeViewer.title=C Compare Viewer
|
||||||
CStructureCreator.name=C Compare
|
CStructureCreator.name=C Compare
|
||||||
|
AsmMergeViewer.title=Assembly Compare Viewer
|
||||||
|
|
||||||
# ------- OpenIncludeDeclarationAction------------
|
# ------- OpenIncludeDeclarationAction------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue