Package org.eclipse.ui.dialogs

Examples of org.eclipse.ui.dialogs.ContainerSelectionDialog


        browseButton.setText("Browse...");
        browseButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                final IProject project = getProject();
                ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), project, false, null);
                dialog.showClosedProjects(false);
                dialog.setValidator(new ISelectionValidator() {

                    @Override
                    public String isValid(Object selection) {

                        if (!(selection instanceof IPath)) {
                            return null;
                        }

                        IPath path = (IPath) selection;
                        if (project.getFullPath().isPrefixOf(path)) {
                            return null;
                        }

                        return "The folder must be contained in the " + project.getName() + " project";
                    }
                });

                dialog.open();

                Object[] results = dialog.getResult();
                if (results == null) {
                    return;
                }

                IPath selectedPath = (IPath) results[0];
View Full Code Here


    determinePageCompletion();
  }

    protected IPath queryForLocation(IProject initialSelection, String msg,
            String title) {
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(
                getControl().getShell(), initialSelection,
                allowNewContainerName(), msg);
        if (title != null) {
      dialog.setTitle(title);
    }
        dialog.showClosedProjects(false);
        dialog.setValidator(new ISelectionValidator() {
     
      @Override
      public String isValid(Object selection) {
        if (!(selection instanceof IPath)) {
                    return "Please select a valid import location";
        }
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
                IContainer container = (IContainer) root.findMember((IPath) selection);
        if (container instanceof IProject) {
          return "Please select a folder inside the project";
        }
       
                if (!ProjectHelper.isContentProject(container.getProject())) {
                    return "Project " + container.getProject().getName() + " is not a content project";
                }

        if ( ! ProjectUtil.isInsideContentSyncRoot(container) ) {
                    return "Please select a folder inside the content sync root folder "
                            + ProjectUtil.getSyncDirectory(container.getProject()).getProjectRelativePath();
        }
       
                return null;
      }
    });
        dialog.open();
        Object[] result = dialog.getResult();
        if (result != null && result.length == 1) {
            return (IPath) result[0];
        }
        return null;
    }
View Full Code Here

        IContainer currentContainer = getContainer();
        if (currentContainer == null)
        {
            currentContainer = ResourcesPlugin.getWorkspace().getRoot();
        }
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(
            getShell(), currentContainer, false,
            "Select a &workspace relative working directory:"); //$NON-NLS-1$
        dialog.showClosedProjects(false);
        dialog.open();
        Object[] results = dialog.getResult();
        if ((results != null) && (results.length > 0)
            && (results[0] instanceof IPath))
        {
            IPath path = (IPath) results[0];
            String containerName = path.makeRelative().toString();
View Full Code Here

   * Uses the standard container selection dialog to choose the new value for
   * the container field.
   */

  protected void handleBrowse() {
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(
        getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
        "Select new file container");
    if (dialog.open() == ContainerSelectionDialog.OK) {
      Object[] result = dialog.getResult();
      if (result.length == 1) {
        containerText.setText(((Path) result[0]).toString());
      }
    }
  }
View Full Code Here

    /**
     * Uses the standard container selection dialog to choose the new value for
     * the container field.
     */
    void handleBrowse() {
        final ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
                ResourcesPlugin.getWorkspace().getRoot(), false,
                "Select new file container");
        if (dialog.open() == Window.OK) {
            final Object[] result = dialog.getResult();
            if (result.length == 1) {
                containerText.setText(((Path) result[0]).toString());
            }
        }
    }
View Full Code Here

    /**
     * Uses the standard container selection dialog to choose the new value for the container field.
     */

    private void handleBrowse() {
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin
                .getWorkspace().getRoot(), false, "Select new file container");
        if (dialog.open() == ContainerSelectionDialog.OK) {
            Object[] result = dialog.getResult();
            if (result.length == 1) {
                containerText.setText(((Path) result[0]).toString());
            }
        }
    }
View Full Code Here

        outputFolderTextBox.setText(returnString);
      }
    } else {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
     
      ContainerSelectionDialog dialog = new ContainerSelectionDialog(
          getShell(),
          root,
          false,
          CodegenWizardPlugin
              .getResourceString("page3.containerbox.title"));
      if (dialog.open() == ContainerSelectionDialog.OK) {
        Object[] result = dialog.getResult();
        if (result.length == 1) {
          Path path = ((Path) result[0]);
          // append to the workspace path
          if (root.exists(path)) {
            outputFolderTextBox.setText(root.getLocation().append(path)
View Full Code Here

        outputLocation.setText(returnString);
      }
    } else {
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
     
      ContainerSelectionDialog dialog = new ContainerSelectionDialog(
          getShell(),
          root,
          false,
          CodegenWizardPlugin
              .getResourceString("page3.containerbox.title"));
      if (dialog.open() == ContainerSelectionDialog.OK) {
        Object[] result = dialog.getResult();
        if (result.length == 1) {
          Path path = ((Path) result[0]);
          // append to the workspace path
          if (root.exists(path)) {
            outputLocation.setText(root.getLocation().append(path)
View Full Code Here

    /**
     * Uses the standard container selection dialog to choose the new value for the container field.
     */

    private void handleBrowse() {
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin
                .getWorkspace().getRoot(), false, "Select new file container");
        if (dialog.open() == ContainerSelectionDialog.OK) {
            Object[] result = dialog.getResult();
            if (result.length == 1) {
                containerText.setText(((Path) result[0]).toString());
            }
        }
    }
View Full Code Here

    browseOutputFolderButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
     // TODO: Only select elements within project
        String currentContainerString = outputFolderText.getText();
        IContainer currentContainer = getContainer(currentContainerString);
        ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
                currentContainer, false, "Select output folder");
        dialog.showClosedProjects(false);
        dialog.open();
        Object[] results = dialog.getResult();
        if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
          IPath path = (IPath) results[0];
          String containerName = path.toOSString();
          outputFolderText.setText(containerName);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.dialogs.ContainerSelectionDialog

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.