Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.FileDialog


    /* Export Log to File */
    helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE) {
      @Override
      public void run() {
        FileDialog dialog = new FileDialog(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), SWT.SAVE);
        dialog.setText(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE_DIALOG);
        dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
        dialog.setFileName("rssowl.log"); //$NON-NLS-1$
        dialog.setOverwrite(true);

        String file = dialog.open();
        if (StringUtils.isSet(file)) {
          try {

            /* Check for Log Message from Core to have a complete log */
            String logMessages = CoreUtils.getAndFlushLogMessages();
View Full Code Here


        String size = OwlUI.getSize(attachment.getLength());

        Action action = new Action(size != null ? (NLS.bind(Messages.ApplicationActionBarAdvisor_FILE_SIZE, fileName, size)) : (fileName)) {
          @Override
          public void run() {
            FileDialog dialog = new FileDialog(shellProvider.getShell(), SWT.SAVE);
            dialog.setText(Messages.ApplicationActionBarAdvisor_SELECT_FILE_FOR_DOWNLOAD);
            dialog.setFileName(Application.IS_WINDOWS ? CoreUtils.getSafeFileNameForWindows(fileName) : fileName);
            dialog.setOverwrite(true);

            String downloadFolder = preferences.getString(DefaultPreferences.DOWNLOAD_FOLDER);
            if (StringUtils.isSet(downloadFolder) && new File(downloadFolder).exists())
              dialog.setFilterPath(downloadFolder);

            String selectedFileName = dialog.open();
            if (StringUtils.isSet(selectedFileName)) {
              File file = new File(selectedFileName);
              Controller.getDefault().getDownloadService().download(attachmentPair.getFirst(), attachmentPair.getSecond(), file.getName(), file.getParentFile(), true);

              /* Remember Download Folder in Settings */
 
View Full Code Here

      setButtonLayoutData(fCustomBrowserSearchButton);
      fCustomBrowserSearchButton.setEnabled(fUseCustomExternalBrowser.getSelection());
      fCustomBrowserSearchButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
          FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
          dialog.setFileName(fCustomBrowserInput.getText());
          String path = dialog.open();
          if (path != null)
            fCustomBrowserInput.setText(path);
        }
      });
    }
View Full Code Here

  public void doSaveAs() {
    if (fIsDisposed || Controller.getDefault().isShuttingDown())
      return;

    /* Ask user for File */
    FileDialog dialog = new FileDialog(getSite().getShell(), SWT.SAVE);
    dialog.setOverwrite(true);
    if (fInput.getMark() instanceof IBookMark)
      dialog.setFilterExtensions(new String[] { ".html", ".xml" }); //$NON-NLS-1$ //$NON-NLS-2$
    else
      dialog.setFilterExtensions(new String[] { ".html" }); //$NON-NLS-1$
    dialog.setFileName(Application.IS_WINDOWS ? CoreUtils.getSafeFileNameForWindows(fInput.getName()) : fInput.getName());

    String fileName = dialog.open();
    if (fileName == null)
      return;

    if (fileName.endsWith(".xml")) //$NON-NLS-1$
      saveAsXml(fileName);
View Full Code Here

     
      currPath = currPath.replace("/".toCharArray()[0], sep.toCharArray()[0]);
      currPath = currPath.replace("\\".toCharArray()[0], sep.toCharArray()[0]);


      FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.OPEN);
      fdialog.setFilterPath(currPath);
      fdialog.setFilterExtensions(new String[]{"*.xml"});
      fdialog.setText("Open Base File");

      String fname = fdialog.open();
      if (fname == null)
        return;

      //fname = fname.substring(currPath.length()+1);
      fname = fname.replaceAll("/", sep);
View Full Code Here

    public static String getFile(Collection filenames) {

       try {        
             // open file dialog
             if (filename == null || filename.equals("")) {
                 FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.OPEN);
                 fdialog.setFilterPath(Options.getLastDirectory());
                 fdialog.setText("Open File");
                 filename = fdialog.open();
             }

             // check for opened file
             if (filenames != null) {
                 for (Iterator it = filenames.iterator(); it.hasNext();) {
View Full Code Here

  public org.eclipse.swt.widgets.Composite openQuick() {
    String xmlFilename = "";
    try {

      FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.OPEN);                           
      fdialog.setFilterPath(Options.getLastDirectory());
      fdialog.setText("Open");
      fdialog.setFilterExtensions(new String[] {"*.xml"});
      xmlFilename = fdialog.open();
      return openQuick(xmlFilename);

    } catch (Exception e) {
      try {
        new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " ; could not open File ", e);
View Full Code Here

   * �ffnet
   */
  public static String openDirectoryFile(String mask) {
    String filename = "";

    FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.OPEN);            



    fdialog.setFilterPath(Options.getLastDirectory());
    String filterMask = mask.replaceAll("\\\\", "");
    filterMask = filterMask.replaceAll("\\^.", "");
    filterMask = filterMask.replaceAll("\\$", "");

    fdialog.setFilterExtensions(new String[]{filterMask});
    filename = fdialog.open()

    if(filename == null || filename.trim().length() == 0)
      return filename;


View Full Code Here

    try {
      boolean isDirectory = dom instanceof SchedulerDom &&  ((SchedulerDom)dom).isDirectory();
      String xml =null;
      // open file dialog           
      if (!isDirectory && (filename == null || filename.equals(""))) {
        FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.OPEN);                           
        fdialog.setFilterPath(Options.getLastDirectory());
        fdialog.setText("Open" + getDomInstance(dom) + " File");               
        filename = fdialog.open();               
      }

      // open Directory
      //if (filename != null && filename.equals("#xml#")) {
      if(isDirectory) {

        String path = filename;
        if(filename == null || filename.length() == 0) {
          DirectoryDialog fdialog = new DirectoryDialog(MainWindow.getSShell(), SWT.MULTI);
          fdialog.setFilterPath(Options.getLastDirectory());

          fdialog.setText("Open" + getDomInstance(dom) + " File");

          String fname = fdialog.open();
          if (fname == null)
            return false;
          //path = fdialog.getFilterPath();
          path = fname;
View Full Code Here

    boolean overrideOriFile = saveas;
    try {

      // if save file as...
      if (saveas || filename == null || filename.equals("")) { //$NON-NLS-1$
        FileDialog fdialog = new FileDialog(MainWindow.getSShell(), SWT.SAVE);
        fdialog.setFilterPath(Options.getLastDirectory());
        fdialog.setText("Save" + getDomInstance(dom) + " File");
        filename = fdialog.open();
        if (filename == null)
          return false;
        saveas = true;
      }
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.