Package org.eclipse.jface.dialogs

Examples of org.eclipse.jface.dialogs.InputDialog


    composite.setLayout(layout);
   
    addItem.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog input = new InputDialog(getSection().getShell(),
            "Add new custom components package", "Please input packages which includes Tapestry custom components:",
            "", null);
        if (input.open() == Window.OK) {
          String newBundleName = input.getValue().trim();
          List<String> tmp = model.getPackageList();
          if(newBundleName != null && !newBundleName.equals("")&& !tmp.contains(newBundleName)){
            List<String> added = new LinkedList<String>();
            model.addPackageByPath(newBundleName);
            added.add(newBundleName);
           
            // Update the model and view
            if(!added.isEmpty()) {
              viewer.add(added.toArray(new String[added.size()]));
              markDirty();
            }
          } 
        }
      }
    });
    removeItem.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        boolean b = MessageDialog.openQuestion(getSection().getShell(), "Delete Confirm", "Are you confirm to delete this package?");
            if(b){
              IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            if(!selection.isEmpty()) {
              Iterator<?> elements = selection.iterator();
              List<Object> removed = new LinkedList<Object>();
              while(elements.hasNext()) {
                Object pkg = elements.next();
                model.removePackageByPath(pkg.toString());
                removed.add(pkg);
              }

              if(!removed.isEmpty()) {
                viewer.remove(removed.toArray(new String[removed.size()]));
                markDirty();
              }
            }
            }
      }
    });
    collectItem.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        IEditorPart editorPart = Workbench.getInstance()
            .getActiveWorkbenchWindow().getActivePage().getActiveEditor();

        if (editorPart != null) {
          IFileEditorInput input = (IFileEditorInput) editorPart
              .getEditorInput();
          IFile file = input.getFile();
          collectCustomComponents(file.getProject());
        }
      }
    });
View Full Code Here


                    message += MessageFormat.format(
                        Messages.RenameContactAction_rename_current_nickname_message, rosterEntry.getName());
                }
                message += ":"; //$NON-NLS-1$

                InputDialog dialog = new InputDialog(shell, Messages.RenameContactAction_new_nickname_dialog_title,
                    message, rosterEntry.getName(), null);

                if (dialog.open() == Window.OK) {
                    String newName = dialog.getValue();
                    rosterEntry.setName(newName.length() == 0 ? null : newName);
                }
            }
        });
    }
View Full Code Here

    add.setText("Add");
    add.addSelectionListener(new SelectionAdapter() {

     
      public void widgetSelected(SelectionEvent e) {
        InputDialog inputDialog = new InputDialog(getControl()
            .getShell(), "Kind:", "Type new kind here:", "",
            new IInputValidator() {

              public String isValid(String newText) {
                if (newText.trim().length() == 0) {
                  return "Kind may not be empty string";
                }
                return null;
              }

            });
        int open = inputDialog.open();
        if (open == Dialog.OK) {
          tv.add(inputDialog.getValue());
        }
        super.widgetSelected(e);
      }

    });
View Full Code Here

    /* (non-Javadoc)
     * @see java.lang.Thread#run()
     */
    public void run() {
      InputDialog d = new InputDialog(RoomManager.getMain().getDisplay()
          .getActiveShell(), title, desc, def, validator);
      if (d.open() == Window.OK) {
        returnValue = d.getValue();
      }
      latch.countDown();
    }
View Full Code Here

      @Override
      public void widgetSelected(SelectionEvent e) {
       
        if(tree.getSelectionCount() != 1) return;
        InputDialog d = new InputDialog(parent.getShell(),
            "Rename Script File",
            "Choose the new name of the script file.",
            "modified_script_name.js",
            new ValidFileName());
        if(d.open() == Window.OK){
          for(TreeItem t : tree.getSelection()){
            for(Script s : ScriptManager.scripts){
              Script fScript = (Script)t.getData();
              if(s.getReference().equals(fScript.getReference())){
                fScript.getReference().renameTo(new File("./scripts/"+d.getValue()));
              }
            }
          }
        }
      }
      @Override
      public void widgetDefaultSelected(SelectionEvent e) {
       
      }});
   
    tltmDelete.addSelectionListener(new SelectionListener(){
     
      @Override
      public void widgetSelected(SelectionEvent e) {
        if(tree.getSelection().length==0){return;}
        RoomManager.getMain().getDisplay().asyncExec(new Runnable(){

          @Override
          public void run() {
            NSAlertBox a = new NSAlertBox("Delete Scripts", "Are you sure you want to delete the selected files? You can always uncheck them to not use them!", SWT.ICON_QUESTION, SWT.YES|SWT.NO);
            if(a.go() == SWT.YES){
              for(TreeItem s : tree.getSelection()){
                ((Script)s.getData()).getReference().delete();
              }
            }
             
          }});       
      }

      @Override
      public void widgetDefaultSelected(SelectionEvent e) {
      }});
   
    tltmNew.addSelectionListener(new SelectionListener(){

      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog d = new InputDialog(parent.getShell(),
            "Create New Script File",
            "Choose the name of the new script file.",
            "newscript.js",
            new ValidFileName());
        if(d.open() == Window.OK){
          File f = new File("./scripts/"+d.getValue());
          try {
            if(!f.createNewFile()){
              System.err.println("Could not create file: "+f.getName());
            }
          } catch (IOException e1) {
View Full Code Here

  /**
   * Ask the user a name for a new MigrationGroup, and create it.
   * Also call {@link MigrationTaskListener#groupsListUpdated(Object)}.
   */
  protected void newGroup() {
    InputDialog dialog = new InputDialog(control.getShell(),
        "New Migration Group", "Select a name for the group", "",
        new IInputValidator() {
          public String isValid(String newText) {
            if (newText.length() <= 0) {
              return "The name must contains at least one character.";
            }
            for (MigrationGroup group : task.getMigrationGroups()) {
              if (group.getName().equals(newText)) {
                return "A Group with this name already exists.";
              }
            }
            return null;
          }
        });
    if (dialog.open() != InputDialog.OK) {
      return;
    }
    MigrationGroup newGroup = new MigrationGroup();
    newGroup.setName(dialog.getValue());
    task.addMigrationGroup(newGroup);
    groupSelect.refresh(false);
    checkBoxTableViewer.refresh(false);
    listener.groupsListUpdated(this);
  }
View Full Code Here

                else
                    return null;
            }
        };

        InputDialog dialog = new InputDialog( getShell(), "Rename Connection", "New name:", connection.getName(),
            validator );

        dialog.open();
        String newName = dialog.getValue();
        if ( newName != null )
        {
            connection.setName( newName );
        }
    }
View Full Code Here

                else
                    return null;
            }
        };

        InputDialog dialog = new InputDialog( getShell(), "Rename Search", "New name:", search.getName(), validator );

        dialog.open();
        String newName = dialog.getValue();
        if ( newName != null )
        {
            search.setName( newName );
        }
    }
View Full Code Here

                else
                    return null;
            }
        };

        InputDialog dialog = new InputDialog( getShell(), "Rename Bookmark", "New name:", bookmark.getName(), validator );

        dialog.open();
        String newName = dialog.getValue();
        if ( newName != null )
        {
            bookmark.setName( newName );
        }
    }
View Full Code Here

                if (selectionIndex != -1)
                {
                    final CompositeData selectedLogger = (CompositeData)_table.getItem(
                                                                        selectionIndex).getData();
                    String user = selectedLogger.get(USERNAME).toString();
                    InputDialog id = new InputDialog(setPasswordButton.getShell(),"Set Password",
                                        "Please enter the new password for '" + user + "':",null,null){
                        @Override
                        protected Control createDialogArea(Composite parent)
                        {
                            Control control = super.createDialogArea(parent);
                            //set the Text field echo char to '*' to mask the password
                            getText().setEchoChar('*');
                            //return the normal result
                            return control;
                        }
                    };
                   
                    int returnValue;
                    while((returnValue = id.open()) == InputDialog.OK)
                    {
                        if (id.getValue() == null || id.getValue().toString().length() == 0)
                        {                           
                            ViewUtility.popupErrorMessage("Set Password", "Please enter a valid password");                      
                        }
                        else
                        {
                            break;
                        }
                    }
                   
                    if (returnValue  == InputDialog.OK)
                    {
                        char[] passwordArray = id.getValue().toCharArray();

                        // Qpid JMX API 1.1 and below expects the password to be sent as a hashed value.
                        if (_ApiVersion.lessThanOrEqualTo(1,1))
                        {
                            try
                            {
                                passwordArray = ViewUtility.getHash(id.getValue());
                            }
                            catch (Exception hashException)
                            {
                                ViewUtility.popupErrorMessage("Set Password",
                                        "Unable to calculate hash for Password:"
                                        + hashException.getMessage());
                                return;
                            }
                        }

                        try
                        {
                            boolean result;

                            //For Qpid JMX API >=1.7 use String based method instead of older char[] based method.
                            if(_ApiVersion.greaterThanOrEqualTo(1, 7))
                            {
                                result = _ummb.setPassword(user, id.getValue());
                            }
                            else
                            {
                                result = _ummb.setPassword(user, passwordArray);
                            }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.dialogs.InputDialog

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.