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

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

Introduction

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

Prototype

public FileFieldEditor(String name, String labelText, Composite parent) 

Source Link

Document

Creates a file field editor.

Usage

From source file:ac.soton.fmusim.components.ui.importWizards.ImportWizardPage.java

License:Open Source License

protected void createAdvancedControls(Composite parent) {
    Composite fileSelectionArea = new Composite(parent, SWT.NONE);
    GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    fileSelectionArea.setLayoutData(fileSelectionData);

    GridLayout fileSelectionLayout = new GridLayout();
    fileSelectionLayout.numColumns = 3;//from   w w w  .  j a  v a 2s .c  om
    fileSelectionLayout.makeColumnsEqualWidth = false;
    fileSelectionLayout.marginWidth = 0;
    fileSelectionLayout.marginHeight = 0;
    fileSelectionArea.setLayout(fileSelectionLayout);

    editor = new FileFieldEditor("fileSelect", "Select File: ", fileSelectionArea); //NON-NLS-1 //NON-NLS-2
    editor.getTextControl(fileSelectionArea).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            IPath path = new Path(ImportWizardPage.this.editor.getStringValue());
            setFileName(path.lastSegment());
        }
    });
    String[] extensions = new String[] { "*.zip;*.tar;*.jar" }; //NON-NLS-1
    editor.setFileExtensions(extensions);
    fileSelectionArea.moveAbove(null);

}

From source file:alice.tuprologx.eclipse.importWizards.ImportWizardPage.java

License:Open Source License

protected void createAdvancedControls(Composite parent) {
    Composite fileSelectionArea = new Composite(parent, SWT.NONE);
    GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    fileSelectionArea.setLayoutData(fileSelectionData);

    GridLayout fileSelectionLayout = new GridLayout();
    fileSelectionLayout.numColumns = 3;//from  ww w.j a  v a  2  s  . c  o  m
    fileSelectionLayout.makeColumnsEqualWidth = false;
    fileSelectionLayout.marginWidth = 0;
    fileSelectionLayout.marginHeight = 0;
    fileSelectionArea.setLayout(fileSelectionLayout);

    editor = new FileFieldEditor("fileSelect", "Select File: ", fileSelectionArea); // NON-NLS-1 //NON-NLS-2
    editor.getTextControl(fileSelectionArea).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            IPath path = new Path(ImportWizardPage.this.editor.getStringValue());
            setFileName(path.lastSegment());
        }
    });
    String[] extensions = new String[] { "*.pl" }; // NON-NLS-1
    editor.setFileExtensions(extensions);
    fileSelectionArea.moveAbove(null);

}

From source file:br.ufms.facom.acctrace.importWizards.ImportWizardPage.java

License:Open Source License

protected void createAdvancedControls(Composite parent) {
    Composite fileSelectionArea = new Composite(parent, SWT.NONE);
    GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    fileSelectionArea.setLayoutData(fileSelectionData);

    GridLayout fileSelectionLayout = new GridLayout();
    fileSelectionLayout.numColumns = 3;/*from   www.j ava 2 s .  com*/
    fileSelectionLayout.makeColumnsEqualWidth = false;
    fileSelectionLayout.marginWidth = 0;
    fileSelectionLayout.marginHeight = 0;
    fileSelectionArea.setLayout(fileSelectionLayout);

    editor = new FileFieldEditor("fileSelect", "Select File: ", fileSelectionArea); // NON-NLS-1 //NON-NLS-2
    editor.getTextControl(fileSelectionArea).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            IPath path = new Path(ImportWizardPage.this.editor.getStringValue());
            setFileName(path.lastSegment());
        }
    });
    String[] extensions = new String[] { "*.*" }; // NON-NLS-1
    editor.setFileExtensions(extensions);
    fileSelectionArea.moveAbove(null);

}

From source file:ch.elexis.extdoc.preferences.ExterneDokumente.java

License:Open Source License

@Override
protected void createFieldEditors() {
    DirectoryFieldEditor dfe;/*from   www.  j a v  a2  s  . c o  m*/
    StringFieldEditor sfe;
    FileFieldEditor ffe;

    PreferenceConstants.PathElement[] prefElems = PreferenceConstants.getPrefenceElements();
    for (int j = 0; j < prefElems.length; j++) {
        sfe = new StringFieldEditor(prefElems[j].prefName,
                String.format(Messages.ExterneDokumente_shorthand_for_path, j), getFieldEditorParent());
        sfe.setTextLimit(8);
        addField(sfe);
        dfe = new DirectoryFieldEditor(prefElems[j].prefBaseDir, Messages.ExterneDokumente_path_name_preference,
                getFieldEditorParent());
        addField(dfe);
    }
    sfe = new StringFieldEditor(PreferenceConstants.CONCERNS, Messages.ExterneDokumente_Concerns,
            getFieldEditorParent());
    sfe.setTextLimit(60);
    addField(sfe);
    Composite composite = getFieldEditorParent();
    ffe = new FileFieldEditor(PreferenceConstants.EMAIL_PROGRAM, Messages.ExterneDokumente_email_app,
            getFieldEditorParent());
    ffe.getLabelControl(composite).setToolTipText(
            "Programm das zum Verschicken von E-Mails verwendet werden soll, falls leer wird dir URL mailto: verwendet, welche keine Anhnge untersttzt");
    addField(ffe);

}

From source file:ch.elexis.laborimport.bioanalytica.PreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new FileFieldEditor(JAR_PATH, "OpenMedical Bibliothek (JMedTransferO.jar)",
            getFieldEditorParent()));/*www .  j  a  v  a  2  s  .c o  m*/
    addField(new FileFieldEditor(INI_PATH, "OpenMedical Konfiguration (MedTransfer.ini)",
            getFieldEditorParent()));
    addField(new DirectoryFieldEditor(DL_DIR, "Download Verzeichnis", getFieldEditorParent()));
}

From source file:ch.elexis.laborimport.labtop.PreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new FileFieldEditor(JAR_PATH, Messages.PreferencePage_JMedTrasferJar, getFieldEditorParent()));
    addField(new FileFieldEditor(INI_PATH, Messages.PreferencePage_JMedTrasferJni, getFieldEditorParent()));
    addField(new DirectoryFieldEditor(DL_DIR, Messages.PreferencePage_DownloadDir, getFieldEditorParent()));
}

From source file:ch.elexis.laborimport.teamw.PreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parentComp = getFieldEditorParent();
    final RadioGroupFieldEditor groupFieldEditor = new RadioGroupFieldEditor(BATCH_OR_FTP,
            Messages.getString("PreferencePage.direktimport.label"), 2, new String[][] { //$NON-NLS-1$
                    { Messages.getString("PreferencePage.batchscript.label"), BATCH }, //$NON-NLS-1$
                    { Messages.getString("PreferencePage.ftpserver.label"), FTP } }, //$NON-NLS-1$
            parentComp, true);/*  w ww . j  av  a 2  s .co  m*/
    final FileFieldEditor batchFileEditor = new FileFieldEditor(BATCH_DATEI,
            Messages.getString("PreferencePage.batchdatei.label"), //$NON-NLS-1$
            parentComp);

    addField(groupFieldEditor);
    addField(batchFileEditor);

    addField(new StringFieldEditor(FTP_HOST, Messages.getString("PreferencePage.label.host"), //$NON-NLS-1$
            getFieldEditorParent()));
    addField(new StringFieldEditor(FTP_USER, Messages.getString("PreferencePage.label.user"), //$NON-NLS-1$
            getFieldEditorParent()));
    addField(new StringFieldEditor(FTP_PWD, Messages.getString("PreferencePage.label.password"), //$NON-NLS-1$
            getFieldEditorParent()));
    addField(new InexistingDirectoryOKDirectoryFieldEditor(DL_DIR,
            Messages.getString("PreferencePage.label.download"), getFieldEditorParent())); //$NON-NLS-1$
}

From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.wizards.DockerConnectionWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    composite.setLayoutData(fileSelectionData);

    GridLayout fileSelectionLayout = new GridLayout();
    fileSelectionLayout.numColumns = 3;/*from   w w w  .  j a v a2s .  c om*/
    fileSelectionLayout.makeColumnsEqualWidth = false;
    fileSelectionLayout.marginWidth = 0;
    fileSelectionLayout.marginHeight = 0;
    composite.setLayout(fileSelectionLayout);
    setControl(composite);

    editor = new StringFieldEditor("connName", "Docker Connection Name: ", composite); //NON-NLS-1 //NON-NLS-2
    editor.getTextControl(composite).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String connName = DockerConnectionWizardPage.this.editor.getStringValue();
            System.out.println("connName:" + connName);
        }
    });

    //      Group group0 = new Group(composite, SWT.NULL);
    //      GridLayout layout = new GridLayout();
    //       layout.numColumns = 1;
    //       group0.setLayout(layout);

    connSetting = new Button(composite, SWT.CHECK);
    connSetting.setSelection(true);
    connSetting.setText("Use default connection settings");
    GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    connSetting.setLayoutData(gridData);

    group1 = new Group(composite, SWT.NULL);
    group1.setText("Connection Setting");
    gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    group1.setLayoutData(gridData);

    optionsButton = new Button[2];
    optionsButton[0] = new Button(group1, SWT.RADIO);
    optionsButton[0].setText("Unix Socket");
    optionsButton[0].setSelection(true);
    gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    optionsButton[0].setLayoutData(gridData);

    unixSocketFileFieldEditor = new FileFieldEditor("Location", "      Location: ", group1); //NON-NLS-1 //NON-NLS-2
    unixSocketFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String location = DockerConnectionWizardPage.this.unixSocketFileFieldEditor.getStringValue();
            System.out.println("Location:" + location);
        }
    });
    optionsButton[1] = new Button(group1, SWT.RADIO);
    optionsButton[1].setText("HTTPS Connection");
    gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    optionsButton[1].setLayoutData(gridData);
    hostEditor = new StringFieldEditor("host", "      Host: ", group1); //NON-NLS-1 //NON-NLS-2
    hostEditor.getTextControl(group1).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String host = DockerConnectionWizardPage.this.hostEditor.getStringValue();
            System.out.println("host:" + host);
        }
    });
    authenticationButton = new Button(group1, SWT.CHECK);
    authenticationButton.setSelection(true);
    authenticationButton.setText("Enable authentication");
    gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    authenticationButton.setLayoutData(gridData);
    authenticationFileFieldEditor = new FileFieldEditor("Path", "     Path: ", group1); //NON-NLS-1 //NON-NLS-2
    authenticationFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String path = DockerConnectionWizardPage.this.authenticationFileFieldEditor.getStringValue();
            System.out.println("Path:" + path);
        }
    });
    testConnection = new Button(composite, SWT.PUSH);
    testConnection.setText("Test Connection");
    testConnection.setAlignment(SWT.RIGHT);
    testConnection.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent arg0) {
            try {
                String conn = testConnection();
                StringBuilder sb = new StringBuilder(
                        "Successfully connect to Docker with the following info:\n");
                sb.append(conn);
                MessageDialog.openInformation(getShell(), "Docker Connection", sb.toString());
            } catch (Exception e) {
                e.printStackTrace();
                StringBuilder sb = new StringBuilder(
                        "Failed to connect to Docker with the following reason:\n");
                sb.append(e.getLocalizedMessage());
                MessageDialog.openError(getShell(), "Docker Connection", sb.toString());
            }

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            keyPressed(arg0);
        }
    });
    composite.moveAbove(null);

    checkUseUnixSocket();
    checkUseDefaultConnSetting();

    addListener();
}

From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.wizards.DockerfileWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    composite.setLayoutData(fileSelectionData);

    GridLayout fileSelectionLayout = new GridLayout();
    fileSelectionLayout.numColumns = 3;// w  w w.  j a va 2  s . co m
    fileSelectionLayout.makeColumnsEqualWidth = false;
    fileSelectionLayout.marginWidth = 0;
    fileSelectionLayout.marginHeight = 0;
    composite.setLayout(fileSelectionLayout);
    setControl(composite);

    dockerfileEditor = new FileFieldEditor("dockerfile", "Dockerfile: ", composite); //NON-NLS-1 //NON-NLS-2
    dockerfileEditor.getTextControl(composite).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {

        }
    });
    GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 2;
    dockerfileEditor.getLabelControl(composite).setLayoutData(layoutData);
    layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 1;
    dockerfileEditor.getTextControl(composite).setLayoutData(layoutData);
    //      dockerfileEditor.fillIntoGrid(composite, 4);
    targetImageNameEditor = new StringFieldEditor("t",
            "Repository name (and optionally a tag) to be applied to the resulting image in case of success: ",
            composite);
    layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 2;
    targetImageNameEditor.getLabelControl(composite).setLayoutData(layoutData);
    layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    layoutData.horizontalSpan = 2;
    targetImageNameEditor.getTextControl(composite).setLayoutData(layoutData);
    //      targetImageNameEditor.fillIntoGrid(composite, 2);
    composite.moveAbove(null);
    addListener();
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.DockerFoundryCredentialsPart.java

License:Open Source License

private void createExistingUserComposite(TabFolder folder) {
    Composite composite = new Composite(folder, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite topComposite = new Composite(composite, SWT.NONE);
    topComposite.setLayout(new GridLayout(2, false));
    topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    //      Label emailLabel = new Label(topComposite, SWT.NONE);
    //      emailLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    //      emailLabel.setText(Messages.COMMONTXT_EMAIL_WITH_COLON);

    dockerfileEditor = new FileFieldEditor("dockerfile", "Dockerfile: ", topComposite);

    dockerfileEditor.getTextControl(topComposite).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            cfServer.setDockerfile(dockerfileEditor.getStringValue());
            updateUI(false);//from   ww  w  . j  a va 2  s  .c  o  m
        }
    });
    //      dockerfileEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    //      containerName.setEditable(true);
    //      if (cfServer.getUsername() != null) {
    //         emailText.setText(cfServer.getUsername());
    //      }
    //
    //      emailText.addModifyListener(new ModifyListener() {
    //         public void modifyText(ModifyEvent e) {
    //            cfServer.setUsername(emailText.getText());
    //            updateUI(false);
    //         }
    //      });
    //
    topComposite = new Composite(composite, SWT.NONE);
    topComposite.setLayout(new GridLayout(2, false));
    topComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label containerVolumeLabel = new Label(topComposite, SWT.NONE);
    containerVolumeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    containerVolumeLabel.setText("ADD VOLUME:");

    containerVolumeText = new Text(topComposite, SWT.BORDER);
    containerVolumeText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    containerVolumeText.setEditable(true);
    containerVolumeText.setText("/home/wangxn/Docker/volume/tomcat:/usr/local/tomcat/webapps");
    cfServer.setDockerVolume(containerVolumeText.getText());

    containerVolumeText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            cfServer.setDockerVolume(containerVolumeText.getText());
            updateUI(false);
        }
    });

    Label containerNameLabel = new Label(topComposite, SWT.NONE);
    containerNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    containerNameLabel.setText("Container Name:");

    containerNameText = new Text(topComposite, SWT.BORDER);
    containerNameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    containerNameText.setEditable(true);
    containerNameText.setText("container1");
    cfServer.setDockerContainerName(containerNameText.getText());

    containerNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            cfServer.setDockerContainerName(containerNameText.getText());
            updateUI(false);
        }
    });

    Label containerLinksLabel = new Label(topComposite, SWT.NONE);
    containerLinksLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    containerLinksLabel.setText("Container Links:");
    containerLinksText = new Text(topComposite, SWT.BORDER);
    containerLinksText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    containerLinksText.setEditable(true);
    containerLinksText.setText("");
    cfServer.setDockerContainerLinks(containerLinksText.getText());

    containerLinksText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            cfServer.setDockerContainerLinks(containerLinksText.getText());
            updateUI(false);
        }
    });

    urlWidget = new CloudUrlWidget(cfServer) {

        @Override
        protected void setUpdatedSelectionInServer() {

            super.setUpdatedSelectionInServer();

            updateUI(false);
        }

    };

    urlWidget.createControls(topComposite);

    String url = urlWidget.getURLSelection();
    if (url != null) {
        cfServer.setUrl(CloudUiUtil.getUrlFromDisplayText(url));
    }

    final Composite validateComposite = new Composite(composite, SWT.NONE);
    validateComposite.setLayout(new GridLayout(3, false));
    validateComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    validateButton = new Button(validateComposite, SWT.PUSH);
    validateButton.setText(Messages.DockerFoundryCredentialsPart_TEXT_VALIDATE_BUTTON);
    validateButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {

            updateUI(true);

        }
    });

    //      registerAccountButton = new Button(validateComposite, SWT.PUSH);
    //      registerAccountButton.setText(Messages.DockerFoundryCredentialsPart_TEXT_REGISTER_BUTTON);
    //      registerAccountButton.addSelectionListener(new SelectionAdapter() {
    //         @Override
    //         public void widgetSelected(SelectionEvent event) {
    //            RegisterAccountWizard wizard = new RegisterAccountWizard(cfServer);
    //            WizardDialog dialog = new WizardDialog(validateComposite.getShell(), wizard);
    //            if (dialog.open() == Window.OK) {
    //               if (wizard.getEmail() != null) {
    //                  emailText.setText(wizard.getEmail());
    //               }
    //               if (wizard.getPassword() != null) {
    //                  passwordText.setText(wizard.getPassword());
    //               }
    //            }
    //         }
    //      });
    //
    //      cfSignupButton = new Button(validateComposite, SWT.PUSH);
    //      cfSignupButton.setText(CloudFoundryConstants.PUBLIC_CF_SERVER_SIGNUP_LABEL);
    //      cfSignupButton.addSelectionListener(new SelectionAdapter() {
    //
    //         public void widgetSelected(SelectionEvent event) {
    //            String signupURL = CloudFoundryBrandingExtensionPoint.getSignupURL(serverTypeId, cfServer.getUrl());
    //            if (signupURL != null) {
    //               CloudFoundryURLNavigation nav = new CloudFoundryURLNavigation(signupURL);
    //               nav.navigateExternal();
    //            }
    //         }
    //      });

    TabItem item = new TabItem(folder, SWT.NONE);
    item.setText(Messages.COMMONTXT_ACCOUNT_INFO);
    item.setControl(composite);
}