Examples of FolderSelectionDialog


Examples of org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog

    ITreeContentProvider cp = new WorkbenchContentProvider();

    Class<?>[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
    ViewerFilter filter = new TypedViewerFilter( acceptedClasses );

    FolderSelectionDialog dialog = new FolderSelectionDialog( parent, lp, cp );
    dialog.setTitle( "Output directory" );
    dialog.setMessage( "Select output directory" );
    dialog.addFilter( filter );
    dialog.setInput( ResourcesPlugin.getWorkspace().getRoot() );
    if ( dialog.open() == Window.OK ) {
      IContainer c = (IContainer) dialog.getFirstResult();
      if ( c.getProject() == ( (IFileEditorInput) getEditorInput() ).getFile().getProject() ) {
        return "${project}/" + c.getProjectRelativePath().toString();
      }
      else {
        return "${workspace}/" + c.getProject().getName() + "/" + c.getProjectRelativePath().toString();
View Full Code Here

Examples of org.erlide.ui.util.FolderSelectionDialog

        IResource initSelection = null;
        if (outputLocation != null) {
            initSelection = root.findMember(outputLocation);
        }

        final FolderSelectionDialog dialog = new FolderSelectionDialog(shell, lp, cp);
        dialog.setTitle(dialogTitle);

        final ISelectionStatusValidator validator = new ISelectionStatusValidator() {
            ISelectionStatusValidator myValidator = new TypedElementSelectionValidator(
                    acceptedClasses, false);

            @Override
            public IStatus validate(final Object[] selection) {
                final IStatus typedStatus = myValidator.validate(selection);
                if (!typedStatus.isOK()) {
                    return typedStatus;
                }
                if (selection[0] instanceof IFolder) {
                    // try {
                    // IStatus result = ClasspathModifier
                    // .checkSetOutputLocationPrecondition(
                    // fEntryToEdit, folder.getFullPath(),
                    // fAllowInvalidClasspath, fCPJavaProject);
                    // if (result.getSeverity() == IStatus.ERROR) {
                    // return result;
                    // }
                    // } catch (CoreException e) {
                    // JavaPlugin.log(e);
                    // }
                    return new StatusInfo();
                }
                return new StatusInfo(IStatus.ERROR, "");
            }
        };
        dialog.setValidator(validator);
        dialog.setMessage(labelText);
        dialog.addFilter(filter);
        dialog.setInput(root);
        dialog.setInitialSelection(initSelection);
        dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));

        if (dialog.open() == Window.OK) {
            return (IContainer) dialog.getFirstResult();
        }
        return null;
    }
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.