Package org.eclipse.ui.dialogs

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator


    /**
     * Creates a special validator that considers that items may be gotten from what's filtered (not only actually selected).
     */
    private ISelectionStatusValidator createValidator() {
        return new ISelectionStatusValidator() {

            public IStatus validate(Object[] selection) {
                if (selection != null && selection.length == 1) {
                    return new Status(IStatus.OK, PydevPlugin.getPluginID(), getEntry(selection[0].toString()));
                }
View Full Code Here


        this.setInput(project);
        this.setTitle(title);
        this.setMessage(message);

        // Do not allow folders to be selected
        this.setValidator(new ISelectionStatusValidator() {
            public IStatus validate(Object selection[]) {
                if (selection.length == 1) {
                    if (selection[0] instanceof IFile) {
                        IFile file = (IFile) selection[0];
                        return new Status(IStatus.OK, PydevPlugin.getPluginID(), IStatus.OK, "Module  "
View Full Code Here

    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
        getShell(), provider, treeContentProvider);
    // dialog.setComparator(new JavaElementComparator());
    dialog.setAllowMultiple(false);
    dialog.setValidator(new ISelectionStatusValidator() {
      public IStatus validate(Object[] selection) {
        StatusInfo res = new StatusInfo();
        // only single selection
        if (selection.length == 1
            && (selection[0] instanceof IFile || selection[0] instanceof ISourceModule))
View Full Code Here

  }

  // ---------- util method ------------
  private IContainer chooseContainer() {
    Class[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
    ISelectionStatusValidator validator = new TypedElementSelectionValidator(
        acceptedClasses, false);
    IProject[] allProjects = fWorkspaceRoot.getProjects();
    ArrayList rejectedElements = new ArrayList(allProjects.length);
    IProject currProject = fCurrScriptProject.getProject();
    for (int i = 0; i < allProjects.length; i++) {
View Full Code Here

 
  private void selectProject(){
    IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
   
    // required validator
    ISelectionStatusValidator validator = new ISelectionStatusValidator(){
      private IStatus fgErrorStatus= new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$
      private IStatus fgOKStatus= new StatusInfo();
     
      public IStatus validate(Object[] selection){
        if(selection==null || selection.length != 1){
View Full Code Here

        if(!init.exists()){
          init = null;
        }
      }
      Class[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
      ISelectionStatusValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
      IProject[] allProjects = wsroot.getProjects();
      ArrayList rejectedElements = new ArrayList(allProjects.length);
      for (int i = 0; i < allProjects.length; i++) {
        if (!allProjects[i].equals(currProject)) {
          rejectedElements.add(allProjects[i]);
View Full Code Here

  }
 
  private void selectSourceFolder() {
    try {
      Class[] acceptedClasses = new Class[] { IJavaModel.class, IJavaProject.class, IPackageFragmentRoot.class };
      ISelectionStatusValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
     
      IPackageFragmentRoot init = null;
      IJavaProject project = JavaCore.create(getProject());
     
      IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
View Full Code Here

            String path = null;
            if (project != null && project.getProject().getLocation() != null) {
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display
                        .getDefault().getActiveShell(), new WorkbenchLabelProvider(),
                        new WorkbenchContentProvider());
                dialog.setValidator(new ISelectionStatusValidator() {
                    private final IStatus errorStatus = new Status(IStatus.ERROR, IvyPlugin.ID, 0,
                            "", null);

                    public IStatus validate(Object[] selection) {
                        if (selection.length == 0) {
View Full Code Here

    return false;
  }

  private void handleBrowseAction() {
    Class[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
    ISelectionStatusValidator validator = new ISelectionStatusValidator() {
        public IStatus validate(Object[] selection) {
          if ((null == selection) || (selection.length == 0)) {
            return new StatusInfo(IStatus.ERROR, "empty selection is not allowed");
          }
View Full Code Here

        final ElementTreeSelectionDialog dlg = new ElementTreeSelectionDialog(null, new ShowViewDialogLabelProvider(), new ShowViewDialogTreeContentProvider());
        dlg.setTitle(Messages.ViewShare_VIEWSHARE_VIEW_REQUEST_DIALOG_TITLE);
        dlg.setMessage(Messages.ViewShare_VIEWSHARE_VIEW_REQUEST_DIALOG_MESSAGE);
        dlg.addFilter(new ShowViewDialogViewerFilter());
        dlg.setComparator(new ViewerComparator());
        dlg.setValidator(new ISelectionStatusValidator() {
          public IStatus validate(Object[] selection) {
            for (int i = 0; i < selection.length; ++i)
              if (!(selection[i] instanceof IViewDescriptor))
                return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
View Full Code Here

TOP

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

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.