public Optional<String> getUserName() { return Optional.ofNullable( preferences.getString(PREFERENCES_KEY, null) ); }
public URL getPluginRegistryLocation() { String pluginRegistryLoc = getPrefs().getString(PLUGIN_REGISTRY_KEY, DEFAULT_REGISTRY); try { return new URL(pluginRegistryLoc); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
private IRI getIRI(String key, IRI defaultIRI) { String value = preferences.getString(key, null); if(value != null) { return IRI.create(value); } else { return defaultIRI; } }
private DateFormatter instantiateDateFormatter() { String formatterClass = preferences.getString(DATE_FORMATTER_CLASS_KEY, ISO8601Formatter.class.getName()); try { Class<?> cls = Class.forName(formatterClass); return (DateFormatter) cls.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { logger.error("Could not create date formatter: {}", e.getMessage(), e); return new ISO8601Formatter(); } }
public URL getPluginRegistryLocation() { String pluginRegistryLoc = getPrefs().getString(PLUGIN_REGISTRY_KEY, DEFAULT_REGISTRY); try { return new URL(pluginRegistryLoc); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
public PhysicalLocationPanel(EditorKit editorKit) { super(ID, "Physical Location", editorKit); Preferences prefs = PreferencesManager.getInstance().getApplicationPreferences(ProtegeOWL.ID); String path = prefs.getString(DEFAULT_LOCAL_BASE_KEY, new File(new File(System.getProperty("user.home")), "ontologies").toString()); locationBase = new File(path); }
public PhysicalLocationPanel(EditorKit editorKit) { super(ID, "Physical Location", editorKit); Preferences prefs = PreferencesManager.getInstance().getApplicationPreferences(ProtegeOWL.ID); String path = prefs.getString(DEFAULT_LOCAL_BASE_KEY, new File(new File(System.getProperty("user.home")), "ontologies").toString()); locationBase = new File(path); }
public void setPluginRegistryLocation(URL url) { String oldPluginRegistryLoc = getPrefs().getString(PLUGIN_REGISTRY_KEY, DEFAULT_REGISTRY); String newPluginRegistryLoc = url.toString(); if (!newPluginRegistryLoc.equals(oldPluginRegistryLoc)) { getPrefs().putString(PLUGIN_REGISTRY_KEY, newPluginRegistryLoc); } }
public static IRI getNameLabelIRI() { Preferences prefs = getPrefs(); String uriStr = prefs.getString(NAME_LABEL_URI, null); if (uriStr != null){ return IRI.create(uriStr); } return null; }
/** * Reads a serialisation of a view layout from the preferences system * @return The serialisation, or the empty string if no serialisation * was previously stored. */ public String readViewLayout() { return getViewLayoutPreferences().getString(getLayoutPreferencesKey(), ""); } }
public static IRI getDefaultBaseIRI() { Preferences prefs = getPrefs(); String baseIRIStr = prefs.getString(DEFAULT_BASE_URI, "http://www.co-ode.org/ontologies/ont.owl#"); return IRI.create(baseIRIStr); }
public static String getCurrentFileDirectory() { String dir = "~"; Preferences p = PreferencesManager.getInstance().getApplicationPreferences(FILE_PREFERENCES_KEY); dir = p.getString(CURRENT_FILE_DIRECTORY_KEY, dir); return dir; }
public String getDefaultPluginId() { PreferencesManager prefMan = PreferencesManager.getInstance(); Preferences prefs = prefMan.getPreferencesForSet(PREFERENCES_SET_KEY, ReasonerPreferences.class); return prefs.getString(DEFAULT_EXPLANATION_ID, null); }
public static IRI getDefaultBaseIRI() { Preferences prefs = getPrefs(); String baseIRIStr = prefs.getString(DEFAULT_BASE_URI, "http://www.co-ode.org/ontologies/ont.owl#"); return IRI.create(baseIRIStr); }
/** * Reads a serialisation of a view layout from the preferences system * @return The serialisation, or the empty string if no serialisation * was previously stored. */ public String readViewLayout() { return getViewLayoutPreferences().getString(getLayoutPreferencesKey(), ""); } }
public void updatePanelSelection(String selectedPanel) { if (selectedPanel == null){ final Preferences prefs = PreferencesManager.getInstance().getApplicationPreferences(ExplanationPreferencesPanel.class); selectedPanel = prefs.getString(EXPL_PREFS_HISTORY_PANEL_KEY, null); } Component c = componentMap.get(selectedPanel); if (c != null) { tabbedPane.setSelectedComponent(c); } }
private void restore() { Preferences p = getPreferences(); baseURI = URI.create(p.getString(BASE_URI_KEY, baseURI.toString())); includeYear = p.getBoolean(INC_YEAR_KEY, true); includeMonth = p.getBoolean(INC_MONTH_KEY, true); includeDay = p.getBoolean(INC_DAY_KEY, false); useCounter = p.getBoolean(INC_DOCUMENT_COUNTER, true); }
public void load() { Preferences prefs = getPreferences(); displayed.load(this); precompute.load(prefs); defaultReasonerId = prefs.getString(DEFAULT_REASONER_ID, NoOpReasonerInfo.NULL_REASONER_ID); }
public FreshAxiomLocation getFreshAxiomLocation() { String locationName = PreferencesManager.getInstance().getApplicationPreferences(PREFERENCES_KEY) .getString(FRESH_AXIOM_LOCATION_KEY, null); if(locationName == null) { return FreshAxiomLocation.getDefaultValue(); } return FreshAxiomLocation.getLocationFromName(locationName).or(FreshAxiomLocation.getDefaultValue()); }
private void restore() { Preferences p = PreferencesManager.getInstance().getApplicationPreferences(PREFERENCES_KEY); baseURI = URI.create(p.getString(BASE_URI_KEY, DEFAULT_BASE)); includeYear = p.getBoolean(INC_YEAR_KEY, true); includeMonth = p.getBoolean(INC_MONTH_KEY, true); includeDay = p.getBoolean(INC_DAY_KEY, false); }