Package org.python.pydev.editor.actions

Examples of org.python.pydev.editor.actions.PyOpenAction


                        IDefinition[] definitions = mod.findDefinition(CompletionStateFactory.getEmptyCompletionState(
                                tok.toString(), nature, new CompletionCache()), -1, -1, nature);
                        List<ItemPointer> pointers = new ArrayList<ItemPointer>();
                        PyRefactoringFindDefinition.getAsPointers(pointers, (Definition[]) definitions);
                        if (pointers.size() > 0) {
                            new PyOpenAction().run(pointers.get(0));
                        }
                    } catch (Exception e) {
                        Log.log(e);
                    }
                }
View Full Code Here


                            String start = "<pydev_link pointer=\"";
                            String end = "\">";
                            if (tagReplaced.startsWith(start) && tagReplaced.endsWith(end)) {
                                String pointer = tagReplaced.substring(start.length(),
                                        tagReplaced.length() - end.length());
                                new PyOpenAction().run(ItemPointer.fromPortableString(pointer));
                            }
                        }
                    }
                }
            });
View Full Code Here

        return null;
    }

    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);
View Full Code Here

        File f = (File) itemPointer.file;
        String filename = f.getName();
        if (PythonPathHelper.isValidSourceFile(filename) || filename.indexOf('.') == -1 || //treating files without any extension!
                (itemPointer.zipFilePath != null && PythonPathHelper.isValidSourceFile(itemPointer.zipFilePath))) {

            final PyOpenAction openAction = (PyOpenAction) pyEdit.getAction(PyEdit.ACTION_OPEN);

            openAction.run(itemPointer);
        } else if (itemPointer.definition instanceof JavaDefinition) {
            //note that it will only be able to find a java definition if JDT is actually available
            //so, we don't have to care about JDTNotAvailableExceptions here.
            JavaDefinition javaDefinition = (JavaDefinition) itemPointer.definition;
            OpenAction openAction = new OpenAction(pyEdit.getSite());
            StructuredSelection selection = new StructuredSelection(new Object[] { javaDefinition.javaElement });
            openAction.run(selection);
        } else {
            String message;
            if (itemPointer.definition != null && itemPointer.definition.module instanceof AbstractJavaClassModule) {
                AbstractJavaClassModule module = (AbstractJavaClassModule) itemPointer.definition.module;
                message = "The definition was found at: " + f.toString() + "\n" + "as the java module: "
View Full Code Here

                Log.log(e);
            }
        }

        //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);
View Full Code Here

                TreeItem[] selection = treeMembers.getSelection();
                if (selection.length > 0) {
                    Object data = selection[0].getData();
                    ItemPointer p = (ItemPointer) data;
                    if (p != null) {
                        new PyOpenAction().run(p);
                    }
                }
            }
        });
View Full Code Here

        if (clickCount == 2) {
            if (model != null) {
                IModule m = model.module;
                if (m != null && model.ast != null) {
                    ItemPointer pointer = new ItemPointer(m.getFile(), model.ast.name);
                    new PyOpenAction().run(pointer);
                }
            }
        } else {

            Runnable r = new Runnable() {
View Full Code Here

                TreeNode<OutlineEntry> n = (TreeNode<OutlineEntry>) result[0];
                OutlineEntry outlineEntry = n.data;
                if (outlineEntry.model == null) {
                    Location location = new Location(NodeUtils.getNameLineDefinition(outlineEntry.node) - 1,
                            NodeUtils.getNameColDefinition(outlineEntry.node) - 1);
                    new PyOpenAction().showInEditor(pyEdit, location, location);
                } else {
                    PyOpenAction pyOpenAction = new PyOpenAction();
                    IModule m = outlineEntry.model.module;
                    if (m instanceof SourceModule) {
                        SourceModule sourceModule = (SourceModule) m;
                        File file = sourceModule.getFile();
                        if (file != null) {
                            ItemPointer p = new ItemPointer(file, outlineEntry.node);
                            pyOpenAction.run(p);
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.actions.PyOpenAction

Copyright © 2018 www.massapicom. 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.