Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.DirectoryDialog


       * (non-Javadoc)
       *
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event arg0) {
        DirectoryDialog fd = new DirectoryDialog(wizard.getWizardWindow());
        if (wizard.getErrorMessage().equals("") && !((NewTorrentWizard) wizard).directoryPath.equals("")) {
          fd.setFilterPath(((NewTorrentWizard) wizard).directoryPath);
        }else{
          String  def = ((NewTorrentWizard) wizard).getDefaultOpenDir();
         
          if ( def.length() > 0 ){
           
            fd.setFilterPath( def );
          }
        }
        String f = fd.open();
        if (f != null){
          file.setText(f);
         
          File  ff = new File(f);
         
View Full Code Here


    browse.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
      dialog.setFilterPath(pathParameter.getValue());
      dialog.setText(MessageText.getString("ConfigView.section.stats.choosedefaultsavepath")); //$NON-NLS-1$
      String path = dialog.open();
      if (path != null) {
        pathParameter.setValue(path);
      }
      }
    });
View Full Code Here

    pageChanged();
   
  }

  private void handleBrowse() {
    DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SINGLE);
    dialog.setText("Select export directory");
    String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
      _txtExportLocation.setText(selectedDirectory);
      Plugin.getDefault().getPreferenceStore().putValue(Preferences.PLUGIN_EXPORT_LOCATION, _txtExportLocation.getText());
    }
  }
View Full Code Here

  protected String getBrowseImageResource() {
    return "openFolderButton";
  }
 
  protected String openDialog(Shell shell, String old_value) {
        DirectoryDialog dialog = new DirectoryDialog(shell, SWT.APPLICATION_MODAL);
        dialog.setFilterPath(old_value);       
        return dialog.open();
  }
View Full Code Here

    add_button.setText(_._("mainwindow.sharedtab.button.add"));
    add_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    add_button.setAlignment(SWT.LEFT);
    add_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        DirectoryDialog dir_dialog = new DirectoryDialog (getShell(),SWT.MULTI | SWT.OPEN);
        String directory = dir_dialog.open();
        if (directory == null) return ;
        java.util.List<File> shared_dirs = null;
        try {
          shared_dirs = config_manager.getSharedFolders();
        } catch (ConfigurationManagerException e) {
View Full Code Here

  }

  public void initUIComponents() {
    if (type == WindowType.SHARED_DIR) {
      shell = new Shell(SWTThread.getDisplay());
      DirectoryDialog dir_dialog = new DirectoryDialog (shell,SWT.MULTI | SWT.OPEN);
      dir_dialog.setText(_._("newwindow.title.shared_dir"));
      String directory = dir_dialog.open();
      if (directory == null) return ;
     
      List<File> shared_dirs = null;
      try {
        shared_dirs = config_manager.getSharedFolders();
View Full Code Here

  addButton.setLayoutData(addButtonGd);
  addButton.addListener( SWT.Selection, new Listener()
  {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select a directory to exclude from the scan");
    String dir = dd.open();
    if (dir != null)  { dirs.add(dir); fillUpTable(); }
   }
  });

  final Button deleteButton = new Button(composite, SWT.PUSH); deleteButton.setText("Delete");
View Full Code Here

  indexButtonGd.grabExcessHorizontalSpace = false;
  indexButton.setLayoutData(indexButtonGd);
  indexButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Lucene index directory");
    String dir = dd.open();
    if (dir != null)
      { indexText.setText(dir);( (CrawlConfigWizard) getWizard() ).crawlConfig.setIndexDir(dir); }
   }
  });

  //*-- description of the Lucene index dir.
  GridData indexDescrGd = new GridData(); indexDescrGd.grabExcessHorizontalSpace = true;
  indexDescrGd.horizontalAlignment = GridData.FILL; indexDescrGd.horizontalSpan = 3;
  indexDescrGd.widthHint = 350;
  Text indexDescrText = new Text(composite,  SWT.LEFT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
  indexDescrText.setEditable(false);
  indexDescrText.setText("The Lucene index directory is where one or more indexes will be stored. If there are " + Constants.NEWLINE +
    "sub-directories in this directory, a multisearcher will be created to scan all index. Otherwise, a " + Constants.NEWLINE +
  "single index reader will be used. The files in this directory can become quite large.");
  indexDescrText.setLayoutData(indexDescrGd);

  //*-- add the database directory selector
  GridData dbGd = new GridData(); dbGd.grabExcessHorizontalSpace = false; dbGd.horizontalAlignment = GridData.FILL;
  CLabel dbLabel = new CLabel(composite, SWT.LEFT); dbLabel.setText("Berkeley DB dir.: ");
  dbLabel.setBackground( labelColors, new int[] {100} );
  dbLabel.setLayoutData(dbGd);

  final Text dbText = new Text(composite, SWT.SINGLE | SWT.BORDER);
  dbText.setText( ( (CrawlConfigWizard) getWizard() ).crawlConfig.getDbDir() );
  if (dbText.getText().length() == 0)
   dbText.setText(Constants.MUSTRU_HOME + Constants.fs + "data" + Constants.fs + "bdb");
  GridData dbTextGd = new GridData(); dbTextGd.horizontalAlignment = GridData.BEGINNING;
  dbTextGd.minimumWidth = 350; dbTextGd.grabExcessHorizontalSpace = true;
  dbText.setEditable(false);
  dbText.setLayoutData(dbTextGd);

  Button dbButton = new Button(composite, SWT.PUSH); dbButton.setText("Browse");
  GridData dbButtonGd = new GridData(); dbButtonGd.horizontalAlignment = GridData.BEGINNING;
  dbButtonGd.grabExcessHorizontalSpace = false;
  dbButton.setLayoutData(dbButtonGd);
  dbButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Berekeley DB directory");
    String dir = dd.open();
    if (dir != null
    { dbText.setText(dir); ( (CrawlConfigWizard) getWizard() ).crawlConfig.setDbDir(dir); }
   }
  });

  //*-- description of the Berkeley DB dir.
  GridData dbDescrGd = new GridData(); dbDescrGd.grabExcessHorizontalSpace = true;
  dbDescrGd.horizontalAlignment = GridData.FILL; dbDescrGd.horizontalSpan = 3;
  dbDescrGd.widthHint = 350;
  Text dbDescrText = new Text(composite,  SWT.LEFT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
  dbDescrText.setEditable(false);
  dbDescrText.setText("The Berkeley database directory contains the log and data files for the database. " + Constants.NEWLINE +
  "For a large database, there will be many files and sufficient space will be required in this directory.");
  dbDescrText.setLayoutData(dbDescrGd);

  //*-- add the web directory selector
  GridData webGd = new GridData(); webGd.grabExcessHorizontalSpace = false; webGd.horizontalAlignment = GridData.FILL;
  CLabel webLabel = new CLabel(composite, SWT.LEFT); webLabel.setText("Web Server Root dir.: ");
  webLabel.setBackground( labelColors, new int[] {100} );
  webLabel.setLayoutData(dbGd);

  final Text webText = new Text(composite, SWT.SINGLE | SWT.BORDER);
  webText.setText( ( (CrawlConfigWizard) getWizard() ).crawlConfig.getWebDir() );
  GridData webTextGd = new GridData(); webTextGd.horizontalAlignment = GridData.BEGINNING;
  webTextGd.minimumWidth = 350; webTextGd.grabExcessHorizontalSpace = true;
  webText.setEditable(false);
  webText.setLayoutData(webTextGd);

  Button webButton = new Button(composite, SWT.PUSH); webButton.setText("Browse");
  GridData webButtonGd = new GridData(); webButtonGd.horizontalAlignment = GridData.BEGINNING;
  webButtonGd.grabExcessHorizontalSpace = false;
  webButton.setLayoutData(dbButtonGd);
  webButton.addListener( SWT.Selection, new Listener() {
   public void handleEvent(Event e)
   {
    DirectoryDialog dd = new DirectoryDialog(composite.getShell());
    dd.setMessage("Please select the Web server root directory");
    String dir = dd.open();
    if (dir != null
    { webText.setText(dir); ( (CrawlConfigWizard) getWizard() ).crawlConfig.setWebDir(dir); }
   }
  });

View Full Code Here

    folderButton.setText(Messages.getString("general.browse"));
    folderButton.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        String lPath = mDirectoryField.getText();
        Shell lShell = OwlUI.getPrimaryShell();
        DirectoryDialog dialog = new DirectoryDialog(lShell, SWT.OPEN);
        dialog.setFilterPath(lPath);
        dialog.open();
        String lFileName = dialog.getFilterPath();
        if (!"".equals(lFileName) && !lFileName.equalsIgnoreCase(lPath)) {
          File lFile = new File(lFileName);
          if (lFile.isDirectory()) {
            mDirectoryField.setText(lFile.getPath());
          }
View Full Code Here

        String sumSize = OwlUI.getSize(sumBytes);

        Action downloadAllAction = new Action(sumSize != null ? (NLS.bind(Messages.ApplicationActionBarAdvisor_DOWNLOAD_ALL_WITH_SIZE, sumSize)) : (Messages.ApplicationActionBarAdvisor_DOWNLOAD_ALL)) {
          @Override
          public void run() {
            DirectoryDialog dialog = new DirectoryDialog(shellProvider.getShell(), SWT.None);
            dialog.setText(Messages.ApplicationActionBarAdvisor_SELECT_FOLDER_FOR_DOWNLOADS);

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

            String folder = dialog.open();
            if (StringUtils.isSet(folder)) {
              for (Pair<IAttachment, URI> attachment : attachments) {
                Controller.getDefault().getDownloadService().download(attachment.getFirst(), attachment.getSecond(), new File(folder), true);
              }

              /* Remember Download Folder in Settings */
              preferences.putString(DefaultPreferences.DOWNLOAD_FOLDER, folder);
            }
          }
        };
        downloadAllAction.setImageDescriptor(OwlUI.getImageDescriptor("icons/elcl16/save_all.gif")); //$NON-NLS-1$
        attachmentMenu.add(downloadAllAction);
        attachmentMenu.add(new Separator());
      }

      /* Collect openable Attachments that have already been downloaded */
      List<Action> openActions = new ArrayList<Action>(1);
      Set<String> downloadLocations = getDownloadLocations();

      /* Offer Download Action for each */
      for (final Pair<IAttachment, URI> attachmentPair : attachments) {
        IAttachment attachment = attachmentPair.getFirst();
        final String fileName = URIUtils.getFile(attachmentPair.getSecond(), OwlUI.getExtensionForMime(attachment.getType()));
        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

TOP

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

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.