Search in sources :

Example 6 with PropertyName

use of com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName in project convertigo by convertigo.

the class EnginePreferenceDialog method applyProceed.

private void applyProceed() {
    if (modifiedProperties != null) {
        for (PropertyName property : modifiedProperties.keySet()) {
            ConvertigoPlugin.logDebug("Updating engine property " + property.name() + ": " + modifiedProperties.get(property));
            if (property.getType() == PropertyType.Array) {
                String value = modifiedProperties.get(property);
                StringTokenizer st = new StringTokenizer(value, "\r\n", false);
                String[] propertyAsStringArray = new String[st.countTokens()];
                int i = 0;
                while (st.hasMoreTokens()) {
                    String item = st.nextToken();
                    propertyAsStringArray[i] = item;
                    i++;
                }
                EnginePropertiesManager.setPropertyFromStringArray(property, propertyAsStringArray);
            } else {
                EnginePropertiesManager.setProperty(property, modifiedProperties.get(property));
            }
        }
        try {
            EnginePropertiesManager.saveProperties();
        } catch (Exception e) {
            ConvertigoPlugin.logException(e, "Unable to save engine properties!");
        }
    }
    this.close();
}
Also used : PropertyName(com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName) StringTokenizer(java.util.StringTokenizer) Point(org.eclipse.swt.graphics.Point)

Example 7 with PropertyName

use of com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName in project convertigo by convertigo.

the class FileCacheManager method onEvent.

@Override
public void onEvent(PropertyChangeEvent event) {
    super.onEvent(event);
    PropertyName name = event.getKey();
    String cacheDir = EnginePropertiesManager.getProperty(PropertyName.CACHE_MANAGER_FILECACHE_DIRECTORY);
    if (!cacheDir.equals(Engine.CACHE_PATH) && name.equals(PropertyName.CACHE_MANAGER_FILECACHE_DIRECTORY)) {
        try {
            destroy();
        } catch (EngineException e) {
            Engine.logEngine.error("Error on FileCacheManager.destroy", e);
        }
        try {
            init();
        } catch (EngineException e) {
            Engine.logEngine.error("Error on FileCacheManager.init", e);
        }
    }
}
Also used : PropertyName(com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 8 with PropertyName

use of com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName in project convertigo by convertigo.

the class EnginePreferencePage method performOk.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
	 */
public boolean performOk() {
    for (PropertyName property : modifiedProperties.keySet()) {
        ConvertigoPlugin.logDebug("Updating engine property " + property.name() + ": " + modifiedProperties.get(property));
        if (property.getType() == PropertyType.Array) {
            String value = modifiedProperties.get(property);
            StringTokenizer st = new StringTokenizer(value, "\r\n", false);
            String[] propertyAsStringArray = new String[st.countTokens()];
            int i = 0;
            while (st.hasMoreTokens()) {
                String item = st.nextToken();
                propertyAsStringArray[i] = item;
                i++;
            }
            EnginePropertiesManager.setPropertyFromStringArray(property, propertyAsStringArray);
        } else {
            EnginePropertiesManager.setProperty(property, modifiedProperties.get(property));
        }
    }
    try {
        EnginePropertiesManager.saveProperties();
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "Unable to save engine properties!");
    }
    return super.performOk();
}
Also used : PropertyName(com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName) StringTokenizer(java.util.StringTokenizer)

Aggregations

PropertyName (com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyName)8 Role (com.twinsoft.convertigo.engine.AuthenticatedSessionManager.Role)2 ComboEnum (com.twinsoft.convertigo.engine.EnginePropertiesManager.ComboEnum)2 PropertyCategory (com.twinsoft.convertigo.engine.EnginePropertiesManager.PropertyCategory)2 StringTokenizer (java.util.StringTokenizer)2 Element (org.w3c.dom.Element)2 NodeList (org.w3c.dom.NodeList)2 AuthenticationException (com.twinsoft.convertigo.engine.AuthenticationException)1 EngineException (com.twinsoft.convertigo.engine.EngineException)1 InvalidParameterException (java.security.InvalidParameterException)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1