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.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourceAttributes;
@ -182,13 +183,15 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
private List fBufferListeners= new ArrayList(3);
private IStatus fStatus;
private IPath fLocation;
final private IPath fLocation;
final private LocationKind fLocationKind;
public DocumentAdapter(IOpenable owner, IFile file) {
fOwner= owner;
fFile= file;
fLocation= file.getFullPath();
fLocationKind= LocationKind.IFILE;
initialize();
}
@ -196,20 +199,20 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
public DocumentAdapter(IOpenable owner, IPath location) {
fOwner= owner;
fLocation= location;
fLocationKind= LocationKind.LOCATION;
initialize();
}
private void initialize() {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
IPath location= fLocation;
try {
manager.connect(location, new NullProgressMonitor());
fTextFileBuffer= manager.getTextFileBuffer(location);
manager.connect(fLocation, fLocationKind, new NullProgressMonitor());
fTextFileBuffer= manager.getTextFileBuffer(fLocation, fLocationKind);
fDocument= fTextFileBuffer.getDocument();
} catch (CoreException x) {
fStatus= x.getStatus();
fDocument= manager.createEmptyDocument(location);
fDocument= manager.createEmptyDocument(fLocation, fLocationKind);
if (fDocument instanceof ISynchronizable)
((ISynchronizable)fDocument).setLockObject(new Object());
}
@ -287,7 +290,7 @@ public class DocumentAdapter implements IBuffer, IDocumentListener {
if (fTextFileBuffer != null) {
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
try {
manager.disconnect(fTextFileBuffer.getLocation(), new NullProgressMonitor());
manager.disconnect(fLocation, fLocationKind, new NullProgressMonitor());
} catch (CoreException x) {
// 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.model.IWorkingCopy;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor;
/**
* A proposal computer for handling the legacy extensions from the
@ -43,6 +42,9 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
public LegacyCompletionProposalComputer() {
}
/**
* @deprecated this is for backwards compatibility, only.
*/
protected List computeCompletionProposals(
CContentAssistInvocationContext context,
IASTCompletionNode completionNode, String prefix) throws CoreException {
@ -72,9 +74,9 @@ public class LegacyCompletionProposalComputer extends ParsingBasedProposalComput
if (!"contributor".equals(element.getName())) //$NON-NLS-1$
continue;
Object contribObject = element.createExecutableExtension("class"); //$NON-NLS-1$
if (!(contribObject instanceof ICompletionContributor))
if (!(contribObject instanceof org.eclipse.cdt.ui.text.contentassist.ICompletionContributor))
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,
workingCopy, (ASTCompletionNode) completionNode,
prefix, proposals);