Package org.python.pydev.ui.dialogs

Examples of org.python.pydev.ui.dialogs.SourceFolder


                    try {
                        PythonPackageSelectionDialog dialog = new PythonPackageSelectionDialog(getShell(), false);
                        dialog.open();
                        Object firstResult = dialog.getFirstResult();
                        if (firstResult instanceof SourceFolder) { //it is the default package
                            SourceFolder f = (SourceFolder) firstResult;
                            textPackage.setText("");
                            textSourceFolder.setText(f.folder.getFullPath().toString());

                        }
                        if (firstResult instanceof org.python.pydev.ui.dialogs.Package) {
                            org.python.pydev.ui.dialogs.Package f = (org.python.pydev.ui.dialogs.Package) firstResult;
                            textPackage.setText(f.getPackageName());
                            textSourceFolder.setText(f.sourceFolder.folder.getFullPath().toString());
                        }
                    } catch (Exception e1) {
                        Log.log(e1);
                    }

                }

                public void widgetDefaultSelected(SelectionEvent e) {
                }

            });

        }

        Object element = selection.getFirstElement();

        try {
            if (element instanceof IAdaptable) {
                IAdaptable adaptable = (IAdaptable) element;
                element = adaptable.getAdapter(IFile.class);
                if (element == null) {
                    element = adaptable.getAdapter(IFolder.class);
                }
            }

            if (element instanceof IFile) {
                IFile f = (IFile) element;
                element = f.getParent();
            }

            if (element instanceof IFolder) {
                IFolder f = (IFolder) element;
                String srcPath = getSrcFolderFromFolder(f);
                if (srcPath == null) {
                    return false;
                }
                String complete = f.getFullPath().toString();
                if (complete.startsWith(srcPath)) {
                    complete = complete.substring(srcPath.length()).replace('/', '.');
                    if (complete.startsWith(".")) {
                        complete = complete.substring(1);
                    }
View Full Code Here


                try {
                    PythonPackageSelectionDialog dialog = new PythonPackageSelectionDialog(getShell(), true);
                    dialog.open();
                    Object firstResult = dialog.getFirstResult();
                    if (firstResult instanceof SourceFolder) {
                        SourceFolder f = (SourceFolder) firstResult;
                        textSourceFolder.setText(f.folder.getFullPath().toString());
                    }
                } catch (Exception e1) {
                    Log.log(e1);
                }

            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }

        });

        Object element = selection.getFirstElement();

        try {

            if (element instanceof IAdaptable) {
                IAdaptable adaptable = (IAdaptable) element;
                element = adaptable.getAdapter(IFile.class);
                if (element == null) {
                    element = adaptable.getAdapter(IProject.class);
                }
                if (element == null) {
                    element = adaptable.getAdapter(IFolder.class);
                }
            }

            if (element instanceof IFile) {
                IFile f = (IFile) element;
                element = f.getParent();
            }

            if (element instanceof IProject) {
                IPythonPathNature nature = PythonNature.getPythonPathNature((IProject) element);
                if (nature != null) {
View Full Code Here

TOP

Related Classes of org.python.pydev.ui.dialogs.SourceFolder

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.