Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.FileDialog


            String path = null;

            while ( !canOverwrite )
            {
                // Open FileDialog
                FileDialog dialog = new FileDialog( shell, SWT.SAVE );
                path = dialog.open();
                if ( path == null )
                {
                    return false;
                }
View Full Code Here


        {
            returnData = currentData;
        }
        else if ( buttonId == SAVE_BUTTON_ID )
        {
            FileDialog fileDialog = new FileDialog( getShell(), SWT.SAVE );
            fileDialog.setText( Messages.getString( "CertificateDialog.SaveCertificate" ) ); //$NON-NLS-1$
            // fileDialog.setFilterExtensions(new String[]{"*.pem"});
            String returnedFileName = fileDialog.open();
            if ( returnedFileName != null )
            {
                try
                {
                    File file = new File( returnedFileName );
                    FileUtils.writeByteArrayToFile( file, currentData );
                }
                catch ( IOException e )
                {
                    ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
                        new Status( IStatus.ERROR, ValueEditorsConstants.PLUGIN_ID, IStatus.ERROR, Messages
                            .getString( "CertificateDialog.CantWriteToFile" ), e ) ); //$NON-NLS-1$
                }
            }
        }
        else if ( buttonId == LOAD_BUTTON_ID )
        {
            FileDialog fileDialog = new FileDialog( getShell(), SWT.OPEN );
            fileDialog.setText( Messages.getString( "CertificateDialog.LoadCertificate" ) ); //$NON-NLS-1$
            String returnedFileName = fileDialog.open();
            if ( returnedFileName != null )
            {
                try
                {
                    File file = new File( returnedFileName );
View Full Code Here

    /**
     * This method is called when the exportSingleFile 'browse' button is selected.
     */
    private void chooseExportFile()
    {
        FileDialog dialog = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE );
        dialog.setText( Messages.getString( "ExportSchemasForADSWizardPage.SelectFile" ) ); //$NON-NLS-1$
        dialog.setFilterExtensions( new String[]
            { "*.ldif", "*" } ); //$NON-NLS-1$ //$NON-NLS-2$
        dialog
            .setFilterNames( new String[]
                {
                    Messages.getString( "ExportSchemasForADSWizardPage.LDIFFiles" ), Messages.getString( "ExportSchemasForADSWizardPage.AllFiles" ) } ); //$NON-NLS-1$ //$NON-NLS-2$
        if ( "".equals( exportSingleFileText.getText() ) ) //$NON-NLS-1$
        {
            dialog.setFilterPath( Activator.getDefault().getPreferenceStore().getString(
                PluginConstants.FILE_DIALOG_EXPORT_SCHEMAS_APACHE_DS ) );
        }
        else
        {
            dialog.setFilterPath( exportSingleFileText.getText() );
        }

        String selectedFile = dialog.open();
        if ( selectedFile != null )
        {
            exportSingleFileText.setText( selectedFile );
        }
    }
View Full Code Here

            }
        }
    }

    void doAddExternal() {
        FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.MULTI);
        dialog.setFilterExtensions(new String[] {
            "*.jar"}); //$NON-NLS-1$
        String res = dialog.open();
        if (res != null) {
            IPath filterPath = new Path(dialog.getFilterPath());

            String[] fileNames = dialog.getFileNames();
            List<File> added = new ArrayList<File>(fileNames.length);
            for (String fileName : fileNames) {
                added.add(filterPath.append(fileName).toFile());
            }
            if (!added.isEmpty()) {
View Full Code Here

        btnFolder.addListener(SWT.Selection, listener);

        btnBrowseJar.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
                dialog.setFilterExtensions(new String[] {
                    "*.jar"
                });
                dialog.setFilterNames(new String[] {
                    "JAR Files"
                });
                String path = dialog.open();
                if (path != null)
                    txtJarPath.setText(path);
            }
        });
    }
View Full Code Here

        IFile file = ResourceUtil.getFile(page.getEditorInput());
        return file;
    }

    void doAdd() {
        FileDialog dialog = new FileDialog(getManagedForm().getForm().getShell(), SWT.OPEN | SWT.MULTI);
        try {
            File wsdir = Central.getWorkspace().getBase();
            File cnfdir = new File(wsdir, Workspace.CNFDIR);
            dialog.setFilterPath(cnfdir.getAbsolutePath());
            dialog.setFilterExtensions(new String[] {
                "*.jar"}); //$NON-NLS-1$

            String res = dialog.open();
            if (res != null) {
                File baseDir = new File(dialog.getFilterPath());
                String[] fileNames = dialog.getFileNames();
                if (fileNames != null && fileNames.length > 0) {
                    for (String fileName : fileNames) {
                        File file = new File(fileName);
                        if (!file.isAbsolute())
                            file = new File(baseDir, fileName);
View Full Code Here

     *
     * @param shell
     *            the parent shell
     */
    public SafeSaveDialog(Shell shell) {
        dlg = new FileDialog(shell, SWT.SAVE);
    }
View Full Code Here

    il.data = new ImageData[] {screenShot.getImageData()};
    il.save(to, SWT.IMAGE_PNG);
  }
 
  public void makeScreenShot() {
    FileDialog f = new FileDialog(parent.getShell(), SWT.SAVE);
    f.setText("Select where to save your screenshot.");
    String filepath = f.open();
    if(filepath == null){
      return;
    }

   
View Full Code Here

    return CommandOptions.getDefaultTunnelOptionsDescription();
  }

  protected void handleFileLocationButtonSelected() {
    if (shell != null && locationField != null) {
      FileDialog fileDialog = new FileDialog(shell, SWT.NONE);
      fileDialog.setFileName(locationField.getText());
      String text = fileDialog.open();
      if (text != null) {
        locationField.setText(text);
      }
    }
View Full Code Here

                text.setText(value);
            }
        }
        else
        {
            FileDialog dialog = new FileDialog(shell, SWT.NONE);
            dialog.setText(msg);
            String value = dialog.open();
            if (value != null)
            {
                text.setText(value);
            }
        }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.FileDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.