コード例 #1
0
  public int open() {

    dlg =
        new InputDialog(
            getParentObject(),
            title,
            message,
            defaultValue,
            new IInputValidator() {

              public String isValid(String arg0) {
                return null;
              }
            });

    Image parentImg = null;
    if (getParentObject() != null) {
      parentImg = getParentObject().getImage();
    }
    if (parentImg != null) {
      dlg.setDefaultImage(parentImg);
    }
    int retVal = dlg.open();
    notifyListeners(retVal);
    return retVal;
  }
コード例 #2
0
  public void widgetSelected(SelectionEvent e) {
    Object source = e.getSource();
    if (source == btAdd) {
      InputDialog dialog =
          new InputDialog(
              getShell(),
              "Add custom command to list",
              "Add custom command to list",
              "",
              new IInputValidator() {

                public String isValid(String newText) {
                  if (newText.trim().length() == 0) {
                    return "Command not entered.";
                  }
                  if (input.contains(newText)) {
                    return "Command already entered.";
                  }
                  return null;
                }
              });
      int open = dialog.open();
      if (open == InputDialog.OK) {
        String value = dialog.getValue();
        input.add(value);
        saveCurrentCommands(value); // Save it.
        updateGui();
      }
    } else if (source == btRemove) {
      removeSelection();
    }
  }
コード例 #3
0
  /**
   * Close selected page.
   *
   * @param pageMngr
   */
  public void execute(final Diagram diagram, final IEditorPart editorPart) {

    TransactionalEditingDomain editingDomain = EditorUtils.getTransactionalEditingDomain();
    if (editingDomain != null) {
      InputDialog dialog =
          new InputDialog(
              Display.getCurrent().getActiveShell(),
              "Rename an existing diagram",
              "New name:",
              diagram.getName(),
              null);
      if (dialog.open() == Window.OK) {
        final String name = dialog.getValue();
        if (name != null && name.length() > 0) {

          Command command =
              new RecordingCommand(editingDomain) {

                @Override
                protected void doExecute() {
                  diagram.setName(name);
                }
              };

          editingDomain.getCommandStack().execute(command);
        }
      }
    }
  }
コード例 #4
0
 protected boolean updateModel(IFile file, ModelType model) {
   if (newId == null) {
     newId = getNewIdProposal(model.getId());
     InputDialog dialog =
         new InputDialog(
             getShell(),
             Diagram_Messages.LB_ACTION_CopyVersion,
             Diagram_Messages.MSG_EnterNewID,
             newId,
             new IInputValidator() {
               public String isValid(String newText) {
                 if (newText == null || newText.length() == 0) {
                   return Diagram_Messages.MSG_NoId;
                 }
                 if (existsId(newText)) {
                   return MessageFormat.format(
                       Diagram_Messages.MSG_ANOTHER_MODEL_HIERARCHY_WITH_ID_ALREADY_EXISTS,
                       new Object[] {newText});
                 }
                 return null;
               }
             });
     if (dialog.open() == 0) {
       newId = dialog.getValue();
     } else {
       return false;
     }
   }
   model.setId(newId);
   basicFileName = newId;
   return true;
 }
コード例 #5
0
 @Override
 protected void preRun() throws Exception {
   String uri =
       AbstractViewAction.lastResourceNumber == 0
           ? ""
           : "/res" + AbstractViewAction.lastResourceNumber; // $NON-NLS-1$ //$NON-NLS-2$
   InputDialog dialog =
       new InputDialog(
           getShell(),
           TITLE,
           Messages.getString("LoadResourceAction.4"),
           uri,
           null); //$NON-NLS-1$
   if (dialog.open() == InputDialog.OK) {
     resourcePath = dialog.getValue();
     if (!getView().hasResource(resourcePath)) {
       MessageDialog.openError(
           getShell(),
           Messages.getString("LoadResourceAction.2"),
           MessageFormat.format( // $NON-NLS-1$
               Messages.getString("LoadResourceAction.3"), resourcePath)); // $NON-NLS-1$
       cancel();
     }
   } else {
     cancel();
   }
 }
コード例 #6
0
 /** {@inheritDoc} */
 public Object executeImpl(ExecutionEvent event) {
   DirectoryDialog directoryDialog = createDirectoryDialog();
   genPath = directoryDialog.open();
   if (genPath != null) {
     org.eclipse.jubula.client.ui.rcp.utils.Utils.storeLastDirPath(
         directoryDialog.getFilterPath());
     File directory = new File(genPath);
     if (directory.list().length == 0) {
       InputDialog inputDialog =
           new InputDialog(
               getActiveShell(),
               Messages.InputDialogName,
               Messages.InputDialogMessage,
               StringConstants.EMPTY,
               new PackageNameValidator());
       if (inputDialog.open() == Window.OK) {
         genPackage = inputDialog.getValue();
         IWorkbench workbench = PlatformUI.getWorkbench();
         try {
           workbench.getProgressService().run(true, true, new ConvertProjectOperation());
         } catch (InvocationTargetException | InterruptedException e) {
           LOG.error(Messages.ErrorWhileConverting, e);
         }
       }
     } else {
       ErrorHandlingUtil.createMessageDialog(MessageIDs.E_NON_EMPTY_DIRECTORY);
     }
   }
   return null;
 }
コード例 #7
0
 @Override
 public void run() {
   InputDialog inputDialog =
       new InputDialog(
           null,
           Messages.RenameActionProvider_ProvideNameTitle,
           Messages.RenameActionProvider_ProvideNameDescription,
           eclass.getName(),
           null);
   int open = inputDialog.open();
   if (open == Dialog.OK) {
     String newName = inputDialog.getValue();
     Resource resource = eclass.eResource();
     ResourceSet resourceSet = resource.getResourceSet();
     TransactionalEditingDomain domain =
         TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
     try {
       if (domain != null) {
         Command setCommand =
             domain.createCommand(
                 SetCommand.class,
                 new CommandParameter(
                     eclass, EcorePackage.Literals.ENAMED_ELEMENT__NAME, newName));
         domain.getCommandStack().execute(setCommand);
         try {
           resource.save(Collections.emptyMap());
         } catch (IOException e) {
           e.printStackTrace();
         }
       }
     } finally {
       domain.dispose();
     }
   }
 }
コード例 #8
0
ファイル: UpdateStatusControl.java プロジェクト: aam/dartdev
 private Revision promptForRevision(Revision originalRevision) {
   InputDialog inputDialog =
       new InputDialog(
           null,
           "Download Revision",
           "FOR DEVELOPMENT USE ONLY"
               + System.getProperty("line.separator")
               + "    Enter the revision to be downloaded and installed",
           originalRevision.toString(),
           new IInputValidator() {
             @Override
             public String isValid(String newText) {
               if (newText == null || newText.length() == 0) {
                 return "Enter a revision # or click Cancel";
               }
               try {
                 Integer.valueOf(newText);
               } catch (NumberFormatException e) {
                 return "Invalid revision #";
               }
               return null;
             }
           });
   if (inputDialog.open() != Window.OK) {
     return null;
   }
   return new Revision(Integer.valueOf(inputDialog.getValue()));
 }
コード例 #9
0
ファイル: NewVersion.java プロジェクト: rraaff/wtf
 /** @see ActionDelegate#run(IAction) */
 public void run(IAction action) {
   if (this.selection instanceof StructuredSelection) {
     StructuredSelection selection = (StructuredSelection) this.selection;
     if (!selection.isEmpty()) {
       IWorkbench workbench = PlatformUI.getWorkbench();
       Shell shell = workbench.getActiveWorkbenchWindow().getShell();
       IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
       InputDialog inputDialog =
           new InputDialog(
               Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell(),
               "Ingreso de version",
               "Ingrese la version a generar",
               "",
               null);
       int manual = inputDialog.open();
       if (manual == 0) {
         String value = inputDialog.getValue();
         IFolder folder = (IFolder) selection.getFirstElement();
         try {
           IFolder folder1 = folder.getFolder(new Path(value));
           folder1.create(true, false, new NullProgressMonitor());
           IFile file = folder1.getFile(new Path("000_db_version_insert.sql"));
           file.create(
               new ByteArrayInputStream(VERSION_SCRIPT.replace("DBVERSION", value).getBytes()),
               true,
               new NullProgressMonitor());
         } catch (CoreException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
         }
       }
     }
   }
 }
コード例 #10
0
  @Override
  public Object getNewObject() {
    Circle circle = null;
    try {
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      circle = new Circle();

      InputDialog id =
          new InputDialog(
              new Shell(), "Circle Name", "Please give a name for the circle!", "", null);
      int open = id.open();
      if (open == 0) {
        if (!id.getValue().equals("")) {
          circle.setName(id.getValue());
        }
      }

      ModelProvider.INSTANCE.getModel().addChild(circle);
      UMLGraphicalEditor editor = (UMLGraphicalEditor) page.getActiveEditor();
      editor.refresh();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return circle;
  }
コード例 #11
0
 public void run() {
   LFWExplorerTreeView view = LFWExplorerTreeView.getLFWExploerTreeView(null);
   if (view == null) return;
   Shell shell = new Shell(Display.getCurrent());
   InputDialog input =
       new InputDialog(
           shell,
           WEBProjConstants.NEW_VIRTUALDIR,
           "输入" + WEBProjConstants.VIRTUALDIR + "名称",
           "",
           null);
   if (input.open() == InputDialog.OK) {
     String vitualDirName = input.getValue();
     if (vitualDirName != null && vitualDirName.trim().length() > 0) {
       vitualDirName = vitualDirName.trim();
       try {
         view.addVirtualTreeNode(vitualDirName);
       } catch (Exception e) {
         String title = WEBProjConstants.NEW_VIRTUALDIR;
         String message = e.getMessage();
         MessageDialog.openError(shell, title, message);
       }
     }
   }
 }
コード例 #12
0
  /** Handler for the "Rename..." button. */
  private void renameConfig() {
    InputDialog dlg =
        new InputDialog(
            tree.getTree().getShell(),
            WorkingSetMessages.WSConfigsController_renameDlg_title,
            WorkingSetMessages.WSConfigsController_renameDlg_msg,
            currentConfig.getName(),
            new IInputValidator() {

              public String isValid(String newText) {
                if (newText.equals(currentConfig.getName())) {
                  return ""; //$NON-NLS-1$
                }
                if (currentWorkingSet.getConfiguration(newText) != null) {
                  return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
                }
                if (newText.length() == 0) {
                  return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
                }
                return null;
              }
            });

    if (dlg.open() == IDialogConstants.OK_ID) {
      currentConfig.setName(dlg.getValue());
      tree.refresh(currentWorkingSet);
    }
  }
コード例 #13
0
  /** {@inheritDoc} */
  @Override
  public void run() {
    CreateChapterPopupMenuAction.LOGGER.debug(CmnStringUtil.EMPTY);

    InputDialog inputDialog =
        new InputDialog(
            PluginUtil.getActiveWorkbenchShell(),
            ResourceUtil.inputChapterSubject,
            ResourceUtil.inputChapterName,
            null,
            null);
    if (inputDialog.open() == InputDialog.OK) {
      // Pretreatment
      TreeViewer entryViewer = (TreeViewer) treeViewer;
      Object[] expandedNodes = entryViewer.getExpandedElements();
      entryViewer.getTree().setRedraw(false);
      // Entry Processing
      List<EntryOperator> entryList = treeViewer.getInputEntry();
      ChapterEntry chapter = new ChapterEntry();
      chapter.setKey(ResourceUtil.dummyChapterID);
      chapter.setName(inputDialog.getValue());
      chapter.setLevel(0);
      entryList.add(chapter);
      treeViewer.setEntryListData(entryList);
      // Post-processing
      treeViewer.refreshTreeViewer(true);
      entryViewer.setExpandedElements(expandedNodes);
      entryViewer.getTree().setRedraw(true);
    }
    CreateChapterPopupMenuAction.LOGGER.info(
        MessagePropertiesUtil.getMessage(MessagePropertiesUtil.LOG_CREATE_CONTEXTMENULIST));
  }
コード例 #14
0
  /** Handler for the "Add..." button. */
  private void addConfig() {
    InputDialog dlg =
        new InputDialog(
            tree.getTree().getShell(),
            WorkingSetMessages.WSConfigsController_addDlg_title,
            WorkingSetMessages.WSConfigsController_addDlg_msg,
            WorkingSetMessages.WSConfigsController_addDlg_defaultName,
            new IInputValidator() {

              public String isValid(String newText) {
                if (currentWorkingSet.getConfiguration(newText) != null) {
                  return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
                }
                if (newText.length() == 0) {
                  return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
                }
                return null;
              }
            });

    if (dlg.open() == IDialogConstants.OK_ID) {
      IWorkingSetConfiguration.ISnapshot newConfig =
          currentWorkingSet.createConfiguration(dlg.getValue());
      tree.refresh(currentWorkingSet);
      tree.setSelection(new StructuredSelection(newConfig), true);
      currentConfig = newConfig;
      currentWorkingSet = currentConfig.getWorkingSet();

      // this is a "recently used" working set
      IWorkingSet ws = currentWorkingSet.resolve();
      if (ws != null) {
        WorkingSetConfigurationManager.WS_MGR.addRecentWorkingSet(ws);
      }
    }
  }
コード例 #15
0
  /**
   * Returns the new name to be given to the target resource.
   *
   * @param resource the resource to query status on
   * @return the new name
   */
  protected String queryNewResourceName(final File resource) {
    final IWorkspace workspace = ResourcesPlugin.getWorkspace();
    final IPath prefix = new Path(resource.getAbsolutePath()).removeLastSegments(1);

    IInputValidator validator =
        new IInputValidator() {

          /*
           * (non-Javadoc)
           *
           * @see
           * org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String
           * )
           */
          public String isValid(String string) {
            if (new Path(resource.getName())
                .removeFileExtension()
                .toFile()
                .getName()
                .equals(string)) {
              return Messages.getString("RenameResourceAction.nameExists"); // $NON-NLS-1$
            }

            IPath newPath = new Path(string);

            IStatus status =
                workspace.validateName(
                    newPath.toFile().getName(),
                    resource.isFile() ? IResource.FILE : IResource.FOLDER);

            if (!status.isOK()) {
              return status.getMessage();
            }

            IPath fullPath = prefix.append(string);

            if (fullPath.toFile().exists()) {
              return Messages.getString("RenameResourceAction.nameExists"); // $NON-NLS-1$
            }
            return null;
          }
        };

    InputDialog dialog =
        new InputDialog(
            getShell(),
            Messages.getString("RenameResourceAction.inputDialogTitle"), // $NON-NLS-1$
            Messages.getString("RenameResourceAction.inputDialogMessage"), // $NON-NLS-1$
            new Path(resource.getName()).toFile().getName(),
            validator);

    dialog.setBlockOnOpen(true);
    int result = dialog.open();
    if (result == Window.OK) {
      IPath newPath = new Path(dialog.getValue());

      return newPath.toFile().getName();
    }
    return null;
  }
コード例 #16
0
 /**
  * Opens an simple input dialog with OK and Cancel buttons.
  *
  * <p>
  *
  * @param dialogTitle the dialog title, or <code>null</code> if none
  * @param dialogMessage the dialog message, or <code>null</code> if none
  * @param initialValue the initial input value, or <code>null</code> if none (equivalent to the
  *     empty string)
  * @return the string
  */
 public static String askString(String dialogTitle, String dialogMessage, String initialValue) {
   String ret = null;
   Shell shell = getShell();
   InputDialog inputDialog =
       new InputDialog(shell, dialogTitle, dialogMessage, initialValue, null);
   int retDialog = inputDialog.open();
   if (retDialog == Window.OK) {
     ret = inputDialog.getValue();
   }
   return ret;
 }
コード例 #17
0
 private void editEntry(ListDialogField<String> field) {
   List<String> selElements = field.getSelectedElements();
   if (selElements.size() != 1) {
     return;
   }
   String entry = selElements.get(0);
   InputDialog dialog = createInputDialog(entry);
   if (dialog.open() == Window.OK) {
     field.replaceElement(entry, dialog.getValue());
   }
 }
コード例 #18
0
  /** The behaviour of the action. Checks if the name entered by the user is valid. */
  public void run() {
    ISelection selection = viewer.getSelection();
    if (selection.isEmpty()) {
      this.setEnabled(false);
    }
    TreeObject object = (TreeObject) ((IStructuredSelection) selection).getFirstElement();
    if (object instanceof DocumentTreeObject) {

      String oldValue = object.getValue().toString();

      IInputValidator validator = new TextValidator(oldValue);
      InputDialog dialog =
          new InputDialog(
              parent.getShell(),
              Properties.getProperty("rename"),
              Properties.getProperty("new_name"),
              oldValue,
              validator);
      dialog.setBlockOnOpen(true); // waits for user enter a name

      int res = dialog.open(); // opens the rename dialog

      if (res == InputDialog.OK) {
        String newValue = dialog.getValue();

        String newExtension = GUIUtil.getFileExtension(newValue);
        String oldExtension = GUIUtil.getFileExtension(oldValue);

        if (!newExtension.equalsIgnoreCase(oldExtension)) {
          newValue += oldExtension;
        }

        if (!newValue.equalsIgnoreCase(oldValue)) {
          if (!ProjectManagerController.getInstance().renameDocument(oldValue, newValue)) {
            MessageDialog.openError(
                parent.getShell(),
                Properties.getProperty("error_while_renaming"),
                Properties.getProperty("can_not_rename"));
          }
          try {
            GUIManager.getInstance().refreshViews();
          } catch (TargetException e) {
            MessageDialog.openError(
                this.parent.getShell(),
                Properties.getProperty("error_while_reloading_project"),
                e.getMessage());
            e.printStackTrace();
          }
        }
      }
    }
  }
コード例 #19
0
  /** @return */
  public boolean resetProjectName() {
    String prj;
    final InputDialog inputDialog =
        new InputDialog(getShell(), "Project to work with", "Enter the project name", "", null);

    if (inputDialog.open() == Window.CANCEL || inputDialog.getValue().trim().equals(EMPTY_STR)) {
      return false;
    }

    prj = inputDialog.getValue();
    this.preferenceStore.setValue(P_REPOSITORY_PROJECT, prj);
    return true;
  }
コード例 #20
0
  private void changeQuantityDialog(String p, Verrechnet v) {
    InputDialog dlg =
        new InputDialog(
            UiDesk.getTopShell(),
            Messages.VerrechnungsDisplay_changeNumberCaption, // $NON-NLS-1$
            Messages.VerrechnungsDisplay_changeNumberBody, // $NON-NLS-1$
            p,
            null);
    if (dlg.open() == Dialog.OK) {
      try {
        String val = dlg.getValue();
        if (!StringTool.isNothing(val)) {
          int changeAnzahl;
          double secondaryScaleFactor = 1.0;
          String text = v.getVerrechenbar().getText();

          if (val.indexOf(StringConstants.SLASH) > 0) {
            changeAnzahl = 1;
            String[] frac = val.split(StringConstants.SLASH);
            secondaryScaleFactor = Double.parseDouble(frac[0]) / Double.parseDouble(frac[1]);
            text =
                v.getText()
                    + " ("
                    + val
                    + Messages.VerrechnungsDisplay_Orininalpackungen; // $NON-NLS-1$
          } else if (val.indexOf('.') > 0) {
            changeAnzahl = 1;
            secondaryScaleFactor = Double.parseDouble(val);
            text = v.getText() + " (" + Double.toString(secondaryScaleFactor) + ")";
          } else {
            changeAnzahl = Integer.parseInt(dlg.getValue());
          }

          IStatus ret = v.changeAnzahlValidated(changeAnzahl);
          if (ret.isOK()) {
            v.setSecondaryScaleFactor(secondaryScaleFactor);
            v.setText(text);
          } else {
            SWTHelper.showError(Messages.VerrechnungsDisplay_error, ret.getMessage());
          }
        }
        setLeistungen((Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class));
      } catch (NumberFormatException ne) {
        SWTHelper.showError(
            Messages.VerrechnungsDisplay_invalidEntryCaption, // $NON-NLS-1$
            Messages.VerrechnungsDisplay_invalidEntryBody); // $NON-NLS-1$
      }
    }
  }
コード例 #21
0
    public void widgetSelected(SelectionEvent e) {
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
      InputDialog dialog =
          new InputDialog(shell, "Create Criteria", "Criteria Description", null, null);
      dialog.open();

      if (dialog.getReturnCode() == InputDialog.OK) {
        Criteria c = new Criteria();
        c.setName(dialog.getValue());
        selectedLiteratureReview.getCritireon().add(c);
        LiteratureReviewController literatureReviewController = new LiteratureReviewController();
        literatureReviewController.updateLiteratureReview(selectedLiteratureReview);
        refreshCriteriaList();
      }
    }
コード例 #22
0
 private Object showDialog() {
   if (window == null) {
     window = PlanPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
   }
   if (window != null) {
     InputDialog d =
         new InputDialog(
             window.getShell(), getEarliestOrLatestName(), getDialogText(), "", validator);
     int code = d.open();
     if (code == Window.OK) {
       return data;
     }
   }
   return null;
 }
コード例 #23
0
 private void handleIgnoreNewButtonPressed() {
   InputDialog dialog =
       new InputDialog(
           getShell(),
           Messages.getString("MemcheckToolPage.Ignore_Ranges"),
           Messages.getString("MemcheckToolPage.Range"),
           "",
           null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   if (dialog.open() == Window.OK) {
     String function = dialog.getValue();
     if (!function.equals("")) { // $NON-NLS-1$
       ignoreRangesList.add(function);
     }
   }
 }
コード例 #24
0
    @Override
    protected void createButtonsForButtonBar(Composite parent) {
      super.createButtonsForButtonBar(parent);
      Button browse =
          createButton(
              parent,
              3,
              CPathEntryMessages.IncludeSymbolEntryPage_addExternal_button_browse,
              false);
      browse.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent ev) {
              DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
              dialog.setText(CPathEntryMessages.IncludeSymbolEntryPage_browseForFolder);
              String currentName = getText().getText();
              if (currentName != null && currentName.trim().length() != 0) {
                dialog.setFilterPath(currentName);
              }
              String dirname = dialog.open();
              if (dirname != null) {
                getText().setText(dirname);
              }
            }
          });
    }
コード例 #25
0
    public void widgetSelected(SelectionEvent e) {
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
      InputDialog dialog =
          new InputDialog(shell, "Create literature review", "Literature review title", null, null);
      dialog.open();

      if (dialog.getReturnCode() == InputDialog.OK) {
        LiteratureReview literatureReview = new LiteratureReview();

        literatureReview.setTitle(dialog.getValue());

        LiteratureReviewController literatureReviewController = new LiteratureReviewController();
        literatureReviewController.createLiteratureReview(literatureReview);
        refreshLiteratureView();
      }
    }
コード例 #26
0
 protected void addInclude(CPElement existing) {
   InputDialog dialog;
   if (existing == null) {
     dialog =
         new SelectPathInputDialog(
             getShell(),
             CPathEntryMessages.IncludeSymbolEntryPage_addExternal_title,
             CPathEntryMessages.IncludeSymbolEntryPage_addExternal_message,
             null,
             null);
   } else {
     dialog =
         new SelectPathInputDialog(
             getShell(),
             CPathEntryMessages.IncludeSymbolEntryPage_editExternal_title,
             CPathEntryMessages.IncludeSymbolEntryPage_editExternal_message,
             ((IPath) existing.getAttribute(CPElement.INCLUDE)).toOSString(),
             null);
   }
   String newItem = null;
   if (dialog.open() == Window.OK) {
     newItem = dialog.getValue();
     if (newItem != null && !newItem.isEmpty()) {
       if (existing == null) {
         CPElementGroup group = getSelectedGroup();
         CPElement newPath =
             new CPElement(
                 fCurrCProject,
                 IPathEntry.CDT_INCLUDE,
                 group.getResource().getFullPath(),
                 group.getResource());
         newPath.setAttribute(CPElement.INCLUDE, new Path(newItem));
         if (!group.contains(newPath)) {
           addPathToResourceGroups(newPath, group, fIncludeSymPathsList.getElements());
           fIncludeSymPathsList.refresh();
           fIncludeSymPathsList.selectElements(new StructuredSelection(newPath));
         }
       } else {
         existing.setAttribute(CPElement.INCLUDE, new Path(newItem));
         updatePathOnResourceGroups(existing, fIncludeSymPathsList.getElements());
         fIncludeSymPathsList.refresh();
       }
       updateStatus();
     }
   }
 }
コード例 #27
0
 @Override
 protected void buttonPressed(int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     mPropertyValue = mPropertyValueText.getText();
     mInstanceDefault = mAllowInstanceDefault && mInstanceDefaultButton.getSelection();
   }
   super.buttonPressed(buttonId);
 }
コード例 #28
0
ファイル: GotoScriptLineAction.java プロジェクト: xored/rcptt
  public void run() {

    TextViewer viewer = getTextViewer();
    if (viewer == null) return;

    IDocument document = viewer.getDocument();
    if (document == null) return;

    try {
      fLastLine = document.getLineOfOffset(document.getLength()) + 1;
    } catch (BadLocationException ex) {
      IStatus status =
          new Status(
              IStatus.ERROR,
              Q7UIPlugin.PLUGIN_ID,
              IStatus.OK,
              "Go to Line failed",
              ex); //$NON-NLS-1$
      Q7UIPlugin.getDefault().getLog().log(status);
      return;
    }

    String title = DIALOG_TITLE;
    String message = MessageFormat.format(DIALOG_MESSAGE, new Integer(fLastLine));

    String currentLineStr = ""; // $NON-NLS-1$
    StyledText textWidget = viewer.getTextWidget();
    int currentLine = textWidget.getLineAtOffset(textWidget.getCaretOffset());
    if (currentLine > -1) currentLineStr = Integer.toString(currentLine + 1);

    InputDialog d =
        new InputDialog(
            viewer.getTextWidget().getShell(),
            title,
            message,
            currentLineStr,
            new NumberValidator());
    if (d.open() == Window.OK) {
      try {
        int line = Integer.parseInt(d.getValue());
        gotoLine(line - 1);
      } catch (NumberFormatException x) {
      }
    }
  }
コード例 #29
0
  @Override
  protected void preRun() throws Exception {
    InputDialog dialog =
        new InputDialog(
            getShell(),
            createFolder ? TITLE_FOLDER : TITLE_RESOURCE,
            createFolder ? "Enter folder name" : Messages.getString("CreateResourceAction.2"),
            "res" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                + (ViewAction.lastResourceNumber + 1),
            new ResourceNodeNameInputValidator(selectedNode));

    if (dialog.open() == InputDialog.OK) {
      ++ViewAction.lastResourceNumber;
      resourceNodeName = dialog.getValue();
    } else {
      cancel();
    }
  }
コード例 #30
0
 @Override
 protected String getNewInputObject() {
   String str = new String("image/");
   InputDialog dialog =
       new InputDialog(
           Display.getCurrent().getActiveShell(),
           "New Image Type",
           "Enter the image type",
           str,
           null);
   int result = dialog.open();
   if (result == Window.OK) {
     str = dialog.getValue();
   }
   if ("image/".equals(str)) {
     return null; // nothing to add
   }
   return str;
 }