Examples of InputDialog


Examples of org.eclipse.jface.dialogs.InputDialog

        final ArrayList<WranglerPage> pages = new ArrayList<WranglerPage>();

        // apply ad hoc refactoring
        if (actionId.equals("org.erlide.wrangler.refactoring.adhoc")) {
            final InputDialog dialog = getModuleInput("Apply ad hoc refactoring",
                    "Please type the gen_refac module name!");

            dialog.open();

            if (dialog.getReturnCode() == Window.CANCEL) {
                return null;
            }

            final String callbackModule = dialog.getValue();

            pages.add(new UserRefacInputPage("Apply ad hoc refactoring",
                    "Please type input arguments for this refactoring",
                    "Arguments should not be empty!", new NonEmptyStringValidator()));
            refactoring = new ApplyAdhocElemRefactoring();

            ((ApplyAdhocElemRefactoring) refactoring)
                    .setCallbackModuleName(callbackModule);

            if (!((ApplyAdhocElemRefactoring) refactoring).fetchParPrompts()) {
                MessageDialog.openError(PlatformUI.getWorkbench()
                        .getActiveWorkbenchWindow().getShell(),
                        "Elementary refactoring error", "Can not load callback module");
                return null;
            }

            // apply user-defined refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.gen_refac")) {
            final String callbackModule = event
                    .getParameter("org.erlide.wrangler.refactoring.gen_refac.callback");
            final String name = event
                    .getParameter("org.erlide.wrangler.refactoring.gen_refac.name");

            pages.add(new UserRefacInputPage(name,
                    "Please type input arguments for this refactoring",
                    "Arguments should not be empty!", new NonEmptyStringValidator()));
            refactoring = new ApplyUserElementaryRefactoring(name, callbackModule);

            if (!((ApplyUserElementaryRefactoring) refactoring).fetchParPrompts()) {
                MessageDialog.openError(PlatformUI.getWorkbench()
                        .getActiveWorkbenchWindow().getShell(), "Refactoring error",
                        "Can not find callback module");
                return null;
            }

            // run rename variable refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.renamevariable")) {
            refactoring = new RenameVariableRefactoring();
            final SimpleInputPage page = new SimpleInputPage("Rename variable",
                    "Please type the new variable name!", "New variable name:",
                    "New name must be a valid Erlang variable name!",
                    new VariableNameValidator());
            page.setInput(refactoring.getDefaultValue());
            pages.add(page);

            // introduce new variable refactoring
        } else if (actionId
                .equals("org.erlide.wrangler.refactoring.introducenewvariable")) {
            pages.add(new SimpleInputPage("Introduce new variable",
                    "Please type the new variable name!", "New variable name:",
                    "New name must be a valid Erlang variable name!",
                    new VariableNameValidator()));
            refactoring = new IntroduceNewVariableRefactoring();

            // run rename function refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.renamefunction")) {
            refactoring = new RenameFunctionRefactoring();
            final CostumworkFlowInputPage page = new CostumworkFlowInputPage(
                    "Rename function", "Please type the new function name!",
                    "New function name:", "New name must be a valid Erlang atom!",
                    new AtomValidator());
            page.setInput(refactoring.getDefaultValue());
            pages.add(page);

            // run extract function refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.extractfunction")) {
            pages.add(new CostumworkFlowInputPage("Extract function",
                    "Please type a function name!", "Function name:",
                    "Function name must be a valid Erlang atom!", new AtomValidator()));
            refactoring = new ExtractFunctionRefactoring();

            // run rename module refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.renamemodule")) {
            final boolean answer = MessageDialog
                    .openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                            .getShell(), "Warning!",
                            "The requested operation cannot be undone. Would you like to continue?");

            if (!answer) {
                return null;
            }

            refactoring = new RenameModuleRefactoring();
            final CostumworkFlowInputPage page = new CostumworkFlowInputPage(
                    "Rename module", "Please type the new module name!",
                    "New module name:", "New module name must be a valid Erlang atom!",
                    new AtomValidator());
            page.setInput(refactoring.getDefaultValue());
            pages.add(page);

            // run move function refactoring
        } else if (actionId.equals("org.erlide.wrangler.refactoring.movefunction")) {

            final IProject project = ErlangEngine.getInstance().getModelUtilService()
                    .getProject(GlobalParameters.getWranglerSelection().getErlElement())
                    .getWorkspaceProject();
            final ArrayList<String> moduleList = WranglerUtils.getModuleNames(project);
            final String moduleName = GlobalParameters.getWranglerSelection()
                    .getErlElement().getResource().getName();
            moduleList.remove(WranglerUtils.removeExtension(moduleName));

            pages.add(new ComboInputPage("Move function",
                    "Please select the destination module", "Destination module:",
                    moduleList));
            refactoring = new MoveFunctionRefactoring();

            // run fold expression against a local function
        } else if (actionId.equals("org.erlide.wrangler.refactoring.foldlocalexpression")) {

            refactoring = new FoldLocalExpressionRefactoring();

            pages.add(new SelectionInputPage("Fold expression",
                    "Please select expression which should be fold!",
                    "Select expressions which should be folded!",
                    (CostumWorkflowRefactoringWithPositionsSelection) refactoring));

            // run fold expression against a remote function
        } else {
            final Shell activeShell = PlatformUI.getWorkbench().getDisplay()
                    .getActiveShell();
            if (actionId.equals("org.erlide.wrangler.refactoring.foldremoteexpression")) {

                // must store the selection, because, the user through the
                // dialog
                // may change it
                final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                        .getWranglerSelection();

                final RemoteFunctionClauseDialog dialog = new RemoteFunctionClauseDialog(
                        activeShell, "Fold expression");

                dialog.open();
                dialog.resetSelection();

                if (dialog.isFinished()) {
                    final IErlFunctionClause functionClause = dialog.getFunctionClause();
                    refactoring = new FoldRemoteExpressionRefactoring(functionClause, sel);
                    pages.add(new SelectionInputPage("Fold expression",
                            "Please select expression which should be fold!",
                            "Select expressions which should be folded!",
                            (CostumWorkflowRefactoringWithPositionsSelection) refactoring));
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

        return null;

    }

    private InputDialog getModuleInput(final String name, final String mesg) {
        return new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getShell(), name, mesg, "", new IInputValidator() {

            public IValidator internalV = new ModuleNameValidator();

            @Override
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

public class AddRefacHandler extends AbstractHandler {

    @Override
    public Object execute(final ExecutionEvent event) throws ExecutionException {

        final InputDialog dialog = new InputDialog(PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getShell(), "Add user-defined refactoring",
                "Please type callback module name!", "", new IInputValidator() {

                    public IValidator internalV = new ModuleNameValidator();

                    @Override
                    public String isValid(final String newText) {
                        if (internalV.isValid(newText)) {
                            return null;
                        }
                        return "Please type a correct module name!";
                    }
                });

        dialog.open();

        if (dialog.getReturnCode() == Window.CANCEL) {
            return null;
        }

        final String callbackModule = dialog.getValue();

        final RefacType type = checkType(callbackModule);
        if (type == null) {
            showErrorMesg("Callback module must implement either "
                    + "gen_refac or gen_composite_refac behaviour");
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

  /**
   * Adds new {@link CategoryInfo}.
   */
  private void onAddCategory() {
    InputDialog inputDialog =
        new InputDialog(getShell(), "New category", "Enter new category name:", "", null);
    if (inputDialog.open() == Window.OK) {
      commands_add(new CategoryAddCommand("category_" + System.currentTimeMillis(),
          inputDialog.getValue()));
    }
  }
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

   */
  private void onEdit() {
    Object element = getSelectedElements().get(0);
    if (element instanceof CategoryInfo) {
      CategoryInfo category = (CategoryInfo) element;
      InputDialog inputDialog =
          new InputDialog(getShell(),
              "Category",
              "Enter new category name:",
              category.getName(),
              null);
      // execute dialog
      if (inputDialog.open() == Window.OK) {
        commands_add(new CategoryNameCommand(category, inputDialog.getValue()));
      }
    } else if (element instanceof DeviceInfo) {
      DeviceInfo device = (DeviceInfo) element;
      DeviceEditDialog dialog = new DeviceEditDialog(device);
      // execute dialog
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

                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

Examples of org.eclipse.jface.dialogs.InputDialog

   *
   * @see java.lang.Runnable#run()
   */
  @Override
  public void run() {
    InputDialog dlg = new InputDialog(
        Display.getCurrent().getActiveShell(), "Create new Java class",
        "Enter a name for the enclosing Java class:", "", null);
    if (dlg.open() == InputDialog.OK) {
      className = dlg.getValue();
      logger.debug("Classname: " + dlg.getValue());
    } else {
      logger.debug("Do not create a class.");
    }
  }
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

    Button btnAdd = new Button(grpValues, SWT.NONE);
    btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnAdd.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog inputDialog = new InputDialog((Shell) shell,
            RedisClient.i18nFile.getText(I18nFile.INPUTVALUES),
            RedisClient.i18nFile.getText(I18nFile.LISTINPUTFORMAT), "", null);
        if (inputDialog.open() == InputDialog.OK) {
          String values = inputDialog.getValue();
          String[] listValues = values.split(";");
          TableItem item = null;
         
          for (String value : listValues) {
            item = new TableItem(table, SWT.NONE);
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

    Button btnAdd = new Button(grpValues, SWT.NONE);
    btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnAdd.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog inputDialog = new InputDialog(
            (Shell) shell,
            RedisClient.i18nFile.getText(I18nFile.INPUTVALUES),
            RedisClient.i18nFile.getText(I18nFile.INPUTZSETFORMAT),
            "", null);
        if (inputDialog.open() == InputDialog.OK) {
          String values = inputDialog.getValue();
          String[] zsetValues = values.split(";");
          TableItem item = null;
          for (String value : zsetValues) {
            item = new TableItem(table, SWT.NONE);
            String[] zset = value.split(",");
View Full Code Here

Examples of org.eclipse.jface.dialogs.InputDialog

    btnInsertHead = new Button(grpValues, SWT.NONE);
    btnInsertHead.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnInsertHead.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog dialog = new InputDialog(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.INSERTHEAD), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), "", null);
        if(dialog.open() == InputDialog.OK){
            String value = dialog.getValue();
            service.addHead(id, db, key, value);
            refresh();
        }
      }
    });
    btnInsertHead.setText(RedisClient.i18nFile.getText(I18nFile.INSERTHEAD));

    btnAppendTail = new Button(grpValues, SWT.NONE);
    btnAppendTail.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false,
        1, 1));
    btnAppendTail.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        InputDialog dialog = new InputDialog(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.APPENDTAIL), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), "", null);
        if(dialog.open() == InputDialog.OK){
            String value = dialog.getValue();
            service.addTail(id, db, key, value);
            pageListener.setCount();
            table.clear(table.getItemCount()-1);
            table.setSelection(table.getItemCount()-1);
            table.setSelection(-1);
            currentData.setItem(null);
            status = Status.Normal;
          statusChanged();
        }
      }
    });
    btnAppendTail.setText(RedisClient.i18nFile.getText(I18nFile.APPENDTAIL));

    btnDeleteHead = new Button(grpValues, SWT.NONE);
    btnDeleteHead.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnDeleteHead.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        service.removeFirst(id, db, key);
        refresh();
      }
    });
    btnDeleteHead.setText(RedisClient.i18nFile.getText(I18nFile.DELETEHEAD));

    btnDeleteTail = new Button(grpValues, SWT.NONE);
    btnDeleteTail.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1,
        1));
    btnDeleteTail.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        service.removeLast(id, db, key);
        pageListener.setCount();
        table.getItem(table.getItemCount()-1);
        table.setSelection(table.getItemCount()-1);
          table.setSelection(-1);
          currentData.setItem(null);
          status = Status.Normal;
        statusChanged();
      }
    });
    btnDeleteTail.setText(RedisClient.i18nFile.getText(I18nFile.DELETETAIL));
   
    btnApply = new Button(grpValues, SWT.NONE);
    btnApply.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        TableItem[] items = table.getSelection();
        service.setValue(id, db, key, table.getSelectionIndex(), items[0].getText());
        table.setSelection(-1);
        currentData.setItem(null);
        status = Status.Normal;
        statusChanged();
      }
    });
    btnApply.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    setApply(false);
    btnApply.setText(RedisClient.i18nFile.getText(I18nFile.APPLY));
   
    btnCancel = new Button(grpValues, SWT.NONE);
    btnCancel.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        switch(status){
        case Normal:
          break;
        case Update:
          table.setSelection(-1);
          status = Status.Normal;
          currentData.setItem(null);
          statusChanged();
          break;
        case Updating:
          currentData.reset();
          status = Status.Update;
          listener.clickRow(currentData.getItem(), 0);
          addModifyTextListener();
          statusChanged();
          break;
        }
       
      }
    });
    btnCancel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnCancel.setEnabled(false);
    btnCancel.setText(RedisClient.i18nFile.getText(I18nFile.CANCEL));
   
    btnRefresh = new Button(grpValues, SWT.NONE);
    btnRefresh.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        refresh();
      }
    });
    btnRefresh.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnRefresh.setEnabled(true);
    btnRefresh.setText(RedisClient.i18nFile.getText(I18nFile.REFRESH));

    btnWatch = new Button(grpValues, SWT.NONE);
    btnWatch.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
    btnWatch.setText(RedisClient.i18nFile.getText(I18nFile.WATCH));
    btnWatch.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        WatchDialog dialog = new WatchDialog(shell.getParent()
            .getShell(), image, currentData.getValue());
        dialog.open();
      }
    });
   
   
   
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.