Adding Persistent Properties

After the first execution of INTViewer there is a properties file, intviewer.properties, containing the defined variables and their current settings. An example of this is the variable intDataPath whose value is the path to the last data set loaded. It is continually updated and saved with INTViewer is exited.

Any NetBeans module (plug-in) may take advantage of this facility to save and retrieve variables including paths to unique types of data or files.

An example of how to create a new variable, set its value and retrieve the value in a later run is as follows.

EXAMPLE.JAVA

import org.openide.util.NbPreferences;
import com.interactive.intviewerapi.util.IntPreferences;
/**
* Creates a new variable in intviewer.properties whose name is "someDatapath" and its value is path.
*/
public static void setPropertyVariable ( String path ) {
NbPreferences.forModule(IntPreferences.class).put("someDataPath", path );
}
/**
* Returns the value of a variable "someDatapath" contained in intviewer.properties
*/
public static String getPropertyVariable() {
return NbPreferences.forModule(IntPreferences.class)get("someDataPath", ".");
}

The intviewer.properties file can be found at:

(windows XP) C:\Documents and Settings\"username"\Application Data\.intviewer\5.2\config\Preferences\com\interactive\intviewer.properties

(windows 7 to Windows 10) C:\Users\"username"\AppData\Roaming\.intviewer\5.2\config\Preferences\com\interactive\intviewer.properties

(linux/unix ...) $HOME\.intviewer\5.2\config\Preferences\com\interactive\intviewer.properties