Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.FileDialog


    /**
     * 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( "ExportSchemasAsXmlWizardPage.SelectFile" ) ); //$NON-NLS-1$
        dialog.setFilterExtensions( new String[]
            { "*.xml", "*" } ); //$NON-NLS-1$ //$NON-NLS-2$
        dialog
            .setFilterNames( new String[]
                {
                    Messages.getString( "ExportSchemasAsXmlWizardPage.XMLFiles" ), Messages.getString( "ExportSchemasAsXmlWizardPage.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_XML ) );
        }
        else
        {
            dialog.setFilterPath( exportSingleFileText.getText() );
        }

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


*/
public class LoadStateCommand extends AbstractHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    FileDialog fd = new FileDialog(new Shell(), SWT.OPEN);
    fd.setText(Messages.LoadStateCommand_Open);
    String[] filterExt = { "*.baron", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
    fd.setFilterExtensions(filterExt);
    String selected = fd.open();
    if (selected != null) {
      Activator.getDefault().getServer().loadState(selected);
    }
    return null;
  }
View Full Code Here

public class SaveStateCommand extends AbstractHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {

    FileDialog fd = new FileDialog(new Shell(), SWT.SAVE);
    fd.setText(Messages.SaveStateCommand_Save);
    String[] filterExt = { "*.baron", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
    fd.setFilterExtensions(filterExt);
    String selected = fd.open();
    if (selected != null) {
      Activator.getDefault().getServer().saveState(selected);
    }
    return null;
  }
View Full Code Here

    private void buttonOKMouseDown(MouseEvent evt) {
        Shell shell = new Shell(Display.getCurrent());
        shell.setFocus();
        //shell.setImage(image);
        FileDialog dialog = new FileDialog(shell,
                SWT.SAVE);

        dialog.setFilterNames(new String[]{
                    "XML Documents"});
        dialog.setFilterExtensions(new String[]{
                    "*.xml"}); // Wild
        // cards
        dialog.setFileName(".xml");
        dialog.setText("Location to save the file");
        String path = dialog.open();

        FileOutputStream out;
        try {
            out = new FileOutputStream(path);

            PrintStream newXML; // declare a print stream
            // object
            newXML = new PrintStream(out);
            // Connect print stream to the output
            // stream

            /*
             * now the convert method will simply
             * convert and the o/p is put to file
             * only after the user presses ok button
             */
            //Write header
            newXML.println("<?xml version=\"1.0\"?>");

            //Start of the XML Data

            String temp;
            int length = dialog.getFileName().length();
            temp = dialog.getFileName().substring(0, length - 4);

            newXML.println("<" + temp + ">\n");

            /*The row from A to L starts here*/

 
View Full Code Here

       * Opens a file dialog and adds the selected files to the file table viewer.
       */
      public void widgetSelected(SelectionEvent e) {

        // open a file dialog
        FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.MULTI);
        fd.setText("Choose text files");
        fd.setFilterExtensions(new String[] { "*.txt;*.rtf", "*.*"});
        fd.setFilterNames(new String[] {"Text Files", "All Files (*)"});
        if (fd.open() != null) {
          for (String fileItem : fd.getFileNames()) {
            fileTable.add(new File(fd.getFilterPath() + File.separator + fileItem));
          }

          updatePageState();
        }
      }
View Full Code Here

    public void run(IAction action) {
        Shell activeShell = Display.getDefault().getActiveShell();
        String path = null;

        while (path == null) {
            FileDialog dialog = new FileDialog(activeShell);
            // dialog.setFilterPath(Messages.OpenProject_newProject_filename);
            // dialog.setMessage(Messages.OpenProject_selectProject);
            dialog.setText(Messages.OpenProject_openProject);
            path = dialog.open();
            if (path == null) {
                return;
            }

            loadMapFromString(path, ApplicationGIS.getActiveProject(), true);
View Full Code Here

      return stripEndSlash(path.substring(0, path.length() - 1));
    return path;
  }

  private File selectFile(File destination, String string) {
    FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
    dialog.setText(string);
    dialog.setFilterPath(destination.getParent());
    dialog.setFileName(destination.getName());
    String file = dialog.open();
    if (file == null) {
      destination = null;
    } else {
      destination = new File(file);
    }
View Full Code Here

   */
  private void loadFile() {

    setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));

    FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell());

    dialog.setFileName(Preferences.getImagePath());
    // dialog.setFileName(cmd.getImagePath());

    String file = dialog.open();

    if (file != null && !file.equals("")) { //$NON-NLS-1$

      this.image = new Image(Display.getCurrent(), file);
      setDefaultLoadData();
View Full Code Here

        Button pathButton = new Button(pathComposite, SWT.PUSH);
        pathButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
        pathButton.setText("..."); //$NON-NLS-1$
        pathButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter(){
            public void widgetSelected( org.eclipse.swt.events.SelectionEvent e ) {
                FileDialog fileDialog = new FileDialog(graphicsPathText.getShell(), SWT.OPEN);
                String path = fileDialog.open();
                if (path == null || path.length() < 1) {
                    graphicsPathText.setText(""); //$NON-NLS-1$
                } else {
                    graphicsPathText.setText(path);
                }
View Full Code Here

            return stripEndSlash(path.substring(0, path.length() - 1));
        return path;
    }

    private File selectFile( File destination, String string ) {
        FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
        dialog.setText(string);
        dialog.setFilterPath(destination.getParent());
        dialog.setFileName(destination.getName());
        String file = dialog.open();
        if (file == null) {
            destination = null;
        } else {
            destination = new File(file);
        }
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.