Example usage for org.eclipse.jface.preference FileFieldEditor setFileExtensions

List of usage examples for org.eclipse.jface.preference FileFieldEditor setFileExtensions

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FileFieldEditor setFileExtensions.

Prototype

public void setFileExtensions(String[] extensions) 

Source Link

Document

Sets this file field editor's file extension filter.

Usage

From source file:egovframework.mgt.fit.preferences.FitPreferencePage.java

License:Apache License

/**
 * ?? FieldEditor? ? ?? ?.//from  w w  w .ja v a2s  . com
 */
public void createFieldEditors() {

    FileFieldEditor rulesetPath = new FileFieldEditor(PreferenceConstants.P_RULESET_PATH, "&RuleSet File:",
            getFieldEditorParent());
    rulesetPath.setFileExtensions(new String[] { "*.fir" });
    addField(rulesetPath);

    DirectoryFieldEditor saveDir = new DirectoryFieldEditor(PreferenceConstants.P_SAVE_PATH, "&Save Directory:",
            getFieldEditorParent());
    saveDir.setChangeButtonText("Br&owse...");
    addField(saveDir);

    addField(new BooleanFieldEditor(PreferenceConstants.P_AUTOSAVE, "&Auto Save", getFieldEditorParent()));
}

From source file:msi.gama.hpc.gui.perspective.explorer.HeadlessParam.java

License:Open Source License

public void createPartControl(final Composite parent) {

    // GridLayout parentLayout = new GridLayout(3, true);
    // parentLayout.marginWidth = 0;
    // parentLayout.marginHeight = 0;
    // parentLayout.verticalSpacing = 0;
    // parent.setLayout(parentLayout);

    // RowLayout rowLayout = new RowLayout();
    // rowLayout.wrap = true;
    // rowLayout.pack = true;
    // rowLayout.justify = true;
    // rowLayout.type = SWT.VERTICAL;
    // rowLayout.marginLeft = 5;
    // rowLayout.marginTop = 5;
    // rowLayout.marginRight = 5;
    // rowLayout.marginBottom = 5;
    // rowLayout.spacing = 0;
    ///* ww  w. jav a 2s . c  om*/
    // parent.setLayout(rowLayout);

    final DirectoryFieldEditor de_bin = new DirectoryFieldEditor("the GAMA binary folder",
            "Select GAMA binary folder", parent);

    final DirectoryFieldEditor de_inp = new DirectoryFieldEditor("the Input folder", "Select input folder",
            parent);
    final DirectoryFieldEditor de_out = new DirectoryFieldEditor("the Output folder", "Select output folder",
            parent);

    final IntegerFieldEditor ie = new IntegerFieldEditor("Cores number", "Enter number of cores", parent);
    // parent.pack();

    Button b = new Button(parent, SWT.PUSH);
    b.setText("Run simulation");

    final FileFieldEditor fe = new FileFieldEditor("the XML file for charts display", "Select XML file: ",
            parent);
    String[] extensions = new String[] { "*.xml" }; // NON-NLS-1
    fe.setFileExtensions(extensions);

    b.addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void mouseDown(MouseEvent e) throws GamaRuntimeException {
            // TODO Auto-generated method stub

            //BatchExecutor.submitExperiment(de_bin.getStringValue(), de_inp.getStringValue(),
            //   de_out.getStringValue(), ie.getIntValue());

            // BatchExecutor.submitExperiment("C://Users//Administrator//Desktop//GAMA//eclipse",
            // "C://Users//Administrator//Desktop//GAMA//eclipse//samples",
            // "C://Users//Administrator//Desktop//GAMA//eclipse//samples", 10);
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

    Button b1 = new Button(parent, SWT.PUSH);
    b1.setText("Draw charts");

    b1.addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void mouseDown(MouseEvent e) throws GamaRuntimeException {
            HeadlessChart.xmlfilename = fe.getStringValue();
            //   GuiUtils.showHeadlessChartView();

        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

}

From source file:openbiomind.gui.preferences.OpenBiomindPreferencePage.java

License:Open Source License

/**
 * Creates the new file field editor.//from  www . j  a  va 2  s  .  co m
 * 
 * @param preferenceName the preference name
 * @param labelText the label text
 * @param fileExtensions the file extensions
 * @param emptyStringAllowed the empty string allowed
 * @param errorMessage the error message
 * 
 * @return the file field editor
 */
private FileFieldEditor createNewFileFieldEditor(final String preferenceName, final String labelText,
        final String[] fileExtensions, final boolean emptyStringAllowed, final String errorMessage) {
    final FileFieldEditor fileFieldEditor = new FileFieldEditor(preferenceName, labelText, true,
            StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
    fileFieldEditor.setFileExtensions(fileExtensions);
    fileFieldEditor.setEmptyStringAllowed(emptyStringAllowed);
    fileFieldEditor.setErrorMessage(errorMessage);
    return fileFieldEditor;
}

From source file:org.apache.pig.pigpen.preferences.PigPreferencePage.java

License:Apache License

/**
 * Creates the field editors. Field editors are abstractions of the common
 * GUI blocks needed to manipulate various types of preferences. Each field
 * editor knows how to save and restore itself.
 *///w ww .  j  a  v  a2 s  .c om
@Override
public void createFieldEditors() {
    // DirectoryFieldEditor
    FileFieldEditor fileEditor = new FileFieldEditor(PreferenceConstants.P_PATH, "Pig jar &location:",
            getFieldEditorParent());

    fileEditor.setFileExtensions(new String[] { "*.jar" });
    addField(fileEditor);

    addField(new JobConfPropertiesEditor(PreferenceConstants.P_PROPERTIES, "&JobConf properties :",
            getFieldEditorParent()));
}

From source file:org.axdt.common.preferences.fields.FileField.java

License:Open Source License

public FieldEditor createFieldEditor(Composite comp) {
    FileFieldEditor editor = new FileFieldEditor(key, desc, absolute, comp);
    editor.setFileExtensions(extensions);
    if ("".equals(defValue))
        editor.setEmptyStringAllowed(true);
    return editor;
}

From source file:org.boris.winrun4j.eclipse.WDebugPreferencePage.java

License:Open Source License

protected void createFieldEditors() {
    // Selection for an alternative launcher exe
    FileFieldEditor ffe = new FileFieldEditor(IWPreferenceConstants.LAUNCHER_LOCATION, "&Launcher Location:",
            getFieldEditorParent());//from ww  w .java  2  s. co  m
    ffe.setFileExtensions(new String[] { "*.exe" });
    addField(ffe);

    // Directory for alternative winrun4j library
    DirectoryFieldEditor dfe = new DirectoryFieldEditor(IWPreferenceConstants.LIBRARY_DIR,
            "&Library Directory:", getFieldEditorParent());
    addField(dfe);

    // File/Jar location for winrun4j library
    FileFieldEditor lf = new FileFieldEditor(IWPreferenceConstants.LIBRARY_FILE, "&Library File:",
            getFieldEditorParent());
    lf.setFileExtensions(new String[] { "*.jar;*.zip" });
    addField(lf);

    // Location to winrun4j library source
    addField(new StringFieldEditor(IWPreferenceConstants.LIBRARY_SRC, "&Source Location:",
            getFieldEditorParent()));
}

From source file:org.ect.reo.prefs.ui.AnimationPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.// w w w.j av  a 2s.  c  o m
 */
public void createFieldEditors() {

    if (ColouringEngines.getDescriptions().size() > 1) {
        createEnginesGroup();
    }

    CustomRadioGroupFieldEditor colourEditor = new CustomRadioGroupFieldEditor(ReoPreferenceConstants.COLOURS,
            "&Colours", 1, new String[][] { { "2", "2" }, { "3", "3" } }, getFieldEditorParent());
    addField(colourEditor);

    CustomRadioGroupFieldEditor traversalEditor = new CustomRadioGroupFieldEditor(
            ReoPreferenceConstants.TRAVERSAL_TYPE, "&Traversal", 1,
            new String[][] { { "Depth-first (recommended)", TraversalType.DEPTH_FIRST.toString() },
                    { "Breadth-first", TraversalType.BREADTH_FIRST.toString() }, },
            getFieldEditorParent());
    addField(traversalEditor);

    //addField(new ColorFieldEditor(ReoPreferenceConstants.ANIMATION_BACKGROUND_COLOR, "&Background color:", getFieldEditorParent()));
    //addField(new ColorFieldEditor(ReoPreferenceConstants.ANIMATION_LINE_COLOR, "&Line color:", getFieldEditorParent()));

    addField(new BooleanFieldEditor(ReoPreferenceConstants.DRAW_CONNECTOR_CONTAINERS,
            "Draw &connector containers", BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.USE_MODULE_SCOPE, "Module scope",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.DRAW_NODES, "Draw &nodes",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.SHOW_NO_FLOW_ARROW, "Show no-flow &arrows",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.SHOW_NO_FLOW_ANIMS, "Show no-flow &steps",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.USE_SAME_TOKEN_COLOR, "&Use same token color",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
    addField(new BooleanFieldEditor(ReoPreferenceConstants.LOOP_ANIMATIONS, "&Loop animations",
            BooleanFieldEditor.DEFAULT, getFieldEditorParent()));

    BooleanFieldEditor editor = new BooleanFieldEditor(ReoPreferenceConstants.MULTI_CORE_SUPPORT,
            "&Enable multi-core support", BooleanFieldEditor.DEFAULT, getFieldEditorParent());
    editor.setEnabled(Runtime.getRuntime().availableProcessors() > 1, getFieldEditorParent());
    addField(editor);

    IntegerFieldEditor maxlength = new IntegerFieldEditor(ReoPreferenceConstants.MAX_ANIMATION_LENGTH,
            "&Max number of steps", getFieldEditorParent());
    maxlength.setValidRange(-1, 100);
    addField(maxlength);

    IntegerFieldEditor maxcount = new IntegerFieldEditor(ReoPreferenceConstants.MAX_ANIMATION_COUNT,
            "&Max number of animations", getFieldEditorParent());
    maxcount.setValidRange(1, 100);
    addField(maxcount);

    IntegerFieldEditor speed = new IntegerFieldEditor(ReoPreferenceConstants.ANIMATION_SPEED,
            "&Animation speed", getFieldEditorParent());
    speed.setValidRange(1, 20);
    addField(speed);

    addField(new DoubleFieldEditor(ReoPreferenceConstants.SCALE_FACTOR, "&Zoom", getFieldEditorParent(), 0.1,
            5.0));

    FileFieldEditor font = new FileFieldEditor(ReoPreferenceConstants.ANIMATION_FONT, "&Font",
            getFieldEditorParent());
    font.setFileExtensions(new String[] { "*.swf" });
    addField(font);

}

From source file:org.limy.eclipse.code.preference.LimyCodePreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    System.out.println(parent.getLayout());
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayout(new GridLayout());

    FileFieldEditor gnuHeaderFile = new FileFieldEditor(LimyCodeConstants.PREF_JAVA_HEADER,
            "Java Header Text File : ", comp);
    gnuHeaderFile.setFileExtensions(new String[] { "*.txt" });

    FileFieldEditor javadocProp = new FileFieldEditor(LimyCodeConstants.PREF_PROP_PATH,
            "Javadoc Comment File : ", comp);

    initField(gnuHeaderFile);/* w  ww.j a va2 s. c om*/
    initField(javadocProp);

    Button button = new Button(comp, SWT.NONE);
    button.setText("&Edit...");
    button.setLayoutData(GridDataCreator.createHorizontalSpan(3, SWT.RIGHT));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            String path = LimyCodePlugin.getDefault().getPreferenceStore()
                    .getString(LimyCodeConstants.PREF_PROP_PATH);
            if (path != null && path.length() > 0) {
                JavadocPropDialog dialog = new JavadocPropDialog(getShell(), new File(path));
                dialog.open();
            } else {
                LimySwtUtils.showAlertDialog(LimyCodePlugin.getResourceString("not.specified.javadoc.file"));
            }
        }
    });

    Composite comp2 = new Composite(parent, SWT.NONE);
    comp2.setLayout(new GridLayout());
    comp2.setLayoutData(GridDataCreator.createFillGrab());

    StringFieldEditor getter = new StringFieldEditor(LimyCodeConstants.PREF_GETTER_DESC,
            "Getter-method Description : ", comp2);

    StringFieldEditor setter = new StringFieldEditor(LimyCodeConstants.PREF_SETTER_DESC,
            "Setter-method Description : ", comp2);

    initField(getter);
    initField(setter);

    return comp;
}

From source file:org.lyllo.kickassplugin.ui.PreferencesCompiler.java

License:Open Source License

/**
 * {@inheritDoc}//w w  w  .  ja v  a 2s.  co  m
 */
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();

    // Field for Compiler-Executable
    FileFieldEditor compiler = new FileFieldEditor(Constants.PREFERENCES_COMPILER_NAME,
            Messages.COMPILER_NAME + ": ", true, parent);
    compiler.setEmptyStringAllowed(false);
    compiler.setFileExtensions(new String[] { "*.jar" });

    addField(compiler);

    BooleanFieldEditor symbols = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_SYMBOLS,
            Messages.COMPILER_SYMBOLS, parent);
    addField(symbols);

    BooleanFieldEditor vicesymbols = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_VICESYMBOLS,
            Messages.COMPILER_VICESYMBOLS, parent);
    addField(vicesymbols);

    BooleanFieldEditor afo = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_AFO, Messages.COMPILER_AFO,
            parent);
    addField(afo);

    StringFieldEditor kickasscfg = new StringFieldEditor(Constants.PREFERENCES_LOCAL_CONFIG,
            Messages.COMPILER_LOCAL_CFG, parent);
    kickasscfg.setEmptyStringAllowed(true);
    addField(kickasscfg);

    PathEditor pathEditor = new PathEditor(Constants.PREFERENCES_COMPILER_LIBDIRS, Messages.COMPILER_LIBDIRS,
            Messages.COMPILER_LIBDIRS_CHOOSETEXT, parent);
    addField(pathEditor);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;

    Label label = new Label(parent, SWT.LEFT);
    label.setText(Messages.PARAMS_TEMPLATE_COMPILER);
    label.setLayoutData(gd);

    // Field for parameters to use Compiler-Executable
    MultiLineStringFieldEditor params = new MultiLineStringFieldEditor(Constants.PREFERENCES_COMPILER_PARAMS,
            Messages.PARAMS_NAME, parent);
    params.setErrorMessage("Invalid parameter. Must be in 'key=value' format.");

    addField(params);

}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.DefaultLaunchConfigurationPreferencePage.java

License:Apache License

private void createExecutorLaunchConfigurationPreferences(final Composite parent) {
    final Group group = new Group(parent, SWT.NONE);
    group.setText("Executor tab");
    GridLayoutFactory.fillDefaults().applyTo(group);
    GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).span(2, 1).applyTo(group);

    final StringFieldEditor additionalInterpreterArguments = new StringFieldEditor(
            RedPreferences.LAUNCH_ADDITIONAL_INTERPRETER_ARGUMENTS, "Additional interpreter arguments:", group);
    additionalInterpreterArguments.load();
    addField(additionalInterpreterArguments);

    final FileFieldEditor scriptPathEditor = new FileFieldEditor(RedPreferences.LAUNCH_EXECUTABLE_FILE_PATH,
            "Executable file:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, group);
    scriptPathEditor.setFileExtensions(RobotLaunchConfiguration.getSystemDependentExecutableFileExtensions());
    scriptPathEditor.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile());
    scriptPathEditor.load();/*ww w .  j  a v  a  2  s.c  o  m*/
    addField(scriptPathEditor);

    final StringFieldEditor additionalScriptArguments = new StringFieldEditor(
            RedPreferences.LAUNCH_ADDITIONAL_EXECUTABLE_FILE_ARGUMENTS, "Additional executable file arguments:",
            group);
    additionalScriptArguments.load();
    addField(additionalScriptArguments);

    GridDataFactory.fillDefaults().span(2, 1).applyTo(scriptPathEditor.getLabelControl(group));
}