www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - dwtx.jface.preference.PathEditor new line issue

reply yidabu <yidabu.spam gmail.com> writes:
When click on the OK button, always add a new line to the list :

Code:

module DwtTest;

import dwtx.jface.preference.BooleanFieldEditor;
import dwtx.jface.preference.ColorFieldEditor;
import dwtx.jface.preference.DirectoryFieldEditor;
import dwtx.jface.preference.FileFieldEditor;
import dwtx.jface.preference.FontFieldEditor;
import dwtx.jface.preference.FieldEditorPreferencePage;
import dwtx.jface.preference.RadioGroupFieldEditor;
import dwtx.jface.preference.PathEditor;
import dwtx.jface.preference.IntegerFieldEditor;
import dwtx.jface.preference.ScaleFieldEditor;
import dwtx.jface.preference.StringFieldEditor;
import dwtx.jface.preference.IPreferenceStore;
import dwtx.jface.preference.PreferenceManager;
import dwtx.jface.preference.PreferencePage;
import dwtx.jface.preference.PreferenceNode;
import dwtx.jface.preference.PreferenceStore;
import dwtx.jface.preference.PreferenceDialog;
import dwtx.jface.resource.ImageDescriptor;

import dwt.widgets.Display;
import dwt.widgets.Composite;
import dwt.widgets.Label;
import dwt.widgets.Button;
import dwt.widgets.Text;
import dwt.widgets.Control;
import dwt.events.SelectionAdapter;
import dwt.events.SelectionEvent;
import dwt.layout.RowLayout;
import dwt.layout.GridLayout;
import dwt.layout.GridData;
import dwt.DWT;
import dwt.dwthelper.utils;

import tango.io.File;
import tango.io.FilePath;

version(JIVE) import jive.stacktrace;
const char[] FILENAME = "showfieldprefs";

/**
 * This class demonstrates field editors
 */
public class FieldEditorPageOne : FieldEditorPreferencePage {
    public this() {
        // Use the "flat" layout
        super(FLAT);
    }

    /**
     * Creates the field editors
     */
    protected void createFieldEditors() {
        auto sourceDirectories = new PathEditor("Source Directories", "Source
Directories:", "Select The source directory for the backup",
getFieldEditorParent());
        addField(sourceDirectories);
    }
}



/**
 * This class demonstrates JFace preferences and field editors
 */
public class ShowFieldPrefs {
    /**
    * Runs the application
    */
    public void run() {
//         Display display = new Display();

        // Create the preference manager
        PreferenceManager mgr = new PreferenceManager();

        // Create the nodes
        PreferenceNode one = new PreferenceNode("one", "One", null,
            FieldEditorPageOne.classinfo.name );

        // Add the nodes
        mgr.addToRoot(one);

        // Create the preferences dialog
        PreferenceDialog dlg = new PreferenceDialog(null, mgr);

        // Set the preference store
        PreferenceStore ps = new PreferenceStore(FILENAME);
        try {
            ps.load();
        } catch (IOException e) {
            // Ignore
        }
        dlg.setPreferenceStore(ps);

        // Open the dialog
        dlg.open();

        try {
            // Save the preferences
            ps.save();
        } catch (IOException e) {
            ExceptionPrintStackTrace(e);
        }
//         display.dispose();
    }

    /**
     * The application entry point
     *
     *  param args the command line arguments
     */
    public static void main(String[] args) {
        (new ShowFieldPrefs()).run();
    }
}


void main(){
    scope fn = new FilePath( FILENAME );
    if( !fn.exists ){
        scope prefs = new File( fn.dup.native.toString );
        version(linux){
            prefs.write( import("jface.showfieldprefs.properties.linux" ));
        }
        version(Windows){
            prefs.write( import("jface.showfieldprefs.properties.win" ));
        }
    }
    ShowFieldPrefs.main( null );
}










-- 
yidabu <yidabu.spam gmail.com>
http://www.dsource.org/projects/dwin

D -(D Chinese):
http://www.d-programming-language-china.org/
http://bbs.d-programming-language-china.org/
http://dwin.d-programming-language-china.org/
http://scite4d.d-programming-language-china.org/
Jul 11 2008
parent Digited <digited yandex.ru> writes:
I try to build latest dwt samples from source with installed dmd
snapshot 0.6.2 and DMC (for optlink): compiling is ok, but linking
fails: symbol undefined: _IsHungAppWindow and _GetSystemDefaultUILanguage.

What to do?
Jul 13 2008