Пример #1
0
  private void switchToRuntimeView() {
    if (isInPerspective(ACTRRuntimePerspective.ID)) return;
    /*
     * query
     */
    IPreferenceStore prefs = RuntimePlugin.getDefault().getPreferenceStore();
    boolean dontAsk = prefs.getBoolean(RuntimePreferences.DONT_ASK_RUN_SWITCH);
    int rtnCode = 2; // yes

    if (!dontAsk) {
      MessageDialogWithToggle mdwt =
          MessageDialogWithToggle.openYesNoQuestion(
              PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
              "Switch to jACT-R Run Perspective?",
              "Models are best inspected using the jACT-R Run perspective. Switch now?",
              "Don't ask again",
              false,
              prefs,
              RuntimePreferences.DONT_ASK_RUN_SWITCH);

      rtnCode = mdwt.getReturnCode();

      if (mdwt.getToggleState()) {
        prefs.setValue(RuntimePreferences.SWITCH_TO_RUN_PERSPECTIVE, rtnCode == 2);
        prefs.setValue(RuntimePreferences.DONT_ASK_RUN_SWITCH, true);
      } else prefs.setValue(RuntimePreferences.DONT_ASK_RUN_SWITCH, false);
    } else if (prefs.getBoolean(RuntimePreferences.SWITCH_TO_RUN_PERSPECTIVE)) rtnCode = 2;
    else rtnCode = 3;

    if (rtnCode == 2) switchToPerspective(ACTRRuntimePerspective.ID);
  }
Пример #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.preference.PreferencePage#performOk()
  */
 @Override
 public boolean performOk() {
   IPreferenceStore store = getPreferenceStore();
   store.setValue(IPreferenceConstants.LINUX_FILE_MANAGER, selectedFileManager);
   store.setValue(IPreferenceConstants.LINUX_FILE_MANAGER_PATH, fileManagerPath.getText());
   return super.performOk();
 }
  /*
   * @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();
  }
 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;
 }
Пример #5
0
  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();
  }
Пример #6
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();
  }
Пример #7
0
  private void switchToDebugView(boolean dueToBreakpoint) {
    if (isInPerspective("org.eclipse.debug.ui.DebugPerspective")) return;

    IPreferenceStore prefs = RuntimePlugin.getDefault().getPreferenceStore();
    boolean dontAsk = prefs.getBoolean(RuntimePreferences.DONT_ASK_DEBUG_SWITCH);
    int rtnCode = 2;

    if (!dontAsk) {
      MessageDialogWithToggle mdwt =
          MessageDialogWithToggle.openYesNoQuestion(
              PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
              dueToBreakpoint
                  ? "Switch to jACT-R Run Perspective?"
                  : "Switch to Debug Perspective?",
              dueToBreakpoint
                  ? "Model breakpoint detected! Switch to debug perspective?"
                  : "Debug models start suspended. To resume, use the Debug Perspective. Switch now?",
              "Don't ask again",
              false,
              prefs,
              RuntimePreferences.DONT_ASK_DEBUG_SWITCH);

      rtnCode = mdwt.getReturnCode();

      if (mdwt.getToggleState()) {
        prefs.setValue(RuntimePreferences.SWITCH_TO_DEBUG_PERSPECTIVE, rtnCode == 2);
        prefs.setValue(RuntimePreferences.DONT_ASK_DEBUG_SWITCH, true);
      } else prefs.setValue(RuntimePreferences.DONT_ASK_DEBUG_SWITCH, false);
    } else if (prefs.getBoolean(RuntimePreferences.SWITCH_TO_DEBUG_PERSPECTIVE)) rtnCode = 2;
    else rtnCode = 3;

    if (rtnCode == 2) switchToPerspective("org.eclipse.debug.ui.DebugPerspective");
  }
 @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 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();
    }
  }
 public void storeHighlight(
     final IPreferenceStore store, final TokenHighlight th, HighlightStyle style) {
   if (store != null) {
     store.setValue(th.getColorKey(), StringConverter.asString(style.getColor()));
     store.setValue(th.getStylesKey(), style.getStyles());
   }
 }
 public void copyTo(IPreferenceStore dest) {
   for (String name : IDjangoPrefs.COLOR_NAMES) {
     dest.setValue(name, this.getString(name));
   }
   for (String name : IDjangoPrefs.STYLE_NAMES) {
     dest.setValue(name, this.getString(name));
   }
 }
  @Override
  protected void performDefaults() {
    store.setValue(VALGRIND_ENABLE, store.getDefaultBoolean(VALGRIND_ENABLE));
    enableButton.setSelection(store.getDefaultBoolean(VALGRIND_ENABLE));

    store.setValue(VALGRIND_PATH, store.getDefaultString(VALGRIND_PATH));
    binText.setText(store.getDefaultString(VALGRIND_PATH));
    super.performDefaults();
  }
  @Before
  public void initializeXMPPcredentials() {

    // XWS uses preferences, so set prefs for XWS
    IPreferenceStore preferences = Activator.getDefault().getPreferenceStore();
    preferences.setValue(PreferenceConstants.P_STRING_JID, jid);
    preferences.setValue(PreferenceConstants.P_STRING_RESOURCE, resource);
    preferences.setValue(PreferenceConstants.P_STRING_PASSWORD, pwd);
    preferences.setValue(PreferenceConstants.P_STRING_SERVER, server);
    preferences.setValue(PreferenceConstants.P_STRING_SERVERPORT, server_port);
  }
 /* (non-Javadoc)
  * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
  */
 public void init(IWorkbench workbench) {
   try {
     PROSActions actions = Activator.getPROSActions();
     IPreferenceStore store = Activator.getDefault().getPreferenceStore();
     store.setValue(
         PreferenceConstants.P_LOCAL_REPOSITORY, actions.getLocalRepositoryPath().toString());
     store.setValue(PreferenceConstants.P_UPDATE_SITE, actions.getUpdateSite().toExternalForm());
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 @Override
 public boolean performOk() {
   prefStore.setValue(PreferenceConstants.BASE_RISK_FACTOR, projectBase.getText());
   for (int i = 0; i < USED_MARKERS.size(); ++i) {
     prefStore.setValue(
         ProblemNameToPreferenceMapper.nameSmellImpact(markers.get(i)),
         impacts.get(i).getSelectionIndex() + 1);
     prefStore.setValue(
         ProblemNameToPreferenceMapper.nameSmellBaseLine(markers.get(i)),
         baselines.get(i).getText());
   }
   return true;
 }
Пример #16
0
 /** Sets all the code folding options to false */
 private void setAllOptions(boolean value) {
   preferences.setValue(PyDevCodeFoldingPrefPage.USE_CODE_FOLDING, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_CLASSDEF, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_COMMENTS, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.INITIALLY_FOLD_COMMENTS, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_FOR, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_FUNCTIONDEF, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_IF, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_IMPORTS, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_STRINGS, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_TRY, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_WHILE, value);
   preferences.setValue(PyDevCodeFoldingPrefPage.FOLD_WITH, value);
 }
Пример #17
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ptp.ui.preferences.AbstractPreferencePage#storeValues()
  */
 @Override
 protected void storeValues() {
   IPreferenceStore store = getPreferenceStore();
   store.setValue(SDMPreferenceConstants.SDM_DEBUG_ENABLED, debugEnabled);
   store.setValue(SDMPreferenceConstants.SDM_DEBUG_LEVEL, debugLevel);
   int index = sdmBackendCombo.getSelectionIndex();
   if (index >= 0) {
     String backend = sdmBackendCombo.getItem(index);
     store.setValue(SDMPreferenceConstants.PREFS_SDM_BACKEND, backend);
     store.setValue(
         SDMPreferenceConstants.PREFS_SDM_BACKEND_PATH + backend, sdmBackendPathText.getText());
     store.setValue(SDMPreferenceConstants.PREFS_SDM_PATH + backend, sdmPathText.getText());
   }
 }
  public void testGetXLintOptions() throws Exception {
    String lint = AspectJPreferences.getLintOptions(project);
    int ind = lint.indexOf("-Xlintfile"); // $NON-NLS-1$
    if (ind == -1) {
      fail(
          "Didn't find -Xlintfile in string returned from AspectJPreferences.getLintOptions(). Got: "
              + lint); //$NON-NLS-1$
    }
    int ind2 = lint.indexOf('\"', ind);
    if (ind2 == -1) {
      fail(
          "Didn't find start quote in string returned from AspectJPreferences.getLintOptions(). Got: "
              + lint); //$NON-NLS-1$
    }
    int ind3 = lint.indexOf('\"', ind2 + 1);
    if (ind3 == -1) {
      fail(
          "Didn't find end quote in string returned from AspectJPreferences.getLintOptions(). Got: "
              + lint); //$NON-NLS-1$
    }
    String fileName = lint.substring(ind2 + 1, ind3);

    // check the file exists
    File file = new File(fileName);
    assertTrue("Xlintfile does not exist: " + file, file.exists()); // $NON-NLS-1$

    // now try to read from it and check for typeNotExposedToWeaver=warning
    boolean gotWarning =
        checkXlintOption(file, "typeNotExposedToWeaver", "warning"); // $NON-NLS-1$ //$NON-NLS-2$
    assertTrue(
        "Did not find typeNotExpostedToWeaver entry set to warning", gotWarning); // $NON-NLS-1$

    boolean isProjectSettings = AspectJPreferences.isUsingProjectSettings(project);
    String original = prefStore.getString(AspectJPreferences.OPTION_ReportTypeNotExposedToWeaver);
    try {
      // change option to ignore
      AspectJPreferences.setUsingProjectSettings(project, false);
      prefStore.setValue(AspectJPreferences.OPTION_ReportTypeNotExposedToWeaver, JavaCore.IGNORE);

      // recheck
      checkXlintOption(file, "typeNotExposedToWeaver", "ignore"); // $NON-NLS-1$ //$NON-NLS-2$
      assertTrue(
          "Did not find typeNotExpostedToWeaver entry set to ignore", gotWarning); // $NON-NLS-1$
    } finally {
      // restore settings
      AspectJPreferences.setUsingProjectSettings(project, isProjectSettings);
      prefStore.setValue(AspectJPreferences.OPTION_ReportTypeNotExposedToWeaver, original);
    }
  }
 /*
  * @see IPreferencePage#performOk()
  */
 public boolean performOk() {
   IPreferenceStore prefs = getPreferenceStore();
   prefs.setValue(PREF_METHOD_RETURNTYPE, fShowMethodReturnType.isSelected());
   //		prefs.setValue(PREF_METHOD_TYPEPARAMETERS, fShowMethodTypeParameters.isSelected());
   prefs.setValue(PREF_CATEGORY, fShowCategory.isSelected());
   prefs.setValue(SHOW_CU_CHILDREN, fShowMembersInPackageView.isSelected());
   //		prefs.setValue(STACK_BROWSING_VIEWS_VERTICALLY, fStackBrowsingViewsVertically.isSelected());
   //		prefs.setValue(PREF_PKG_NAME_PATTERN_FOR_PKG_VIEW, fPackageNamePattern.getText());
   //		prefs.setValue(PREF_COMPRESS_PACKAGE_NAMES, fCompressPackageNames.isSelected());
   prefs.setValue(
       PREF_FOLD_PACKAGES_IN_PACKAGE_EXPLORER, fFoldPackagesInPackageExplorer.isSelected());
   prefs.setValue(PREF_COLORED_LABELS, fShowColoredLabels.isSelected());
   JavaScriptPlugin.getDefault().savePluginPreferences();
   return super.performOk();
 }
 @Override
 public boolean performOk() {
   if (isValid()) {
     boolean enabled = enableButton.getSelection();
     store.setValue(VALGRIND_ENABLE, enabled);
     // Only store path if enabled
     if (enabled) {
       store.setValue(VALGRIND_PATH, binText.getText());
     }
     ValgrindPlugin.getDefault().savePluginPreferences();
     return true;
   } else {
     return false;
   }
 }
Пример #21
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());
 }
Пример #22
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();
 }
  /**
   * 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());
    }
  }
  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);
  }
Пример #25
0
  @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();
      }
    }
  }
Пример #26
0
  /**
   * From diagram URI get Apdl URI. set it to private field.
   *
   * @param diagramFileURI
   */
  public void setAPDLFileName(URI diagramFileURI) {
    IPreferenceStore store = BpwmeDiagramEditorPlugin.getInstance().getPreferenceStore();
    String dot = "\\.";
    String[] names = diagramFileURI.lastSegment().split(dot);
    if (names.length == 2) {
      apdlURI = diagramFileURI.trimFileExtension().appendFileExtension("xml");
      // apdlURI =
      // URI.createFileURI(store.getString(PreferenceConstants.P_APDL_DIR)+names[0]+".xml");
      store.setValue(PreferenceConstants.P_APDL_FILE, apdlURI.toFileString());

      File f = new File(apdlURI.toFileString());
      if (!f.exists()) {

        try {
          f.createNewFile();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }

      IPath location = new Path(f.getAbsolutePath());
      PathEditorInput input = new PathEditorInput(location);
      SimpleEditor.setEditorInput(input);

    } else {
      System.err.println("Error in MainControl.getFileName");
    }
  }
 /* (non-Javadoc)
  * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
  */
 @Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   // just set the preference
   IPreferenceStore store = SketchPlugin.getDefault().getPreferenceStore();
   boolean compactGroups = store.getBoolean(ISketchPluginPreferences.COMPACT_LOOPS_PREFERENCE);
   store.setValue(ISketchPluginPreferences.COMPACT_LOOPS_PREFERENCE, !compactGroups);
   return null;
 }
  @Override
  public boolean performOk() {

    preferencesStoreWB.setValue(wbProp, workbenchPort.getIntegerValue());
    // preferencesStoreWF.setValue(wfProp, workflowPort.getIntegerValue());

    return super.performOk();
  }
Пример #29
0
 /** Save an object to global plugin's preference store. */
 public static void toPreferenceStore(String globalPreferenceKey, Object object) {
   final IPreferenceStore prefStore = WorkbenchCorePlugin.getDefault().getPreferenceStore();
   try {
     prefStore.setValue(globalPreferenceKey, toString(object));
   } catch (IOException e) {
     Utils.logError(e, false);
   }
 }
Пример #30
0
 public void save(final Vector<RGB> initialColors) {
   final StringBuffer value = new StringBuffer();
   for (final RGB rgb : initialColors) {
     value.append(rgb.red + RGB_DELIMITER + rgb.green + RGB_DELIMITER + rgb.blue);
     value.append(RGBS_DELIMITER);
   }
   _store.setValue(CUSTOM_COLORS, value.toString());
 }