Esempio n. 1
0
 /**
  * Finds or creates a dialog settings section that is used to make the dialog control settings
  * persistent
  */
 public IDialogSettings getSettingsSection(IDialogSettings master) {
   IDialogSettings settings = master.getSection(SETTINGS_SECTION);
   if (settings == null) {
     settings = master.addNewSection(SETTINGS_SECTION);
   }
   return settings;
 }
Esempio n. 2
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$
    }
  }
 /**
  * Persist table settings into the give dialog store, prefixed with the given key.
  *
  * @param settings dialog store
  * @param qualifier key qualifier
  */
 public void saveColumnSettings(IDialogSettings settings, String qualifier) {
   int columnCount = fTable.getColumnCount();
   for (int i = 0; i < columnCount; i++) {
     settings.put(qualifier + ".columnWidth" + i, fTable.getColumn(i).getWidth()); // $NON-NLS-1$
   }
   settings.put(qualifier + ".sortColumn", fSortColumn); // $NON-NLS-1$
 }
Esempio n. 4
0
  protected void updatePeriodActions() {
    IActionBars actionBars = getViewSite().getActionBars();

    IMenuManager menuManager = actionBars.getMenuManager();
    if (periodActions != null) {
      for (int i = 0; i < periodActions.length; i++) {
        menuManager.remove(periodActions[i]);
        periodActions[i].dispose();
      }
      periodActions = null;
    }

    createPeriodActions();

    if (periodActions != null) {
      for (int i = 0; i < periodActions.length; i++) {
        menuManager.appendToGroup("periods", periodActions[i]);
      }
    }

    TimeSpan periodTimeSpan = TimeSpan.fromString(dialogSettings.get(K_PERIOD));
    TimeSpan resolutionTimeSpan = TimeSpan.fromString(dialogSettings.get(K_RESOLUTION));
    setPeriodActionSelection(periodTimeSpan, resolutionTimeSpan);

    actionBars.updateActionBars();
  }
 private void storeSettings() {
   if (this.getReturnCode() == OK) {
     IDialogSettings settings = VistAServerPlugin.getDefault().getDialogSettings(this, MAIN);
     String[] globalHistory = this.comboToHistory();
     settings.put(GLOBAL_HISTORY, globalHistory);
   }
 }
Esempio n. 6
0
  @Override
  protected void okPressed() {
    if (!isCommitWithoutFilesAllowed()) {
      MessageDialog.openWarning(
          getShell(),
          UIText.CommitDialog_ErrorNoItemsSelected,
          UIText.CommitDialog_ErrorNoItemsSelectedToBeCommitted);
      return;
    }

    if (!commitMessageComponent.checkCommitInfo()) return;

    Object[] checkedElements = filesViewer.getCheckedElements();
    selectedFiles.clear();
    for (Object obj : checkedElements) selectedFiles.add(((CommitItem) obj).path);

    amending = commitMessageComponent.isAmending();
    commitMessage = commitMessageComponent.getCommitMessage();
    author = commitMessageComponent.getAuthor();
    committer = commitMessageComponent.getCommitter();
    createChangeId = changeIdItem.getSelection();

    IDialogSettings settings = org.eclipse.egit.ui.Activator.getDefault().getDialogSettings();
    settings.put(SHOW_UNTRACKED_PREF, showUntracked);
    CommitMessageHistory.saveCommitHistory(getCommitMessage());
    super.okPressed();
  }
 @Override
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = Activator.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION_NAME);
   if (section == null) section = settings.addNewSection(DIALOG_SETTINGS_SECTION_NAME);
   return section;
 }
Esempio n. 8
0
 /** Saves the widget values */
 private void saveWidgetValues() {
   if (settings != null) {
     RecentHistory<String> recent = new RecentHistory<String>(settings.getArray(WW_RECENT));
     recent.add(url);
     settings.put(WW_RECENT, recent.toArray(new String[recent.size()]));
   }
 }
  /**
   * Saves the state of the filter into the given dialog settings.
   *
   * @param dialogSettings the dialog settings
   */
  public void saveState(final IDialogSettings dialogSettings) {

    if (dialogSettings != null) {
      IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);

      if (settings == null) {
        settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
      }

      settings.put(TAG_ENABLED, this.mEnabled);
      settings.put(TAG_ON_RESOURCE, this.mOnResource);

      if (this.mWorkingSet != null) {
        settings.put(TAG_WORKING_SET, this.mWorkingSet.getName());
      }

      settings.put(TAG_SELECT_BY_SEVERITY, this.mSelectBySeverity);
      settings.put(TAG_SEVERITY, this.mSeverity);

      settings.put(TAG_SELECT_BY_REGEX, this.mFilterByRegex);

      if (this.mFilterRegex != null) {
        settings.put(
            TAG_REGULAR_EXPRESSIONS,
            (String[]) this.mFilterRegex.toArray(new String[this.mFilterRegex.size()]));
      }
    }
  }
Esempio n. 10
0
  private static void restoreState() {
    fgLRUWorkingSets = new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
    IDialogSettings settingsStore = getDialogStoreSection();

    boolean foundLRU = false;
    for (int i = LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
      String[] lruWorkingSetNames = settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES + i);
      if (lruWorkingSetNames != null) {
        Set workingSets = new HashSet(2);
        for (int j = 0; j < lruWorkingSetNames.length; j++) {
          IWorkingSet workingSet =
              PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
          if (workingSet != null) {
            workingSets.add(workingSet);
          }
        }
        foundLRU = true;
        if (!workingSets.isEmpty())
          fgLRUWorkingSets.add(
              (IWorkingSet[]) workingSets.toArray(new IWorkingSet[workingSets.size()]));
      }
    }
    if (!foundLRU)
      // try old preference format
      restoreFromOldFormat();
  }
 public QifBankDownloadImportWizard() {
   IDialogSettings workbenchSettings = QIFPlugin.getDefault().getDialogSettings();
   IDialogSettings section = workbenchSettings.getSection("QifImportWizard"); // $NON-NLS-1$
   if (section == null) {
     section = workbenchSettings.addNewSection("QifImportWizard"); // $NON-NLS-1$
   }
   setDialogSettings(section);
 }
  @Override
  protected void saveSettings() {

    IDialogSettings settings = getDialogSettings();

    settings.put(VIEW_FROM_KEY, VIEW_FROM);
    settings.put(SHOW_DUPLICATES_KEY, showDuplicates);
  }
 /** Constructs the import trace package wizard */
 public ImportTracePackageWizard() {
   IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
   IDialogSettings section = workbenchSettings.getSection(STORE_IMPORT_TRACE_PKG_WIZARD);
   if (section == null) {
     section = workbenchSettings.addNewSection(STORE_IMPORT_TRACE_PKG_WIZARD);
   }
   setDialogSettings(section);
 }
 private void saveSize() {
   if (fCurrentPage instanceof PreviewWizardPage) {
     Control control = fPageContainer.getTopPage();
     Point size = control.getSize();
     fSettings.put(WIDTH, size.x);
     fSettings.put(HEIGHT, size.y);
   }
 }
  private void saveWidgetValues() {
    IDialogSettings settings = this.getDialogSettings();

    if (settings != null) {
      String[] driverPaths = this.jarPaths.toArray(new String[0]);
      settings.put(this.storedDriverClasspathId, driverPaths);
    }
  }
Esempio n. 16
0
 public void saveColumnSettings(final IDialogSettings settings, final String qualifier) {
   int columnCount = table.getColumnCount();
   for (int i = 0; i < columnCount; i++) {
     int width = table.getColumn(i).getWidth();
     settings.put(qualifier + KEY_COLUMN_WIDTH + i, width);
   }
   settings.put(qualifier + KEY_SORT_COLUMN, sortColumn);
 }
  @Override
  public boolean close() {
    final IDialogSettings dialogSettings = getDialogSettings();
    dialogSettings.put(
        SETTINGS_HOST_HISTORY_KEY, fHistoryAddress.toArray(new String[fHistoryAddress.size()]));

    return super.close();
  }
 private void initDialogSettings() {
   IDialogSettings workbenchSettings = SamplesUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = workbenchSettings.getSection(NEWPROJECT_WIZARD);
   if (section == null) {
     section = workbenchSettings.addNewSection(NEWPROJECT_WIZARD);
   }
   setDialogSettings(section);
 }
Esempio n. 19
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
  */
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(SETTINGS_ID);
   if (section == null) {
     section = settings.addNewSection(SETTINGS_ID);
   }
   return section;
 }
Esempio n. 20
0
 public static IDialogSettings getDialogSettings(String dialogId) {
   IDialogSettings workbenchSettings = DBeaverActivator.getInstance().getDialogSettings();
   IDialogSettings section = workbenchSettings.getSection(dialogId);
   if (section == null) {
     section = workbenchSettings.addNewSection(dialogId);
   }
   return section;
 }
Esempio n. 21
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.window.Dialog#getDialogBoundsSettings()
  *
  * @since 3.2
  */
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = IDEWorkbenchPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
   if (section == null) {
     section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
   }
   return section;
 }
Esempio n. 22
0
 /**
  * Gets the dialog settings.
  *
  * @param sectionName The sectionName
  * @return The dialog settings
  */
 public IDialogSettings getDialogSettings(String sectionName) {
   IDialogSettings settings = getDialogSettings();
   IDialogSettings section = settings.getSection(sectionName);
   if (section == null) {
     section = settings.addNewSection(sectionName);
   }
   return section;
 }
Esempio n. 23
0
 /** Saves the state of the widgets on the page */
 void saveWidgetState() {
   IDialogSettings rootsettings = ApiUIPlugin.getDefault().getDialogSettings();
   IDialogSettings settings = rootsettings.getSection(SETTINGS_SECTION);
   if (settings == null) {
     settings = rootsettings.addNewSection(SETTINGS_SECTION);
   }
   settings.put(REPORT_PATH_STATE, getValue());
 }
 /**
  * Returns the dialog settings for this hover or <code>null</code> if none
  *
  * @param create whether to create the settings
  */
 private IDialogSettings getDialogSettings(boolean create) {
   IDialogSettings settings = Activator.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(this.getClass().getName());
   if (section == null & create) {
     section = settings.addNewSection(this.getClass().getName());
   }
   return section;
 }
Esempio n. 25
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
  */
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
   if (section == null) {
     section = settings.addNewSection(getDialogSettingsSectionName());
   }
   return section;
 }
 private int getLastSelectedJREKind() {
   int kind = PROJECT_RE;
   IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings();
   if (settings.get(LAST_SELECTED_JRE_KIND2_KEY) != null) {
     kind = settings.getInt(LAST_SELECTED_JRE_KIND2_KEY);
   }
   return kind;
 }
Esempio n. 27
0
 /**
  * Returns a section in the Erlang plugin's dialog settings. If the section doesn't exist yet, it
  * is created.
  *
  * @param name the name of the section
  * @return the section of the given name
  * @since 3.2
  */
 public IDialogSettings getDialogSettingsSection(final String name) {
   final IDialogSettings dialogSettings = getDialogSettings();
   IDialogSettings section = dialogSettings.getSection(name);
   if (section == null) {
     section = dialogSettings.addNewSection(name);
   }
   return section;
 }
Esempio n. 28
0
 /**
  * Returns the {@link IDialogSettings} for the given id
  *
  * @param id the id of the dialog settings to get
  * @return the {@link IDialogSettings} to pass into the {@link ContainerSelectionDialog}
  * @since 3.6
  */
 IDialogSettings getDialogBoundsSettings(String id) {
   IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(id);
   if (section == null) {
     section = settings.addNewSection(id);
   }
   return section;
 }
 public ErlangProjectImportWizard() {
   super();
   final IDialogSettings workbenchSettings = ErlideUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = workbenchSettings.getSection("FileSystemImportWizard"); // $NON-NLS-1$
   if (section == null) {
     section = workbenchSettings.addNewSection("FileSystemImportWizard"); // $NON-NLS-1$
   }
   setDialogSettings(section);
 }
 /**
  * Initialize the wizard's dialog-settings.<br>
  * Subclasses should override to provide specific initialization.
  */
 protected void initDialogSettings() {
   IDialogSettings workbenchSettings = ProjectsPlugin.getDefault().getDialogSettings();
   IDialogSettings section =
       workbenchSettings.getSection("BasicNewProjectResourceWizard"); // $NON-NLS-1$
   if (section == null) {
     section = workbenchSettings.addNewSection("BasicNewProjectResourceWizard"); // $NON-NLS-1$
   }
   setDialogSettings(section);
 }