|
Lines 1-10
Link Here
|
| 1 |
package $packageName$; |
1 |
package $packageName$; |
| 2 |
|
2 |
|
|
|
3 |
import java.io.FileInputStream; |
| 4 |
import java.io.FileNotFoundException; |
| 5 |
|
| 3 |
import org.eclipse.core.runtime.CoreException; |
6 |
import org.eclipse.core.runtime.CoreException; |
|
|
7 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 4 |
import org.eclipse.jface.text.IDocument; |
8 |
import org.eclipse.jface.text.IDocument; |
| 5 |
import org.eclipse.jface.text.IDocumentPartitioner; |
9 |
import org.eclipse.jface.text.IDocumentPartitioner; |
| 6 |
import org.eclipse.jface.text.rules.DefaultPartitioner; |
10 |
import org.eclipse.jface.text.rules.DefaultPartitioner; |
| 7 |
import org.eclipse.ui.editors.text.FileDocumentProvider; |
11 |
import org.eclipse.ui.editors.text.FileDocumentProvider; |
|
|
12 |
import org.eclipse.ui.internal.editors.text.JavaFileEditorInput; |
| 8 |
|
13 |
|
| 9 |
public class XMLDocumentProvider extends FileDocumentProvider { |
14 |
public class XMLDocumentProvider extends FileDocumentProvider { |
| 10 |
|
15 |
|
|
Lines 21-25
Link Here
|
| 21 |
document.setDocumentPartitioner(partitioner); |
26 |
document.setDocumentPartitioner(partitioner); |
| 22 |
} |
27 |
} |
| 23 |
return document; |
28 |
return document; |
|
|
29 |
} |
| 30 |
|
| 31 |
protected boolean setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) throws CoreException { |
| 32 |
if (editorInput instanceof JavaFileEditorInput) { |
| 33 |
JavaFileEditorInput input = (JavaFileEditorInput) editorInput; |
| 34 |
FileInputStream contentStream = null; |
| 35 |
try { |
| 36 |
contentStream = new FileInputStream(input.getPath(editorInput).toFile()); |
| 37 |
} catch (FileNotFoundException e) { |
| 38 |
e.printStackTrace(); |
| 39 |
} |
| 40 |
setDocumentContent(document, contentStream, encoding); |
| 41 |
} |
| 42 |
return super.setDocumentContent(document, editorInput, encoding); |
| 24 |
} |
43 |
} |
| 25 |
} |
44 |
} |