本文整理匯總了Java中org.eclipse.swt.widgets.DirectoryDialog.setFilterPath方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectoryDialog.setFilterPath方法的具體用法?Java DirectoryDialog.setFilterPath怎麽用?Java DirectoryDialog.setFilterPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.DirectoryDialog
的用法示例。
在下文中一共展示了DirectoryDialog.setFilterPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: chooseTestClassesDirectory
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* Open the dialog to chose a directory for the test case classes.
*/
protected void chooseTestClassesDirectory() {
// Initialize the dialog.
DirectoryDialog dialog = new DirectoryDialog(this.shell);
dialog.setMessage("Please chose a directory for the test case classes.");
// Check if the test cases directory exists.
File file = new File(this.testClassesDirectoryText.getText());
if (file.exists() && file.isDirectory()) {
// Set as the start directory.
dialog.setFilterPath(this.testClassesDirectoryText.getText());
}
// Open the dialog and process its result.
String path = dialog.open();
if (path != null) {
// First of all replace double backslashes against slashes.
path = path.replace("\\\\", "\\");
// Convert backslashes to slashes.
path = path.replace("\\", "/");
// Set it as the text.
this.testClassesDirectoryText.setText(path);
}
}
示例2: getNewDir
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* @return
*/
protected String getNewDir() {
final DirectoryDialog dialog = new DirectoryDialog(this.addDirButton.getShell());
if ((this.lastPath != null) && new File(this.lastPath).exists()) {
dialog.setFilterPath(this.lastPath);
}
String dir = dialog.open();
if (dir != null) {
dir = dir.trim();
if (dir.length() == 0) {
return null;
}
this.lastPath = dir;
}
return dir;
}
示例3: showDirectoryDialog
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
public static String showDirectoryDialog(String filePath, String message) {
String fileName = null;
if (filePath != null && !"".equals(filePath.trim())) {
File file = new File(filePath.trim());
fileName = file.getPath();
}
DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), SWT.NONE);
dialog.setMessage(ResourceString.getResourceString(message));
dialog.setFilterPath(fileName);
return dialog.open();
}
示例4: getDirectory
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
protected File getDirectory(final File startingDirectory) {
final DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN | SWT.SHEET);
if (dialogMessage != null && dialogMessage.get() != null) {
fileDialog.setMessage(dialogMessage.get());
}
if (startingDirectory != null) {
fileDialog.setFilterPath(startingDirectory.getPath());
}
else if (filterPath != null) {
fileDialog.setFilterPath(filterPath.getPath());
}
String dir = fileDialog.open();
if (dir != null) {
dir = dir.trim();
if (dir.length() > 0) {
return new File(dir);
}
}
return null;
}
示例5: getNewInputObject
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
@Override
protected String getNewInputObject() {
final DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SHEET);
if (dirChooserLabelText != null && dirChooserLabelText.get() != null) {
dialog.setMessage(dirChooserLabelText.get());
}
if (lastPath != null && new File(lastPath).exists()) {
dialog.setFilterPath(lastPath);
}
String dir = dialog.open();
if (dir != null) {
dir = dir.trim();
if (dir.length() == 0) {
return null;
}
lastPath = dir;
}
return dir;
}
示例6: handleOpsLocationBrowseButtonPressed
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* user手动选择ops路径是调å–的方法 å¯ä»¥èŽ·å–
* @ToDo opsæœåŠ¡å™¨çš„路径是å¦ç¬¦åˆè§„范的验è¯
*/
private void handleOpsLocationBrowseButtonPressed() {
DirectoryDialog dialog = new DirectoryDialog(opsLocationPathField.getShell());
dialog.setText( "Select the ops contents directory");
String dirName = getOpsLocationFieldValue();
//opsæœåŠ¡å™¨çš„è§„æ ¼åœ¨è¿™ä¸ªåœ°æ–¹è¿›è¡ŒéªŒè¯
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) {
opsCustomLocationFieldValue = selectedDirectory;
opsLocationPathField.setText(opsCustomLocationFieldValue);
}
}
示例7: handleLocationBrowseButtonPressed
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* Open an appropriate directory browser
*/
private void handleLocationBrowseButtonPressed() {
DirectoryDialog dialog = new DirectoryDialog(schemalocationPathField.getShell());
dialog.setMessage( "Select the project contents directory" );
String dirName = getProjectLocationFieldValue();
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;
schemalocationPathField.setText(customLocationFieldValue);
setSchemaPath(schemalocationPathField.getText());
}
}
示例8: getDirectory
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* Helper that opens the directory chooser dialog.
* @param startingDirectory The directory the dialog will open in.
* @return File File or <code>null</code>.
*
*/
private File getDirectory(File startingDirectory) {
DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN | SWT.SHEET);
if (startingDirectory != null) {
fileDialog.setFilterPath(startingDirectory.getPath());
}
else if (filterPath != null) {
fileDialog.setFilterPath(filterPath.getPath());
}
String dir = fileDialog.open();
if (dir != null) {
dir = dir.trim();
if (dir.length() > 0) {
return new File(dir);
}
}
return null;
}
示例9: handleOpsapiLocationBrowseButtonPressed
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
private void handleOpsapiLocationBrowseButtonPressed() {
DirectoryDialog dialog = new DirectoryDialog(
opsapiLocationPathField.getShell());
dialog.setText("Select_the_ops_contents_directory");
String dirName = getOpsapiLocationFieldValue();
// ops�������Ĺ��������ط�������֤
if (dirName != null && !dirName.equals("")) {
File path = new File(dirName);
File resourcePath = new File(dirName + File.separator + "resource");
if (path.exists() && resourcePath.exists()
&& !resourcePath.isFile()) {
dialog.setFilterPath(new Path(dirName).toOSString());
}
}
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
opsCustomapiLocationFieldValue = selectedDirectory;
opsapiLocationPathField.setText(opsCustomapiLocationFieldValue);
}
}
示例10: chooseExternalClassFolderEntries
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* 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: configureExternalClassFolderEntries
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* Shows the UI to configure an external class folder.
* The dialog returns the configured 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.
* @param initialEntry The path of the initial archive entry.
* @return Returns the configured external class folder path or <code>null</code> if the dialog has
* been canceled by the user.
*
* @since 3.4
*/
public static IPath configureExternalClassFolderEntries(Shell shell, IPath initialEntry) {
DirectoryDialog dialog= new DirectoryDialog(shell, SWT.SINGLE);
dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_edit_title);
dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_edit_description);
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;
}
示例12: configureExternalClassFolderEntries
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
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;
}
示例13: promptForDirectory
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
/**
* Prompts the user to select a directory.
*
* @param parentShell
* the parent shell. Must not be null.
* @param title
* title of the dialog window. Must not be null.
* @param message
* description of the purpose of the dialog. Must not be null.
* @param defaultPath
* the path that the dialog will initially show when it is opened.
* May be null for the system's default path.
* @return the selected directory, or null if not selected.
*/
public static File promptForDirectory( Shell parentShell, String title, String message, String defaultPath )
{
File result = null;
DirectoryDialog dialog = new DirectoryDialog( parentShell );
dialog.setFilterPath( defaultPath );
dialog.setText( title );
dialog.setMessage( message );
String path = dialog.open();
if ( path == null ) {
// User aborted selection
// Nothing to do here
}
else {
result = new File( path );
}
return result;
}
示例14: chooseExternal
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
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;
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:NativeLibrariesConfigurationBlock.java
示例15: chooseExtFolder
import org.eclipse.swt.widgets.DirectoryDialog; //導入方法依賴的package包/類
private IPath chooseExtFolder() {
IPath currPath= getFilePath();
if (currPath.segmentCount() == 0) {
currPath= fEntry.getPath();
}
if (ArchiveFileFilter.isArchivePath(currPath, true)) {
currPath= currPath.removeLastSegments(1);
}
DirectoryDialog dialog= new DirectoryDialog(getShell());
dialog.setMessage(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_message);
dialog.setText(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_text);
dialog.setFilterPath(currPath.toOSString());
String res= dialog.open();
if (res != null) {
return Path.fromOSString(res).makeAbsolute();
}
return null;
}