1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Cosmetics.

This commit is contained in:
Andrew Gvozdev 2013-06-11 21:56:36 -04:00
parent 5b7641063a
commit c0717fe40d
19 changed files with 112 additions and 288 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -44,11 +44,6 @@ public class AddBuildTargetAction extends Action {
fOutliner = outliner;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
@ -115,15 +110,18 @@ public class AddBuildTargetAction extends Action {
public boolean canActionBeAdded(ISelection selection) {
ITargetRule[] rules = getTargetRules(selection);
if (rules.length == 0)
if (rules.length == 0) {
return false;
}
IFile file = getFile();
if (file == null)
if (file == null) {
return false;
}
if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject()))
if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject())) {
return false;
}
return true;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -18,7 +18,6 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
/**
*/
public interface IMakefileDocumentProvider extends IDocumentProvider {
/**
* Shuts down this provider.
*/
@ -31,5 +30,4 @@ public interface IMakefileDocumentProvider extends IDocumentProvider {
* @return the working copy for the given element
*/
IMakefile getWorkingCopy(Object element);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2008 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -16,11 +16,7 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
/**
*/
public interface IMakefileEditorActionDefinitionIds extends ITextEditorActionDefinitionIds {
final String UNCOMMENT = "org.eclipse.cdt.make.ui.edit.text.makefile.uncomment"; //$NON-NLS-1$
final String COMMENT = "org.eclipse.cdt.make.ui.edit.text.makefile.comment"; //$NON-NLS-1$
final String OPEN_DECLARATION = "org.eclipse.cdt.make.ui.edit.text.makefile.opendecl"; //$NON-NLS-1$
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2010 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -15,14 +15,13 @@ import org.eclipse.cdt.make.core.makefile.IDirective;
import org.eclipse.cdt.make.core.makefile.IInferenceRule;
import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
import org.eclipse.cdt.make.core.makefile.ISpecialRule;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
public class LexicalSortingAction extends Action {
private static final String ACTION_NAME = "LexicalSortingAction"; //$NON-NLS-1$
private static final String DIALOG_STORE_KEY = ACTION_NAME + ".sort"; //$NON-NLS-1$
@ -60,7 +59,6 @@ public class LexicalSortingAction extends Action {
}
private class LexicalMakefileSorter extends ViewerSorter {
@Override
public int category(Object obj) {
if (obj instanceof IDirective) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -27,8 +27,8 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule;
import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
import org.eclipse.cdt.make.core.makefile.gnu.ITerminal;
import org.eclipse.cdt.make.internal.core.makefile.NullMakefile;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.IWorkingCopyManager;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@ -57,9 +57,7 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
* MakefileContentOutlinePage
*/
public class MakefileContentOutlinePage extends ContentOutlinePage {
private class MakefileContentProvider implements ITreeContentProvider {
protected boolean showMacroDefinition = true;
protected boolean showTargetRule = true;
protected boolean showInferenceRule = true;
@ -68,9 +66,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
protected IMakefile makefile;
protected IMakefile nullMakefile = new NullMakefile();
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override
public Object[] getChildren(Object element) {
if (element == fInput) {
@ -81,9 +76,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return new Object[0];
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override
public Object getParent(Object element) {
if (element instanceof IMakefile) {
@ -94,9 +86,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return fInput;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@Override
public boolean hasChildren(Object element) {
if (element == fInput) {
@ -111,9 +100,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@Override
public Object[] getElements(Object inputElement) {
IDirective[] directives;
@ -131,35 +117,29 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
directives = new IDirective[0];
}
List<IDirective> list = new ArrayList<IDirective>(directives.length);
for (int i = 0; i < directives.length; i++) {
if (showMacroDefinition && directives[i] instanceof IMacroDefinition) {
list.add(directives[i]);
} else if (showInferenceRule && directives[i] instanceof IInferenceRule) {
list.add(directives[i]);
} else if (showTargetRule && directives[i] instanceof ITargetRule) {
list.add(directives[i]);
for (IDirective directive : directives) {
if (showMacroDefinition && directive instanceof IMacroDefinition) {
list.add(directive);
} else if (showInferenceRule && directive instanceof IInferenceRule) {
list.add(directive);
} else if (showTargetRule && directive instanceof ITargetRule) {
list.add(directive);
} else {
boolean irrelevant = (directives[i] instanceof IComment ||
directives[i] instanceof IEmptyLine ||
directives[i] instanceof ITerminal);
boolean irrelevant = (directive instanceof IComment ||
directive instanceof IEmptyLine ||
directive instanceof ITerminal);
if (!irrelevant) {
list.add(directives[i]);
list.add(directive);
}
}
}
return list.toArray();
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
public void dispose() {
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != null) {
@ -174,14 +154,9 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
}
}
}
}
private class MakefileLabelProvider extends LabelProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
if (element instanceof ITargetRule) {
@ -202,9 +177,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return super.getImage(element);
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
String name;
@ -223,7 +195,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
}
return name;
}
}
protected MakefileEditor fEditor;
@ -238,9 +209,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
fOpenIncludeAction = new OpenIncludeAction(this);
}
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
super.createControl(parent);
@ -264,9 +232,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
tree.setMenu(menu);
viewer.addDoubleClickListener(new IDoubleClickListener() {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
*/
@Override
public void doubleClick(DoubleClickEvent event) {
if (fOpenIncludeAction != null) {
@ -278,7 +243,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
IPageSite site= getSite();
site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$
site.setSelectionProvider(viewer);
}
/**
@ -331,9 +295,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
*/
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -27,14 +27,12 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
IMakefile fMakefile;
protected class MakefileAnnotationModel extends ResourceMarkerAnnotationModel /*implements IProblemRequestor */{
public MakefileAnnotationModel(IResource resource) {
super(resource);
}
public void setMakefile(IMakefile makefile) {
fMakefile = makefile;
}
@ -62,26 +60,22 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return null;
}
/* (non-Javadoc)
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createAnnotationModel(org.eclipse.core.resources.IFile)
*/
@Override
@Override
protected IAnnotationModel createAnnotationModel(IFile file) {
return new MakefileAnnotationModel(file);
}
return new MakefileAnnotationModel(file);
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object)
*/
@Override
protected FileInfo createFileInfo(Object element) throws CoreException {
if (!(element instanceof IFileEditorInput))
if (!(element instanceof IFileEditorInput)) {
return null;
}
IFileEditorInput input= (IFileEditorInput) element;
IMakefile original= createMakefile(input.getFile());
if (original == null)
if (original == null) {
return null;
}
FileInfo info= super.createFileInfo(element);
if (!(info instanceof MakefileFileInfo)) {
@ -100,31 +94,22 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return makefileInfo;
}
/* (non-Javadoc)
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object, org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)
*/
@Override
@Override
protected void disposeFileInfo(Object element, FileInfo info) {
if (info instanceof MakefileFileInfo) {
MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
if (makefileInfo.fCopy != null) {
makefileInfo.fCopy = null;
}
}
super.disposeFileInfo(element, info);
}
if (info instanceof MakefileFileInfo) {
MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
if (makefileInfo.fCopy != null) {
makefileInfo.fCopy = null;
}
}
super.disposeFileInfo(element, info);
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
*/
@Override
protected FileInfo createEmptyFileInfo() {
return new MakefileFileInfo();
}
/*
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object)
*/
@Override
public IMakefile getWorkingCopy(Object element) {
FileInfo fileInfo= getFileInfo(element);
@ -135,19 +120,14 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return null;
}
/*
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#shutdown()
*/
@Override
public void shutdown() {
Iterator<?> e= getConnectedElementsIterator();
while (e.hasNext())
while (e.hasNext()) {
disconnect(e.next());
}
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
*/
@Override
protected DocumentProviderOperation createSaveOperation(Object element, IDocument document, boolean overwrite)
throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -23,7 +23,6 @@ import org.eclipse.jface.text.rules.FastPartitioner;
* The document setup participant for Makefile.
*/
public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant {
/**
* The name of the Makefiile partitioning.
*/
@ -32,9 +31,6 @@ public class MakefileDocumentSetupParticipant implements IDocumentSetupParticip
public MakefileDocumentSetupParticipant() {
}
/*
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
*/
@Override
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {

View file

@ -364,8 +364,8 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
public void reconciled() {
// Notify listeners
Object[] listeners = fReconcilingListeners.getListeners();
for (int i = 0, length= listeners.length; i < length; ++i) {
((IReconcilingParticipant)listeners[i]).reconciled();
for (Object listener : listeners) {
((IReconcilingParticipant)listener).reconciled();
}
}
@ -378,9 +378,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
return fFoldingGroup;
}
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
*/
@Override
protected void performRevert() {
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
@ -390,15 +387,17 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
boolean projectionMode= projectionViewer.isProjectionMode();
if (projectionMode) {
projectionViewer.disableProjection();
if (fProjectionMakefileUpdater != null)
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.uninstall();
}
}
super.performRevert();
if (projectionMode) {
if (fProjectionMakefileUpdater != null)
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.install(this, projectionViewer);
}
projectionViewer.enableProjection();
}
@ -422,8 +421,9 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
ISourceViewer sourceViewer= getSourceViewer();
if (sourceViewer == null)
if (sourceViewer == null) {
return;
}
String property = event.getProperty();
@ -438,8 +438,9 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
if (MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
if (sourceViewer instanceof ProjectionViewer) {
ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer;
if (fProjectionMakefileUpdater != null)
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.uninstall();
}
// either freshly enabled or provider changed
fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
if (fProjectionMakefileUpdater != null) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2011 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -46,12 +46,8 @@ public class MakefileEditorActionContributor extends TextEditorActionContributor
fTogglePresentation = new MakefileEditorTogglePresentationAction();
fOpenDeclarationAction = new OpenDeclarationAction();
fOpenDeclarationAction.setActionDefinitionId(IMakefileEditorActionDefinitionIds.OPEN_DECLARATION);
}
/**
* @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
@Override
public void setActiveEditor(IEditorPart targetEditor) {
super.setActiveEditor(targetEditor);
@ -76,9 +72,6 @@ public class MakefileEditorActionContributor extends TextEditorActionContributor
fOpenDeclarationAction.update();
}
/*
* @see IEditorActionBarContributor#dispose()
*/
@Override
public void dispose() {
doSetActiveEditor(null);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -9,15 +9,11 @@
* QNX Software Systems - Initial API and implementation
* Patrick Hofer - Bug 326265
*******************************************************************************/
// this file is based on org.eclipse.cdt.internal.ui.editor.CEditorMessages
package org.eclipse.cdt.make.internal.ui.editor;
import org.eclipse.osgi.util.NLS;
public final class MakefileEditorMessages extends NLS {
public static String MakefileEditor_menu_folding;
static {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -10,15 +10,14 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
/**
*/
public class MakefileEditorTogglePresentationAction extends TextEditorAction {
/**
* Constructor for MakefileEditorTogglePresentationAction.
*/
@ -29,9 +28,6 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction {
update();
}
/**
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
ITextEditor editor= getTextEditor();
@ -41,9 +37,6 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction {
editor.showHighlightRangeOnly(!show);
}
/**
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
@Override
public void update() {
setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* Copyright (c) 2000, 2013 QNX Software Systems 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
@ -36,13 +36,11 @@ import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.ITokenScanner;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
private ColorManager fColorManager;
MakefileCodeScanner fCodeScanner;
private MakefileEditor fEditor;
@ -53,24 +51,15 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
*/
static class SingleTokenScanner extends AbstractMakefileCodeScanner {
private final String[] fProperties;
public SingleTokenScanner(String property) {
fProperties= new String[] { property };
initialize();
}
/*
* @see org.eclipse.cdt.make.internal.ui.text.makefile.AbstractMakefileCodeScanner#createRules()
*/
@Override
protected List<IRule> createRules() {
setDefaultReturnToken(getToken(fProperties[0]));
return null;
}
/*
* @see org.eclipse.cdt.make.internal.ui.text.makefile.AbstractMakefileCodeScanner#getTokenProperties()
*/
@Override
protected String[] getTokenProperties() {
return fProperties;
@ -86,18 +75,12 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
fColorManager = ColorManager.getDefault();
}
/**
* @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
*/
@Override
public String[] getConfiguredContentTypes(ISourceViewer v) {
return MakefilePartitionScanner.MAKE_PARTITIONS;
}
/**
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
*/
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
if (fEditor != null && fEditor.isEditable()) {
@ -120,14 +103,16 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
}
protected MakefileCodeScanner getCodeScanner() {
if (null == fCodeScanner)
if (null == fCodeScanner) {
fCodeScanner = new MakefileCodeScanner();
}
return fCodeScanner;
}
protected ITokenScanner getCommentScanner() {
if (null == fCommentScanner)
if (null == fCommentScanner) {
fCommentScanner = new SingleTokenScanner(ColorManager.MAKE_COMMENT_COLOR);
}
return fCommentScanner;
}
@ -147,17 +132,11 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
return reconciler;
}
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
return MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING;
}
/**
* @see SourceViewerConfiguration#getReconciler(ISourceViewer)
*/
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (fEditor != null && fEditor.isEditable()) {
@ -169,17 +148,11 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
@Override
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)
*/
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if (fEditor != null) {
@ -187,9 +160,6 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
}
return super.getTextHover(sourceViewer, contentType);
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
if (fEditor != null) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2005 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -22,11 +22,6 @@ import org.eclipse.ui.editors.text.StorageDocumentProvider;
* MakefileStorageDocumentProvider
*/
public class MakefileStorageDocumentProvider extends StorageDocumentProvider {
/*
* @see org.eclipse.ui.editors.text.StorageDocumentProvider#setupDocument(java.lang.Object,
* org.eclipse.jface.text.IDocument)
*/
@Override
protected void setupDocument(Object element, IDocument document) {
if (document != null) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2010 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -21,7 +21,6 @@ import org.eclipse.jface.text.reconciler.MonoReconciler;
* NotifyingReconciler
*/
public class NotifyingReconciler extends MonoReconciler {
private ArrayList<IReconcilingParticipant> fReconcilingParticipants= new ArrayList<IReconcilingParticipant>();
/**
@ -31,9 +30,6 @@ public class NotifyingReconciler extends MonoReconciler {
super(strategy, isIncremental);
}
/*
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#process(org.eclipse.jface.text.reconciler.DirtyRegion)
*/
@Override
protected void process(DirtyRegion dirtyRegion) {
super.process(dirtyRegion);
@ -53,9 +49,7 @@ public class NotifyingReconciler extends MonoReconciler {
participant.reconciled();
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#initialProcess()
*/
@Override
protected void initialProcess() {
super.initialProcess();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* Copyright (c) 2000, 2013 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
@ -23,7 +23,6 @@ import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
public class OpenDeclarationAction extends TextEditorAction {
public OpenDeclarationAction() {
this(null);
}
@ -32,11 +31,6 @@ public class OpenDeclarationAction extends TextEditorAction {
super(MakeUIPlugin.getDefault().getResourceBundle(), "OpenDeclarationAction.", editor); //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
ITextEditor editor = getTextEditor();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2009 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -38,11 +38,10 @@ import org.eclipse.ui.ide.IDE;
* OpenIncludeAction
*/
public class OpenIncludeAction extends Action {
ISelectionProvider fSelectionProvider;
/**
*
* Constructor.
*/
public OpenIncludeAction(ISelectionProvider provider) {
super(MakeUIPlugin.getResourceString("OpenIncludeAction.title")); //$NON-NLS-1$
@ -51,20 +50,14 @@ public class OpenIncludeAction extends Action {
fSelectionProvider= provider;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
IInclude[] includes= getIncludeDirective(fSelectionProvider.getSelection());
if (includes != null) {
for (int i = 0; i < includes.length; ++i) {
IDirective[] directives = includes[i].getDirectives();
for (int j = 0; j < directives.length; ++j) {
for (IInclude include : includes) {
for (IDirective directive : include.getDirectives()) {
try {
openInEditor(directives[j]);
openInEditor(directive);
} catch (PartInitException e) {
}
}
@ -111,8 +104,7 @@ public class OpenIncludeAction extends Action {
List<Object> list= ((IStructuredSelection)sel).toList();
if (list.size() > 0) {
List<IInclude> includes = new ArrayList<IInclude>(list.size());
for (int i = 0; i < list.size(); ++i) {
Object element= list.get(i);
for (Object element : list) {
if (element instanceof IInclude) {
includes.add((IInclude) element);
}
@ -124,7 +116,7 @@ public class OpenIncludeAction extends Action {
}
public boolean canActionBeAdded(ISelection selection) {
IInclude[] includes = getIncludeDirective(selection);
return includes != null && includes.length != 0;
IInclude[] includes = getIncludeDirective(selection);
return includes != null && includes.length != 0;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 QNX Software Systems and others.
* Copyright (c) 2002, 2013 QNX Software Systems 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
@ -42,9 +42,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
* ProjectionMakefileUpdater
*/
public class ProjectionMakefileUpdater implements IProjectionListener {
private static class MakefileProjectionAnnotation extends ProjectionAnnotation {
private IDirective fDirective;
private boolean fIsComment;
@ -71,7 +69,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
// }
}
public void install(MakefileEditor editor, ProjectionViewer viewer) {
fEditor= editor;
fViewer= viewer;
@ -92,10 +89,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private class ReconcilerParticipant implements IReconcilingParticipant {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.ui.editor.IReconcilingParticipant#reconciled()
*/
@Override
public void reconciled() {
processReconcile();
@ -113,9 +106,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
private boolean fCollapseRule = false;
private boolean fCollapseConditional = false;
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled()
*/
@Override
public void projectionEnabled() {
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
@ -130,9 +120,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
fEditor.addReconcilingParticipant(fParticipant);
}
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled()
*/
@Override
public void projectionDisabled() {
fCachedDocument= null;
@ -143,14 +130,13 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
public void initialize() {
if (!isInstalled())
if (!isInstalled()) {
return;
}
initializePreferences();
try {
IDocumentProvider provider= fEditor.getDocumentProvider();
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
fAllowCollapsing= true;
@ -166,7 +152,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
model.replaceAnnotations(null, additions);
}
}
} finally {
fCachedDocument= null;
fAllowCollapsing= false;
@ -187,9 +172,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private void computeAdditions(IDirective[] elements, Map<MakefileProjectionAnnotation, Position> map) {
for (int i= 0; i < elements.length; i++) {
IDirective element= elements[i];
for (IDirective element : elements) {
computeAdditions(element, map);
if (element instanceof IParent) {
@ -200,9 +183,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private void computeAdditions(IDirective element, Map<MakefileProjectionAnnotation, Position> map) {
boolean createProjection= false;
boolean collapse= false;
if (element instanceof IConditional) {
@ -225,9 +206,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private Position createProjectionPosition(IDirective element) {
if (fCachedDocument == null)
if (fCachedDocument == null) {
return null;
}
try {
int startLine= element.getStartLine() - 1;
@ -237,7 +218,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
int endOffset= fCachedDocument.getLineOffset(endLine + 1);
return new Position(offset, endOffset - offset);
}
} catch (BadLocationException x) {
}
@ -245,12 +225,14 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
public void processReconcile() {
if (!isInstalled())
if (!isInstalled()) {
return;
}
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model == null)
if (model == null) {
return;
}
try {
IDocumentProvider provider= fEditor.getDocumentProvider();
@ -264,7 +246,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
Map<MakefileProjectionAnnotation, Position> updated= computeAdditions((IParent) fInput);
Map<IDirective, List<MakefileProjectionAnnotation>> previous= createAnnotationMap(model);
for (MakefileProjectionAnnotation annotation : updated.keySet()) {
IDirective element= annotation.getElement();
Position position= updated.get(annotation);
@ -288,15 +269,17 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
}
if (annotations.isEmpty())
if (annotations.isEmpty()) {
previous.remove(element);
}
}
}
for (List<MakefileProjectionAnnotation> list : previous.values()) {
int size= list.size();
for (int i= 0; i < size; i++)
for (int i= 0; i < size; i++) {
deletions.add(list.get(i));
}
}
match(model, deletions, additions, updates);
@ -316,8 +299,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions,
Map<MakefileProjectionAnnotation, Position> additions, List<MakefileProjectionAnnotation> changes) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) {
return;
}
List<MakefileProjectionAnnotation> newDeletions= new ArrayList<MakefileProjectionAnnotation>();
List<MakefileProjectionAnnotation> newChanges= new ArrayList<MakefileProjectionAnnotation>();
@ -326,16 +310,18 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
outer: while (deletionIterator.hasNext()) {
MakefileProjectionAnnotation deleted= deletionIterator.next();
Position deletedPosition= model.getPosition(deleted);
if (deletedPosition == null)
if (deletedPosition == null) {
continue;
}
Iterator<MakefileProjectionAnnotation> changesIterator= changes.iterator();
while (changesIterator.hasNext()) {
MakefileProjectionAnnotation changed= changesIterator.next();
if (deleted.isComment() == changed.isComment()) {
Position changedPosition= model.getPosition(changed);
if (changedPosition == null)
if (changedPosition == null) {
continue;
}
if (deletedPosition.getOffset() == changedPosition.getOffset()) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* Copyright (c) 2000, 2013 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
@ -28,7 +28,6 @@ import org.eclipse.ui.IEditorInput;
* additionally offers to "overwrite" the working copy provided by this document provider.
*/
public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
private IMakefileDocumentProvider fDocumentProvider;
private Map<IEditorInput, IMakefile> fMap;
private boolean fIsShuttingDown;
@ -44,25 +43,16 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
fDocumentProvider= provider;
}
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
*/
@Override
public void connect(IEditorInput input) throws CoreException {
fDocumentProvider.connect(input);
}
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
*/
@Override
public void disconnect(IEditorInput input) {
fDocumentProvider.disconnect(input);
}
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown()
*/
@Override
public void shutdown() {
if (!fIsShuttingDown) {
@ -79,34 +69,27 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
}
}
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
*/
@Override
public IMakefile getWorkingCopy(IEditorInput input) {
IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input);
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
}
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.make.core.makefile.IMakefile)
*/
@Override
public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) {
if (fDocumentProvider.getDocument(input) != null) {
if (fMap == null)
if (fMap == null) {
fMap= new HashMap<IEditorInput, IMakefile>();
}
fMap.put(input, workingCopy);
}
}
/*
* @see org.eclipse.cdt.make.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
*/
@Override
public void removeWorkingCopy(IEditorInput input) {
fMap.remove(input);
if (fMap.isEmpty())
if (fMap.isEmpty()) {
fMap= null;
}
}
}