Opened 17 years ago

Closed 17 years ago

Last modified 11 years ago

#78 closed enhancement (fixed)

Preferences: support dynamically computed defaults

Reported by: David Aspinall Owned by: David Aspinall
Priority: trivial Milestone:
Component: 1:pg-eclipse Keywords:
Cc:

Description

The preference mechanism should support dynamically computed defaults. This can be achieved by using reflection together with a method name given in the preference file:

 <pref name="ActiveHighlight" type="string" setDefault="setExample"/>

The method should be located in the already given class associated with the preference file, e.g. ExamplePrefs.java:

  public Boolean setExample() {
     return Eclipse.isRunningOnMac() ? "Orange" : "Blue";
  }

This is bogus and slightly silly example, but one reason we want this is to set platform-specific defaults for some values.

Change History (3)

comment:1 Changed 17 years ago by David Aspinall

Type: defectenhancement

comment:2 Changed 17 years ago by David Aspinall

Resolution: fixed
Status: newclosed

I've now added a simpler mechanism for allowing OS-specific preference overrides in the preference table, as:

<pref name="Highlight colour" os="macosx" value="Orange"/>

The os attribute should be contained in Platform.getOS() for this to work (so mac would be another way).

This is a crude way of having OS-specific prefs: the first preference that appears will win, and non-specific preferences win defaults for all OS settings. The main crudeness is having to repeat the preference, description etc.

But this does for choosing the Default Symbol Table in ProofGeneralPrefs.xml.

comment:3 Changed 11 years ago by David Aspinall

Milestone: PG-Eclipse-1.0.7

Milestone PG-Eclipse-1.0.7 deleted

Note: See TracTickets for help on using tickets.