org.eclipse.swt.widgets.DirectoryDialog#setMessage ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.DirectoryDialog#setMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: thym   文件: HybridProjectImportPage.java
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);
	}
}
 
源代码2 项目: birt   文件: ClassPathBlock.java
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;
}
 
源代码3 项目: olca-app   文件: XEI3MetaDataImportAction.java
@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();
}
 
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;
}
 
源代码5 项目: xds-ide   文件: CompilerWorkingDirectoryBlock.java
/**
 * 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);
        }
    }       
}
 
源代码6 项目: Pydev   文件: WorkingDirectoryBlock.java
/**
 * 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);
    }
}
 
源代码7 项目: tracecompass   文件: ImportTraceWizardPage.java
/**
 * 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);
    }
}
 
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;
}
 
源代码9 项目: Pydev   文件: AppEngineConfigWizardPage.java
/**
 *  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);
    }
}
 
/**
 * 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;
}
 
源代码11 项目: thym   文件: DirectorySelectionGroup.java
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();
    }
}
 
/**
 * 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);
      }
    }
  };
}
 
@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);
        }
    }
}
 
源代码14 项目: birt   文件: ScriptMainTab.java
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;
}
 
源代码15 项目: gwt-eclipse-plugin   文件: AddSdkDialog.java
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();
}
 
源代码16 项目: birt   文件: IDEResourcePageHelper.java
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 );
	}
}
 
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;
}
 
源代码18 项目: APICloud-Studio   文件: NodePreferencePage.java
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;
}
 
源代码19 项目: ermasterr   文件: ERDiagramActivator.java
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();
}
 
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());
}