Package org.eclipse.jface.dialogs

Examples of org.eclipse.jface.dialogs.InputDialog


    btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    btnAdd.setText(Messages.UniqueValuesDialog_AddButton);
    btnAdd.addSelectionListener(new SelectionAdapter(){
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog id = new InputDialog(getParentShell(), Messages.UniqueValuesDialog_AddValueDialogTitle, Messages.UniqueValuesDialog_AddValueDialogMessage, "0", new IInputValidator() { //$NON-NLS-1$
          @Override
          public String isValid(String newText) {
            try{
              Double.parseDouble(newText);
              return null;
            }catch(Exception ex){
              return Messages.UniqueValuesDialog_InvalidNumberText;
            }
          }
        });
        if (id.open() == InputDialog.OK){
          Double d = Double.valueOf(id.getValue());
          uniqueValues.add(d);
          lstViewer.refresh();
        }
      }
    });
View Full Code Here


    IInputValidator inputValidator= new IInputValidator() {
      public String isValid(String newText) {
        return (newText == null || newText.trim().length() == 0) ? " " : null; //$NON-NLS-1$
      }
    };
    InputDialog dialog= new InputDialog(fTextEditor.getSite().getShell(), title, message, proposal, inputValidator);

    String label= null;
    if (dialog.open() != Window.CANCEL)
      label= dialog.getValue();

    if (label == null)
      return false;

    label= label.trim();
View Full Code Here

      if (initialValue == null)
        initialValue= encodingSupport.getDefaultEncoding();
      if (initialValue == null)
        initialValue= ""; //$NON-NLS-1$

      InputDialog d= new InputDialog(editor.getSite().getShell(), title, message, initialValue, inputValidator);
      if (d.open() == Window.OK)
        encodingSupport.setEncoding(d.getValue());
    }
View Full Code Here

    IInputValidator inputValidator= new IInputValidator() {
      public String isValid(String newText) {
        return  (newText == null || newText.trim().length() == 0) ? " " : null//$NON-NLS-1$
      }
    };
    InputDialog dialog= new InputDialog(getTextEditor().getSite().getShell(), title, message, proposal, inputValidator);

    String label= null;
    if (dialog.open() != Window.CANCEL)
      label= dialog.getValue();

    if (label == null)
      return false;

    label= label.trim();
View Full Code Here

                        return null;
                    }
                };

                InputDialog dialog = new InputDialog(getShell(),
                        RENAME_DEVICE_TITLE, RENAME_DEVICE_MESSAGE,
                        oldName, validator);
                dialog.setBlockOnOpen(true);
                int result = dialog.open();

                // Return the entered name if the dialog was completed
                // successfully.
                String newName = null;
                if (result == Dialog.OK) {
                    newName = dialog.getValue();
                    // Add a leading _ if necessary for non-admin users
                    if (!hasAdminRights && !newName.startsWith("_")) {
                        newName = "_" + newName;
                    }
                }
                return newName;
            }
        };

        // create the move action
        moveAction = context.new DemarcatingResourceAction(
                DevicesMessages.getResourceBundle(),
                RESOURCE_PREFIX + "move.") {
            // javadoc inherited
            protected void runImpl() {
                // get hold of the node that is to be moved
                final ODOMElement selected = getSelectedDevice();
                // create the dialog that allows the user to select the
                // destination for the "move" device action

                // we need to filter out the selected node from the
                // NodeSelectionDialog as it does not make sense to move the
                // selected device to itself or a descendent of itself.
                // We can do this by wrapping the hierarchy content provider
                // in a FilteringTreeContentProvider that filters out the
                // selected device.
                ITreeContentProvider filteringContentProvider =
                        new FilteringTreeContentProvider(
                                CONTENT_PROVIDER,
                                new FilteringTreeContentProvider.NodeFilter() {
                                    // To store the filtered nodes
                                    List filtered = new ArrayList();

                                    // javadoc inherited
                                    public Object[] filter(Object[] nodes) {
                                        filtered.clear();
                                        // filter out the selected device if
                                        // it is in the list of nodes
                                        for (int i = 0; i < nodes.length; i++) {
                                            if (nodes[i] != selected) {
                                                filtered.add(nodes[i]);
                                            }
                                        }
                                        return filtered.toArray();
                                    }
                                });
                // create the dialog that allows the user to select the new
                // position in the device hierarchy.
                NodeSelectionDialog dialog = new NodeSelectionDialog(
                        displayArea.getShell(),
                        SELECT_DEVICE_MESSAGE,
                        context.getDeviceRepositoryAccessorManager().
                        getDeviceHierarchyDocument().getRootElement(),
                        filteringContentProvider,
                        new DeviceHierarchyLabelProvider());

                // set the title for the dialog
                dialog.setTitle(SELECT_DEVICE_TITLE);
                // display the dialog
                dialog.open();
                // retrieve the selected device
                Object[] result = dialog.getResult();
                // if the result is null then the user pressed the cancel
                // button. However, if it is non null then a selection will
                // have been made and the result array should contain 1
                // ODOMElement - the device that was selected.
                if (result != null) {
View Full Code Here

  private void changeFeature(Shell shell, Object node) {
    FeatureCheckTreeNode featTreeNode = (FeatureCheckTreeNode) node;
    shell.setText("Change value of feature");
    Type range = featTreeNode.getFeature().getRange();
    IInputValidator validator = new ChangeFeatureValidator(range);
    InputDialog dialog = new InputDialog(getShell(), "Define new feature value",
            "New feature value:", "", validator);
    if (dialog.open() == Window.OK) {
      featTreeNode.setValue(dialog.getValue());
      treeView.refresh();
      return;
    }
  }
View Full Code Here

              if (newText.trim().length() > 0 && newText.matches("[_a-zA-Z]*")) //$NON-NLS-1$
                return null;
              return RutaFoldingMessages.RutaFoldingPreferenceBlock_2;
            }
          };
          InputDialog dlg = new InputDialog(null, RutaFoldingMessages.RutaFoldingPreferenceBlock_3,
                  RutaFoldingMessages.RutaFoldingPreferenceBlock_4, "", validator);
          if (dlg.open() == Window.OK) {
            fList.add(dlg.getValue());
            save();
          }
        }
      });
      fRemoveButton = createPushButton(pathButtonComp,
View Full Code Here

      new MenuItem(entryMenu,SWT.SEPARATOR);
      MenuItem rename = new MenuItem(entryMenu,SWT.PUSH);
      rename.setText("Rename Contact");
      rename.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          InputDialog dialog = new InputDialog(
              entryMenu.getShell(),
              "Rename Contact",
              "Enter New Name for " + (selectedEntry.getName() == null ? selectedEntry.getUser() : selectedEntry.getName()),
              (selectedEntry.getName() == null ? selectedEntry.getUser() : selectedEntry.getName()),
              null);
          dialog.setBlockOnOpen(true);
          if(dialog.open() != InputDialog.OK) return;
          selectedEntry.setName(dialog.getValue());
        }
      });
     
      MenuItem remove = new MenuItem(entryMenu,SWT.PUSH);
      remove.setText("Remove Contact");
      remove.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          activeAccount.xmpp.removeContact(selectedEntry,entryMenu.getShell());
        }
      });
     
      MenuItem authorization = new MenuItem(entryMenu,SWT.CASCADE);
      authorization.setText("Authorization");
      Menu authMenu = new Menu(authorization);
      authorization.setMenu(authMenu);
     
      MenuItem authSendTo = new MenuItem(authMenu,SWT.PUSH);
      authSendTo.setText("(Re)Send Subscribe Authorization");
      MenuItem authRequestFrom = new MenuItem(authMenu,SWT.PUSH);
      authRequestFrom.setText("(Re)Request Subscribe Authorization");
      MenuItem authRemove = new MenuItem(authMenu,SWT.PUSH);
      authRemove.setText("Remove Subscribe Authorization");
     
      authSendTo.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          Presence presence = new Presence(Presence.Type.SUBSCRIBED);
          presence.setTo(StringUtils.parseBareAddress(selectedEntry.getUser()));
          activeAccount.xmpp.getConnection().sendPacket(presence);
        }
      });
      authRequestFrom.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          Presence presence = new Presence(Presence.Type.SUBSCRIBE);
          presence.setTo(StringUtils.parseBareAddress(selectedEntry.getUser()));
          activeAccount.xmpp.getConnection().sendPacket(presence);
        }
      });
      authRemove.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          Presence presence = new Presence(Presence.Type.UNSUBSCRIBED);
          presence.setTo(StringUtils.parseBareAddress(selectedEntry.getUser()));
          activeAccount.xmpp.getConnection().sendPacket(presence);
        }
      });
     
      addToGroupItem = new MenuItem(entryMenu,SWT.CASCADE);
      addToGroupItem.setText("Add To Group");
      addToGroup = new Menu(addToGroupItem);
      addToGroupItem.setMenu(addToGroup);
      MenuItem createGroup = new MenuItem(addToGroup,SWT.PUSH);
      createGroup.setText("New Group");
      createGroup.setData("constant",true);
      new MenuItem(addToGroup,SWT.SEPARATOR).setData("constant",true);
      createGroup.addListener(SWT.Selection,new Listener() {
        public void handleEvent(Event event) {
          InputDialog dialog = new InputDialog(
              addToGroup.getShell(),
              "Create Group",
              "Name for the newly created Group",
              "",
              new IInputValidator(){
                public String isValid(String newText) {
                  if(newText.equals("")) return "Enter a valid name.";
                  if(activeAccount.xmpp.getRoster().getGroup(newText) != null) return "Group already exists.";
                  if(newText.equalsIgnoreCase("default")) return "Invalid Group Name";
                  return null;
                }});
          dialog.setBlockOnOpen(true);
          int code = dialog.open();
          if(code != InputDialog.OK) return;
          RosterGroup group = activeAccount.xmpp.getRoster().createGroup(dialog.getValue());
          try {
            group.addEntry(selectedEntry);
          } catch (XMPPException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
View Full Code Here

    multiUserChatCreateRoom.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        String addressid = (String) selectedItem.getData("address");
        if (addressid == null)
          return;
        InputDialog dialog = new InputDialog(sShell,
            "Creating MUC Room",
            "Enter the name for the New Room (will be known as yourinput@" + addressid + ")",
            null,null);
        int r = dialog.open();
        if(r != InputDialog.OK) return;
        String room = dialog.getValue();
        String froom = room + "@" + addressid;
        MultiUserChat muc = new MultiUserChat(account.xmpp.getConnection(),froom);
        try {
          muc.create(account.getUsername());
          account.chatWindowExtensionManager.openMUCWindow(froom,muc);
View Full Code Here

  }

  private void joinMUCRoom(String addressid) {
    String name = StringUtils.parseName(addressid);
    if(name.equals("")) {
      InputDialog dialog = new InputDialog(sShell,"Join Room","Enter Name of the room you want to join on service: " + addressid,"",new IInputValidator(){
        public String isValid(String newText) {
          if(newText.equals("") ||
              newText.indexOf('@')>-1)
            return "Enter a valid room name. e.g: myroomname";
          return null;
        }});
      if(dialog.open() != InputDialog.OK) return;
      name = dialog.getValue() + "@" + addressid;
    } else
      name = addressid;
    MultiUserChat muc = new MultiUserChat(account.xmpp.getConnection(),name);
    try {
      muc.join(account.getUsername());
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.