Java Code Examples for org.eclipse.swt.widgets.DirectoryDialog#setMessage()

The following examples show how to use org.eclipse.swt.widgets.DirectoryDialog#setMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkingDirectoryBlock.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Show a dialog that lets the user select a working directory
 */
private void handleWorkingDirBrowseButtonSelected() {
    DirectoryDialog dialog = new DirectoryDialog(getShell());
    dialog.setMessage("Select a working directory for the launch configuration:");
    String currentWorkingDir = getWorkingDirectoryText();
    if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
        File path = new File(currentWorkingDir);
        if (path.exists()) {
            dialog.setFilterPath(currentWorkingDir);
        }
    }
    String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
        fOtherWorkingText.setText(selectedDirectory);
    }
}
 
Example 2
Source File: BuildPathDialogAccess.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Shows the UI to select new external class folder entries.
 * The dialog returns the selected entry paths or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @return Returns the new external class folder path or <code>null</code> if the dialog has
 * been canceled by the user.
 *
 * @since 3.4
 */
public static IPath[] chooseExternalClassFolderEntries(Shell shell) {
	String lastUsedPath= JavaPlugin.getDefault().getDialogSettings().get(IUIConstants.DIALOGSTORE_LASTEXTJARFOLDER);
	if (lastUsedPath == null) {
		lastUsedPath= ""; //$NON-NLS-1$
	}
	DirectoryDialog dialog= new DirectoryDialog(shell, SWT.MULTI);
	dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_new_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_new_description);
	dialog.setFilterPath(lastUsedPath);

	String res= dialog.open();
	if (res == null) {
		return null;
	}

	File file= new File(res);
	if (file.isDirectory())
		return new IPath[] { new Path(file.getAbsolutePath()) };

	return null;
}
 
Example 3
Source File: AppEngineConfigWizardPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 *  Open an appropriate directory browser
 */
private void handleLocationBrowseButtonPressed() {
    DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
    dialog.setMessage(
            "Select the Google App Engine root directory (dir containing dev_appserver.py, appcfg.py, lib, etc).");

    String dirName = getAppEngineLocationFieldValue();
    if (!dirName.equals("")) { //$NON-NLS-1$
        File path = new File(dirName);
        if (path.exists()) {
            dialog.setFilterPath(new Path(dirName).toOSString());
        }
    }

    String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
        customLocationFieldValue = selectedDirectory;
        locationPathField.setText(customLocationFieldValue);
    }
}
 
Example 4
Source File: JavadocConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private String chooseJavaDocFolder() {
	String initPath= ""; //$NON-NLS-1$
	if (fURLResult != null && "file".equals(fURLResult.getProtocol())) { //$NON-NLS-1$
		initPath= JavaDocLocations.toFile(fURLResult).getPath();
	}
	DirectoryDialog dialog= new DirectoryDialog(fShell);
	dialog.setText(PreferencesMessages.JavadocConfigurationBlock_javadocFolderDialog_label);
	dialog.setMessage(PreferencesMessages.JavadocConfigurationBlock_javadocFolderDialog_message);
	dialog.setFilterPath(initPath);
	String result= dialog.open();
	if (result != null) {
		try {
			URL url= new File(result).toURI().toURL();
			return url.toExternalForm();
		} catch (MalformedURLException e) {
			JavaPlugin.log(e);
		}
	}
	return null;
}
 
Example 5
Source File: ImportTraceWizardPage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Handle the button pressed event
 */
protected void handleSourceDirectoryBrowseButtonPressed() {
    String currentSource = directoryNameField.getText();
    DirectoryDialog dialog = DirectoryDialogFactory.create(directoryNameField.getShell(), SWT.SAVE | SWT.SHEET);
    dialog.setText(Messages.ImportTraceWizard_SelectTraceDirectoryTitle);
    dialog.setMessage(Messages.ImportTraceWizard_SelectTraceDirectoryMessage);
    dialog.setFilterPath(getSourceDirectoryName(currentSource));

    String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
        // Just quit if the directory is not valid
        if ((getSourceDirectory(selectedDirectory) == null) || selectedDirectory.equals(currentSource)) {
            return;
        }
        // If it is valid then proceed to populate
        setErrorMessage(null);
        setSourcePath(selectedDirectory);
    }
}
 
Example 6
Source File: CompilerWorkingDirectoryBlock.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Show a dialog that lets the user select a working directory
 */
private void handleWorkingDirBrowseButtonSelected() {
    DirectoryDialog dialog = new DirectoryDialog(getShell());
    dialog.setMessage(Messages.CompilerWorkingDirectoryBlock_SelectXcWorkDir); 
    String currentWorkingDir = getOtherDirectoryText();
    if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
        File path = new File(currentWorkingDir);
        if (path.exists()) {
            dialog.setFilterPath(currentWorkingDir);
        }       
    }
    String selectedDirectory = dialog.open();
    if (selectedDirectory != null) {
        setOtherWorkingDirectoryText(selectedDirectory);
        if (actionListener != null) {
            actionListener.actionPerformed(null);
        }
    }       
}
 
Example 7
Source File: NativeLibrariesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private String chooseExternal() {
	IPath currPath= new Path(fPathField.getText());
	if (currPath.isEmpty()) {
		currPath= fEntry.getPath();
	} else {
		currPath= currPath.removeLastSegments(1);
	}

	DirectoryDialog dialog= new DirectoryDialog(fShell);
	dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_external_message);
	dialog.setText(NewWizardMessages.NativeLibrariesDialog_extfiledialog_text);
	dialog.setFilterPath(currPath.toOSString());
	String res= dialog.open();
	if (res != null) {
		return res;
	}
	return null;
}
 
Example 8
Source File: XEI3MetaDataImportAction.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void run() {
	DirectoryDialog dialog = new DirectoryDialog(UI.shell());
	dialog.setText("Master data directory");
	dialog.setMessage("Select the EcoSpold 02 directory that contains the "
			+ "master data.");
	String path = dialog.open();
	if (path == null)
		return;
	File masterDataDir = new File(path);
	if (masterDataDir == null || !masterDataDir.isDirectory())
		return;
	File personFile = new File(masterDataDir, "Persons.xml");
	if (personFile.exists())
		new PersonUpdate(Database.get(), personFile).run();
	File sourceFile = new File(masterDataDir, "Sources.xml");
	if (sourceFile.exists())
		new SourceUpdate(Database.get(), sourceFile).run();
	updateIsicTree();
}
 
Example 9
Source File: ClassPathBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static IPath configureExternalClassFolderEntries( Shell shell,
		IPath initialEntry )
{
	DirectoryDialog dialog = new DirectoryDialog( shell, SWT.SINGLE );
	dialog.setText( Messages.getString( "ClassPathBlock_FolderDialog.edit.text" ) ); //$NON-NLS-1$
	dialog.setMessage( Messages.getString( "ClassPathBlock_FolderDialog.edit.message" ) ); //$NON-NLS-1$
	dialog.setFilterPath( initialEntry.toString( ) );

	String res = dialog.open( );
	if ( res == null )
	{
		return null;
	}

	File file = new File( res );
	if ( file.isDirectory( ) )
		return new Path( file.getAbsolutePath( ) );

	return null;
}
 
Example 10
Source File: HybridProjectImportPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void handleBrowseButtonPressed() {
	final DirectoryDialog dialog = new DirectoryDialog(
			directoryPathField.getShell(), SWT.SHEET);
	dialog.setMessage("Select search directory");

	String dirName = directoryPathField.getText().trim();
	if (dirName.isEmpty()) {
		dirName = previouslyBrowsedDirectory;
	}

	if (dirName.isEmpty()) {
		dialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
	} else {
		File path = new File(dirName);
		if (path.exists()) {
			dialog.setFilterPath(new Path(dirName).toOSString());
		}
	}
	
	String selectedDirectory = dialog.open();
	if (selectedDirectory != null) {
		previouslyBrowsedDirectory = selectedDirectory;
		directoryPathField.setText(previouslyBrowsedDirectory);
		updateProjectsList(selectedDirectory);
	}
}
 
Example 11
Source File: DirectoryBluemixWizardPage.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent event) {
    if (event.widget == _dirBtn) {
        DirectoryDialog dlg = new DirectoryDialog(getShell());
        dlg.setFilterPath(getDirectory());
        dlg.setMessage("Choose a deployment directory for your application:"); // $NLX-DirectoryBluemixWizardPage.Chooseadeploymentdirectoryforyour-1$
        String loc = dlg.open();
        if (StringUtil.isNotEmpty(loc)) {
            _dirText.setText(loc);
        }
    }
}
 
Example 12
Source File: ScriptMainTab.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private IPath chooseDropLocation( String title, String message,
		String filterPath )
{
	DirectoryDialog dialog = new DirectoryDialog( getShell( ) );
	dialog.setFilterPath( filterPath );
	dialog.setText( title );
	dialog.setMessage( message );
	String res = dialog.open( );
	if ( res != null )
	{
		return new Path( res );
	}
	return null;
}
 
Example 13
Source File: DirectorySelectionGroup.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private void chooseDirectory(){
    final DirectoryDialog dialog = new DirectoryDialog(this.getShell());
    dialog.setText("Select Destination");
    dialog.setMessage("Select a destination directory");
    String directory = dialog.open();
    if(directory != null ){
        this.destinationCombo.setText(directory);
        sendModifyEvent();
    }
}
 
Example 14
Source File: NewDataflowProjectWizardLandingPage.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * A listener that opens a folder selection dialog when the button is pressed and sets the text
 * when the dialog was closed if a selection was made.
 */
private SelectionListener folderSelectionListener(final Shell shell) {
  return new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent event) {
      DirectoryDialog dialog = new DirectoryDialog(shell);
      dialog.setMessage(Messages.getString("select.project.location")); //$NON-NLS-1$
      String result = dialog.open();
      if (!Strings.isNullOrEmpty(result)) {
        locationInput.setText(result);
      }
    }
  };
}
 
Example 15
Source File: AddSdkDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
protected String browseForDirectory() {
  DirectoryDialog dlg = new DirectoryDialog(getShell(), SWT.OPEN);
  dlg.setFilterPath(directoryText.getText().trim());
  dlg.setMessage("Please select the root directory of your SDK installation.");

  return dlg.open();
}
 
Example 16
Source File: IDEResourcePageHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void handleBrowseFileSystem( )
{
	DirectoryDialog dialog = new DirectoryDialog( getControl( ).getShell( ) );
	dialog.setFilterPath( getLocation( ) );
	dialog.setText( DirectoryDialog_Text );
	dialog.setMessage( DirectoryDialog_Message );
	String result = dialog.open( );
	if ( result != null )
	{
		// fLocationText.setText(result);
		location = result;
		result = replaceString( result );
		notifyTextChange( result );
	}
}
 
Example 17
Source File: VariableCreationDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IPath chooseExtDirectory() {
	String initPath= getInitPath();

	DirectoryDialog dialog= new DirectoryDialog(getShell());
	dialog.setText(NewWizardMessages.VariableCreationDialog_extdirdialog_text);
	dialog.setMessage(NewWizardMessages.VariableCreationDialog_extdirdialog_message);
	dialog.setFilterPath(initPath);
	String res= dialog.open();
	if (res != null) {
		fDialogSettings.put(IUIConstants.DIALOGSTORE_LASTEXTJAR, dialog.getFilterPath());
		return Path.fromOSString(res);
	}
	return null;
}
 
Example 18
Source File: NodePreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private IPath getDirectory()
{
	DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN | SWT.SHEET);
	fileDialog.setMessage(MessageFormat.format(Messages.NodePreferencePage_nodejsDirSelectionMessage,
			NODE_JS_ROOT_NAME));
	String dir = fileDialog.open();
	if (!StringUtil.isEmpty(dir))
	{
		return Path.fromOSString(dir);
	}
	return null;
}
 
Example 19
Source File: ERDiagramActivator.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
public static String showDirectoryDialog(final String filePath, final String message) {
    String fileName = null;

    if (filePath != null && !"".equals(filePath.trim())) {
        final File file = new File(filePath.trim());
        fileName = file.getPath();
    }

    final DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.NONE);

    dialog.setMessage(ResourceString.getResourceString(message));

    dialog.setFilterPath(fileName);

    return dialog.open();
}
 
Example 20
Source File: BuildProcessContributionItem.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private Optional<String> getPath(Shell shell) {
    final DirectoryDialog directoryDialog = new DirectoryDialog(shell, SWT.SAVE | SWT.SHEET);
    directoryDialog.setMessage(Messages.selectDestinationTitle);
    return Optional.ofNullable(directoryDialog.open());
}