private void updateBackendService(
      boolean useAutoDownload, boolean useAutoDelete, String directoryPath) {
    // get backend service
    IBackendService backendService = null;
    backendService = getBackendService();
    if (backendService == null) {
      return;
    }

    try {

      backendService.setCoreDumpLocation(directoryPath);
      backendService.setAutoDownload(useAutoDownload);
      backendService.setAutoDelete(useAutoDelete);

      IPreferenceStore store = getPreferenceStore();
      store.setValue(SystemProperties.BACKEND_AUTO_DELETE_ENABLED, useAutoDelete);
      store.setValue(SystemProperties.BACKEND_AUTO_DOWNLOAD_ENABLED, useAutoDownload);
      if (directoryPath != null) {
        store.setValue(SystemProperties.BACKEND_DOWNLOAD_PATH, directoryPath);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#2
0
 private void scheduleUpdate() {
   // Nothing to do if we don't know what profile we are checking
   if (profileId == null) return;
   IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore();
   // See if automatic search is enabled at all
   if (!pref.getBoolean(PreferenceConstants.PREF_AUTO_UPDATE_ENABLED)) return;
   String schedule = pref.getString(PreferenceConstants.PREF_AUTO_UPDATE_SCHEDULE);
   long delay = IUpdateChecker.ONE_TIME_CHECK;
   long poll = IUpdateChecker.ONE_TIME_CHECK;
   if (!schedule.equals(PreferenceConstants.PREF_UPDATE_ON_STARTUP)) {
     delay = computeDelay(pref);
     poll = computePoll(pref);
   }
   // We do not access the AutomaticUpdater directly when we register
   // the listener. This prevents the UI classes from being started up
   // too soon.
   // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=227582
   listener =
       new IUpdateListener() {
         public void updatesAvailable(UpdateEvent event) {
           AutomaticUpdatePlugin.getDefault().getAutomaticUpdater().updatesAvailable(event);
         }
       };
   checker.addUpdateCheck(profileId, getProfileQuery(), delay, poll, listener);
 }
  /** @generated */
  public static void initDefaults(IPreferenceStore store) {

    String key = ActivityDiagramEditPart.MODEL_ID + "_OutputPin";
    store.setDefault(
        PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 16);
    store.setDefault(
        PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 16);

    Map<String, Boolean> map = getStaticLabelVisibilityPreferences();

    for (String role : map.keySet()) {
      String preferenceName =
          PreferenceConstantHelper.getLabelElementConstant(
              key, role, PreferenceConstantHelper.LABEL_VISIBILITY);
      store.setDefault(preferenceName, map.get(role));
    }

    // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
    // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
    // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
    // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));

    // Set the default for the gradient
    // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
    // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter
    // gradientPreferenceConverter = new
    // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
    //		new org.eclipse.swt.graphics.RGB(255, 255, 255),
    //		new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
    // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());

  }
  public static void migrateToClasspathAttributes() {
    final Map<IPath, String> oldLocations = loadOldForCompatibility();
    if (oldLocations.isEmpty()) {
      IPreferenceStore preferenceStore = PreferenceConstants.getPreferenceStore();
      preferenceStore.setValue(PREF_JAVADOCLOCATIONS, ""); // $NON-NLS-1$
      preferenceStore.setValue(PREF_JAVADOCLOCATIONS_MIGRATED, true);
      return;
    }

    Job job =
        new Job(CorextMessages.JavaDocLocations_migratejob_name) {
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            try {
              IWorkspaceRunnable runnable =
                  new IWorkspaceRunnable() {
                    @Override
                    public void run(IProgressMonitor pm) throws CoreException {
                      updateClasspathEntries(oldLocations, pm);
                      IPreferenceStore preferenceStore = PreferenceConstants.getPreferenceStore();
                      preferenceStore.setValue(PREF_JAVADOCLOCATIONS, ""); // $NON-NLS-1$
                      preferenceStore.setValue(PREF_JAVADOCLOCATIONS_MIGRATED, true);
                    }
                  };
              new WorkbenchRunnableAdapter(runnable).run(monitor);
            } catch (InvocationTargetException e) {
              JavaPlugin.log(e);
            } catch (InterruptedException e) {
              // should not happen, cannot cancel
            }
            return Status.OK_STATUS;
          }
        };
    job.schedule();
  }
  /**
   * initialize the background for a graphical element
   *
   * @param view the element to initialize
   * @param store the preference store
   * @param elementName the name to the element
   */
  public static void initBackgroundFromPrefs(
      View view, final IPreferenceStore store, String elementName) {
    if (!usePreferenceInitializer(view)) {
      return;
    }

    String fillColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_FILL);
    String gradientColorConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.COLOR_GRADIENT);
    String gradientPolicyConstant =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.GRADIENT_POLICY);
    String shadowConstant = getpreferenceKey(view, elementName, PreferenceConstantHelper.SHADOW);
    String elementIcon = getpreferenceKey(view, elementName, PreferenceConstantHelper.ELEMENTICON);
    String qualifiedName =
        getpreferenceKey(view, elementName, PreferenceConstantHelper.QUALIFIEDNAME);

    org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
    ViewUtil.setStructuralFeatureValue(
        view,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));

    FillStyle fillStyle = (FillStyle) view.getStyle(NotationPackage.Literals.FILL_STYLE);
    fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());

    if (store.getBoolean(gradientPolicyConstant)) {
      GradientPreferenceConverter gradientPreferenceConverter =
          new GradientPreferenceConverter(store.getString(gradientColorConstant));
      fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
      fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
    }

    EditingDomain domain = EMFHelper.resolveEditingDomain(view);
    if (domain instanceof TransactionalEditingDomain) {
      TransactionalEditingDomain editingDomain = (TransactionalEditingDomain) domain;
      // shadow
      RecordingCommand shadowcommand =
          AnnotationStyleProvider.getSetShadowCommand(
              editingDomain, view, store.getBoolean(shadowConstant));
      if (shadowcommand.canExecute()) {
        shadowcommand.execute();
      }
      // icon label
      RecordingCommand namelabelIconCommand =
          AnnotationStyleProvider.getSetElementIconCommand(
              editingDomain, view, store.getBoolean(elementIcon));
      if (namelabelIconCommand.canExecute()) {
        namelabelIconCommand.execute();
      }
      // qualified name
      if (!store.getBoolean(qualifiedName)) {
        RecordingCommand qualifiedNameCommand =
            AnnotationStyleProvider.getSetQualifiedNameDepthCommand(editingDomain, view, 1000);
        if (qualifiedNameCommand.canExecute()) {
          qualifiedNameCommand.execute();
        }
      }
    }
  }
 public boolean performFinish() {
   if (addPage.getHostText().length() > 0) {
     String docbroker = "";
     if (addPage.getPortText().length() > 0) {
       docbroker = addPage.getHostText() + Constants.docbrokerToken + addPage.getPortText();
     } else {
       docbroker = addPage.getHostText() + Constants.docbrokerToken + Constants.defaultPort;
     }
     String globalRegistry = null;
     if (addPage.getGlobalRegUsernameText().length() > 0
         && addPage.getGlobalRegUsernameText().length() > 0
         && addPage.getGlobalRegPasswordText().length() > 0) {
       globalRegistry =
           addPage.getGlobalRegRepositoryText()
               + Constants.docbrokerToken
               + addPage.getGlobalRegUsernameText()
               + Constants.docbrokerToken
               + addPage.getGlobalRegPasswordText();
     }
     IPreferenceStore store = Activator.getDefault().getPreferenceStore();
     if (globalRegistry != null) {
       store.setValue(
           Constants.P_DOCBROKERS,
           listItems
               + Constants.docbrokerListToken
               + docbroker
               + Constants.docbrokerToken
               + globalRegistry);
     } else {
       store.setValue(
           Constants.P_DOCBROKERS, listItems + Constants.docbrokerListToken + docbroker);
     }
   }
   return true;
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.presentations.AbstractPresentationFactory#createViewPresentation(org.eclipse.swt.widgets.Composite,
   *      org.eclipse.ui.presentations.IStackPresentationSite)
   */
  public StackPresentation createViewPresentation(Composite parent, IStackPresentationSite site) {

    DefaultTabFolder folder =
        new DefaultTabFolder(
            parent,
            viewTabPosition | SWT.BORDER,
            site.supportsState(IStackPresentationSite.STATE_MINIMIZED),
            site.supportsState(IStackPresentationSite.STATE_MAXIMIZED));

    final IPreferenceStore store = PlatformUI.getPreferenceStore();
    final int minimumCharacters =
        store.getInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS);
    if (minimumCharacters >= 0) {
      folder.setMinimumCharacters(minimumCharacters);
    }

    PresentablePartFolder partFolder = new PresentablePartFolder(folder);

    folder.setUnselectedCloseVisible(false);
    folder.setUnselectedImageVisible(true);

    TabbedStackPresentation result =
        new TabbedStackPresentation(site, partFolder, new StandardViewSystemMenu(site));

    DefaultThemeListener themeListener = new DefaultThemeListener(folder, result.getTheme());
    result.getTheme().addListener(themeListener);

    // RAP [bm]: not needed as tab style does not change
    //		new DefaultSimpleTabListener(result.getApiPreferences(),
    //				IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
    //				folder);
    // RAPEND: [bm]

    return result;
  }
 /** @generated */
 public static void initDefaults(IPreferenceStore store) {
   String key = ActivityDiagramEditPart.MODEL_ID + "_ActivityCN";
   store.setDefault(
       PreferencesConstantsHelper.getElementConstant(key, PreferencesConstantsHelper.WIDTH), 200);
   store.setDefault(
       PreferencesConstantsHelper.getElementConstant(key, PreferencesConstantsHelper.HEIGHT), 100);
   for (String name : compartments) {
     String preferenceName =
         PreferencesConstantsHelper.getCompartmentElementConstant(
             key, name, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
     store.setDefault(preferenceName, true);
   }
   // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
   // org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
   // org.eclipse.jface.preference.PreferenceConverter.setDefault(store,
   // org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0));
   // Set the default for the gradient
   // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.GRADIENT_POLICY),false);
   // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter
   // gradientPreferenceConverter = new
   // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter(
   //		new org.eclipse.swt.graphics.RGB(255, 255, 255),
   //		new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0);
   // store.setDefault(org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
 }
示例#9
0
  @Override
  public void dispose() {
    // store current settings back into preferences
    IPreferenceStore preferenceStore = AnalysisRCPActivator.getDefault().getPreferenceStore();
    String pName = getPartName();
    Integer setting = colourSettings.get(pName);
    if (setting != null)
      preferenceStore.setValue(
          pName + "." + PreferenceConstants.PLOT_VIEW_PLOT2D_COLOURMAP, setting);
    preferenceStore.setValue(
        pName + "." + PreferenceConstants.PLOT_VIEW_PLOT2D_SCALING, (useLog ? 1 : 0));
    deleteIObservers();
    if (histogramPlotter != null) histogramPlotter.cleanUp();
    data = null;
    if (histogramUI != null) {
      histogramUI.deactivate(false);
      histogramUI.dispose();
    }
    if (!cmbAlpha.isDisposed()) cmbAlpha.removeSelectionListener(this);
    if (!cmbRedColour.isDisposed()) cmbRedColour.removeSelectionListener(this);
    if (!cmbGreenColour.isDisposed()) cmbGreenColour.removeSelectionListener(this);
    if (!cmbBlueColour.isDisposed()) cmbBlueColour.removeSelectionListener(this);
    if (!btnGreenInverse.isDisposed()) btnGreenInverse.removeSelectionListener(this);
    if (!btnBlueInverse.isDisposed()) btnBlueInverse.removeSelectionListener(this);
    if (!btnAlphaInverse.isDisposed()) btnAlphaInverse.removeSelectionListener(this);
    if (!btnRedInverse.isDisposed()) btnRedInverse.removeSelectionListener(this);

    super.dispose();
  }
  @Deprecated
  public void promptToAddQuery(TaskRepository taskRepository) {
    IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
    if (!preferenceStore.getBoolean(PREF_ADD_QUERY)) {
      Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialogWithToggle messageDialog =
          MessageDialogWithToggle.openYesNoQuestion(
              shell,
              Messages.AddRepositoryAction_Add_new_query,
              Messages.AddRepositoryAction_Add_a_query_to_the_Task_List,
              Messages.AddRepositoryAction_Do_not_show_again,
              false,
              preferenceStore,
              PREF_ADD_QUERY);
      preferenceStore.setValue(PREF_ADD_QUERY, messageDialog.getToggleState());
      if (messageDialog.getReturnCode() == IDialogConstants.YES_ID) {
        AbstractRepositoryConnectorUi connectorUi =
            TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
        IWizard queryWizard = connectorUi.getQueryWizard(taskRepository, null);
        if (queryWizard instanceof Wizard) {
          ((Wizard) queryWizard).setForcePreviousAndNextButtons(true);
        }

        WizardDialog queryDialog = new WizardDialog(shell, queryWizard);
        queryDialog.create();
        queryDialog.setBlockOnOpen(true);
        queryDialog.open();
      }
    }
  }
示例#11
0
 private void setValuesFrom(Object object) throws CoreException {
   if (object instanceof IPreferenceStore) {
     IPreferenceStore preferences = (IPreferenceStore) object;
     suspendOnFirstLine.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_FIRST_LINE));
     suspendOnExceptions.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_EXCEPTIONS));
     suspendOnErrors.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_ERRORS));
     suspendOnDebuggerKeyword.setSelection(
         preferences.getBoolean(IJSDebugPreferenceNames.SUSPEND_ON_DEBUGGER_KEYWORD));
   } else if (object instanceof ILaunchConfiguration) {
     ILaunchConfiguration configuration = (ILaunchConfiguration) object;
     suspendOnFirstLine.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_FIRST_LINE, false));
     suspendOnExceptions.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_EXCEPTIONS, false));
     suspendOnErrors.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_ERRORS, false));
     suspendOnDebuggerKeyword.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_SUSPEND_ON_DEBUGGER_KEYWORDS, false));
   }
 }
 @Override
 public void afterPage() {
   preferences.setValue(
       IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName(), getAccount().getUUID());
   preferences.setValue(
       IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName(), getPortfolio().getUUID());
 }
  private void preselectDropDowns() {
    // idea: generally one type of document (i.e. from the same bank) will
    // be imported into the same account

    List<Account> activeAccounts = client.getActiveAccounts();
    if (!activeAccounts.isEmpty()) {
      String uuid =
          preferences.getString(IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName());

      // do not trigger selection listener (-> do not user #setSelection)
      primaryAccount
          .getCombo()
          .select(
              IntStream.range(0, activeAccounts.size())
                  .filter(i -> activeAccounts.get(i).getUUID().equals(uuid))
                  .findAny()
                  .orElse(0));
      secondaryAccount.getCombo().select(0);
    }

    List<Portfolio> activePortfolios = client.getActivePortfolios();
    if (!activePortfolios.isEmpty()) {
      String uuid =
          preferences.getString(IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName());
      // do not trigger selection listener (-> do not user #setSelection)
      primaryPortfolio
          .getCombo()
          .select(
              IntStream.range(0, activePortfolios.size())
                  .filter(i -> activePortfolios.get(i).getUUID().equals(uuid))
                  .findAny()
                  .orElse(0));
      secondaryPortfolio.getCombo().select(0);
    }
  }
示例#14
0
 public void initializeDefaultPreferences() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   store.setDefault(
       DiviConfiguration.P_ANNOTATIONS,
       DiviConfiguration.createAnnotationPreference(
           DiviConfiguration.DEFAULT_INJECT_ANNOTATION_ARRAY));
 }
  /**
   * Removes the marker annotation values which are shown on the general Annotations page from the
   * given store and prevents setting the default values in the future.
   *
   * <p>Note: In order to work this method must be called before any call to {@link
   * #initializeDefaultValues(IPreferenceStore)}
   *
   * <p>This method is not part of the API and must only be called by {@link
   * org.eclipse.ui.editors.text.EditorsUI}
   *
   * @param store the preference store to be initialized
   * @throws IllegalStateException if not called by {@link org.eclipse.ui.editors.text.EditorsUI}
   * @since 3.0
   */
  public static void useAnnotationsPreferencePage(IPreferenceStore store)
      throws IllegalStateException {
    checkAccess();

    store.putValue(
        AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE,
        Boolean.toString(true));

    MarkerAnnotationPreferences preferences =
        EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
      AnnotationPreference info = e.next();

      // Only reset annotations shown on Annotations preference page
      if (!info.isIncludeOnPreferencePage() || !isComplete(info)) continue;

      store.setToDefault(info.getTextPreferenceKey());
      store.setToDefault(info.getOverviewRulerPreferenceKey());
      if (info.getVerticalRulerPreferenceKey() != null)
        store.setToDefault(info.getVerticalRulerPreferenceKey());
      store.setToDefault(info.getColorPreferenceKey());
      if (info.getShowInNextPrevDropdownToolbarActionKey() != null)
        store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey());
      if (info.getIsGoToNextNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToNextNavigationTargetKey());
      if (info.getIsGoToPreviousNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToPreviousNavigationTargetKey());
      if (info.getHighlightPreferenceKey() != null)
        store.setToDefault(info.getHighlightPreferenceKey());
      if (info.getTextStylePreferenceKey() != null)
        store.setToDefault(info.getTextStylePreferenceKey());
    }
  }
  /*
   * @see PreferencePage#performDefaults()
   */
  @Override
  protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
      Button button = fCheckBoxes.get(i);
      String key = (String) button.getData();
      button.setSelection(store.getDefaultBoolean(key));
    }
    for (int i = 0; i < fRadioButtons.size(); i++) {
      Button button = fRadioButtons.get(i);
      String[] info = (String[]) button.getData();
      button.setSelection(info[1].equals(store.getDefaultString(info[0])));
    }
    for (int i = 0; i < fTextControls.size(); i++) {
      Text text = fTextControls.get(i);
      String key = (String) text.getData();
      text.setText(store.getDefaultString(key));
    }
    if (fJRECombo != null) {
      fJRECombo.select(store.getDefaultInt(CLASSPATH_JRELIBRARY_INDEX));
    }

    validateFolders();
    super.performDefaults();
  }
示例#17
0
 @Override
 public void initializeDefaultPreferences() {
   IPreferenceStore store = RcpActivator.getDefault().getPreferenceStore();
   store.setDefault(PASSWORD, "");
   store.setDefault(USER, "user");
   store.setDefault(URL, "http://host-adress.web/path/resource");
 }
  /*
   * @see IPreferencePage#performOk()
   */
  @Override
  public boolean performOk() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
      Button button = fCheckBoxes.get(i);
      String key = (String) button.getData();
      store.setValue(key, button.getSelection());
    }
    for (int i = 0; i < fRadioButtons.size(); i++) {
      Button button = fRadioButtons.get(i);
      if (button.getSelection()) {
        String[] info = (String[]) button.getData();
        store.setValue(info[0], info[1]);
      }
    }
    for (int i = 0; i < fTextControls.size(); i++) {
      Text text = fTextControls.get(i);
      String key = (String) text.getData();
      store.setValue(key, text.getText());
    }

    if (fJRECombo != null) {
      store.setValue(CLASSPATH_JRELIBRARY_INDEX, fJRECombo.getSelectionIndex());
    }

    JavaPlugin.flushInstanceScope();
    return super.performOk();
  }
示例#19
0
  public static void show() {
    if (shownInSession) {
      return;
    }
    shownInSession = true;
    if (SharedCorePlugin.inTestMode()) {
      return;
    }
    String hide = System.getProperty("pydev.funding.hide");
    if (hide != null && (hide.equals("1") || hide.equals("true"))) {
      return;
    }
    IPreferenceStore preferenceStore = PydevPrefs.getPreferenceStore();
    boolean shownOnce = preferenceStore.getBoolean(PYDEV_FUNDING_SHOWN);
    if (!shownOnce) {
      boolean runNowIfInUiThread = false;
      RunInUiThread.async(
          new Runnable() {

            @Override
            public void run() {
              Display disp = Display.getCurrent();
              Shell shell = new Shell(disp);
              DialogNotifier notifier = new DialogNotifier(shell);
              notifier.open();
            }
          },
          runNowIfInUiThread);
    }
  }
    public void restoreControl(Control control) {
      IPreferenceStore store = getPreferenceStore();
      if (control == forceConvert) {

        //	if(store.contains(getPreferenceKey()+"."+"forceconvert")){ //MUST NOT USE contains,if
        // false never called this.

        forceConvert.setSelection(store.getBoolean(getPreferenceKey() + "." + "forceconvert"));

      } else if (control == quickCopy) {
        // log.info(getPreferenceKey()+"."+"quickcopy"+"="+store.getBoolean(getPreferenceKey()+"."+"quickcopy"));
        quickCopy.setSelection(store.getBoolean(getPreferenceKey() + "." + "quickcopy"));

      } else if (control == defaultBitrate) {

        String value = store.getString(getPreferenceKey() + "." + "defaultBitrate");

        int s = defaultBitrate.getItemCount();
        for (int i = 0; i < s; i++) {
          if (defaultBitrate.getItem(i).equals(value)) {
            defaultBitrate.select(i);
            break;
          }
        }
      } else if (control == useAvisynth) {
        // log.info(getPreferenceKey()+"."+"quickcopy"+"="+store.getBoolean(getPreferenceKey()+"."+"quickcopy"));
        useAvisynth.setSelection(store.getBoolean(getPreferenceKey() + "." + "useAvisynth"));
      }
    }
示例#21
0
 /**
  * Reloads some layout relevant preferences from the PreferenceStore to include any preference
  * changes made in between.
  */
 private void reloadPrefrences() {
   IPreferenceStore prefs = VersionTreePlugin.getDefault().getPreferenceStore();
   hspacing = prefs.getInt(VersionTreePlugin.PREF_HSPACING);
   vspacing = prefs.getInt(VersionTreePlugin.PREF_VSPACING);
   height = prefs.getInt(VersionTreePlugin.PREF_ELEMENT_HEIGHT);
   width = prefs.getInt(VersionTreePlugin.PREF_ELEMENT_WIDTH);
 }
  /** Initialize semantic highlightings. */
  private void initializeHighlightings() {
    fSemanticHighlightings = SemanticHighlightings.getSemanticHighlightings();
    fHighlightings = new Highlighting[fSemanticHighlightings.length];

    for (int i = 0, n = fSemanticHighlightings.length; i < n; i++) {
      SemanticHighlighting semanticHighlighting = fSemanticHighlightings[i];
      String colorKey = SemanticHighlightings.getColorPreferenceKey(semanticHighlighting);
      addColor(colorKey);

      String boldKey = SemanticHighlightings.getBoldPreferenceKey(semanticHighlighting);
      int style = fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;

      String italicKey = SemanticHighlightings.getItalicPreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(italicKey)) style |= SWT.ITALIC;

      String strikethroughKey =
          SemanticHighlightings.getStrikethroughPreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(strikethroughKey)) style |= TextAttribute.STRIKETHROUGH;

      String underlineKey = SemanticHighlightings.getUnderlinePreferenceKey(semanticHighlighting);
      if (fPreferenceStore.getBoolean(underlineKey)) style |= TextAttribute.UNDERLINE;

      boolean isEnabled =
          fPreferenceStore.getBoolean(
              SemanticHighlightings.getEnabledPreferenceKey(semanticHighlighting));

      fHighlightings[i] =
          new Highlighting(
              new TextAttribute(
                  fColorManager.getColor(PreferenceConverter.getColor(fPreferenceStore, colorKey)),
                  null,
                  style),
              isEnabled);
    }
  }
 /** @generated */
 public Edge createViewTableViewedTables_3002(
     View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
   Edge edge = NotationFactory.eINSTANCE.createEdge();
   edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
   edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
   ArrayList points = new ArrayList(2);
   points.add(new RelativeBendpoint());
   points.add(new RelativeBendpoint());
   bendpoints.setPoints(points);
   edge.setBendpoints(bendpoints);
   ViewUtil.insertChildView(containerView, edge, index, persisted);
   edge.setType(SqlmodelVisualIDRegistry.getType(ViewTableViewedTables2EditPart.VISUAL_ID));
   edge.setElement(null);
   // initializePreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (edgeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     edgeFontStyle.setFontName(fontData.getName());
     edgeFontStyle.setFontHeight(fontData.getHeight());
     edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
   if (routing != null) {
     ViewUtil.setStructuralFeatureValue(
         edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
   }
   return edge;
 }
  /*
   * (non-Javadoc)
   *
   * @see com.ibm.examples.chart.widget.AbstractChartBuilder#buildChart()
   */
  protected void createChart() {
    data = adapter.getData();
    while (data.length == 0) {
      data = adapter.getData();
    }
    IPreferenceStore store = GraphingAPIUIPlugin.getDefault().getPreferenceStore();
    xSeriesTicks = store.getInt(GraphingAPIPreferenceConstants.P_X_SERIES_TICKS);
    ySeriesTicks = store.getInt(GraphingAPIPreferenceConstants.P_Y_SERIES_TICKS);
    maxItems = store.getInt(GraphingAPIPreferenceConstants.P_MAX_DATA_ITEMS);
    viewableItems = store.getInt(GraphingAPIPreferenceConstants.P_VIEWABLE_DATA_ITEMS);

    chart = ChartWithAxesImpl.create();

    chart.setDimension(ChartDimension.TWO_DIMENSIONAL_LITERAL);
    chart.setType("Scatter Chart");

    // Plot
    // chart.getBlock( ).setBackground(ColorDefinitionImpl.WHITE( ) );
    //  Plot p = chart.getPlot( );
    ///  p.getClientArea( ).setBackground(GradientImpl.create( ColorDefinitionImpl.create(
    // 225,225,255 ),ColorDefinitionImpl.create( 255, 255, 225 ),-35,false ) );
    // p.getOutline( ).setVisible( true );
    // Title        cwaBar.getTitle( )                .getLabel()                .getCaption( )
    //           .setValue( "Bar Chart with        Multiple Y Series" );//$NON-NLS-1$
    // Legend
    // Legend lg = cwaBar.getLegend( );
    // lg.getText(
    // ).getFont( ).setSize( 16 );        lg.getInsets( ).set( 10, 5, 0, 0 );
    // lg.setAnchor( Anchor.NORTH_LITERAL );

  }
 @Override
 public void initializeDefaultPreferences() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   store.setDefault(PreferenceConstants.P_CRITERIA_TABLE_ALTERNATIVES_IN_ROWS, true);
   store.setDefault(PreferenceConstants.P_ALTERNATIVES_TABLE_EXPERTS_IN_ROWS, true);
   store.setDefault(PreferenceConstants.P_EXPERTS_TABLE_ALTERNATIVES_IN_ROWS, true);
 }
示例#26
0
 public void addColor(final RGB rgb) {
   final StringBuffer res = new StringBuffer();
   res.append(_store.getString(CUSTOM_COLORS));
   res.append(RGBS_DELIMITER);
   res.append(rgb.red + RGB_DELIMITER + rgb.green + RGB_DELIMITER + rgb.blue);
   _store.setValue(CUSTOM_COLORS, res.toString());
 }
  /**
   * Cache the installed application location and version in the preferences.
   *
   * @param installDir - The directory the application was installed to.
   * @param versionedFileLocation - Can be the URL that we grabbed the installer from, or any other
   *     string that contains a version information in a form of x.y.z.
   * @param appName - The application name (e.g. xampp)
   */
  @SuppressWarnings("unchecked")
  public void cacheVersion(String installDir, String versionedFileLocation, String appName) {

    IPreferenceStore preferenceStore = PortalUIPlugin.getDefault().getPreferenceStore();
    String versions = preferenceStore.getString(IPortalPreferences.CACHED_VERSIONS_PROPERTY_NAME);
    Map<String, Map<String, String>> versionsMap = null;
    if (versions == null || versions.equals(StringUtil.EMPTY)) {
      versionsMap = new HashMap<String, Map<String, String>>();
    } else {
      versionsMap = (Map<String, Map<String, String>>) JSON.parse(versions);
    }
    Map<String, String> appVersionMap = new HashMap<String, String>();
    Version version = VersionUtil.parseVersion(versionedFileLocation);
    if (!VersionUtil.isEmpty(version)) {
      appVersionMap.put(IPortalPreferences.CACHED_VERSION_PROPERTY, version.toString());
      appVersionMap.put(IPortalPreferences.CACHED_LOCATION_PROPERTY, installDir);
      versionsMap.put(appName.toLowerCase(), appVersionMap);
      preferenceStore.setValue(
          IPortalPreferences.CACHED_VERSIONS_PROPERTY_NAME, JSON.toString(versionsMap));
    } else {
      IdeLog.logError(
          PortalUIPlugin.getDefault(),
          MessageFormat.format(
              "Could not cache the location and version for {0}. Install dir: {1}, versionedFileLocation: {2}", //$NON-NLS-1$
              appName, installDir, versionedFileLocation),
          new Exception());
    }
  }
  private void stackTracingWasChanged(boolean enabled) {
    IPreferenceStore store = CxxTestPlugin.getDefault().getPreferenceStore();
    String driverFile = store.getString(CxxTestPlugin.CXXTEST_PREF_DRIVER_FILENAME);

    IExtraOptionsUpdater updater = CxxTestPlugin.getDefault().getExtraOptionsUpdater();

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject[] projects = workspace.getRoot().getProjects();

    for (IProject project : projects) {
      if (!project.isOpen()) {
        continue;
      }

      try {
        if (project.hasNature(CxxTestPlugin.CXXTEST_NATURE)) {
          IFile driver = project.getFile(driverFile);

          if (driver != null) {
            driver.delete(true, null);
          }

          updater.updateOptions(project);
        }
      } catch (CoreException e) {
        e.printStackTrace();
      }
    }
  }
示例#29
0
 public boolean getEngineEnabled(EngineDescriptor desc) {
   IPreferenceStore store = getPreferenceStore();
   String key = getMasterKey(desc.getId());
   if (store.contains(key)) return store.getBoolean(key);
   store.setValue(key, desc.isEnabled());
   return desc.isEnabled();
 }
  public void checkAllNow() {
    // Add all to be tracked
    Map<IInterpreterManager, Map<String, IInterpreterInfo>> addedToTrack = job.addAllToTrack();

    // remove from the preferences any ignore the user had set previously
    Set<Entry<IInterpreterManager, Map<String, IInterpreterInfo>>> entrySet =
        addedToTrack.entrySet();
    IPreferenceStore preferences = PydevPrefs.getPreferences();
    for (Entry<IInterpreterManager, Map<String, IInterpreterInfo>> entry : entrySet) {
      Set<Entry<String, IInterpreterInfo>> entrySet2 = entry.getValue().entrySet();
      for (Entry<String, IInterpreterInfo> entry2 : entrySet2) {
        String key = SynchSystemModulesManager.createKeyForInfo(entry2.getValue());
        preferences.setValue(key, "");
      }
    }
    if (preferences instanceof IPersistentPreferenceStore) {
      IPersistentPreferenceStore iPersistentPreferenceStore =
          (IPersistentPreferenceStore) preferences;
      try {
        iPersistentPreferenceStore.save();
      } catch (IOException e) {
        Log.log(e);
      }
    }

    // schedule changes to be executed.
    job.scheduleLater(0);
  }