Examples of PyEdit


Examples of org.python.pydev.editor.PyEdit

    public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
        //Upon creation, opens the new editor and creates the class.
        PyOpenAction openAction = new PyOpenAction();
        openAction.run(new ItemPointer(module));
        PyEdit pyEdit = (PyEdit) openAction.editor;
        TddRefactorCompletion completion = new TddRefactorCompletion(fReplacementString, fImage, fDisplayString,
                fContextInformation, fAdditionalProposalInfo, 0, pyEdit, locationStrategy, parametersAfterCall,
                pyCreateAction, ps);
        completion.apply(pyEdit.getEditorSourceViewer(), '\n', 0, 0);

        //As the change was done in another module, let's ask for a new code analysis for the current editor,
        //as the new contents should fix the marker which we used for the fix.
        forceReparseInBaseEditorAnd(pyEdit);
    }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

        IEditorPart[] dirtyEditors = workbenchWindow.getActivePage().getDirtyEditors();
        Set<PyEdit> askReparse = new HashSet<PyEdit>();
        for (IEditorPart iEditorPart : dirtyEditors) {
            if (iEditorPart instanceof PyEdit) {
                PyEdit pyEdit = (PyEdit) iEditorPart;
                long astModificationTimeStamp = pyEdit.getAstModificationTimeStamp();
                IDocument doc = pyEdit.getDocument();
                if (astModificationTimeStamp != -1
                        && astModificationTimeStamp == (((IDocumentExtension4) doc).getModificationStamp())) {
                    //All OK, the ast is synched!
                } else {
                    askReparse.add(pyEdit);
                }
            }
        }

        if (askReparse.size() == 0) {
            findDefinitionsAndOpen(true);
        } else {
            //We don't have a match: ask for a reparse
            Object lock = new Object();
            for (PyEdit pyEdit : askReparse) {
                IParserObserver observer = new FindParserObserver(pyEdit, askReparse, lock);
                PyParser parser = pyEdit.getParser();
                parser.addParseListener(observer); //it will analyze when the next parse is finished
                parser.forceReparse();
            }
        }
    }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

    public ItemPointer[] findDefinitionsAndOpen(boolean doOpenDefinition) {
        request = null;

        ps = new PySelection(getTextEditor());
        final PyEdit pyEdit = getPyEdit();
        RefactoringRequest refactoringRequest;
        try {
            refactoringRequest = getRefactoringRequest();
        } catch (MisconfigurationException e1) {
            Log.log(e1);
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

        //Upon creation, opens the new editor and creates the class.
        PyOpenAction openAction = new PyOpenAction();
        openAction.run(new ItemPointer(file));

        PyEdit pyEdit = (PyEdit) openAction.editor;
        TddRefactorCompletion completion = new TddRefactorCompletion(fReplacementString, fImage, fDisplayString,
                fContextInformation, fAdditionalProposalInfo, 0, pyEdit, PyCreateClass.LOCATION_STRATEGY_END,
                parametersAfterCall, pyCreateAction, ps);
        completion.apply(pyEdit.getEditorSourceViewer(), '\n', 0, 0);

        //As the change was done in another module, let's ask for a new code analysis for the current editor,
        //as the new contents should fix the marker which we used for the fix.
        forceReparseInBaseEditorAnd(pyEdit);
    }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

        final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench();
        Display display = workBench.getDisplay();

        // Make sure to run the UI thread.
        final PyEdit modCovEditor = (PyEdit) PyOpenEditor.doOpenEditor(modCov);
        try {
            display.syncExec(new Runnable() {
                public void run() {
                    LaunchShortcut launchShortcut = new LaunchShortcut();
                    launchShortcut.launch(modCovEditor, "run");
                }
            });

            final String modCovCoverageText = StringUtils.replaceNewLines(getModCovCoverageText(), "\n");
            //Should be enough time for the refresh to happen!
            goToManual(10000, new ICallback<Boolean, Object>() {

                public Boolean call(Object arg) {
                    return modCovCoverageText.equals(StringUtils.replaceNewLines(view.getCoverageText(), "\n"));
                }
            });

            TestCaseUtils.assertContentsEqual(modCovCoverageText, view.getCoverageText());

            //goToManual();
        } finally {
            try {
                modCovEditor.close(false);
            } catch (Exception e) {
                //ignore anything here
            }
        }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

    /**
     * When called, it STOPS hearing notifications to update the outline when the cursor changes positions.
     */
    public void unlink() {
        PyEdit edit = pyEdit.get();
        if (edit != null) {
            edit.removePyeditListener(this);
        }
    }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

    /**
     * When called, it STARTS hearing notifications to update the outline when the cursor changes positions.
     */
    public void relink() {
        PyEdit edit = pyEdit.get();
        if (edit != null) {
            edit.addPyeditListener(this);
        }
    }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

    protected void setActionEnabled(boolean enableAction) {
        PyOutlinePage p = this.page.get();
        if (p != null) {
            p.getStore().setValue(PREF_LINK_WITH_EDITOR, enableAction);
            if (enableAction && pyEdit != null) {
                PyEdit edit = pyEdit.get();
                if (edit != null) {
                    handleCursorPositionChanged(edit, new PySelection(edit));
                }
            }
        }
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

            return Status.OK_STATUS;
        }
        lastRequestTime = currRequestTime;

        try {
            final PyEdit pyEdit = editor.get();

            if (pyEdit == null || monitor.isCanceled()) {
                return Status.OK_STATUS;
            }
            try {
                IDocumentProvider documentProvider = pyEdit.getDocumentProvider();
                if (documentProvider == null || monitor.isCanceled()) {
                    return Status.OK_STATUS;
                }

                IAnnotationModel annotationModel = documentProvider.getAnnotationModel(pyEdit.getEditorInput());
                if (annotationModel == null || monitor.isCanceled()) {
                    return Status.OK_STATUS;
                }

                Tuple3<RefactoringRequest, PyRenameEntryPoint, Boolean> ret = checkAnnotations(pyEdit,
                        documentProvider, monitor);
                if (pyEdit.cache == null || monitor.isCanceled()) { //disposed (cannot add or remove annotations)
                    return Status.OK_STATUS;
                }

                PySourceViewer viewer = pyEdit.getPySourceViewer();
                if (viewer == null || monitor.isCanceled()) {
                    return Status.OK_STATUS;
                }
                if (viewer.getIsInToggleCompletionStyle() || monitor.isCanceled()) {
                    return Status.OK_STATUS;
                }

                if (ret.o3) {
                    if (!addAnnotations(pyEdit, annotationModel, ret.o1, ret.o2)) {
                        //something went wrong, so, let's remove the occurrences
                        removeOccurenceAnnotations(annotationModel, pyEdit);
                    }
                } else {
                    removeOccurenceAnnotations(annotationModel, pyEdit);
                }
            } catch (OperationCanceledException e) {
                throw e;//rethrow this error...
            } catch (AssertionFailedException e) {
                String message = e.getMessage();
                if (message != null && message.indexOf("The file:") != -1 && message.indexOf("does not exist.") != -1) {
                    //don't even report it (the file was probably removed while we were doing the analysis)
                } else {
                    Log.log(e);
                    Log.log("Error while analyzing the file:" + pyEdit.getIFile());
                }
            } catch (Throwable initialE) {
                //Totally ignore this one
                //                Throwable e = initialE;
                //                int i = 0;
View Full Code Here

Examples of org.python.pydev.editor.PyEdit

import com.aptana.shared_core.structure.Tuple;

public class PySelectWord extends PyAction {

    public void run(IAction action) {
        PyEdit pyEdit = getPyEdit();
        PySelection ps = new PySelection(pyEdit);
        try {
            Tuple<String, Integer> currToken = ps.getCurrToken();
            if (currToken.o1 != null) {
                int len = currToken.o1.length();
                if (len > 0) {
                    pyEdit.selectAndReveal(currToken.o2, len);
                }
            }
        } catch (Exception e) {
            Log.log(e);
        }
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.