Examples of ISelectionStatusValidator


Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

            @Override
            public void widgetSelected(SelectionEvent e) {
                // IResource newFile = ResourcesPlugin.getWorkspace().getRoot();
                // if(newFile != null) {
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
                dialog.setValidator(new ISelectionStatusValidator() {
                    public IStatus validate(Object[] selection) {
                        if (selection.length > 0 && selection[0] instanceof IFile) {
                            return new Status(IStatus.OK, Plugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
                        }
                        return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.ERROR, "", null); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

        folderSelectionDialog.setInput(ResourcesPlugin.getWorkspace().getRoot());

        folderSelectionDialog.setTitle("Choose folder");
        folderSelectionDialog.setMessage("Please choose a folder.");

        folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
          public IStatus validate(Object[] selection) {

            if (selection.length == 1) {
             
              Object selectedElement = selection[0];
View Full Code Here

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

      if (containers != null && containers.length > 0) {
        container = containers[0];
      }
    }
    dialog.setInitialSelection(container);
    dialog.setValidator(new ISelectionStatusValidator() {
      @Override public IStatus validate(Object[] selection) {
        if (selection != null && selection.length > 0 && selection[0] instanceof IFile) {
          return error(errorElementIsNotDirectory);
        }
        return OK_STATUS;
View Full Code Here

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

     *
     * @return The ISelectionStatusValidator that validates the
     * selection dialog.
     */
    private ISelectionStatusValidator createSelectionStatusValidator() {
        return new ISelectionStatusValidator() {
            public IStatus validate(Object[] objects) {
                if (objects == null || objects.length == 0) {
                    return INVALID_SELECTION;
                } else if (!(objects[0] instanceof IFile)) {
                    return INVALID_SELECTION;
View Full Code Here

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

     *
     * @return The ISelectionStatusValidator that validates the
     * selection dialog.
     */
    private ISelectionStatusValidator createSelectionStatusValidator() {
        return new ISelectionStatusValidator() {
            public IStatus validate(Object[] objects) {
                if (objects == null || objects.length == 0) {
                    return INVALID_SELECTION;
                } else if (!(objects[0] instanceof IFile)) {
                    return INVALID_SELECTION;
View Full Code Here

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

  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

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

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

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

  }

  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

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

            String path = null;
            if (project != 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

Examples of org.eclipse.ui.dialogs.ISelectionStatusValidator

            new WorkbenchContentProvider());
       
        dialog.setTitle(HTMLPlugin.getResourceString("JavaScriptPropertyPage.ChooseJavaScript"));
        dialog.setMessage(HTMLPlugin.getResourceString("JavaScriptPropertyPage.ChooseJavaScript.Description"));
        dialog.setInput(wsroot);
        dialog.setValidator(new ISelectionStatusValidator(){
          private IStatus okStatus = new Status(Status.OK, HTMLPlugin.getDefault().getPluginId(), Status.OK, "", null);
          private IStatus ngStatus = new Status(Status.ERROR, HTMLPlugin.getDefault().getPluginId(), Status.ERROR, "", null);
         
          public IStatus validate(Object[] selection) {
            for(int i=0;i<selection.length;i++){
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.