コード例 #1
0
  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);
    }
  }
コード例 #2
0
ファイル: Command.java プロジェクト: lucdono/xbladecopter
 public static void updateFromPreferences() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   if (rollMax != null && !rollMax.isDisposed())
     rollMax.setText(store.getString(PreferenceConstants.P_CMD_ROLL));
   if (pitchMax != null && !pitchMax.isDisposed())
     pitchMax.setText(store.getString(PreferenceConstants.P_CMD_PITCH));
 }
コード例 #3
0
 public void initFrom(IPreferenceStore from) {
   for (String name : IDjangoPrefs.COLOR_NAMES) {
     this.setDefault(name, from.getString(name));
   }
   for (String name : IDjangoPrefs.STYLE_NAMES) {
     this.setDefault(name, from.getString(name));
   }
 }
コード例 #4
0
 public void refresh() throws Exception {
   components.clear();
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   String model_process = store.getString(SnakerPreferencePage.MODEL_PROCESS);
   String model_form = store.getString(SnakerPreferencePage.MODEL_FORM);
   load(getResource(model_process, MODEL_PROCESS));
   load(getResource(model_form, MODEL_FORM));
 }
コード例 #5
0
ファイル: Preferences.java プロジェクト: shikexue/eclipseonut
 public static String ws() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   return store.getString(WS.key)
       + "://"
       + store.getString(HOST.key)
       + ":"
       + store.getInt(WS_PORT.key);
 }
コード例 #6
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.
   * debug.core.ILaunchConfigurationWorkingCopy)
   */
  @Override
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
    IPreferenceStore store = PreferenceConstants.getPreferenceStore(null);

    configuration.setAttribute(GENERATE_ABI, store.getBoolean(GENERATE_ABI));
    configuration.setAttribute(GENERATE_MARKDOWN, store.getBoolean(GENERATE_MARKDOWN));
    configuration.setAttribute(GENERATION_TARGET_DOC, store.getString(GENERATION_TARGET_DOC));
    configuration.setAttribute(GENERATE_ABI_TARGET, store.getString(GENERATE_ABI_TARGET));
  }
コード例 #7
0
ファイル: FileHandler.java プロジェクト: mitschke/vespucci
  /**
   * Set the output behavior as it is configured in the properties page
   *
   * @throws FileNotFoundException
   */
  private void configOutput() throws FileNotFoundException {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    saveGlobal = !store.getBoolean(PreferenceConstants.P_SAVE_PER_PROJECT);
    globalPath = store.getString(PreferenceConstants.P_ABSOLUTE_PATH);
    projectPath = store.getString(PreferenceConstants.P_PROJECT_RELATIV_PATH);

    if (saveGlobal && !new File(globalPath).exists()) {
      throw new FileNotFoundException(Activator.PLUGIN_ID + ": Global output dir does not exist");
    }
  }
コード例 #8
0
ファイル: SDMPreferencePage.java プロジェクト: eclipse/ptp
 private void updateValues() {
   IPreferenceStore store = getPreferenceStore();
   int idx = sdmBackendCombo.getSelectionIndex();
   if (idx >= 0) {
     String backend = sdmBackendCombo.getItem(idx);
     sdmPathText.setText(store.getString(SDMPreferenceConstants.PREFS_SDM_PATH + backend));
     sdmBackendPathText.setText(
         store.getString(SDMPreferenceConstants.PREFS_SDM_BACKEND_PATH + backend));
   }
 }
コード例 #9
0
  private List getCategories(List elements) {
    IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore();
    String preference = store.getString(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
    Set disabled = new HashSet();
    StringTokenizer tok = new StringTokenizer(preference, "\0"); // $NON-NLS-1$
    while (tok.hasMoreTokens()) {
      disabled.add(tok.nextToken());
    }
    Map ordered = new HashMap();
    preference = store.getString(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
    tok = new StringTokenizer(preference, "\0"); // $NON-NLS-1$
    while (tok.hasMoreTokens()) {
      StringTokenizer inner = new StringTokenizer(tok.nextToken(), ":"); // $NON-NLS-1$
      String id = inner.nextToken();
      int rank = Integer.parseInt(inner.nextToken());
      ordered.put(id, new Integer(rank));
    }

    List categories = new ArrayList();
    for (Iterator iter = elements.iterator(); iter.hasNext(); ) {
      IConfigurationElement element = (IConfigurationElement) iter.next();
      try {
        if (element.getName().equals("proposalCategory")) { // $NON-NLS-1$
          iter.remove(); // remove from list to leave only computers

          CompletionProposalCategory category = new CompletionProposalCategory(element, this);
          categories.add(category);
          category.setIncluded(!disabled.contains(category.getId()));
          Integer rank = (Integer) ordered.get(category.getId());
          if (rank != null) {
            int r = rank.intValue();
            boolean separate = r < 0xffff;
            category.setSeparateCommand(separate);
            category.setSortOrder(r);
          }
        }
      } catch (InvalidRegistryObjectException x) {
        /*
         * Element is not valid any longer as the contributing plug-in was unloaded or for some
         * other reason. Do not include the extension in the list and inform the user about it.
         */
        Object[] args = {element.toString()};
        String message =
            Messages.format(
                DartTextMessages.CompletionProposalComputerRegistry_invalid_message, args);
        IStatus status =
            new Status(IStatus.WARNING, DartToolsPlugin.getPluginId(), IStatus.OK, message, x);
        informUser(status);
      }
    }
    return categories;
  }
コード例 #10
0
  public void setUp() {
    if (this.isSetUp || this.isStarting) {
      return;
    }
    this.isStarting = true;

    // Login user:

    boolean result = this.client.autoLogin();

    if (result == false) // No Credentials filled in
    return;

    EclipseLogger.getInstance()
        .logInfo("Osbide Logged in as " + prefs.getString(PreferenceConstants.P_USERNAME));
    // Get Courses:

    this.client.getCoursesForUser();

    EclipseLogger.getInstance()
        .logInfo("You are assigned in " + this.client.getCourses().size() + " course(s)");

    // Get assignments for all courses:
    List<Course> courses = this.client.getCourses();

    int counter = 0;

    for (Iterator<Course> iter = courses.iterator(); iter.hasNext(); ) {
      Course c = iter.next();
      List<Assignment> assignmentsOfThisCourse = this.client.getAssignmentsForCourse(c.getId());
      c.setAssignments(assignmentsOfThisCourse);
      counter += assignmentsOfThisCourse.size();
    }
    EclipseLogger.getInstance()
        .logInfo("There are " + counter + " Assignment(s) in all your courses");

    // Set up Osbide Now!

    // set Default project:#
    result = this.setDefaultProjectByName(prefs.getString(PreferenceConstants.P_DEFAULTPROJECT));

    if (result == false) return;

    // We have valid login data and an active project. Set Up trackers:

    this.setUpTracking();

    this.isStarting = false;
    this.isSetUp = true;
  }
コード例 #11
0
 private void load() {
   projectBase.setText(prefStore.getString(PreferenceConstants.BASE_RISK_FACTOR));
   for (int i = 0; i < markers.size(); ++i) {
     impacts
         .get(i)
         .select(
             prefStore.getInt(ProblemNameToPreferenceMapper.nameSmellImpact(markers.get(i))) - 1);
     baselines
         .get(i)
         .setText(
             prefStore.getString(ProblemNameToPreferenceMapper.nameSmellBaseLine(markers.get(i))));
   }
   updateApplyButton();
 }
コード例 #12
0
ファイル: SDMPreferencePage.java プロジェクト: eclipse/ptp
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ptp.ui.preferences.AbstractPreferencePage#setValues()
  */
 @Override
 protected void setValues() {
   IPreferenceStore store = getPreferenceStore();
   String backend = store.getString(SDMPreferenceConstants.PREFS_SDM_BACKEND);
   int index = sdmBackendCombo.indexOf(backend);
   if (index >= 0) {
     sdmBackendCombo.select(index);
   }
   sdmPathText.setText(store.getString(SDMPreferenceConstants.PREFS_SDM_PATH + backend));
   sdmBackendPathText.setText(
       store.getString(SDMPreferenceConstants.PREFS_SDM_BACKEND_PATH + backend));
   debugEnabled = store.getBoolean(SDMPreferenceConstants.SDM_DEBUG_ENABLED);
   debugLevel = store.getInt(SDMPreferenceConstants.SDM_DEBUG_LEVEL);
   updateDebugButtons();
 }
コード例 #13
0
ファイル: FilePlayer.java プロジェクト: perorin0418/akj-betas
  public static boolean play(File file, String ext) {
    boolean played = false;
    if (ext != null) {

      IPreferenceStore store = Akj_betasPlugin.getDefault().getPreferenceStore();
      String playerPath = store.getString(FLVToolsPage.PLAYER_PATH);
      if (playerPath.length() > 0) {
        File player = new File(playerPath);
        if (player.exists()) {
          doPlay(player, file);
          return true;
        }
      }
      // i don't know reason why.
      // return Program.launch(file.getAbsolutePath());

      Program program = Program.findProgram(ext);

      if (program != null) {
        log.info("file:" + file.getAbsolutePath());

        // program.execute(file.getAbsolutePath());
        played = true;
      }
    } else {
      log.warn("no extension:" + file);
    }
    return played;
  }
コード例 #14
0
  /**
   * 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();
        }
      }
    }
  }
コード例 #15
0
ファイル: PydevConsole.java プロジェクト: pmahoney/Pydev
  /** @return the prompt to be used in the console. */
  @Override
  protected ScriptConsolePrompt createConsolePrompt() {
    IPreferenceStore store = PydevPlugin.getDefault().getPreferenceStore();

    String newPrompt = store.getString(PydevConsoleConstants.PREF_NEW_PROMPT);
    String continuePrompt = store.getString(PydevConsoleConstants.PREF_CONTINUE_PROMPT);

    if (newPrompt == null || newPrompt.length() == 0) {
      newPrompt = PydevConsoleConstants.DEFAULT_NEW_PROMPT;
    }
    if (continuePrompt == null || continuePrompt.length() == 0) {
      continuePrompt = PydevConsoleConstants.DEFAULT_CONTINUE_PROMPT;
    }

    return new ScriptConsolePrompt(newPrompt, continuePrompt);
  }
コード例 #16
0
    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"));
      }
    }
コード例 #17
0
ファイル: MainControl.java プロジェクト: kenwenzel/aspirerfid
  public MainControl() throws Exception {
    // create apdl file directory if it's not exist
    IPreferenceStore store = BpwmeDiagramEditorPlugin.getInstance().getPreferenceStore();
    //		File directory = new File(store.getString(PreferenceConstants.P_APDL_DIR));
    //		if(!directory.exists()) {
    //			directory.mkdirs();
    //		}

    String apdlFileString = store.getString(PreferenceConstants.P_APDL_FILE);
    if (!apdlFileString.equals("")) {
      // this is a restart
      fa = FileAction.Restart;
      setAPDLURI(apdlFileString);
    }

    // initialization for some objects
    objectFactory = new ObjectFactory();
    // candidateLRList = new ArrayList<ApdlDataField>();
    objectMap = new HashMap<Integer, Object>();
    // ebprocMap = new HashMap<String, EventType>();
    extraLLRPProperty = new Vector<ExtraProperty>();
    extraRPProperty = new Vector<ExtraProperty>();
    extraHALProperty = new Vector<ExtraProperty>();

    extraLLRPProperty.add(new ExtraProperty("ConnectionPointAddress", ExtraProperty.LLRP_TYPE));
    extraLLRPProperty.add(new ExtraProperty("ConnectionPointPort", ExtraProperty.LLRP_TYPE));
    extraLLRPProperty.add(new ExtraProperty("PhysicalReaderSource", ExtraProperty.LLRP_TYPE));
    extraLLRPProperty.add(new ExtraProperty("RoSpecID", ExtraProperty.LLRP_TYPE));

    extraRPProperty.add(new ExtraProperty("ConnectionPointAddress", ExtraProperty.RP_TYPE));
    extraRPProperty.add(new ExtraProperty("ConnectionPointPort", ExtraProperty.RP_TYPE));
    extraRPProperty.add(new ExtraProperty("PhysicalReaderSource", ExtraProperty.RP_TYPE));
    extraRPProperty.add(new ExtraProperty("RoSpecID", ExtraProperty.RP_TYPE));
  }
コード例 #18
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);
 }
コード例 #19
0
  /**
   * 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();
      }
    }
  }
コード例 #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
ファイル: UiPlugin.java プロジェクト: egouge/udig-platform
  /**
   * Looks a configuration object using the preference store and extension points to locate the
   * class and instantiate it. If there is a problem, null is returned and the caller is expect to
   * supply a default value of their own. Exceptions are not thrown, but messages will be logged.
   *
   * <p>These configuration objects are typically defined in plugin_customization.ini files, and
   * these values are loaded into the preference store. The parameter <tt>prefConstant</tt> is used
   * to look up this value, and should be the key (prefixed by the plug-in name,
   * org.locationtech.udig.ui) used in the ini file.
   *
   * <p>The returned object will either be an instances of <tt>interfaceClass</tt> or <tt>null</tt>.
   *
   * <p>The parameter <tt>xpid</tt> is the extension point ID that the value specified in the ini
   * file should point to. This extension point must contain an attribute used for an id, and an
   * attribute used for the class which is an implementation of <tt>interfaceClass</tt>.
   * <tt>idField</tt> indicates the name of the attribute for id, and <tt>classField</tt> indicates
   * the name of the attribute for the class.
   *
   * <p>Example: plugin_customization.ini
   *
   * <pre>
   * org.locationtech.udig.ui/workbenchConfiguration=org.locationtech.udig.internal.ui.UDIGWorkbenchConfiguration
   * </pre>
   *
   * <b><tt>store</tt></b>: org.locationtech.udig.internal.ui.UiPlugin.getPreferenceStore() (this
   * corresponds to the first part of the key)
   *
   * <p><b><tt>pluginID</tt></b>: "org.locationtech.udig.ui"
   *
   * <p><b><tt>prefConstant</tt></b>: "workbenchConfiguration"
   *
   * <pre>
   *     <extension
   *       point="org.locationtech.udig.ui.workbenchConfigurations">
   *         <workbenchConfiguration
   *           class="org.locationtech.udig.internal.ui.UDIGWorkbenchConfiguration"
   *           id="org.locationtech.udig.internal.ui.UDIGWorkbenchConfiguration"/>
   *     </extension>
   * </pre>
   *
   * <b><tt>xpid</tt></b>: "org.locationtech.udig.ui.workbenchConfigurations"
   * <b><tt>idField</tt></b>: "id" <b><tt>classField</tt></b>: "class"
   *
   * <p>This will return an instance of <tt>org.locationtech.udig.ui.WorkbenchConfiguration</tt>, or
   * null if it cannot find one (in which case, check the logs!).
   *
   * <p>Make sure to be a good developer and use constants. Also make sure to use a default
   * implementation if this returns null! The code should not explode!
   *
   * <p>TODO It would be nice to simplify this API call.
   *
   * @param interfaceClass instance of the interface that will be instantiated and returned
   * @param store the preference store used to lookup prefConstant
   * @param pluginID the ID of the plug-in that the preference store lives
   * @param prefConstant key used in plugin_customization.ini
   * @param xpid extension point id key
   * @param idField id attribute key used in extension point
   * @param classField class attribute key used in extension point
   */
  public static Object lookupConfigurationObject(
      Class<?> interfaceClass,
      final IPreferenceStore store,
      final String pluginID,
      final String prefConstant,
      final String xpid,
      final String idField,
      final String classField) {

    final String configurationID = store.getString(prefConstant);

    if (configurationID != null && !configurationID.equals("")) {
      try {
        final Object[] configObj = new Object[1];
        final Throwable[] error = new Throwable[1];
        ExtensionPointProcessor p =
            new ExtensionPointProcessor() {

              public void process(IExtension extension, IConfigurationElement element)
                  throws Exception {
                try {
                  if (element.getAttribute(idField) != null
                      && element.getAttribute(idField).equals(configurationID)) {
                    Object obj = element.createExecutableExtension(classField);
                    configObj[0] = obj;
                  }
                } catch (Exception e) {
                  configObj[0] = null;
                  error[0] = e;
                }
              }
            };
        ExtensionPointUtil.process(getDefault(), xpid, p);

        if (configObj[0] != null) {
          return configObj[0];
        } else {
          MessageFormat format =
              new MessageFormat(Messages.UDIGWorkbenchWindowAdvisor_specifiedButNotFound);
          Object[] args = new Object[] {configurationID, interfaceClass.getName()};
          StringBuffer message = format.format(args, new StringBuffer(), null);
          Throwable e = null;
          if (error[0] != null) {
            e = error[0];
          }
          trace(message.toString(), e);
        }
      } catch (Exception e) {
        log(
            MessageFormat.format(
                Messages.UDIGWorkbenchWindowAdvisor_classNotFound,
                new Object[] {configurationID},
                interfaceClass.getName()),
            e);
      }
    }

    return null;
  }
コード例 #23
0
 public String getCurrentDictionary(IProject project) {
   IPreferenceStore store = new ProjectPropertyStore(project);
   String dict = store.getString(CFMLPreferenceConstants.P_CFML_DICTIONARY);
   if (dict.length() < 1) {
     dict = CFMLPreferenceConstants.P_CFML_DICTIONARY_DEFAULT;
   }
   return dict;
 }
コード例 #24
0
ファイル: Utils.java プロジェクト: eclipse/jubula.core
 /** @return True, if the server is localhost. False, otherwise. */
 public static boolean isLocalhost() {
   IPreferenceStore prefStore = Plugin.getDefault().getPreferenceStore();
   String serverPort = prefStore.getString(Constants.AUT_AGENT_SETTINGS_KEY);
   String server = serverPort.split(StringConstants.COLON)[0];
   return server.equals(Messages.UtilsLocalhost1)
       || server.equals(Messages.UtilsLocalhost3)
       || server.startsWith(Messages.UtilsLocalhost2);
 }
コード例 #25
0
 public static IVMInstall getSelectedVM() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   IVMInstall jvm = null;
   if (IPreferenceStore.FALSE.equals(
       store.getString(BrowserSimPreferencesPage.BROWSERSIM_JVM_AUTOMATICALLY))) {
     // path to browserSim jvm is located in preferences
     String jvmId = store.getString(BrowserSimPreferencesPage.BROWSERSIM_JVM_ID);
     jvm = PreferencesUtil.getJVM(jvmId);
   } else {
     // detect jvm automatically
     List<IVMInstall> jvms = PreferencesUtil.getSuitableJvms(1);
     if (!jvms.isEmpty()) {
       jvm = jvms.get(0);
     }
   }
   return jvm;
 }
コード例 #26
0
  private void createTangoHost() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    final StringBuffer buf = new StringBuffer();
    buf.append(store.getString(CommonUIPreferenceConstants.SERVER_NAME));
    buf.append(":");
    buf.append(store.getInt(CommonUIPreferenceConstants.SERVER_PORT));
    System.setProperty("TANGO_HOST", buf.toString());
  }
  /** {@inheritDoc} */
  public void init(IWorkbench workbench) {
    isDirty = false;

    IPreferenceStore store = getPreferenceStore();
    updateBackendService(
        store.getBoolean(SystemProperties.BACKEND_AUTO_DOWNLOAD_ENABLED),
        store.getBoolean(SystemProperties.BACKEND_AUTO_DELETE_ENABLED),
        store.getString(SystemProperties.BACKEND_DOWNLOAD_PATH));
  }
コード例 #28
0
 public String helpURL(IProject project) {
   IPreferenceStore store = new ProjectPropertyStore(project);
   String helpUrl = store.getString(CFMLPreferenceConstants.P_DEFAULT_HELP_URL).trim();
   if (helpUrl == "" || helpUrl == null) {
     return defaultHelpURL();
   } else {
     return helpUrl;
   }
 }
コード例 #29
0
 private String initDefaultFolder() {
   IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
   defaultFolder = prefs.getString(PreferenceConstants.DEFAULT_FOLDER_REPORT);
   defaultTemplateFolder = prefs.getString(PreferenceConstants.DEFAULT_TEMPLATE_FOLDER_REPORT);
   if (defaultFolder == null || defaultFolder.isEmpty()) {
     defaultFolder = System.getProperty("user.home");
   }
   if (defaultTemplateFolder == null || defaultTemplateFolder.isEmpty()) {
     defaultTemplateFolder = System.getProperty("user.home");
   }
   if (!defaultFolder.endsWith(System.getProperty(FILE_SEPARATOR))) {
     defaultFolder = defaultFolder + System.getProperty(FILE_SEPARATOR);
   }
   if (!defaultTemplateFolder.endsWith(System.getProperty(FILE_SEPARATOR))) {
     defaultTemplateFolder = defaultTemplateFolder + System.getProperty(FILE_SEPARATOR);
   }
   return defaultFolder;
 }
コード例 #30
0
 protected void doLoad() {
   if (listControl != null) {
     IPreferenceStore store = getPreferenceStore();
     java.util.List<String> wps = new LinkedList<String>();
     int index = 0;
     while (store.contains(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index)
         && store.getString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index).length() > 0) {
       String value =
           getPreferenceStore().getString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index);
       if (value != null && !value.equals("")) {
         wps.add(store.getString(PreferenceConstants.WILDCARD_PATHS_PREFERENCES + index));
       }
       index++;
     }
     String[] array = wps.toArray(new String[wps.size()]);
     for (int i = 0; i < array.length; i++) {
       listControl.add(array[i]);
     }
   }
 }