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 * 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
@ -44,11 +44,6 @@ public class AddBuildTargetAction extends Action {
fOutliner = outliner; fOutliner = outliner;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override @Override
public void run() { public void run() {
IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager(); IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
@ -112,19 +107,22 @@ public class AddBuildTargetAction extends Action {
} }
return newName; return newName;
} }
public boolean canActionBeAdded(ISelection selection) { public boolean canActionBeAdded(ISelection selection) {
ITargetRule[] rules = getTargetRules(selection); ITargetRule[] rules = getTargetRules(selection);
if (rules.length == 0) if (rules.length == 0) {
return false; return false;
}
IFile file = getFile(); IFile file = getFile();
if (file == null) if (file == null) {
return false; return false;
}
if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject()))
if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject())) {
return false; return false;
}
return true; 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 * 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
@ -18,7 +18,6 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
/** /**
*/ */
public interface IMakefileDocumentProvider extends IDocumentProvider { public interface IMakefileDocumentProvider extends IDocumentProvider {
/** /**
* Shuts down this provider. * Shuts down this provider.
*/ */
@ -31,5 +30,4 @@ public interface IMakefileDocumentProvider extends IDocumentProvider {
* @return the working copy for the given element * @return the working copy for the given element
*/ */
IMakefile getWorkingCopy(Object 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 * 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
@ -16,11 +16,7 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
/** /**
*/ */
public interface IMakefileEditorActionDefinitionIds extends ITextEditorActionDefinitionIds { public interface IMakefileEditorActionDefinitionIds extends ITextEditorActionDefinitionIds {
final String UNCOMMENT = "org.eclipse.cdt.make.ui.edit.text.makefile.uncomment"; //$NON-NLS-1$ 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 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$ final String OPEN_DECLARATION = "org.eclipse.cdt.make.ui.edit.text.makefile.opendecl"; //$NON-NLS-1$
} }

View file

@ -16,7 +16,7 @@ package org.eclipse.cdt.make.internal.ui.editor;
* Interface of an object participating in reconciling. * Interface of an object participating in reconciling.
*/ */
public interface IReconcilingParticipant { public interface IReconcilingParticipant {
/** /**
* Called after reconciling has been finished. * Called after reconciling has been finished.
*/ */

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 * 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
@ -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.IInferenceRule;
import org.eclipse.cdt.make.core.makefile.IMacroDefinition; import org.eclipse.cdt.make.core.makefile.IMacroDefinition;
import org.eclipse.cdt.make.core.makefile.ISpecialRule; 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.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.jface.viewers.ViewerSorter;
public class LexicalSortingAction extends Action { public class LexicalSortingAction extends Action {
private static final String ACTION_NAME = "LexicalSortingAction"; //$NON-NLS-1$ private static final String ACTION_NAME = "LexicalSortingAction"; //$NON-NLS-1$
private static final String DIALOG_STORE_KEY = ACTION_NAME + ".sort"; //$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 { private class LexicalMakefileSorter extends ViewerSorter {
@Override @Override
public int category(Object obj) { public int category(Object obj) {
if (obj instanceof IDirective) { 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 * 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
@ -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.IInclude;
import org.eclipse.cdt.make.core.makefile.gnu.ITerminal; import org.eclipse.cdt.make.core.makefile.gnu.ITerminal;
import org.eclipse.cdt.make.internal.core.makefile.NullMakefile; 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.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.IWorkingCopyManager; import org.eclipse.cdt.make.ui.IWorkingCopyManager;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
@ -57,9 +57,7 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
* MakefileContentOutlinePage * MakefileContentOutlinePage
*/ */
public class MakefileContentOutlinePage extends ContentOutlinePage { public class MakefileContentOutlinePage extends ContentOutlinePage {
private class MakefileContentProvider implements ITreeContentProvider { private class MakefileContentProvider implements ITreeContentProvider {
protected boolean showMacroDefinition = true; protected boolean showMacroDefinition = true;
protected boolean showTargetRule = true; protected boolean showTargetRule = true;
protected boolean showInferenceRule = true; protected boolean showInferenceRule = true;
@ -68,9 +66,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
protected IMakefile makefile; protected IMakefile makefile;
protected IMakefile nullMakefile = new NullMakefile(); protected IMakefile nullMakefile = new NullMakefile();
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override @Override
public Object[] getChildren(Object element) { public Object[] getChildren(Object element) {
if (element == fInput) { if (element == fInput) {
@ -81,9 +76,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return new Object[0]; return new Object[0];
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override @Override
public Object getParent(Object element) { public Object getParent(Object element) {
if (element instanceof IMakefile) { if (element instanceof IMakefile) {
@ -94,9 +86,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return fInput; return fInput;
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@Override @Override
public boolean hasChildren(Object element) { public boolean hasChildren(Object element) {
if (element == fInput) { if (element == fInput) {
@ -111,9 +100,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@Override @Override
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {
IDirective[] directives; IDirective[] directives;
@ -131,35 +117,29 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
directives = new IDirective[0]; directives = new IDirective[0];
} }
List<IDirective> list = new ArrayList<IDirective>(directives.length); List<IDirective> list = new ArrayList<IDirective>(directives.length);
for (int i = 0; i < directives.length; i++) { for (IDirective directive : directives) {
if (showMacroDefinition && directives[i] instanceof IMacroDefinition) { if (showMacroDefinition && directive instanceof IMacroDefinition) {
list.add(directives[i]); list.add(directive);
} else if (showInferenceRule && directives[i] instanceof IInferenceRule) { } else if (showInferenceRule && directive instanceof IInferenceRule) {
list.add(directives[i]); list.add(directive);
} else if (showTargetRule && directives[i] instanceof ITargetRule) { } else if (showTargetRule && directive instanceof ITargetRule) {
list.add(directives[i]); list.add(directive);
} else { } else {
boolean irrelevant = (directives[i] instanceof IComment || boolean irrelevant = (directive instanceof IComment ||
directives[i] instanceof IEmptyLine || directive instanceof IEmptyLine ||
directives[i] instanceof ITerminal); directive instanceof ITerminal);
if (!irrelevant) { if (!irrelevant) {
list.add(directives[i]); list.add(directive);
} }
} }
} }
return list.toArray(); return list.toArray();
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override @Override
public void dispose() { public void dispose() {
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != null) { if (oldInput != null) {
@ -174,14 +154,9 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
} }
} }
} }
} }
private class MakefileLabelProvider extends LabelProvider { private class MakefileLabelProvider extends LabelProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override @Override
public Image getImage(Object element) { public Image getImage(Object element) {
if (element instanceof ITargetRule) { if (element instanceof ITargetRule) {
@ -202,9 +177,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
return super.getImage(element); return super.getImage(element);
} }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override @Override
public String getText(Object element) { public String getText(Object element) {
String name; String name;
@ -223,7 +195,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
} }
return name; return name;
} }
} }
protected MakefileEditor fEditor; protected MakefileEditor fEditor;
@ -238,9 +209,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
fOpenIncludeAction = new OpenIncludeAction(this); fOpenIncludeAction = new OpenIncludeAction(this);
} }
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override @Override
public void createControl(Composite parent) { public void createControl(Composite parent) {
super.createControl(parent); super.createControl(parent);
@ -264,9 +232,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
tree.setMenu(menu); tree.setMenu(menu);
viewer.addDoubleClickListener(new IDoubleClickListener() { viewer.addDoubleClickListener(new IDoubleClickListener() {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
*/
@Override @Override
public void doubleClick(DoubleClickEvent event) { public void doubleClick(DoubleClickEvent event) {
if (fOpenIncludeAction != null) { if (fOpenIncludeAction != null) {
@ -278,7 +243,6 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
IPageSite site= getSite(); IPageSite site= getSite();
site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$ site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$
site.setSelectionProvider(viewer); 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 @Override
public void setActionBars(IActionBars actionBars) { public void setActionBars(IActionBars actionBars) {
super.setActionBars(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 * 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
@ -27,14 +27,12 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel; import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider { public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
IMakefile fMakefile; IMakefile fMakefile;
protected class MakefileAnnotationModel extends ResourceMarkerAnnotationModel /*implements IProblemRequestor */{ protected class MakefileAnnotationModel extends ResourceMarkerAnnotationModel /*implements IProblemRequestor */{
public MakefileAnnotationModel(IResource resource) { public MakefileAnnotationModel(IResource resource) {
super(resource); super(resource);
} }
public void setMakefile(IMakefile makefile) { public void setMakefile(IMakefile makefile) {
fMakefile = makefile; fMakefile = makefile;
} }
@ -62,26 +60,22 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return null; return null;
} }
/* (non-Javadoc) @Override
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createAnnotationModel(org.eclipse.core.resources.IFile)
*/
@Override
protected IAnnotationModel createAnnotationModel(IFile file) { 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 @Override
protected FileInfo createFileInfo(Object element) throws CoreException { protected FileInfo createFileInfo(Object element) throws CoreException {
if (!(element instanceof IFileEditorInput)) if (!(element instanceof IFileEditorInput)) {
return null; return null;
}
IFileEditorInput input= (IFileEditorInput) element; IFileEditorInput input= (IFileEditorInput) element;
IMakefile original= createMakefile(input.getFile()); IMakefile original= createMakefile(input.getFile());
if (original == null) if (original == null) {
return null; return null;
}
FileInfo info= super.createFileInfo(element); FileInfo info= super.createFileInfo(element);
if (!(info instanceof MakefileFileInfo)) { if (!(info instanceof MakefileFileInfo)) {
@ -100,31 +94,22 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return makefileInfo; return makefileInfo;
} }
/* (non-Javadoc) @Override
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object, org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)
*/
@Override
protected void disposeFileInfo(Object element, FileInfo info) { protected void disposeFileInfo(Object element, FileInfo info) {
if (info instanceof MakefileFileInfo) { if (info instanceof MakefileFileInfo) {
MakefileFileInfo makefileInfo= (MakefileFileInfo) info; MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
if (makefileInfo.fCopy != null) { if (makefileInfo.fCopy != null) {
makefileInfo.fCopy = null; makefileInfo.fCopy = null;
} }
} }
super.disposeFileInfo(element, info); super.disposeFileInfo(element, info);
} }
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
*/
@Override @Override
protected FileInfo createEmptyFileInfo() { protected FileInfo createEmptyFileInfo() {
return new MakefileFileInfo(); return new MakefileFileInfo();
} }
/*
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object)
*/
@Override @Override
public IMakefile getWorkingCopy(Object element) { public IMakefile getWorkingCopy(Object element) {
FileInfo fileInfo= getFileInfo(element); FileInfo fileInfo= getFileInfo(element);
@ -135,19 +120,14 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return null; return null;
} }
/*
* @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#shutdown()
*/
@Override @Override
public void shutdown() { public void shutdown() {
Iterator<?> e= getConnectedElementsIterator(); Iterator<?> e= getConnectedElementsIterator();
while (e.hasNext()) while (e.hasNext()) {
disconnect(e.next()); disconnect(e.next());
}
} }
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
*/
@Override @Override
protected DocumentProviderOperation createSaveOperation(Object element, IDocument document, boolean overwrite) protected DocumentProviderOperation createSaveOperation(Object element, IDocument document, boolean overwrite)
throws CoreException { 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 * 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
@ -23,7 +23,6 @@ import org.eclipse.jface.text.rules.FastPartitioner;
* The document setup participant for Makefile. * The document setup participant for Makefile.
*/ */
public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant { public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant {
/** /**
* The name of the Makefiile partitioning. * The name of the Makefiile partitioning.
*/ */
@ -32,9 +31,6 @@ public class MakefileDocumentSetupParticipant implements IDocumentSetupParticip
public MakefileDocumentSetupParticipant() { public MakefileDocumentSetupParticipant() {
} }
/*
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
*/
@Override @Override
public void setup(IDocument document) { public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) { if (document instanceof IDocumentExtension3) {

View file

@ -364,8 +364,8 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
public void reconciled() { public void reconciled() {
// Notify listeners // Notify listeners
Object[] listeners = fReconcilingListeners.getListeners(); Object[] listeners = fReconcilingListeners.getListeners();
for (int i = 0, length= listeners.length; i < length; ++i) { for (Object listener : listeners) {
((IReconcilingParticipant)listeners[i]).reconciled(); ((IReconcilingParticipant)listener).reconciled();
} }
} }
@ -378,9 +378,6 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
return fFoldingGroup; return fFoldingGroup;
} }
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
*/
@Override @Override
protected void performRevert() { protected void performRevert() {
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer(); ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
@ -390,15 +387,17 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
boolean projectionMode= projectionViewer.isProjectionMode(); boolean projectionMode= projectionViewer.isProjectionMode();
if (projectionMode) { if (projectionMode) {
projectionViewer.disableProjection(); projectionViewer.disableProjection();
if (fProjectionMakefileUpdater != null) if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.uninstall(); fProjectionMakefileUpdater.uninstall();
}
} }
super.performRevert(); super.performRevert();
if (projectionMode) { if (projectionMode) {
if (fProjectionMakefileUpdater != null) if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.install(this, projectionViewer); fProjectionMakefileUpdater.install(this, projectionViewer);
}
projectionViewer.enableProjection(); projectionViewer.enableProjection();
} }
@ -422,8 +421,9 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
@Override @Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
ISourceViewer sourceViewer= getSourceViewer(); ISourceViewer sourceViewer= getSourceViewer();
if (sourceViewer == null) if (sourceViewer == null) {
return; return;
}
String property = event.getProperty(); String property = event.getProperty();
@ -438,8 +438,9 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
if (MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) { if (MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
if (sourceViewer instanceof ProjectionViewer) { if (sourceViewer instanceof ProjectionViewer) {
ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer; ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer;
if (fProjectionMakefileUpdater != null) if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.uninstall(); fProjectionMakefileUpdater.uninstall();
}
// either freshly enabled or provider changed // either freshly enabled or provider changed
fProjectionMakefileUpdater= new ProjectionMakefileUpdater(); fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
if (fProjectionMakefileUpdater != null) { 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 * 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
@ -46,12 +46,8 @@ public class MakefileEditorActionContributor extends TextEditorActionContributor
fTogglePresentation = new MakefileEditorTogglePresentationAction(); fTogglePresentation = new MakefileEditorTogglePresentationAction();
fOpenDeclarationAction = new OpenDeclarationAction(); fOpenDeclarationAction = new OpenDeclarationAction();
fOpenDeclarationAction.setActionDefinitionId(IMakefileEditorActionDefinitionIds.OPEN_DECLARATION); fOpenDeclarationAction.setActionDefinitionId(IMakefileEditorActionDefinitionIds.OPEN_DECLARATION);
} }
/**
* @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
*/
@Override @Override
public void setActiveEditor(IEditorPart targetEditor) { public void setActiveEditor(IEditorPart targetEditor) {
super.setActiveEditor(targetEditor); super.setActiveEditor(targetEditor);
@ -71,14 +67,11 @@ public class MakefileEditorActionContributor extends TextEditorActionContributor
fTogglePresentation.setEditor(editor); fTogglePresentation.setEditor(editor);
fTogglePresentation.update(); fTogglePresentation.update();
fOpenDeclarationAction.setEditor(editor); fOpenDeclarationAction.setEditor(editor);
fOpenDeclarationAction.update(); fOpenDeclarationAction.update();
} }
/*
* @see IEditorActionBarContributor#dispose()
*/
@Override @Override
public void dispose() { public void dispose() {
doSetActiveEditor(null); 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 * 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
@ -9,17 +9,13 @@
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Patrick Hofer - Bug 326265 * Patrick Hofer - Bug 326265
*******************************************************************************/ *******************************************************************************/
// this file is based on org.eclipse.cdt.internal.ui.editor.CEditorMessages
package org.eclipse.cdt.make.internal.ui.editor; package org.eclipse.cdt.make.internal.ui.editor;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
public final class MakefileEditorMessages extends NLS { public final class MakefileEditorMessages extends NLS {
public static String MakefileEditor_menu_folding; public static String MakefileEditor_menu_folding;
static { static {
NLS.initializeMessages(MakefileEditorMessages.class.getName(), MakefileEditorMessages.class); NLS.initializeMessages(MakefileEditorMessages.class.getName(), MakefileEditorMessages.class);
} }

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 * 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
@ -10,15 +10,14 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor; 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.MakeUIImages;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction; import org.eclipse.ui.texteditor.TextEditorAction;
/** /**
*/ */
public class MakefileEditorTogglePresentationAction extends TextEditorAction { public class MakefileEditorTogglePresentationAction extends TextEditorAction {
/** /**
* Constructor for MakefileEditorTogglePresentationAction. * Constructor for MakefileEditorTogglePresentationAction.
*/ */
@ -29,9 +28,6 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction {
update(); update();
} }
/**
* @see org.eclipse.jface.action.IAction#run()
*/
@Override @Override
public void run() { public void run() {
ITextEditor editor= getTextEditor(); ITextEditor editor= getTextEditor();
@ -41,9 +37,6 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction {
editor.showHighlightRangeOnly(!show); editor.showHighlightRangeOnly(!show);
} }
/**
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
@Override @Override
public void update() { public void update() {
setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly()); 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 * 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
@ -36,13 +36,11 @@ import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.ITokenScanner; import org.eclipse.jface.text.rules.ITokenScanner;
import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
private ColorManager fColorManager; private ColorManager fColorManager;
MakefileCodeScanner fCodeScanner; MakefileCodeScanner fCodeScanner;
private MakefileEditor fEditor; private MakefileEditor fEditor;
@ -53,24 +51,15 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
*/ */
static class SingleTokenScanner extends AbstractMakefileCodeScanner { static class SingleTokenScanner extends AbstractMakefileCodeScanner {
private final String[] fProperties; private final String[] fProperties;
public SingleTokenScanner(String property) { public SingleTokenScanner(String property) {
fProperties= new String[] { property }; fProperties= new String[] { property };
initialize(); initialize();
} }
/*
* @see org.eclipse.cdt.make.internal.ui.text.makefile.AbstractMakefileCodeScanner#createRules()
*/
@Override @Override
protected List<IRule> createRules() { protected List<IRule> createRules() {
setDefaultReturnToken(getToken(fProperties[0])); setDefaultReturnToken(getToken(fProperties[0]));
return null; return null;
} }
/*
* @see org.eclipse.cdt.make.internal.ui.text.makefile.AbstractMakefileCodeScanner#getTokenProperties()
*/
@Override @Override
protected String[] getTokenProperties() { protected String[] getTokenProperties() {
return fProperties; return fProperties;
@ -86,18 +75,12 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
fColorManager = ColorManager.getDefault(); fColorManager = ColorManager.getDefault();
} }
/**
* @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
*/
@Override @Override
public String[] getConfiguredContentTypes(ISourceViewer v) { public String[] getConfiguredContentTypes(ISourceViewer v) {
return MakefilePartitionScanner.MAKE_PARTITIONS; return MakefilePartitionScanner.MAKE_PARTITIONS;
} }
/**
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
*/
@Override @Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
if (fEditor != null && fEditor.isEditable()) { if (fEditor != null && fEditor.isEditable()) {
@ -105,10 +88,10 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE); assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE);
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION); assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
assistant.enableAutoActivation(true); assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500); assistant.setAutoActivationDelay(500);
assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW); assistant.setProposalPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW); assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
//Set to Carolina blue //Set to Carolina blue
@ -120,14 +103,16 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
} }
protected MakefileCodeScanner getCodeScanner() { protected MakefileCodeScanner getCodeScanner() {
if (null == fCodeScanner) if (null == fCodeScanner) {
fCodeScanner = new MakefileCodeScanner(); fCodeScanner = new MakefileCodeScanner();
}
return fCodeScanner; return fCodeScanner;
} }
protected ITokenScanner getCommentScanner() { protected ITokenScanner getCommentScanner() {
if (null == fCommentScanner) if (null == fCommentScanner) {
fCommentScanner = new SingleTokenScanner(ColorManager.MAKE_COMMENT_COLOR); fCommentScanner = new SingleTokenScanner(ColorManager.MAKE_COMMENT_COLOR);
}
return fCommentScanner; return fCommentScanner;
} }
@ -136,7 +121,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
PresentationReconciler reconciler = new PresentationReconciler(); PresentationReconciler reconciler = new PresentationReconciler();
reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(v)); reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(v));
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner()); DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
@ -147,17 +132,11 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
return reconciler; return reconciler;
} }
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override @Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
return MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING; return MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING;
} }
/**
* @see SourceViewerConfiguration#getReconciler(ISourceViewer)
*/
@Override @Override
public IReconciler getReconciler(ISourceViewer sourceViewer) { public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (fEditor != null && fEditor.isEditable()) { if (fEditor != null && fEditor.isEditable()) {
@ -169,17 +148,11 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
@Override @Override
public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) { public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) {
return new String[]{"#"}; //$NON-NLS-1$ 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 @Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if (fEditor != null) { if (fEditor != null) {
@ -187,9 +160,6 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
} }
return super.getTextHover(sourceViewer, contentType); return super.getTextHover(sourceViewer, contentType);
} }
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override @Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
if (fEditor != null) { 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 * 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
@ -22,11 +22,6 @@ import org.eclipse.ui.editors.text.StorageDocumentProvider;
* MakefileStorageDocumentProvider * MakefileStorageDocumentProvider
*/ */
public class MakefileStorageDocumentProvider extends StorageDocumentProvider { public class MakefileStorageDocumentProvider extends StorageDocumentProvider {
/*
* @see org.eclipse.ui.editors.text.StorageDocumentProvider#setupDocument(java.lang.Object,
* org.eclipse.jface.text.IDocument)
*/
@Override @Override
protected void setupDocument(Object element, IDocument document) { protected void setupDocument(Object element, IDocument document) {
if (document != null) { if (document != null) {
@ -40,7 +35,7 @@ public class MakefileStorageDocumentProvider extends StorageDocumentProvider {
partitioner.connect(document); partitioner.connect(document);
} }
} }
private IDocumentPartitioner createDocumentPartitioner() { private IDocumentPartitioner createDocumentPartitioner() {
return new FastPartitioner( return new FastPartitioner(
new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS); new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);

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 * 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
@ -21,9 +21,8 @@ import org.eclipse.jface.text.reconciler.MonoReconciler;
* NotifyingReconciler * NotifyingReconciler
*/ */
public class NotifyingReconciler extends MonoReconciler { public class NotifyingReconciler extends MonoReconciler {
private ArrayList<IReconcilingParticipant> fReconcilingParticipants= new ArrayList<IReconcilingParticipant>(); private ArrayList<IReconcilingParticipant> fReconcilingParticipants= new ArrayList<IReconcilingParticipant>();
/** /**
* Constructor for NotifyingReconciler. * Constructor for NotifyingReconciler.
*/ */
@ -31,9 +30,6 @@ public class NotifyingReconciler extends MonoReconciler {
super(strategy, isIncremental); super(strategy, isIncremental);
} }
/*
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#process(org.eclipse.jface.text.reconciler.DirtyRegion)
*/
@Override @Override
protected void process(DirtyRegion dirtyRegion) { protected void process(DirtyRegion dirtyRegion) {
super.process(dirtyRegion); super.process(dirtyRegion);
@ -53,9 +49,7 @@ public class NotifyingReconciler extends MonoReconciler {
participant.reconciled(); participant.reconciled();
} }
} }
/* (non-Javadoc)
* @see org.eclipse.jface.text.reconciler.AbstractReconciler#initialProcess()
*/
@Override @Override
protected void initialProcess() { protected void initialProcess() {
super.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 * 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
@ -23,7 +23,6 @@ import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction; import org.eclipse.ui.texteditor.TextEditorAction;
public class OpenDeclarationAction extends TextEditorAction { public class OpenDeclarationAction extends TextEditorAction {
public OpenDeclarationAction() { public OpenDeclarationAction() {
this(null); this(null);
} }
@ -32,11 +31,6 @@ public class OpenDeclarationAction extends TextEditorAction {
super(MakeUIPlugin.getDefault().getResourceBundle(), "OpenDeclarationAction.", editor); //$NON-NLS-1$ super(MakeUIPlugin.getDefault().getResourceBundle(), "OpenDeclarationAction.", editor); //$NON-NLS-1$
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override @Override
public void run() { public void run() {
ITextEditor editor = getTextEditor(); 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 * 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
@ -38,11 +38,10 @@ import org.eclipse.ui.ide.IDE;
* OpenIncludeAction * OpenIncludeAction
*/ */
public class OpenIncludeAction extends Action { public class OpenIncludeAction extends Action {
ISelectionProvider fSelectionProvider; ISelectionProvider fSelectionProvider;
/** /**
* * Constructor.
*/ */
public OpenIncludeAction(ISelectionProvider provider) { public OpenIncludeAction(ISelectionProvider provider) {
super(MakeUIPlugin.getResourceString("OpenIncludeAction.title")); //$NON-NLS-1$ super(MakeUIPlugin.getResourceString("OpenIncludeAction.title")); //$NON-NLS-1$
@ -51,20 +50,14 @@ public class OpenIncludeAction extends Action {
fSelectionProvider= provider; fSelectionProvider= provider;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override @Override
public void run() { public void run() {
IInclude[] includes= getIncludeDirective(fSelectionProvider.getSelection()); IInclude[] includes= getIncludeDirective(fSelectionProvider.getSelection());
if (includes != null) { if (includes != null) {
for (int i = 0; i < includes.length; ++i) { for (IInclude include : includes) {
IDirective[] directives = includes[i].getDirectives(); for (IDirective directive : include.getDirectives()) {
for (int j = 0; j < directives.length; ++j) {
try { try {
openInEditor(directives[j]); openInEditor(directive);
} catch (PartInitException e) { } catch (PartInitException e) {
} }
} }
@ -111,8 +104,7 @@ public class OpenIncludeAction extends Action {
List<Object> list= ((IStructuredSelection)sel).toList(); List<Object> list= ((IStructuredSelection)sel).toList();
if (list.size() > 0) { if (list.size() > 0) {
List<IInclude> includes = new ArrayList<IInclude>(list.size()); List<IInclude> includes = new ArrayList<IInclude>(list.size());
for (int i = 0; i < list.size(); ++i) { for (Object element : list) {
Object element= list.get(i);
if (element instanceof IInclude) { if (element instanceof IInclude) {
includes.add((IInclude) element); includes.add((IInclude) element);
} }
@ -124,7 +116,7 @@ public class OpenIncludeAction extends Action {
} }
public boolean canActionBeAdded(ISelection selection) { public boolean canActionBeAdded(ISelection selection) {
IInclude[] includes = getIncludeDirective(selection); IInclude[] includes = getIncludeDirective(selection);
return includes != null && includes.length != 0; 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 * 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
@ -42,9 +42,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
* ProjectionMakefileUpdater * ProjectionMakefileUpdater
*/ */
public class ProjectionMakefileUpdater implements IProjectionListener { public class ProjectionMakefileUpdater implements IProjectionListener {
private static class MakefileProjectionAnnotation extends ProjectionAnnotation { private static class MakefileProjectionAnnotation extends ProjectionAnnotation {
private IDirective fDirective; private IDirective fDirective;
private boolean fIsComment; private boolean fIsComment;
@ -71,7 +69,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
// } // }
} }
public void install(MakefileEditor editor, ProjectionViewer viewer) { public void install(MakefileEditor editor, ProjectionViewer viewer) {
fEditor= editor; fEditor= editor;
fViewer= viewer; fViewer= viewer;
@ -92,10 +89,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private class ReconcilerParticipant implements IReconcilingParticipant { private class ReconcilerParticipant implements IReconcilingParticipant {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.ui.editor.IReconcilingParticipant#reconciled()
*/
@Override @Override
public void reconciled() { public void reconciled() {
processReconcile(); processReconcile();
@ -113,9 +106,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
private boolean fCollapseRule = false; private boolean fCollapseRule = false;
private boolean fCollapseConditional = false; private boolean fCollapseConditional = false;
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled()
*/
@Override @Override
public void projectionEnabled() { public void projectionEnabled() {
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html // http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
@ -130,9 +120,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
fEditor.addReconcilingParticipant(fParticipant); fEditor.addReconcilingParticipant(fParticipant);
} }
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled()
*/
@Override @Override
public void projectionDisabled() { public void projectionDisabled() {
fCachedDocument= null; fCachedDocument= null;
@ -143,14 +130,13 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
public void initialize() { public void initialize() {
if (!isInstalled()) {
if (!isInstalled())
return; return;
}
initializePreferences(); initializePreferences();
try { try {
IDocumentProvider provider= fEditor.getDocumentProvider(); IDocumentProvider provider= fEditor.getDocumentProvider();
fCachedDocument= provider.getDocument(fEditor.getEditorInput()); fCachedDocument= provider.getDocument(fEditor.getEditorInput());
fAllowCollapsing= true; fAllowCollapsing= true;
@ -166,7 +152,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
model.replaceAnnotations(null, additions); model.replaceAnnotations(null, additions);
} }
} }
} finally { } finally {
fCachedDocument= null; fCachedDocument= null;
fAllowCollapsing= false; fAllowCollapsing= false;
@ -187,9 +172,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private void computeAdditions(IDirective[] elements, Map<MakefileProjectionAnnotation, Position> map) { private void computeAdditions(IDirective[] elements, Map<MakefileProjectionAnnotation, Position> map) {
for (int i= 0; i < elements.length; i++) { for (IDirective element : elements) {
IDirective element= elements[i];
computeAdditions(element, map); computeAdditions(element, map);
if (element instanceof IParent) { if (element instanceof IParent) {
@ -200,9 +183,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private void computeAdditions(IDirective element, Map<MakefileProjectionAnnotation, Position> map) { private void computeAdditions(IDirective element, Map<MakefileProjectionAnnotation, Position> map) {
boolean createProjection= false; boolean createProjection= false;
boolean collapse= false; boolean collapse= false;
if (element instanceof IConditional) { if (element instanceof IConditional) {
@ -225,9 +206,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private Position createProjectionPosition(IDirective element) { private Position createProjectionPosition(IDirective element) {
if (fCachedDocument == null) {
if (fCachedDocument == null)
return null; return null;
}
try { try {
int startLine= element.getStartLine() - 1; int startLine= element.getStartLine() - 1;
@ -237,7 +218,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
int endOffset= fCachedDocument.getLineOffset(endLine + 1); int endOffset= fCachedDocument.getLineOffset(endLine + 1);
return new Position(offset, endOffset - offset); return new Position(offset, endOffset - offset);
} }
} catch (BadLocationException x) { } catch (BadLocationException x) {
} }
@ -245,12 +225,14 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
public void processReconcile() { public void processReconcile() {
if (!isInstalled()) if (!isInstalled()) {
return; return;
}
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class); ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model == null) if (model == null) {
return; return;
}
try { try {
IDocumentProvider provider= fEditor.getDocumentProvider(); IDocumentProvider provider= fEditor.getDocumentProvider();
@ -264,7 +246,6 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
Map<MakefileProjectionAnnotation, Position> updated= computeAdditions((IParent) fInput); Map<MakefileProjectionAnnotation, Position> updated= computeAdditions((IParent) fInput);
Map<IDirective, List<MakefileProjectionAnnotation>> previous= createAnnotationMap(model); Map<IDirective, List<MakefileProjectionAnnotation>> previous= createAnnotationMap(model);
for (MakefileProjectionAnnotation annotation : updated.keySet()) { for (MakefileProjectionAnnotation annotation : updated.keySet()) {
IDirective element= annotation.getElement(); IDirective element= annotation.getElement();
Position position= updated.get(annotation); Position position= updated.get(annotation);
@ -288,15 +269,17 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
} }
if (annotations.isEmpty()) if (annotations.isEmpty()) {
previous.remove(element); previous.remove(element);
}
} }
} }
for (List<MakefileProjectionAnnotation> list : previous.values()) { for (List<MakefileProjectionAnnotation> list : previous.values()) {
int size= list.size(); int size= list.size();
for (int i= 0; i < size; i++) for (int i= 0; i < size; i++) {
deletions.add(list.get(i)); deletions.add(list.get(i));
}
} }
match(model, deletions, additions, updates); match(model, deletions, additions, updates);
@ -316,8 +299,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions, private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions,
Map<MakefileProjectionAnnotation, Position> additions, List<MakefileProjectionAnnotation> changes) { Map<MakefileProjectionAnnotation, Position> additions, List<MakefileProjectionAnnotation> changes) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) {
return; return;
}
List<MakefileProjectionAnnotation> newDeletions= new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> newDeletions= new ArrayList<MakefileProjectionAnnotation>();
List<MakefileProjectionAnnotation> newChanges= new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> newChanges= new ArrayList<MakefileProjectionAnnotation>();
@ -326,16 +310,18 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
outer: while (deletionIterator.hasNext()) { outer: while (deletionIterator.hasNext()) {
MakefileProjectionAnnotation deleted= deletionIterator.next(); MakefileProjectionAnnotation deleted= deletionIterator.next();
Position deletedPosition= model.getPosition(deleted); Position deletedPosition= model.getPosition(deleted);
if (deletedPosition == null) if (deletedPosition == null) {
continue; continue;
}
Iterator<MakefileProjectionAnnotation> changesIterator= changes.iterator(); Iterator<MakefileProjectionAnnotation> changesIterator= changes.iterator();
while (changesIterator.hasNext()) { while (changesIterator.hasNext()) {
MakefileProjectionAnnotation changed= changesIterator.next(); MakefileProjectionAnnotation changed= changesIterator.next();
if (deleted.isComment() == changed.isComment()) { if (deleted.isComment() == changed.isComment()) {
Position changedPosition= model.getPosition(changed); Position changedPosition= model.getPosition(changed);
if (changedPosition == null) if (changedPosition == null) {
continue; continue;
}
if (deletedPosition.getOffset() == changedPosition.getOffset()) { 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 * 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
@ -28,7 +28,6 @@ import org.eclipse.ui.IEditorInput;
* additionally offers to "overwrite" the working copy provided by this document provider. * additionally offers to "overwrite" the working copy provided by this document provider.
*/ */
public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension { public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
private IMakefileDocumentProvider fDocumentProvider; private IMakefileDocumentProvider fDocumentProvider;
private Map<IEditorInput, IMakefile> fMap; private Map<IEditorInput, IMakefile> fMap;
private boolean fIsShuttingDown; private boolean fIsShuttingDown;
@ -44,25 +43,16 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
fDocumentProvider= provider; fDocumentProvider= provider;
} }
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput)
*/
@Override @Override
public void connect(IEditorInput input) throws CoreException { public void connect(IEditorInput input) throws CoreException {
fDocumentProvider.connect(input); fDocumentProvider.connect(input);
} }
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput)
*/
@Override @Override
public void disconnect(IEditorInput input) { public void disconnect(IEditorInput input) {
fDocumentProvider.disconnect(input); fDocumentProvider.disconnect(input);
} }
/*
* @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown()
*/
@Override @Override
public void shutdown() { public void shutdown() {
if (!fIsShuttingDown) { 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 @Override
public IMakefile getWorkingCopy(IEditorInput input) { public IMakefile getWorkingCopy(IEditorInput input) {
IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input); IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input);
return unit != null ? unit : fDocumentProvider.getWorkingCopy(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 @Override
public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) { public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) {
if (fDocumentProvider.getDocument(input) != null) { if (fDocumentProvider.getDocument(input) != null) {
if (fMap == null) if (fMap == null) {
fMap= new HashMap<IEditorInput, IMakefile>(); fMap= new HashMap<IEditorInput, IMakefile>();
}
fMap.put(input, workingCopy); fMap.put(input, workingCopy);
} }
} }
/*
* @see org.eclipse.cdt.make.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput)
*/
@Override @Override
public void removeWorkingCopy(IEditorInput input) { public void removeWorkingCopy(IEditorInput input) {
fMap.remove(input); fMap.remove(input);
if (fMap.isEmpty()) if (fMap.isEmpty()) {
fMap= null; fMap= null;
}
} }
} }