@BeforeClass
  public static void init() throws Exception {
    importMavenProject("projects/testDeployableContainer.zip", TEST_PROJECT_NAME);
    JobUtils.waitForIdle(1000);
    IProject project = getProject(TEST_PROJECT_NAME);
    addArquillianSupport(project);
    JobUtils.waitForIdle(1000);
    if (!ArquillianUtility.isValidatorEnabled(project)) {
      IEclipsePreferences prefs =
          new ProjectScope(project).getNode(ArquillianCoreActivator.PLUGIN_ID);
      prefs.putBoolean(ArquillianConstants.TEST_ARQUILLIAN_CONTAINER, true);
      prefs.flush();
    }
    IProjectConfigurationManager configurationManager =
        MavenPlugin.getProjectConfigurationManager();
    ResolverConfiguration configuration = configurationManager.getResolverConfiguration(project);

    configuration.setSelectedProfiles("JBOSS_AS_REMOTE_7.X, JBOSS_AS_MANAGED_7.X");
    boolean isSet = configurationManager.setResolverConfiguration(project, configuration);
    if (isSet) {
      MavenUpdateRequest request = new MavenUpdateRequest(project, true, true);
      configurationManager.updateProjectConfiguration(request, new NullProgressMonitor());
    }

    JobUtils.waitForIdle(1000);
  }
    protected IStatus run(IProgressMonitor monitor) {
      IStatus status = Status.OK_STATUS;
      try {
        IProject[] projects = null;
        /* Changed preferences for a single project, only validate it */
        if (getProject() != null) projects = new IProject[] {getProject()};
        /* Workspace-wide preferences changed */
        else {
          /* Get all of the projects in the workspace */
          projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
          IEclipsePreferences prefs = null;
          List projectList = new ArrayList();

          /* Filter out projects that use project-specific settings or have been closed */
          for (int i = 0; i < projects.length; i++) {
            prefs = new ProjectScope(projects[i]).getNode(getPreferenceNodeQualifier());
            if (projects[i].isAccessible() && !prefs.getBoolean(getProjectSettingsKey(), false))
              projectList.add(projects[i]);
          }
          projects = (IProject[]) projectList.toArray(new IProject[projectList.size()]);
        }
        fValidation.validate(projects, true, false, monitor);
      } catch (CoreException ce) {
        status = Status.CANCEL_STATUS;
      }

      return status;
    }
  /**
   * Get the {@link ProgrammerConfig} with the given ID.
   *
   * <p>If the config has been requested before, a reference to the config in the internal cache is
   * returned. All modifications to the returned config will affect the config in the cache.
   *
   * <p>While these changes are only persisted when saveConfig() is called, it is usually better to
   * use the {@link #getConfigEditable(ProgrammerConfig)} call to get a safely modifiable config.
   *
   * @see #getConfigEditable(ProgrammerConfig)
   * @param id <code>String</code> with an ID value.
   * @return The requested <code>ProgrammerConfig</code> or <code>null</code> if no config with the
   *     given ID exists.
   */
  public ProgrammerConfig getConfig(String id) {

    // Test for empty / null id
    if (id == null) return null;
    if (id.length() == 0) return null;

    // Test if the config is already in the cache
    if (fConfigsCache.containsKey(id)) {
      return fConfigsCache.get(id);
    }

    // The config was not in the cache

    // The node must exist, otherwise return null
    try {

      if (!fPreferences.nodeExists(id)) {
        return null;
      }
    } catch (BackingStoreException bse) {
      // TODO What shall we do if we can't access the Preferences?
      // For now log an error and return null.
      logException(bse);
      return null;
    }

    // Load the Config from the Preferences
    Preferences cfgprefs = fPreferences.node(id);
    ProgrammerConfig config = new ProgrammerConfig(id, cfgprefs);

    fConfigsCache.put(id, config);

    return config;
  }
 /**
  * Read prefs to determine if this structure is dirty. Default is TRUE.
  *
  * @return
  */
 public static boolean isDirtyInPreference(StructureType structure, IProject project) {
   IEclipsePreferences node =
       new InstanceScope().getNode(net.bioclipse.qsar.ui.Activator.PLUGIN_ID);
   //        System.out.println(" READ PREFERENCE: " + project.getName()+"_"+structure.getId() +" =
   // " + node.getBoolean( project.getName()+"_"+structure.getId(), true));
   return node.getBoolean(project.getName() + "_" + structure.getId(), true);
 }
  public static String getBuildTime(IProject project) {

    // If exists in prefs, add them
    IEclipsePreferences node =
        new InstanceScope().getNode(net.bioclipse.qsar.ui.Activator.PLUGIN_ID);
    return node.get(project.getName() + "_time", "N/A");
  }
  public static void setBuildTime(IProject project, String time) {

    // If exists in prefs, add them
    IEclipsePreferences node =
        new InstanceScope().getNode(net.bioclipse.qsar.ui.Activator.PLUGIN_ID);
    node.put(project.getName() + "_time", time);
  }
  private void initFromPrefs() {
    IPreferenceStore editorPreferences = EditorsPlugin.getDefault().getPreferenceStore();
    IPreferenceStore toolsPreferences = PreferenceConstants.getPreferenceStore();

    lineNumbersCheck.setSelection(
        editorPreferences.getBoolean(
            AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
    printMarginCheck.setSelection(DartFormatter.getMaxLineLengthEnabled());
    printMarginText.setText(DartFormatter.getMaxLineLength());
    printMarginText.setEnabled(printMarginCheck.getSelection());

    enableAutoCompletion.setSelection(
        toolsPreferences.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION));
    if (!DartCoreDebug.ENABLE_ANALYSIS_SERVER) {
      enableFolding.setSelection(
          toolsPreferences.getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED));
    }
    removeTrailingWhitespaceCheck.setSelection(
        toolsPreferences.getBoolean(PreferenceConstants.EDITOR_REMOVE_TRAILING_WS));
    formatCheck.setSelection(
        toolsPreferences.getBoolean(PreferenceConstants.EDITOR_FORMAT_ON_SAVES));

    IEclipsePreferences prefs = DartCore.getPlugin().getPrefs();
    if (prefs != null) {
      runPubAutoCheck.setSelection(prefs.getBoolean(DartCore.PUB_AUTO_RUN_PREFERENCE, true));
      enableAnalysisServerButton.setSelection(
          prefs.getBoolean(DartCoreDebug.ENABLE_ANALYSIS_SERVER_PREF, true));
    }
  }
  private void PreProcessing(String projectName) {
    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(Constants.BUNDLE_NAME);
    String fileName = prefs.get("LTiEFileName", null);
    java.io.File f = new java.io.File(fileName + projectName + ".MTD");
    if (!f.exists()) {
      String id = "default";
      String UNCTime;
      Calendar calendar = Calendar.getInstance();
      if (fileName != null) {
        int index = fileName.indexOf('_');
        int index2 = fileName.indexOf('_', index + 1);
        UNCTime = fileName.substring(index2 + 1, fileName.length() - 1);
        id = fileName.substring(index + 1, index2);
        calendar.setTimeInMillis(Long.parseLong(UNCTime));
      }

      try {
        PrintStream p = new PrintStream(f);
        p.print(CreateStartOfSessionString(calendar, id, projectName));
        p.close();
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      }
    }
  }
Exemple #9
0
 @Override
 public void earlyStartup() {
   IEclipsePreferences pref = ConfigurationScope.INSTANCE.getNode(this.getClass().getName());
   if (pref.getBoolean(CFG_SHOW_PERSPECTIVE_KEY, true)) {
     pref.putBoolean(CFG_SHOW_PERSPECTIVE_KEY, false);
     try {
       pref.flush();
     } catch (BackingStoreException e) {
       Activator.error(e);
     }
     final IWorkbench workbench = PlatformUI.getWorkbench();
     workbench
         .getDisplay()
         .asyncExec(
             new Runnable() {
               public void run() {
                 IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
                 if (window != null && window.getActivePage() != null) {
                   IPerspectiveDescriptor desc =
                       PlatformUI.getWorkbench()
                           .getPerspectiveRegistry()
                           .findPerspectiveWithId(TYPESCRIPT_PERSPECTIVE_ID);
                   window.getActivePage().setPerspective(desc);
                 }
               }
             });
   }
 }
Exemple #10
0
  private void savePrefs(final SelectedRepos repos) {
    if (fREnv.getConfig() == null) {
      return;
    }
    final IScopeContext prefs = InstanceScope.INSTANCE;

    final IEclipsePreferences node = prefs.getNode(fSelectedReposPref.getQualifier());

    PreferencesUtil.setPrefValue(node, fSelectedReposPref, repos.getRepos());
    PreferencesUtil.setPrefValue(node, fSelectedCRANPref, repos.getCRANMirror());
    PreferencesUtil.setPrefValue(node, fBioCVersionPref, repos.getBioCVersion());
    PreferencesUtil.setPrefValue(node, fSelectedBioCPref, repos.getBioCMirror());

    if (repos.getCRANMirror() != null) {
      PreferencesUtil.setPrefValue(prefs, LAST_CRAN_PREF, repos.getCRANMirror());
    }
    if (repos.getBioCMirror() != null) {
      PreferencesUtil.setPrefValue(prefs, LAST_BIOC_PREF, repos.getBioCMirror());
    }

    try {
      node.flush();
    } catch (final BackingStoreException e) {
      RCorePlugin.log(
          new Status(
              IStatus.ERROR,
              RCore.PLUGIN_ID,
              "An error occurred when saving the R package manager preferences.",
              e));
    }
  }
  /**
   * If modified, also modify the method {@link ModelManager#getDefaultOptionsNoInitialization()}
   */
  @Override
  public void initializeDefaultPreferences() {
    // Get options names set
    HashSet<String> optionNames = ModelManager.getModelManager().optionNames;

    Map<String, String> defaultOptionsMap = new HashMap<String, String>();

    // DLTKCore settings
    defaultOptionsMap.put(DLTKCore.CORE_INCOMPLETE_BUILDPATH, DLTKCore.ERROR);
    defaultOptionsMap.put(DLTKCore.CORE_CIRCULAR_BUILDPATH, DLTKCore.ERROR);
    defaultOptionsMap.put(DLTKCore.CORE_ENABLE_BUILDPATH_EXCLUSION_PATTERNS, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.INDEXER_ENABLED, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.BUILDER_ENABLED, DLTKCore.ENABLED);
    defaultOptionsMap.put(DLTKCore.CODEASSIST_CAMEL_CASE_MATCH, DLTKCore.ENABLED);

    // encoding setting comes from resource plug-in
    optionNames.add(DLTKCore.CORE_ENCODING);

    // project-specific options
    optionNames.add(DLTKCore.PROJECT_SOURCE_PARSER_ID);

    // Store default values to default preferences
    IEclipsePreferences defaultPreferences = new DefaultScope().getNode(DLTKCore.PLUGIN_ID);
    for (Map.Entry<String, String> entry : defaultOptionsMap.entrySet()) {
      String optionName = entry.getKey();
      defaultPreferences.put(optionName, entry.getValue());
      optionNames.add(optionName);
    }
  }
Exemple #12
0
  /**
   * Check if model version is changed and rebuild PHP projects if necessary.
   *
   * @see PHPCoreConstants.STRUCTURE_VERSION
   */
  private void rebuildProjects() {
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(ID);
    String modelVersion = preferences.get(PHPCoreConstants.STRUCTURE_VERSION_PREFERENCE, null);
    if (PHPCoreConstants.STRUCTURE_VERSION.equals(modelVersion)) {
      return;
    }

    preferences.put(
        PHPCoreConstants.STRUCTURE_VERSION_PREFERENCE, PHPCoreConstants.STRUCTURE_VERSION);
    try {
      preferences.flush();
    } catch (BackingStoreException e1) {
      Logger.logException(e1);
    }

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject[] projects = workspace.getRoot().getProjects();
    if (workspace.isAutoBuilding()) {
      try {
        for (IProject project : projects) {
          if (PHPToolkitUtil.isPhpProject(project)) {
            project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
          }
        }
      } catch (CoreException e) {
        Logger.logException(e);
      }
    }
  }
Exemple #13
0
  private IProject initializeWorkspace() {
    IEclipsePreferences node = new InstanceScope().getNode(ResourcesPlugin.PI_RESOURCES);
    node.putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, true);
    try {
      node.flush();
    } catch (BackingStoreException e) {
      e.printStackTrace();
    }

    WorkspaceJob job =
        new WorkspaceJob("init workspace") {

          @Override
          public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
            MyPart.this.project =
                TwitterContentUtil.getOrCreateTwitterDemoProject(workspace, monitor);
            return Status.OK_STATUS;
          }
        };

    job.setRule(workspace.getRoot());
    job.schedule();

    return TwitterContentUtil.getTwitterDemoProject(workspace);
  }
  private void storeViewPaneVisibility() {
    fVisibleViewPanes.clear();
    StringBuffer visibleViewPanes = new StringBuffer();

    Enumeration<String> enumeration = fViewPaneControls.keys();

    while (enumeration.hasMoreElements()) {
      String paneId = enumeration.nextElement();

      Control control = fViewPaneControls.get(paneId);
      if (control.isVisible()) {
        visibleViewPanes.append(paneId);
        visibleViewPanes.append(","); // $NON-NLS-1$
        fVisibleViewPanes.add(paneId);
      }
    }
    IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
    if (node != null) {
      try {
        node.put(getVisibilityPrefId(), visibleViewPanes.toString());
        node.flush();
      } catch (BackingStoreException e) {
        DebugUIPlugin.log(e);
      }
    }
  }
 @SuppressWarnings("unchecked")
 @Override
 protected void doPut(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   traceRequest(req);
   IEclipsePreferences node = getNode(req, resp, true);
   if (node == null) return;
   String key = req.getParameter("key");
   try {
     if (key != null) {
       node.put(key, req.getParameter("value"));
     } else {
       JSONObject newNode = new JSONObject(new JSONTokener(req.getReader()));
       node.clear();
       for (Iterator<String> it = newNode.keys(); it.hasNext(); ) {
         key = it.next();
         node.put(key, newNode.getString(key));
       }
     }
     prefRoot.flush();
     resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
   } catch (Exception e) {
     handleException(
         resp, NLS.bind("Failed to store preferences for {0}", req.getRequestURL()), e);
     return;
   }
 }
  /**
   * Set all the processor options in one call. This will delete any options that are not passed in,
   * so callers who do not wish to destroy pre-existing options should use addProcessorOption()
   * instead.
   *
   * @param options a map of keys to values. The keys should not include any automatic options (@see
   *     #isAutomaticProcessorOption(String)), and the "-A" should not be included. That is, to
   *     perform the equivalent of the apt command line "-Afoo=bar", use the key "foo" and the value
   *     "bar". Keys cannot contain spaces; values can contain anything at all. Keys cannot be null,
   *     but values can be.
   */
  public static void setProcessorOptions(Map<String, String> options, IJavaProject jproj) {
    IScopeContext context =
        (null != jproj) ? new ProjectScope(jproj.getProject()) : InstanceScope.INSTANCE;

    // TODO: this call is needed only for backwards compatibility with
    // settings files previous to 2005.11.13.  At some point it should be
    // removed.
    removeOldStyleSettings(context);

    IEclipsePreferences node =
        context.getNode(
            AptPlugin.PLUGIN_ID
                + "/"
                + //$NON-NLS-1$
                AptPreferenceConstants.APT_PROCESSOROPTIONS);
    try {
      node.clear();
      for (Entry<String, String> option : options.entrySet()) {
        String nonNullVal =
            option.getValue() == null ? AptPreferenceConstants.APT_NULLVALUE : option.getValue();
        node.put(option.getKey(), nonNullVal);
      }
      node.flush();
    } catch (BackingStoreException e) {
      AptPlugin.log(e, "Unable to save annotation processor options"); // $NON-NLS-1$
    }
  }
  public static void checkCurrentOptionsVersion() {
    PreferencesAccess access = PreferencesAccess.getOriginalPreferences();
    ProfileVersioner profileVersioner = new ProfileVersioner();

    IScopeContext instanceScope = access.getInstanceScope();
    IEclipsePreferences uiPreferences = instanceScope.getNode(JavaUI.ID_PLUGIN);
    int version = uiPreferences.getInt(PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, 0);
    if (version >= profileVersioner.getCurrentVersion()) {
      return; // is up to date
    }
    try {
      List<Profile> profiles =
          (new FormatterProfileStore(profileVersioner)).readProfiles(instanceScope);
      if (profiles == null) {
        profiles = new ArrayList<Profile>();
      }
      ProfileManager manager =
          new FormatterProfileManager(profiles, instanceScope, access, profileVersioner);
      if (manager.getSelected() instanceof CustomProfile) {
        manager.commitChanges(instanceScope); // updates JavaCore options
      }
      uiPreferences.putInt(
          PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, profileVersioner.getCurrentVersion());
      savePreferences(instanceScope);
    } catch (CoreException e) {
      JavaPlugin.log(e);
    } catch (BackingStoreException e) {
      JavaPlugin.log(e);
    }
  }
  /**
   * This test ensures that any previously set project settings are not overwritten if say so, but
   * they are as default.
   *
   * @throws Exception
   */
  public void testSetUsingProjectSettings2() throws Exception {

    assertFalse(
        "by default, should not be using project compiler settings", //$NON-NLS-1$
        AspectJPreferences.isUsingProjectSettings(project));

    projectNode.putBoolean(AspectJPreferences.OPTION_XHasMember, true);

    AspectJPreferences.setUsingProjectSettings(project, true, false);
    boolean b1 = projectNode.getBoolean(AspectJPreferences.OPTION_XHasMember, false);
    assertTrue("should not have reset OPTION_XHasMember to default", b1); // $NON-NLS-1$

    AspectJPreferences.setUsingProjectSettings(project, true);
    b1 = projectNode.getBoolean(AspectJPreferences.OPTION_XHasMember, false);
    assertFalse("should have reset OPTION_XHasMember to default", b1); // $NON-NLS-1$

    AspectJPreferences.setUsingProjectSettings(project, false);
    try {
      projectNode.keys();
      projectNode.getBoolean(AspectJPreferences.OPTION_XHasMember, false);
      fail("Should have thrown an exception.  There should be no project settings"); // $NON-NLS-1$
    } catch (IllegalStateException e) {
      // we expect this exception because setting "use project settings" to false
      // should clear all keys and consequently throw this exception.
    }
  }
  public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException {
    IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
    IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
    String encodedMappings = node.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null);
    if (encodedMappings == null) {
      encodedMappings = defaultNode.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null);
    }
    WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration();

    if (encodedMappings == null || encodedMappings.length() == 0) {
      return config;
    }

    // The mappings are encoded as XML in a String so we need to parse it.
    InputSource input = new InputSource(new StringReader(encodedMappings));
    try {
      Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input);
      config.setWorkspaceMappings(decodeContentTypeMappings(document.getDocumentElement()));
      return config;
    } catch (SAXException e) {
      throw new CoreException(Util.createStatus(e));
    } catch (IOException e) {
      throw new CoreException(Util.createStatus(e));
    } catch (ParserConfigurationException e) {
      throw new CoreException(Util.createStatus(e));
    }
  }
  @Override
  public boolean performOk() {
    // Preferences preferences = Activator.getDefault().getPluginPreferences();

    // InstanceScope is = new InstanceScope();

    final IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);

    if (toolGroups != null) {
      for (final BinDirPanel toolGroup : toolGroups) {
        preferences.put(
            IToolLaunchConfigurationConstants.TOOL_BIN_ID + "." + toolGroup.group,
            toolGroup.binDir.getText()); // $NON-NLS-1$
      }
    }

    try {
      preferences.flush();
    } catch (final BackingStoreException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // Activator.getDefault().savePluginPreferences();
    return true;
  }
  public void storeMappings(WorkspaceLanguageConfiguration config) throws CoreException {
    try {
      // Encode mappings as XML and serialize as a String.
      Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
      Element rootElement = doc.createElement(WORKSPACE_MAPPINGS);
      doc.appendChild(rootElement);
      addContentTypeMappings(config.getWorkspaceMappings(), rootElement);
      Transformer serializer = createSerializer();
      DOMSource source = new DOMSource(doc);
      StringWriter buffer = new StringWriter();
      StreamResult result = new StreamResult(buffer);
      serializer.transform(source, result);
      String encodedMappings = buffer.getBuffer().toString();

      IEclipsePreferences node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
      node.put(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings);
      node.flush();
    } catch (ParserConfigurationException e) {
      throw new CoreException(Util.createStatus(e));
    } catch (TransformerException e) {
      throw new CoreException(Util.createStatus(e));
    } catch (BackingStoreException e) {
      throw new CoreException(Util.createStatus(e));
    }
  }
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   traceRequest(req);
   IEclipsePreferences node = getNode(req, resp, false);
   if (node == null) return;
   String key = req.getParameter("key");
   try {
     // if a key is specified write that single value, otherwise write the entire node
     JSONObject result = null;
     if (key != null) {
       String value = node.get(key, null);
       if (value == null) {
         handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
         return;
       }
       result = new JSONObject().put(key, value);
     } else result = toJSON(req, node);
     writeJSONResponse(req, resp, result);
   } catch (Exception e) {
     handleException(
         resp, NLS.bind("Failed to retrieve preferences for path {0}", req.getPathInfo()), e);
     return;
   }
 }
 /** Serializes a preference node as a JSON object. */
 private JSONObject toJSON(HttpServletRequest req, IEclipsePreferences node)
     throws JSONException, BackingStoreException {
   JSONObject result = new JSONObject();
   // TODO Do we need this extra information?
   //		String nodePath = node.absolutePath();
   //		result.put("path", nodePath);
   //		JSONObject children = new JSONObject();
   //		for (String child : node.childrenNames())
   //			children.put(child, createQuery(req, "/prefs" + nodePath + '/' + child));
   //		result.put("children", children);
   //		JSONObject values = new JSONObject();
   for (String key : node.keys()) {
     String valueString = node.get(key, null);
     Object value = null;
     if (valueString != null) {
       try {
         // value might be serialized JSON
         value = new JSONObject(valueString);
       } catch (JSONException e) {
         // value must be a string
         value = valueString;
       }
     }
     result.put(key, value);
   }
   return result;
 }
    private void launchDialog(
        final IServer server, AS7DeploymentScannerUtility.Scanner[] scanners) {
      ModifyDeploymentScannerIntervalDialog d =
          new ModifyDeploymentScannerIntervalDialog(
              server, scanners, Display.getDefault().getActiveShell());
      int ret = d.open();

      final AS7DeploymentScannerUtility.Scanner[] changedArray = d.getChangedScanners();
      boolean neverAskAgainSetting = d.getAskAgainSelection();

      if (neverAskAgainSetting) {
        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(JBossServerUIPlugin.PLUGIN_ID);
        prefs.putBoolean(AS7_IGNORE_ZERO_INTERVAL_SCANNER_SETTING, true);
        try {
          prefs.flush();
        } catch (BackingStoreException e) {
        }
      }

      if (ret == Window.OK && changedArray.length > 0) {
        new Job(Messages.DeploymentScannerUpdateJobTitle) {
          protected IStatus run(IProgressMonitor monitor) {
            return updateServersScanners(server, changedArray);
          }
        }.schedule();
      }
    }
Exemple #25
0
 public void setPreference(IEclipsePreferences preferences, String key, List<String> vals) {
   if (preferences == null) {
     preferences = getProjectOrWorkspacePreferences(null);
   }
   String concat;
   if (vals == null) {
     concat = "";
   } else {
     // we should escape all ',' that happen to exist in the string, but
     // these should not be here since the strings were validated on entry
     StringBuilder sb = new StringBuilder();
     for (Iterator<String> valIter = vals.iterator(); valIter.hasNext(); ) {
       sb.append(valIter.next());
       if (valIter.hasNext()) {
         sb.append(",");
       }
     }
     concat = sb.toString();
   }
   preferences.put(key, concat);
   try {
     preferences.flush();
   } catch (BackingStoreException e) {
     Util.log(e);
   }
 }
 /** {@inheritDoc} */
 @Override
 public void initializeDefaultPreferences() {
   final IEclipsePreferences prefs = new DefaultScope().getNode(Activator.getPluginId());
   prefs.put(PreferenceConstants.DATABASE_URL, "");
   prefs.put(PreferenceConstants.DATABASE_USER, "");
   prefs.put(PreferenceConstants.DATABASE_PASSWORD, "");
   prefs.put(PreferenceConstants.META_DATA_DIRECTORY, "./var/tables");
 }
 @Override
 public void updateElement(
     final UIElement element, @SuppressWarnings("rawtypes") final Map parameters) {
   final IEclipsePreferences prefsNode = ErlangOutlinePage.getPrefsNode();
   final String filterId = (String) parameters.get("org.erlide.ui.filterId");
   final boolean value = prefsNode.getBoolean(filterId, false);
   element.setChecked(value);
 }
Exemple #28
0
 public String getGroovyCompilerLevel(IProject project) {
   IEclipsePreferences projectPreferences = getProjectScope(project);
   if (projectPreferences != null) {
     return projectPreferences.get(GROOVY_COMPILER_LEVEL, null);
   } else {
     return null;
   }
 }
 /**
  * Writes the value of the CONFIGURED attribute.
  *
  * @param value the value to set
  */
 private static void writeConfiguredAttribute(String value) {
   IEclipsePreferences rootNode =
       InstanceScope.INSTANCE.getNode(
           FrameworkUtil.getBundle(WorkspaceConfigurationStatusUtil.class).getSymbolicName());
   if (rootNode != null) {
     rootNode.put(WorkspaceConfigurationConstants.CONFIG_CONFIGURED, value);
   }
 }
 public static ToolEnablementPreferences getPreferences(IProject project) {
   IEclipsePreferences rootNode = Platform.getPreferencesService().getRootNode();
   Preferences prefs =
       rootNode
           .node(ProjectScope.SCOPE)
           .node(project.getName())
           .node("org.eclipse.bpmn2.modeler.tools");
   return new ToolEnablementPreferences(prefs);
 }