diff options
Diffstat (limited to 'build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java')
-rw-r--r-- | build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java deleted file mode 100644 index cd069df0320..00000000000 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileSourceConfiguration.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 QNX Software Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.make.internal.ui.editor; - -import org.eclipse.cdt.make.internal.ui.text.IMakefileColorManager; -import org.eclipse.cdt.make.internal.ui.text.MakefileColorManager; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileAnnotationHover; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileCodeScanner; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileCompletionProcessor; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefilePartitionScanner; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileReconcilingStrategy; -import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileTextHover; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.reconciler.IReconciler; -import org.eclipse.jface.text.reconciler.MonoReconciler; -import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.swt.graphics.RGB; - -public class MakefileSourceConfiguration extends SourceViewerConfiguration { - - private IMakefileColorManager colorManager; - private MakefileCodeScanner codeScanner; - private MakefileEditor fEditor; - - /** - * Single token scanner. - */ - static class SingleTokenScanner extends BufferedRuleBasedScanner { - public SingleTokenScanner(TextAttribute attribute) { - setDefaultReturnToken(new Token(attribute)); - } - } - - /** - * Constructor for MakeConfiguration - */ - public MakefileSourceConfiguration(IMakefileColorManager colorManager, MakefileEditor editor) { - super(); - fEditor = editor; - this.colorManager = colorManager; - } - - /** - * @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer) - */ - public String[] getConfiguredContentTypes(ISourceViewer v) { - return new String[] { - IDocument.DEFAULT_CONTENT_TYPE, - MakefilePartitionScanner.MAKEFILE_COMMENT, - MakefilePartitionScanner.MAKEFILE_IF_BLOCK, - MakefilePartitionScanner.MAKEFILE_DEF_BLOCK, - MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK, - MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT, - }; - - } - - /** - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer) - */ - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - ContentAssistant assistant = new ContentAssistant(); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK); - assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT); - - assistant.enableAutoActivation(true); - assistant.setAutoActivationDelay(500); - - assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW); - assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW); - //Set to Carolina blue - assistant.setContextInformationPopupBackground(getColorManager().getColor(new RGB(0, 191, 255))); - - return assistant; - } - - protected IMakefileColorManager getColorManager() { - if (null == colorManager) - colorManager = new MakefileColorManager(); - return colorManager; - } - - protected MakefileCodeScanner getCodeScanner() { - if (null == codeScanner) - codeScanner = new MakefileCodeScanner(getColorManager()); - return codeScanner; - - } - - public IPresentationReconciler getPresentationReconciler(ISourceViewer v) { - - PresentationReconciler reconciler = new PresentationReconciler(); - - DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_COMMENT); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_COMMENT); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_IF_BLOCK); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_IF_BLOCK); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_DEF_BLOCK); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_DEF_BLOCK); - - dr = new DefaultDamagerRepairer(getCodeScanner()); - reconciler.setDamager(dr, MakefilePartitionScanner.MAKEFILE_OTHER); - reconciler.setRepairer(dr, MakefilePartitionScanner.MAKEFILE_OTHER); - return reconciler; - } - - /** - * @see SourceViewerConfiguration#getReconciler(ISourceViewer) - */ - public IReconciler getReconciler(ISourceViewer sourceViewer) { - if (fEditor != null && fEditor.isEditable()) { - MonoReconciler reconciler= new MonoReconciler(new MakefileReconcilingStrategy(fEditor), false); - reconciler.setDelay(1000); - reconciler.setProgressMonitor(new NullProgressMonitor()); - return reconciler; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ - public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) { - return new String[]{"#"}; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ - public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { - return new MakefileTextHover(fEditor); - } - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer) - */ - public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { - return new MakefileAnnotationHover(fEditor); - } -} |