1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Fix for bug 141295 - Avoid using deprecated extension point "documentCreation"

* Removed documentCreation extensions
* Removed IDocumentFactory implementations
* Removed PartiallySynchronizedDocument classes
* Removed private SetUpSynchronization methods from document providers
This commit is contained in:
Anton Leherbauer 2006-07-03 09:49:47 +00:00
parent 36c5a333f1
commit ed4662692b
8 changed files with 3 additions and 351 deletions

View file

@ -352,15 +352,6 @@
<contentTypeBinding contentTypeId="org.eclipse.cdt.make.core.makefile"/>
</editor>
</extension>
<extension
id="org.eclipse.cdt.make.ui.MakefileDocumentFactory"
name="%MakefileDocumentFactory.name"
point="org.eclipse.core.filebuffers.documentCreation">
<factory
contentTypeId="org.eclipse.cdt.make.core.makefile"
class="org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentFactory">
</factory>
</extension>
<extension
id="org.eclipse.cdt.make.ui.MakefileDocumentSetupParticipant"
name="%MakefileDocumentSetupParticipant.name"

View file

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor;
import org.eclipse.jface.text.IDocument;
/**
* MakefileDocumentFactory
*/
public class MakefileDocumentFactory {
public MakefileDocumentFactory() {
}
/*
* @see org.eclipse.core.filebuffers.IDocumentFactory#createDocument()
*/
public IDocument createDocument() {
return new PartiallySynchronizedDocument();
}
}

View file

@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - Fixed bug 141295
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor;
@ -17,8 +18,6 @@ import org.eclipse.cdt.make.core.makefile.IMakefile;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.editors.text.ForwardingDocumentProvider;
@ -145,15 +144,4 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
disconnect(e.next());
}
private void setUpSynchronization(MakefileFileInfo antInfo) {
IDocument document= antInfo.fTextFileBuffer.getDocument();
IAnnotationModel model= antInfo.fModel;
if (document instanceof ISynchronizable && model instanceof ISynchronizable) {
Object lock= ((ISynchronizable) document).getLockObject();
((ISynchronizable) model).setLockObject(lock);
}
}
}

View file

@ -1,97 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.ISynchronizable;
/**
* PartiallySynchronizedDocument
* Document that can also be used by a background reconciler.
*/
public class PartiallySynchronizedDocument extends Document implements ISynchronizable {
private final Object fInternalLockObject= new Object();
private Object fLockObject;
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocumentExtension#startSequentialRewrite(boolean)
*/
synchronized public void startSequentialRewrite(boolean normalized) {
super.startSequentialRewrite(normalized);
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocumentExtension#stopSequentialRewrite()
*/
synchronized public void stopSequentialRewrite() {
super.stopSequentialRewrite();
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocument#get()
*/
synchronized public String get() {
return super.get();
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocument#get(int, int)
*/
synchronized public String get(int offset, int length) throws BadLocationException {
return super.get(offset, length);
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocument#getChar(int)
*/
synchronized public char getChar(int offset) throws BadLocationException {
return super.getChar(offset);
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
*/
synchronized public void replace(int offset, int length, String text) throws BadLocationException {
super.replace(offset, length, text);
//TODO to be used for incremental parsing...not for 3.0
// if (length == 0 && text != null) {
// // Insert
// } else if (text == null || text.length() == 0) {
// // Remove
// } else {
// fAntModel.setReplaceHasOccurred();
// }
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.IDocument#set(java.lang.String)
*/
synchronized public void set(String text) {
super.set(text);
}
/*
* @see org.eclipse.jface.text.ISynchronizable#setLockObject(java.lang.Object)
*/
public void setLockObject(Object lockObject) {
fLockObject= lockObject;
}
/*
* @see org.eclipse.jface.text.ISynchronizable#getLockObject()
*/
public Object getLockObject() {
return fLockObject == null ? fInternalLockObject : fLockObject;
}
}

View file

@ -477,31 +477,6 @@
contentTypeId="org.eclipse.cdt.core.asmSource">
</participant>
</extension>
<extension
id="org.eclipse.cdt.ui.CDocumentFactory"
name="%cDocumentFactory"
point="org.eclipse.core.filebuffers.documentCreation">
<factory
class="org.eclipse.cdt.internal.ui.editor.CDocumentFactory"
contentTypeId="org.eclipse.cdt.core.cSource">
</factory>
<factory
class="org.eclipse.cdt.internal.ui.editor.CDocumentFactory"
contentTypeId="org.eclipse.cdt.core.cHeader">
</factory>
<factory
class="org.eclipse.cdt.internal.ui.editor.CDocumentFactory"
contentTypeId="org.eclipse.cdt.core.cxxSource">
</factory>
<factory
class="org.eclipse.cdt.internal.ui.editor.CDocumentFactory"
contentTypeId="org.eclipse.cdt.core.cxxHeader">
</factory>
<factory
class="org.eclipse.cdt.internal.ui.editor.CDocumentFactory"
contentTypeId="org.eclipse.cdt.core.asmSource">
</factory>
</extension>
<extension
id="org.eclipse.cdt.ui.ceditor"
point="org.eclipse.ui.editors">

View file

@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
import org.eclipse.core.filebuffers.IDocumentFactory;
import org.eclipse.jface.text.IDocument;
/**
* CDocumentFactory
*/
public class CDocumentFactory implements IDocumentFactory {
/**
*
*/
public CDocumentFactory() {
}
/*
* @see org.eclipse.core.filebuffers.IDocumentFactory#createDocument()
*/
public IDocument createDocument() {
return new PartiallySynchronizedDocument();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2005 QNX Software Systems and others.
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - Fixed bug 141295
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
@ -38,7 +39,6 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultLineTracker;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ILineTracker;
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModelEvent;
@ -868,15 +868,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
return tuInfo;
}
private void setUpSynchronization(TranslationUnitInfo cuInfo) {
IDocument document = cuInfo.fTextFileBuffer.getDocument();
IAnnotationModel model = cuInfo.fModel;
if (document instanceof ISynchronizable && model instanceof ISynchronizable) {
Object lock = ((ISynchronizable) document).getLockObject();
((ISynchronizable) model).setLockObject(lock);
}
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object,
* org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)

View file

@ -1,132 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.jface.text.Position;
/**
* Document that can also be used by a background reconciler.
*/
public class PartiallySynchronizedDocument extends Document implements ISynchronizable {
private final Object fInternalLockObject= new Object();
private Object fLockObject;
/*
* @see org.eclipse.jface.text.ISynchronizable#setLockObject(java.lang.Object)
*/
public void setLockObject(Object lockObject) {
fLockObject= lockObject;
}
/*
* @see org.eclipse.jface.text.ISynchronizable#getLockObject()
*/
public Object getLockObject() {
return fLockObject == null ? fInternalLockObject : fLockObject;
}
/*
* @see IDocumentExtension#startSequentialRewrite(boolean)
*/
public void startSequentialRewrite(boolean normalized) {
synchronized (getLockObject()) {
super.startSequentialRewrite(normalized);
}
}
/*
* @see IDocumentExtension#stopSequentialRewrite()
*/
public void stopSequentialRewrite() {
synchronized (getLockObject()) {
super.stopSequentialRewrite();
}
}
/*
* @see IDocument#get()
*/
public String get() {
synchronized (getLockObject()) {
return super.get();
}
}
/*
* @see IDocument#get(int, int)
*/
public String get(int offset, int length) throws BadLocationException {
synchronized (getLockObject()) {
return super.get(offset, length);
}
}
/*
* @see IDocument#getChar(int)
*/
public char getChar(int offset) throws BadLocationException {
synchronized (getLockObject()) {
return super.getChar(offset);
}
}
/*
* @see IDocument#replace(int, int, String)
*/
public void replace(int offset, int length, String text) throws BadLocationException {
synchronized (getLockObject()) {
super.replace(offset, length, text);
}
}
/*
* @see IDocument#set(String)
*/
public void set(String text) {
synchronized (getLockObject()) {
super.set(text);
}
}
/*
* @see org.eclipse.jface.text.AbstractDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
*/
public void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException {
synchronized (getLockObject()) {
super.addPosition(category, position);
}
}
/*
* @see org.eclipse.jface.text.AbstractDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
*/
public void removePosition(String category, Position position) throws BadPositionCategoryException {
synchronized (getLockObject()) {
super.removePosition(category, position);
}
}
/*
* @see org.eclipse.jface.text.AbstractDocument#getPositions(java.lang.String)
*/
public Position[] getPositions(String category) throws BadPositionCategoryException {
synchronized (getLockObject()) {
return super.getPositions(category);
}
}
}