1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Removes usage of methods deprecated in 3.3M6.

This commit is contained in:
Markus Schorn 2007-03-26 08:35:38 +00:00
parent b2811d8ee4
commit 793c9de63f
2 changed files with 14 additions and 9 deletions

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourceAttributes; import org.eclipse.core.resources.ResourceAttributes;
@ -182,13 +183,15 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
private List fBufferListeners= new ArrayList(3); private List fBufferListeners= new ArrayList(3);
private IStatus fStatus; private IStatus fStatus;
private IPath fLocation; final private IPath fLocation;
final private LocationKind fLocationKind;
public DocumentAdapter(IOpenable owner, IFile file) { public DocumentAdapter(IOpenable owner, IFile file) {
fOwner= owner; fOwner= owner;
fFile= file; fFile= file;
fLocation= file.getFullPath(); fLocation= file.getFullPath();
fLocationKind= LocationKind.IFILE;
initialize(); initialize();
} }
@ -196,20 +199,20 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
public DocumentAdapter(IOpenable owner, IPath location) { public DocumentAdapter(IOpenable owner, IPath location) {
fOwner= owner; fOwner= owner;
fLocation= location; fLocation= location;
fLocationKind= LocationKind.LOCATION;
initialize(); initialize();
} }
private void initialize() { private void initialize() {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
IPath location= fLocation;
try { try {
manager.connect(location, new NullProgressMonitor()); manager.connect(fLocation, fLocationKind, new NullProgressMonitor());
fTextFileBuffer= manager.getTextFileBuffer(location); fTextFileBuffer= manager.getTextFileBuffer(fLocation, fLocationKind);
fDocument= fTextFileBuffer.getDocument(); fDocument= fTextFileBuffer.getDocument();
} catch (CoreException x) { } catch (CoreException x) {
fStatus= x.getStatus(); fStatus= x.getStatus();
fDocument= manager.createEmptyDocument(location); fDocument= manager.createEmptyDocument(fLocation, fLocationKind);
if (fDocument instanceof ISynchronizable) if (fDocument instanceof ISynchronizable)
((ISynchronizable)fDocument).setLockObject(new Object()); ((ISynchronizable)fDocument).setLockObject(new Object());
} }
@ -287,7 +290,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
if (fTextFileBuffer != null) { if (fTextFileBuffer != null) {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
try { try {
manager.disconnect(fTextFileBuffer.getLocation(), new NullProgressMonitor()); manager.disconnect(fLocation, fLocationKind, new NullProgressMonitor());
} catch (CoreException x) { } catch (CoreException x) {
// ignore // ignore
} }

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode; import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
/** /**
* A proposal computer for handling the legacy extensions from the * A proposal computer for handling the legacy extensions from the
@ -43,6 +42,9 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
public LegacyCompletionProposalComputer() { public LegacyCompletionProposalComputer() {
} }
/**
* @deprecated this is for backwards compatibility, only.
*/
protected List computeCompletionProposals( protected List computeCompletionProposals(
CContentAssistInvocationContext context, CContentAssistInvocationContext context,
IASTCompletionNode completionNode, String prefix) throws CoreException { IASTCompletionNode completionNode, String prefix) throws CoreException {
@ -72,9 +74,9 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
if (!"contributor".equals(element.getName())) //$NON-NLS-1$ if (!"contributor".equals(element.getName())) //$NON-NLS-1$
continue; continue;
Object contribObject = element.createExecutableExtension("class"); //$NON-NLS-1$ Object contribObject = element.createExecutableExtension("class"); //$NON-NLS-1$
if (!(contribObject instanceof ICompletionContributor)) if (!(contribObject instanceof org.eclipse.cdt.ui.text.contentassist.ICompletionContributor))
continue; continue;
ICompletionContributor contributor = (ICompletionContributor)contribObject; org.eclipse.cdt.ui.text.contentassist.ICompletionContributor contributor = (org.eclipse.cdt.ui.text.contentassist.ICompletionContributor)contribObject;
contributor.contributeCompletionProposals(viewer, offset, contributor.contributeCompletionProposals(viewer, offset,
workingCopy, (ASTCompletionNode) completionNode, workingCopy, (ASTCompletionNode) completionNode,
prefix, proposals); prefix, proposals);