コード例 #1
0
  protected void saveSettings(IDialogSettings settings) {
    ISecurePreferences preferences = getPreferences(settings.getName());
    if (preferences == null) {
      // only in case it is not possible to create secured storage in
      // default location -> in that case do not persist settings
      return;
    }

    try {
      preferences.putBoolean(S_SIGN_JARS, fButton.getSelection(), true);
      preferences.put(S_KEYSTORE, fKeystoreText.getText().trim(), true);
      preferences.put(S_ALIAS, fAliasText.getText().trim(), true);
      preferences.put(S_PASSWORD, fPasswordText.getText().trim(), true);
      preferences.put(S_KEYPASS, fKeypassText.getText().trim(), true);

      // bug387565 - for keys which are starting with this bugfix to be
      // stored
      // in secured storage, replace value in settings with empty string
      // to avoid keeping sensitive info in plain text
      String[] obsoleted = new String[] {S_KEYSTORE, S_ALIAS, S_PASSWORD, S_KEYPASS};
      for (String key : obsoleted) {
        if (settings.get(key) != null) {
          settings.put(key, ""); // $NON-NLS-1$
        }
      }
    } catch (StorageException e) {
      PDEPlugin.log(
          "Failed to store JarSigning settings in secured preferences store"); //$NON-NLS-1$
    }
  }
コード例 #2
0
 protected String[] getSigningInfo() {
   if (fButton.getSelection()) {
     return new String[] {
       fAliasText.getText().trim(),
       fKeystoreText.getText().trim(),
       fPasswordText.getText().trim(),
       fKeypassText.getText().trim()
     };
   }
   return null;
 }
コード例 #3
0
ファイル: FightView.java プロジェクト: zacharyozer/rssoap
 /** Executes to start fight animation. */
 private void fight() {
   int result1, result2;
   try {
     // gets counts of hits for each search
     result1 = control.getNumberOfArticles(searchText.getText());
     result2 = control.getNumberOfArticles(searchText2.getText());
     // writes the html file
     Util.generateFight(result1, result2);
     // loads it in the browser
     browser.setUrl(new File("articlefight/articlefight.html").getAbsolutePath());
   } catch (ControlException e) {
   }
 }
コード例 #4
0
 protected String validate() {
   String error = null;
   if (fButton.getSelection()) {
     if (fKeystoreText.getText().trim().length() == 0) {
       error = PDEUIMessages.AdvancedPluginExportPage_noKeystore;
     } else if (fAliasText.getText().trim().length() == 0) {
       error = PDEUIMessages.AdvancedPluginExportPage_noAlias;
     } else if (fPasswordText.getText().trim().length() == 0) {
       error = PDEUIMessages.AdvancedPluginExportPage_noPassword;
     }
   }
   return error;
 }
コード例 #5
0
  public void okPressed() {
    if (fileDialogMode == VFS_DIALOG_SAVEAS && "".equals(fileNameText.getText())) { // $NON-NLS-1$
      // do nothing, user did not enter a file name for saving
      MessageBox messageDialog = new MessageBox(dialog, SWT.OK);
      messageDialog.setText(Messages.getString("VfsFileChooserDialog.error")); // $NON-NLS-1$
      messageDialog.setMessage(
          Messages.getString("VfsFileChooserDialog.noFilenameEntered")); // $NON-NLS-1$
      messageDialog.open();
      return;
    }

    if (fileDialogMode == VFS_DIALOG_SAVEAS) {
      try {
        FileObject toBeSavedFile =
            vfsBrowser.getSelectedFileObject().resolveFile(fileNameText.getText());
        if (toBeSavedFile.exists()) {
          MessageBox messageDialog = new MessageBox(dialog, SWT.YES | SWT.NO);
          messageDialog.setText(
              Messages.getString("VfsFileChooserDialog.fileExists")); // $NON-NLS-1$
          messageDialog.setMessage(
              Messages.getString("VfsFileChooserDialog.fileExistsOverwrite")); // $NON-NLS-1$
          int flag = messageDialog.open();
          if (flag == SWT.NO) {
            return;
          }
        }
      } catch (FileSystemException e) {
        e.printStackTrace();
      }
    }
    if (fileDialogMode == VFS_DIALOG_SAVEAS) {
      enteredFileName = fileNameText.getText();
    }

    try {
      if (fileDialogMode == VFS_DIALOG_OPEN_FILE
          && vfsBrowser.getSelectedFileObject().getType().equals(FileType.FOLDER)) {
        // try to open this node, it is a directory
        vfsBrowser.selectTreeItemByFileObject(vfsBrowser.getSelectedFileObject(), true);
        return;
      }
    } catch (FileSystemException e) {
    }

    okPressed = true;
    hideCustomPanelChildren();
    dialog.dispose();
  }
コード例 #6
0
  private void validatePage() {
    String errorMessage = null;
    String newText = fWorkingSetName.getText();

    if (newText.trim().length() == 0) {
      errorMessage = PDEUIMessages.PluginWorkingSet_emptyName;
      if (fFirstCheck) {
        setPageComplete(false);
        fFirstCheck = false;
        return;
      }
    }
    if (errorMessage == null && fTree.getCheckboxTreeViewer().getCheckedElements().length == 0) {
      errorMessage = PDEUIMessages.PluginWorkingSet_noPluginsChecked;
    }

    if (errorMessage == null && fWorkingSet == null) {
      IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
      for (int i = 0; i < workingSets.length; i++) {
        if (newText.equals(workingSets[i].getName())) {
          errorMessage = PDEUIMessages.PluginWorkingSet_nameInUse;
          break;
        }
      }
    }
    setErrorMessage(errorMessage);
    setPageComplete(errorMessage == null);
  }
コード例 #7
0
 private void handleFilter() {
   boolean changed = false;
   String newFilter;
   if (fFilterText == null || (newFilter = fFilterText.getText().trim()).length() == 0)
     newFilter = "*"; // $NON-NLS-1$
   changed = fAvailableFilter.setPattern(newFilter);
   if (changed) {
     fAvailableListViewer.refresh();
     updateButtonEnablement(false, false);
   }
 }
コード例 #8
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 @Nullable
 public static Integer getTextInteger(Text text) {
   String str = text.getText();
   str = str.trim();
   if (str.length() == 0) {
     return null;
   }
   try {
     return Integer.valueOf(str);
   } catch (NumberFormatException e) {
     log.debug(e);
     return null;
   }
 }
コード例 #9
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.dialogs.IWorkingSetPage#finish()
   */
  public void finish() {
    Object[] checked = fTree.getCheckboxTreeViewer().getCheckedElements();
    ArrayList<PersistablePluginObject> list = new ArrayList<PersistablePluginObject>();
    for (int i = 0; i < checked.length; i++) {
      String id = ((IPluginModelBase) checked[i]).getPluginBase().getId();
      if (id != null && id.length() > 0) list.add(new PersistablePluginObject(id));
    }
    PersistablePluginObject[] objects = list.toArray(new PersistablePluginObject[list.size()]);

    String workingSetName = fWorkingSetName.getText().trim();
    if (fWorkingSet == null) {
      IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
      fWorkingSet = workingSetManager.createWorkingSet(workingSetName, objects);
    } else {
      fWorkingSet.setName(workingSetName);
      fWorkingSet.setElements(objects);
    }
  }
コード例 #10
0
 /** Gets the model name of the new file */
 @Override
 public String getDescription() {
   return descriptionText.getText();
 }
コード例 #11
0
 /** Gets the model name of the new file */
 public String getModelName() {
   return titleText.getText();
 }
コード例 #12
0
 /** Gets the author of the new file */
 public String getAuthor() {
   return authorText.getText();
 }
コード例 #13
0
 /** Gets the file name of the new file */
 public String getFileName() {
   return fileText.getText();
 }
コード例 #14
0
 /** Gets the container name of the new file */
 public String getContainerName() {
   // TODO user has to select a project otherwise it doesn't work
   return containerText.getText();
 }
コード例 #15
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
  */
 public boolean isPageComplete() {
   if (fNameText.getText().trim().length() == 0) return false;
   return true;
 }