mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Make sure to attach a document partitioner
This commit is contained in:
parent
2b27259c0f
commit
285675fc89
1 changed files with 14 additions and 0 deletions
|
@ -28,6 +28,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.DefaultLineTracker;
|
import org.eclipse.jface.text.DefaultLineTracker;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.jface.text.IDocumentExtension3;
|
||||||
import org.eclipse.jface.text.ILineTracker;
|
import org.eclipse.jface.text.ILineTracker;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
import org.eclipse.jface.text.TextUtilities;
|
import org.eclipse.jface.text.TextUtilities;
|
||||||
|
@ -794,6 +795,19 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener);
|
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#connect(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void connect(Object element) throws CoreException {
|
||||||
|
super.connect(element);
|
||||||
|
IDocument document= getDocument(element);
|
||||||
|
if (document instanceof IDocumentExtension3) {
|
||||||
|
IDocumentExtension3 extension= (IDocumentExtension3) document;
|
||||||
|
if (extension.getDocumentPartitioner(ICPartitions.C_PARTITIONING) == null)
|
||||||
|
new CDocumentSetupParticipant().setup(document);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a translation unit from the given file.
|
* Creates a translation unit from the given file.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue