Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.FileDialog


  private void makeActions() {
    insert = new Action(getCaption("collection.insertDoc")) {
      @Override
      public void run() {
        FileDialog dialog = new FileDialog(view.getSite().getShell(),
            SWT.OPEN);
        dialog.setFilterExtensions(new String[]{"*.json"});
        String result = dialog.open();
        if (result != null) {
          try {
            String jsonText = IOUtils.readFile(new File(result));
            JSONObject jsonObj = new JSONObject(jsonText);
            col.insert(JSONUtils.toDBObject(jsonObj));
          } catch (Exception ex) {
            UIUtils.openErrorDialog(view.getSite().getShell(),
                ex.toString());
          }
        }
      }
    };

    rename = new Action(getCaption("collection.renameColl")) {
      @Override
      public void run() {
        InputDialog dialog = new InputDialog(view.getSite().getShell(),
            getCaption("collection.renameColl"),
            getCaption("collection.msg.newCollName"),
            col.getName(), new RequiredInputValidator(
                getCaption("collection.msg.inputCollName")));
        if (dialog.open() == InputDialog.OK) {
          try {
            col.rename(dialog.getValue());
          } catch (MongoException ex) {
            UIUtils.openErrorDialog(view.getSite().getShell(),
                ex.toString());
          }
          view.getViewer().refresh(getParent());
View Full Code Here


        });

    scriptField = new StringButtonDialogField(new IStringButtonAdapter() {
      @Override
      public void changeControlPressed(DialogField field) {
        FileDialog dialog = new FileDialog(getShell());
        String path = dialog.open();
        if (path != null) {
          scriptField.setText(path);
        }
      }
    });
View Full Code Here

    @Override
    public void init(final IWorkbench workbench) {
    }

    private String selectPLTDialog(final String s) {
        final FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
        dialog.setText("Select PLT file");
        dialog.setFileName(s);
        dialog.setFilterPath(s);
        dialog.setFilterNames(new String[] { "Dialyzer PLT file (*.plt)", "Any File" });
        dialog.setFilterExtensions(new String[] { "*.plt", "*.*" });
        final String result = dialog.open();
        return result;
    }
View Full Code Here

        if (last == null) {
            last = ""; //$NON-NLS-1$
        } else {
            last = last.trim();
        }
        final FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
        dialog.setText("Select file with external modules");
        dialog.setFileName(last);
        dialog.setFilterExtensions(new String[] { "*.erlidex" });
        final String result = dialog.open();
        if (result == null) {
            return;
        }
        externalModules.setText(result);
    }
View Full Code Here

        if (last == null) {
            last = ""; //$NON-NLS-1$
        } else {
            last = last.trim();
        }
        final FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
        dialog.setText("Select file with external include files");
        dialog.setFileName(last);
        dialog.setFilterExtensions(new String[] { "*.erlidex" });
        final String result = dialog.open();
        if (result == null) {
            return;
        }
        externalIncludes.setText(result);
    }
View Full Code Here

    }

    @Override
    public void run() {

        final FileDialog fd = new FileDialog(shell, SWT.SAVE);
        fd.setText("Select directory to export your HTML reports");
        fd.setFilterExtensions(new String[] { "*.*" });
        final String path = fd.open();

        log.info(path);
        if (path == null) {
            return;
        }
View Full Code Here

    /**
     * Save image to a file
     */
    public void onFileSave() {
        final FileDialog fileChooser = new FileDialog(getShell(), SWT.SAVE);
        fileChooser.setText("Save image file");
        fileChooser.setFilterPath(currentDir);
        fileChooser.setFilterExtensions(new String[] { "*.jpg;*.png" });
        fileChooser.setFilterNames(new String[] { "Image file " + " (jpeg, png)" });
        final String filename = fileChooser.open();
        if (filename != null) {
            final ImageLoader imageLoader = new ImageLoader();
            imageLoader.data = new ImageData[] { sourceImage.getImageData() };
            final Path p = new Path(filename);
            if (p.getFileExtension() == "jpg") {
View Full Code Here

    /**
     * Call back funtion of button "open". Will open a file dialog, and choose
     * the image file. It supports image formats supported by Eclipse.
     */
    public void onFileOpen() {
        final FileDialog fileChooser = new FileDialog(getShell(), SWT.OPEN);
        fileChooser.setText("Open image file");
        fileChooser.setFilterPath(currentDir);
        fileChooser
                .setFilterExtensions(new String[] { "*.gif; *.jpg; *.png; *.ico; *.bmp" });
        fileChooser.setFilterNames(new String[] { "SWT image"
                + " (gif, jpeg, png, ico, bmp)" });
        final String filename = fileChooser.open();
        if (filename != null) {
            loadImage(filename);
            currentDir = fileChooser.getFilterPath();
        }
    }
View Full Code Here

        }

        @Override
        public void run() {
            final FileDialog fileChooser = new FileDialog(imageCanvas.getShell(),
                    SWT.SAVE);
            fileChooser.setText("Save .dot file");
            fileChooser.setFilterPath("");
            fileChooser.setFilterExtensions(new String[] { "*.dot" });
            fileChooser.setFilterNames(new String[] { "Graphviz file " + " (dot)" });
            final String filename = fileChooser.open();
            if (filename != null) {
                try {
                    FileUtils.copyFile(dotFile, new File(filename));
                } catch (final IOException e) {
                    MessageDialog.openError(imageCanvas.getShell(), "Saving error",
View Full Code Here

     * @return File The File the user selected or <code>null</code> if they
     * do not.
     */
    private File getFile(File startingDirectory) {

        FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SHEET);
        if (startingDirectory != null) {
      dialog.setFileName(startingDirectory.getPath());
    }
        else if (filterPath != null) {
          dialog.setFilterPath(filterPath.getPath());
        }
        if (extensions != null) {
      dialog.setFilterExtensions(extensions);
    }
        String file = dialog.open();
        if (file != null) {
            file = file.trim();
            if (file.length() > 0) {
        return 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.