From eaab8181d08302eff95f2333e80e39cfd6630a90 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 19 Sep 2003 05:04:37 +0000 Subject: [PATCH] new icons and improvement on the MakefileEditor by using a working copy to maintain the parse makefile --- .../icons/obj16/command_obj.gif | Bin 0 -> 125 bytes .../icons/obj16/relation_obj.gif | Bin 0 -> 133 bytes .../icons/obj16/trule_obj.gif | Bin 169 -> 135 bytes .../cdt/make/internal/ui/MakeUIImages.java | 9 ++ .../cdt/make/internal/ui/MakeUIPlugin.java | 31 +++++ .../ui/editor/IMakefileDocumentProvider.java | 25 ++++ .../ui/editor/MakefileContentOutlinePage.java | 96 ++++++++++---- .../ui/editor/MakefileDocumentProvider.java | 122 +++++++++++++++++- .../internal/ui/editor/MakefileEditor.java | 62 +++++---- .../ui/editor/WorkingCopyManager.java | 106 +++++++++++++++ .../makefile/MakefileCompletionProcessor.java | 31 +++-- .../cdt/make/ui/IWorkingCopyManager.java | 77 +++++++++++ .../make/ui/IWorkingCopyManagerExtension.java | 43 ++++++ 13 files changed, 540 insertions(+), 62 deletions(-) create mode 100644 build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif create mode 100644 build/org.eclipse.cdt.make.ui/icons/obj16/relation_obj.gif create mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/IMakefileDocumentProvider.java create mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java create mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java create mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/command_obj.gif new file mode 100644 index 0000000000000000000000000000000000000000..f13e465665b9edd7f89f9bf09a853188d38bfc9a GIT binary patch literal 125 zcmZ?wbhEHb6krfwSi}GXE%x>M8CrmVVgCI2Ac}$E|NsArKUo+V7}yzfKuSPr8JL|a zcHP;>-15A^aEmBI#!iK8C8ym4t}T^lO%q^a=Q>|L*Wvd9afkFhk*wP zAQ_Mu3@k+| zz`((v1Cj)p!N3wGaME-2UWvJazbqmQL|h^Z!W5?DXtG>MD`WJmx$Gg*=qR!EZi0}; zSFQ%83mzsy3>VTlFQ~{&_Rj7*@|kg`b7zh?1It>4N2{JTg}Rt+y1hxW`_fDw76xko DSwA 20) { + name = name.substring(0, 20) + "..."; //$NON-NLS-1$ + } + } + return name; } } - protected IDocumentProvider fDocumentProvider; protected MakefileEditor fEditor; protected Object fInput; - public MakefileContentOutlinePage(IDocumentProvider provider, MakefileEditor editor) { + public MakefileContentOutlinePage(MakefileEditor editor) { super(); - fDocumentProvider = provider; fEditor = editor; } @@ -202,8 +250,8 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC fEditor.resetHighlightRange(); } else if (selection instanceof IStructuredSelection){ Object element = ((IStructuredSelection) selection).getFirstElement(); - if (element instanceof IStatement) { - IStatement statement = (IStatement)element; + if (element instanceof IDirective) { + IDirective statement = (IDirective)element; int startLine = statement.getStartLine() - 1; int endLine = statement.getEndLine() - 1; try { @@ -232,7 +280,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC if (control != null && !control.isDisposed()) { control.setRedraw(false); viewer.setInput(fInput); - viewer.expandAll(); + //viewer.expandAll(); control.setRedraw(true); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java index 5f700f59af3..a3abe9cdabb 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java @@ -10,19 +10,47 @@ ***********************************************************************/ package org.eclipse.cdt.make.internal.ui.editor; +import java.io.IOException; +import java.io.StringReader; +import java.util.Iterator; + +import org.eclipse.cdt.make.core.MakeCorePlugin; +import org.eclipse.cdt.make.core.makefile.IMakefile; import org.eclipse.cdt.make.internal.ui.text.makefile.MakefilePartitionScanner; +import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.rules.DefaultPartitioner; +import org.eclipse.jface.text.source.IAnnotationModel; +import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.editors.text.FileDocumentProvider; /** */ -public class MakefileDocumentProvider extends FileDocumentProvider { +public class MakefileDocumentProvider extends FileDocumentProvider implements IMakefileDocumentProvider { private static MakefilePartitionScanner scanner = null; + /** + * Bundle of all required informations to allow working copy management. + */ + protected class MakefileInfo extends FileInfo { + + IMakefile fCopy; + + public MakefileInfo(IDocument document, IAnnotationModel model, FileSynchronizer fileSynchronizer, IMakefile copy) { + super(document, model, fileSynchronizer); + fCopy = copy; + } + + public void setModificationStamp(long timeStamp) { + fModificationStamp = timeStamp; + } + } + /** * Constructor for MakefileDocumentProvider. */ @@ -53,4 +81,96 @@ public class MakefileDocumentProvider extends FileDocumentProvider { return scanner; } + /* + * @see AbstractDocumentProvider#createElementInfo(Object) + */ + protected ElementInfo createElementInfo(Object element) throws CoreException { + if (element instanceof IFileEditorInput) { + + IFileEditorInput input = (IFileEditorInput) element; + IMakefile makefile = createMakefile(input.getFile()); + if (makefile == null) { + return super.createElementInfo(element); + } + try { + refreshFile(input.getFile()); + } catch (CoreException x) { + handleCoreException(x, "FileDocumentProvider.createElementInfo"); + } + + IDocument d = null; + IStatus s = null; + + try { + d = createDocument(element); + } catch (CoreException x) { + s = x.getStatus(); + d = createEmptyDocument(); + } + + IAnnotationModel m = createAnnotationModel(element); + FileSynchronizer f = new FileSynchronizer(input); + f.install(); + + FileInfo info = new MakefileInfo(d, m, f, makefile); + info.fModificationStamp = computeModificationStamp(input.getFile()); + info.fStatus = s; + info.fEncoding = getPersistedEncoding(input); + + return info; + } + + return super.createElementInfo(element); + } + + /** + * @param file + * @return + */ + private IMakefile createMakefile(IFile file) { + return MakeCorePlugin.getDefault().createMakefile(file); + } + + /* + * @see AbstractDocumentProvider#doSaveDocument(IProgressMonitor, Object, IDocument, boolean) + */ + protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { + + // Update the makefile directives tree; + ElementInfo elementInfo= getElementInfo(element); + if (elementInfo instanceof MakefileInfo) { + MakefileInfo info= (MakefileInfo) elementInfo; + String content = document.get(); + StringReader reader = new StringReader(content); + try { + info.fCopy.parse(reader); + } catch (IOException e) { + } + } + super.doSaveDocument(monitor, element, document, overwrite); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.make.internal.ui.editor.IMakefileDocumentProvider#shutdown() + */ + public void shutdown() { + Iterator e = getConnectedElements(); + while (e.hasNext()) { + disconnect(e.next()); + } + } + + /* + * @see org.eclipse.jdt.internal.ui.javaeditor.ICompilationUnitDocumentProvider#getWorkingCopy(java.lang.Object) + */ + public IMakefile getWorkingCopy(Object element) { + + ElementInfo elementInfo = getElementInfo(element); + if (elementInfo instanceof MakefileInfo) { + MakefileInfo info = (MakefileInfo) elementInfo; + return info.fCopy; + } + return null; + } + } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java index 8f6047cb071..6ae32470819 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java @@ -10,19 +10,13 @@ ***********************************************************************/ package org.eclipse.cdt.make.internal.ui.editor; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; import java.util.ResourceBundle; import org.eclipse.cdt.make.core.makefile.IMakefile; -import org.eclipse.cdt.make.internal.core.makefile.NullMakefile; -import org.eclipse.cdt.make.internal.core.makefile.posix.PosixMakefile; import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; import org.eclipse.cdt.make.internal.ui.text.MakefileColorManager; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.DefaultRangeIndicator; @@ -40,31 +34,45 @@ public class MakefileEditor extends TextEditor { private MakefileContentOutlinePage getOutlinePage() { if (page == null) { - page = new MakefileContentOutlinePage(getDocumentProvider(), this); + page = new MakefileContentOutlinePage(this); page.setInput(getEditorInput()); } return page; } - public IMakefile getMakefile() { - IDocument document = getDocumentProvider().getDocument(getEditorInput()); - return getMakefile(document); - } - - public IMakefile getMakefile(IDocument document) { - if (document != null) { - if (makefile == null || isDirty()) { - try { - String content = document.get(); - Reader r = new StringReader(content); - makefile = new PosixMakefile(r); - } catch (IOException e) { - makefile = new NullMakefile(); - } - } - } - return makefile; - } +// public IMakefile getMakefile() { +// IDocument document = getDocumentProvider().getDocument(getEditorInput()); +// if (makefile == null) { +// makefile = new GNUMakefile(); +// try { +// String content = document.get(); +// Reader r = new StringReader(content); +// makefile.parse(r); +// } catch (IOException e) { +// } +// IEditorInput input = getEditorInput(); +// if (makefile instanceof GNUMakefile) { +// GNUMakefile gnu = (GNUMakefile)makefile; +// if (input instanceof IFileEditorInput) { +// IFile file = ((IFileEditorInput)input).getFile(); +// String[] dirs = gnu.getIncludeDirectories(); +// String[] includes = new String[dirs.length + 1]; +// System.arraycopy(dirs, 0, includes, 0, dirs.length); +// String cwd = file.getLocation().removeLastSegments(1).toOSString(); +// includes[dirs.length] = cwd; +// gnu.setIncludeDirectories(includes); +// } +// } +// } else if (isDirty()) { +// try { +// String content = document.get(); +// Reader r = new StringReader(content); +// makefile.parse(r); +// } catch (IOException e) { +// } +// } +// return makefile; +// } public MakefileEditor() { super(); @@ -80,7 +88,7 @@ public class MakefileEditor extends TextEditor { setRangeIndicator(new DefaultRangeIndicator()); setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$ setRulerContextMenuId("#MakefileRulerContext"); //$NON-NLS-1$ - setDocumentProvider(new MakefileDocumentProvider()); + setDocumentProvider(MakeUIPlugin.getDefault().getMakefileDocumentProvider()); } /* (non-Javadoc) diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java new file mode 100644 index 00000000000..a98f7fe995f --- /dev/null +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.make.internal.ui.editor; + + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.make.core.makefile.IMakefile; +import org.eclipse.cdt.make.ui.IWorkingCopyManager; +import org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.text.Assert; +import org.eclipse.ui.IEditorInput; + + +/** + * This working copy manager works together with a given compilation unit document provider and + * additionally offers to "overwrite" the working copy provided by this document provider. + */ +public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension { + + private IMakefileDocumentProvider fDocumentProvider; + private Map fMap; + private boolean fIsShuttingDown; + + /** + * Creates a new working copy manager that co-operates with the given + * compilation unit document provider. + * + * @param provider the provider + */ + public WorkingCopyManager(IMakefileDocumentProvider provider) { + Assert.isNotNull(provider); + fDocumentProvider= provider; + } + + /* + * @see org.eclipse.jdt.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput) + */ + public void connect(IEditorInput input) throws CoreException { + fDocumentProvider.connect(input); + } + + /* + * @see org.eclipse.jdt.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput) + */ + public void disconnect(IEditorInput input) { + fDocumentProvider.disconnect(input); + } + + /* + * @see org.eclipse.jdt.ui.IWorkingCopyManager#shutdown() + */ + public void shutdown() { + if (!fIsShuttingDown) { + fIsShuttingDown= true; + try { + if (fMap != null) { + fMap.clear(); + fMap= null; + } + fDocumentProvider.shutdown(); + } finally { + fIsShuttingDown= false; + } + } + } + + /* + * @see org.eclipse.jdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput) + */ + public IMakefile getWorkingCopy(IEditorInput input) { + IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input); + return unit != null ? unit : fDocumentProvider.getWorkingCopy(input); + } + + /* + * @see org.eclipse.jdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.jdt.core.ICompilationUnit) + */ + public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) { + if (fDocumentProvider.getDocument(input) != null) { + if (fMap == null) + fMap= new HashMap(); + fMap.put(input, workingCopy); + } + } + + /* + * @see org.eclipse.jdt.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput) + */ + public void removeWorkingCopy(IEditorInput input) { + fMap.remove(input); + if (fMap.isEmpty()) + fMap= null; + } +} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java index 0b288725449..46260079f78 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java @@ -15,10 +15,11 @@ import java.util.ArrayList; import org.eclipse.cdt.make.core.makefile.IMacroDefinition; import org.eclipse.cdt.make.core.makefile.IMakefile; import org.eclipse.cdt.make.core.makefile.IRule; -import org.eclipse.cdt.make.core.makefile.IStatement; +import org.eclipse.cdt.make.core.makefile.IDirective; import org.eclipse.cdt.make.internal.ui.MakeUIImages; -import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor; +import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; import org.eclipse.cdt.make.internal.ui.text.WordPartDetector; +import org.eclipse.cdt.make.ui.IWorkingCopyManager; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; @@ -31,6 +32,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.contentassist.IContextInformationPresenter; import org.eclipse.jface.text.contentassist.IContextInformationValidator; import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IEditorPart; /** * MakefileCompletionProcessor @@ -70,10 +72,13 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { protected IContextInformationValidator fValidator = new Validator(); protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO); protected Image imageTarget = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE); - protected MakefileEditor fEditor; - public MakefileCompletionProcessor(MakefileEditor editor) { + protected IEditorPart fEditor; + protected IWorkingCopyManager fManager; + + public MakefileCompletionProcessor(IEditorPart editor) { fEditor = editor; + fManager = MakeUIPlugin.getDefault().getWorkingCopyManager(); } /* (non-Javadoc) @@ -81,8 +86,12 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { */ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { boolean macro = inMacro(viewer, documentOffset); - IMakefile makefile = fEditor.getMakefile(viewer.getDocument()); - IStatement[] statements = null; + IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); +// IMakefile makefile = fEditor.getMakefile(); +// String content = viewer.getDocument().get(); +// Reader r = new StringReader(content); +// makefile.parse(r); + IDirective[] statements = null; if (macro) { statements = makefile.getMacroDefinitions(); } else { @@ -100,7 +109,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { if (statements[i] instanceof IMacroDefinition) { name = ((IMacroDefinition) statements[i]).getName(); image = imageMacro; - infoString = ((IMacroDefinition)statements[i]).getValue(); + infoString = ((IMacroDefinition)statements[i]).getValue().toString(); } else if (statements[i] instanceof IRule) { name = ((IRule) statements[i]).getTarget().toString(); image = imageTarget; @@ -131,15 +140,17 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = inMacro(viewer, documentOffset); - IMakefile makefile = fEditor.getMakefile(viewer.getDocument()); + IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); + //IMakefile makefile = fEditor.getMakefile(viewer.getDocument()); + //IMakefile makefile = fEditor.getMakefile(); ArrayList contextList = new ArrayList(); if (macro) { - IStatement[] statements = makefile.getMacroDefinitions(); + IDirective[] statements = makefile.getMacroDefinitions(); for (int i = 0; i < statements.length; i++) { if (statements[i] instanceof IMacroDefinition) { String name = ((IMacroDefinition) statements[i]).getName(); if (name != null && name.equals(wordPart.getString())) { - String value = ((IMacroDefinition) statements[i]).getValue(); + String value = ((IMacroDefinition) statements[i]).getValue().toString(); if (value != null && value.length() > 0) { contextList.add(value); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java new file mode 100644 index 00000000000..54e4b739ace --- /dev/null +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManager.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.make.ui; + +import org.eclipse.core.runtime.CoreException; + +import org.eclipse.ui.IEditorInput; + +import org.eclipse.cdt.make.core.makefile.IMakefile; + +/** + * Interface for accessing working copies of IMakefile + * objects. The original unit is only given indirectly by means + * of an IEditorInput. The life cycle is as follows: + *
    + *
  • connect creates and remembers a working copy of the + * unit which is encoded in the given editor input
  • + *
  • getWorkingCopy returns the working copy remembered on + * connect
  • + *
  • disconnect destroys the working copy remembered on + * connect
  • + *
+ *

+ * This interface is not intended to be implemented by clients. + *

+ * + * + */ +public interface IWorkingCopyManager { + + /** + * Connects the given editor input to this manager. After calling + * this method, a working copy will be available for the compilation unit encoded + * in the given editor input (does nothing if there is no encoded compilation unit). + * + * @param input the editor input + * @exception CoreException if the working copy cannot be created for the + * unit + */ + void connect(IEditorInput input) throws CoreException; + + /** + * Disconnects the given editor input from this manager. After calling + * this method, a working copy for the compilation unit encoded + * in the given editor input will no longer be available. Does nothing if there + * is no encoded compilation unit, or if there is no remembered working copy for + * the compilation unit. + * + * @param input the editor input + */ + void disconnect(IEditorInput input); + + /** + * Returns the working copy remembered for the compilation unit encoded in the + * given editor input. + * + * @param input the editor input + * @return the working copy of the compilation unit, or null if the + * input does not encode an editor input, or if there is no remembered working + * copy for this compilation unit + */ + IMakefile getWorkingCopy(IEditorInput input); + + /** + * Shuts down this working copy manager. All working copies still remembered + * by this manager are destroyed. + */ + void shutdown(); +} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java new file mode 100644 index 00000000000..e33fa7c3f78 --- /dev/null +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IWorkingCopyManagerExtension.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.make.ui; + +import org.eclipse.ui.IEditorInput; + +import org.eclipse.cdt.make.core.makefile.IMakefile; + +/** + * Extension interface for IWorkingCopyManager. + * @since 2.1 + */ +public interface IWorkingCopyManagerExtension { + + /** + * Sets the given working copy for the given editor input. If the given editor input + * is not connected to this working copy manager, this call has no effect.

+ * This working copy manager does not assume the ownership of this working copy, i.e., + * the given working copy is not automatically be freed when this manager is shut down. + * + * @param input the editor input + * @param workingCopy the working copy + */ + void setWorkingCopy(IEditorInput input, IMakefile workingCopy); + + /** + * Removes the working copy set for the given editor input. If there is no + * working copy set for this input or this input is not connected to this + * working copy manager, this call has no effect. + * + * @param input the editor input + */ + void removeWorkingCopy(IEditorInput input); +}