Examples of IDocument


Examples of org.eclipse.jface.text.IDocument

    this.parser.setSource(cu);
    CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
    ASTNode node = ((JavaElement) elementToRemove).findNode(astCU);
    if (node == null)
      Assert.isTrue(false, "Failed to locate " + elementToRemove.getElementName() + " in " + cu.getElementName()); //$NON-NLS-1$//$NON-NLS-2$
    IDocument document = getDocument(cu);
    AST ast = astCU.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
    rewriter.remove(node, null);
     TextEdit edits = rewriter.rewriteAST(document, null);
     try {
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

            this.parser.setSource(cu);
            CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
            AST ast = astCU.getAST();
            ASTRewrite rewrite = ASTRewrite.create(ast);
            updatePackageStatement(astCU, newFragName, rewrite);
            IDocument document = getDocument(cu);
            TextEdit edits = rewrite.rewriteAST(document, null);
            try {
              edits.apply(document);
            } catch (BadLocationException e) {
              throw new JavaModelException(e, IJavaModelStatusConstants.INVALID_CONTENTS);
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

    // when the file was copied, its read-only flag was preserved -> temporary set it to false
    // note this doesn't interfer with repository providers as this is a new resource that cannot be under
    // version control yet
    Util.setReadOnly(destFile, false);
    ICompilationUnit destCU = dest.getCompilationUnit(destName);
    IDocument document = getDocument(destCU);
    TextEdit edits = rewrite.rewriteAST(document, null);
    try {
      edits.apply(document);
    } catch (BadLocationException e) {
      throw new JavaModelException(e, IJavaModelStatusConstants.INVALID_CONTENTS);
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

  protected void generateNewCompilationUnitAST(ICompilationUnit cu) throws JavaModelException {
    this.cuAST = parse(cu);
   
    AST ast = this.cuAST.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
    IDocument document = getDocument(cu);
    ASTNode child = generateElementAST(rewriter, document, cu);
    if (child != null) {
      ASTNode parent = ((JavaElement) getParentElement()).findNode(this.cuAST);
      if (parent == null)
        parent = this.cuAST;
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

     * {@inheritDoc}
     */
    public ICompletionProposal[] computeCompletionProposals( IContentAssistSubjectControl contentAssistSubjectControl,
        int documentOffset )
    {
        IDocument document = contentAssistSubjectControl.getDocument();
        String text = document.get();

        // search start of current attribute type
        int start = 0;
        for ( int i = documentOffset - 1; i >= 0; i-- )
        {
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

    public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext context) {
        List<ICompletionProposal> proposals = new LinkedList<ICompletionProposal>();

        ISourceViewer viewer = context.getSourceViewer();
        IDocument document = viewer.getDocument();
        IAnnotationModel model = viewer.getAnnotationModel();

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

            return;

        ITextEditor sourcePage = editor.getSourcePage();
        if (sourcePage == null)
            return;
        IDocument document = sourcePage.getDocumentProvider().getDocument(getEditorInput());

        String type = marker.getAttribute("$bndType", (String) null);
        if (type == null)
            return;
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

                resourceName = input.getName();
            }
        }

        final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
        IDocument document = docProvider.getDocument(input);
        try {
            model.loadFrom(new IDocumentWrapper(document));
            model.setBndResourceName(resourceName);

            if (resource != null) {
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

        }
        // File content updated externally => reload all pages
        else if ((delta.getKind() & IResourceDelta.CHANGED) > 0 && (delta.getFlags() & IResourceDelta.CONTENT) > 0) {
            if (!saving.get()) {
                final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
                final IDocument document = docProvider.getDocument(getEditorInput());
                SWTConcurrencyUtil.execForControl(getEditorSite().getShell(), true, new Runnable() {
                    public void run() {
                        try {
                            model.loadFrom(new IDocumentWrapper(document));
                            updatePages();
View Full Code Here

Examples of org.eclipse.jface.text.IDocument

    @Override
    public void run() {
        if (mainEditor != null && switchToPageId != null)
            mainEditor.setActivePage(switchToPageId);

        IDocument document = textEditor.getDocumentProvider().getDocument(mainEditor.getEditorInput());
        proposal.apply(document);

        Point selection = proposal.getSelection(document);
        if (selection != null)
            textEditor.selectAndReveal(selection.x, 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.