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));
    }
  }
  /**
   * 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.
    }
  }
示例#3
0
 /** Update the settings for the global window cache of the workspace. */
 public static void reconfigureWindowCache() {
   final WindowCacheConfig c = new WindowCacheConfig();
   IEclipsePreferences d = DefaultScope.INSTANCE.getNode(Activator.getPluginId());
   IEclipsePreferences p = InstanceScope.INSTANCE.getNode(Activator.getPluginId());
   c.setPackedGitLimit(
       p.getInt(
           GitCorePreferences.core_packedGitLimit,
           d.getInt(GitCorePreferences.core_packedGitLimit, 0)));
   c.setPackedGitWindowSize(
       p.getInt(
           GitCorePreferences.core_packedGitWindowSize,
           d.getInt(GitCorePreferences.core_packedGitWindowSize, 0)));
   c.setPackedGitMMAP(
       p.getBoolean(
           GitCorePreferences.core_packedGitMMAP,
           d.getBoolean(GitCorePreferences.core_packedGitMMAP, false)));
   c.setDeltaBaseCacheLimit(
       p.getInt(
           GitCorePreferences.core_deltaBaseCacheLimit,
           d.getInt(GitCorePreferences.core_deltaBaseCacheLimit, 0)));
   c.setStreamFileThreshold(
       p.getInt(
           GitCorePreferences.core_streamFileThreshold,
           d.getInt(GitCorePreferences.core_streamFileThreshold, 0)));
   c.install();
 }
 public void performDefaults() {
   IEclipsePreferences prefs = new DefaultScope().getNode(PHPDebugEPLPlugin.PLUGIN_ID);
   // fRunWithDebugInfo.setSelection(prefs.getDefaultBoolean(PHPDebugCorePreferenceNames.RUN_WITH_DEBUG_INFO));
   this.fOpenInBrowser.setSelection(
       prefs.getBoolean(PHPDebugCorePreferenceNames.OPEN_IN_BROWSER, true));
   this.fOpenDebugViews.setSelection(
       prefs.getBoolean(PHPDebugCorePreferenceNames.OPEN_DEBUG_VIEWS, true));
   // fDebugTextBox.setText(Integer.toString(prefs.getDefaultInt(PHPDebugCorePreferenceNames.DEBUG_PORT)));
 }
    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;
    }
 /**
  * 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);
 }
示例#7
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);
                 }
               }
             });
   }
 }
示例#8
0
 @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);
 }
 /**
  * {@inheritDoc}
  *
  * @see org.teiid.designer.ui.preferences.IGeneralPreferencePageContributor#refresh()
  */
 @Override
 public void refresh() {
   IEclipsePreferences prefs = getPreferences();
   boolean enable =
       prefs.getBoolean(
           PreferenceConstants.AUTO_CREATE_DATA_SOURCE,
           PreferenceConstants.AUTO_CREATE_DATA_SOURCE_DEFAULT);
   this.chkEnabled.setSelection(enable);
 }
示例#10
0
 public IEclipsePreferences getProjectOrWorkspacePreferences(IProject project) {
   IEclipsePreferences projectPreferences = getProjectScope(project);
   if (projectPreferences != null
       && projectPreferences.getBoolean(USING_PROJECT_PROPERTIES, false)) {
     return projectPreferences;
   } else {
     if (instanceScope == null) {
       instanceScope = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
     }
     return instanceScope;
   }
 }
  private boolean setPrefBool(String prefKey, boolean def, Button button) {
    IEclipsePreferences prefs = DartCore.getPlugin().getPrefs();
    boolean oldValue = prefs.getBoolean(prefKey, def);
    boolean newValue = button.getSelection();
    prefs.putBoolean(prefKey, newValue);
    try {
      prefs.flush();
    } catch (BackingStoreException e) {

    }
    return oldValue != newValue;
  }
示例#12
0
 public void load() {
   IEclipsePreferences prefs =
       EclipsePreferencesUtils.getInstanceScope().getNode(UiPlugin.PLUGIN_ID);
   this.projectTasksVisible = prefs.getBoolean(PREF_PROJECT_TASKS_VISIBLE, false);
   this.taskSelectorsVisible = prefs.getBoolean(PREF_TASK_SELECTORS_VISIBLE, true);
   this.privateTasksVisible = prefs.getBoolean(PREF_PRIVATE_TASKS_VISIBLE, false);
   this.sortByType = prefs.getBoolean(PREF_SORT_BY_TYPE, true);
   this.sortByVisibility = prefs.getBoolean(PREF_SORT_BY_VISIBILITY, true);
   this.linkToSelection = prefs.getBoolean(PREF_LINK_TO_SELECTION, false);
   this.showTreeHeader = prefs.getBoolean(PREF_SHOW_TREE_HEADER, false);
   this.headerNameColumnWidth = prefs.getInt(PREF_HEADER_NAME_COLUMN_WIDTH, 200);
   this.headerDescriptionColumnWidth = prefs.getInt(PREF_HEADER_DESCRIPTION_COLUMN_WIDTH, 400);
 }
示例#13
0
 @Override
 public Object execute(final ExecutionEvent event) throws ExecutionException {
   // final Command command = event.getCommand();
   // final boolean oldValue = HandlerUtil.toggleCommandState(command);
   final String filterId = event.getParameter("org.erlide.ui.filterId");
   final IEclipsePreferences prefsNode = ErlangOutlinePage.getPrefsNode();
   final boolean oldValue = prefsNode.getBoolean(filterId, false);
   final boolean value = !oldValue;
   final Object activePart = HandlerUtil.getVariable(event, "activePart");
   if (activePart instanceof ContentOutline) {
     OutlineFilterUtils.addFilter(filterId, value, activePart);
   }
   prefsNode.putBoolean(filterId, value);
   try {
     prefsNode.flush();
   } catch (final BackingStoreException e) {
     ErlLogger.error(e);
   }
   return null;
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createControl(Composite parent) {
    // adjust layout in order to produce space to the left
    Composite mainComposite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.FILL);
    layout.center = true;
    layout.marginLeft = 10;
    mainComposite.setLayout(layout);

    // create the check box button
    showToolTipButton = new Button(mainComposite, SWT.CHECK);
    showToolTipButton.setText(AndroidSnippetsNLS.TooltipDisplayConfigContriutionItem_ShowPreview);
    showToolTipButton.addSelectionListener(new TooltipSelectionListener());

    // set the selection persisted
    IEclipsePreferences preferences = getEclipsePreferences();
    boolean isTooltipDisplayed =
        preferences.getBoolean(DIALOG_SETTINGS__IS_TOOLTIP_DISPLAYED, true);
    showToolTipButton.setSelection(isTooltipDisplayed);
    performButtonSelection();

    return mainComposite;
  }
 protected boolean getProperty(String key, boolean defaultValue) {
   return eclipsePreferences.getBoolean(DESIGNER_SETTINGS_PREFIX + key, defaultValue);
 }
示例#16
0
 protected boolean isMarkingOccurrences() {
   final IEclipsePreferences prefsNode = ErlideUIPlugin.getPrefsNode();
   return prefsNode.getBoolean("markingOccurences", false);
 }
示例#17
0
 /**
  * @param groovyScriptFilter
  * @param b
  * @return
  */
 public boolean getBooleanPreference(IEclipsePreferences preferences, String key, boolean def) {
   if (preferences == null) {
     preferences = getProjectOrWorkspacePreferences(null);
   }
   return preferences.getBoolean(key, def);
 }