Examples of FileDialog


Examples of org.eclipse.swt.widgets.FileDialog

      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

Examples of org.eclipse.swt.widgets.FileDialog

  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

Examples of org.eclipse.swt.widgets.FileDialog

     
      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

Examples of org.eclipse.swt.widgets.FileDialog

    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

Examples of org.eclipse.swt.widgets.FileDialog

  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

Examples of org.eclipse.swt.widgets.FileDialog

   * �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

Examples of org.eclipse.swt.widgets.FileDialog

    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

Examples of org.eclipse.swt.widgets.FileDialog

    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

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

Examples of org.eclipse.swt.widgets.FileDialog

        {
            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
TOP
Copyright © 2018 www.massapi.com. 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.