当前位置: 首页>>代码示例>>Java>>正文


Java DirectoryDialog.open方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.DirectoryDialog.open方法的典型用法代码示例。如果您正苦于以下问题:Java DirectoryDialog.open方法的具体用法?Java DirectoryDialog.open怎么用?Java DirectoryDialog.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.DirectoryDialog的用法示例。


在下文中一共展示了DirectoryDialog.open方法的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);
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:28,代码来源:OptionsComposite.java

示例2: promptForLocation

import org.eclipse.swt.widgets.DirectoryDialog; //导入方法依赖的package包/类
private File promptForLocation(final String dropPath) {
    final DirectoryDialog dialog = new DirectoryDialog(getShell());

    final String directoryPath = dialog.open();
    if (directoryPath != null) {
        final File targetFile = new File(directoryPath, dropPath);
        if (targetFile.exists()) {
            final String title = Messages.getString("BuildDropDownload.ConfirmOverwriteDialogTitle"); //$NON-NLS-1$
            final String messageFormat = Messages.getString("BuildDropDownload.ConfirmOverwriteDialogTextFormat"); //$NON-NLS-1$
            final String message = MessageFormat.format(messageFormat, targetFile.getAbsolutePath());

            if (!MessageBoxHelpers.dialogConfirmPrompt(getShell(), title, message)) {
                return null;
            }
        }
        return targetFile;
    }
    return null;

}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:OpenDropFolderAction.java

示例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();
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:18,代码来源:ERDiagramActivator.java

示例4: 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;
}
 
开发者ID:rajendarreddyj,项目名称:eclipse-weblogic-plugin,代码行数:19,代码来源:PathFieldEditor.java

示例5: saveAllAsText

import org.eclipse.swt.widgets.DirectoryDialog; //导入方法依赖的package包/类
public void saveAllAsText() {
	if (b.fileindex.size() == 0)
		return;
	String dir = b.projectFile.getParentFile().getAbsolutePath() + "\\Files\\";
	DirectoryDialog getdir = new DirectoryDialog(b);
	getdir.setText("ѡ�����Ŀ¼");
	String dirpath = getdir.open();
	if (dirpath != null && b.fileindex.size() > 0) {
		Iterator<String> it = b.fileindex.iterator();
		while (it.hasNext()) {
			String filename = it.next();
			File file = new File(dir + filename);
			if (file.exists()) {
				String outputname = getShowNameByRealName(filename);
				File output = new File(dirpath + "\\" + outputname + ".txt");
				ioThread io = new ioThread(b);
				String text = io.readBlackFile(file, null).get();
				if (!io.writeTextFile(output, text, "utf-8"))
					getMessageBox("ת���ļ�", "ת��" + outputname + "ʱʧ�ܣ�");
			}
		}
		getMessageBox("ת���ļ�", "�ѽ���Ŀ�е������ļ�ת������ѡ��Ŀ¼��");
		showinExplorer(dirpath, false);
	}
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:26,代码来源:blackAction.java

示例6: 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;
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:21,代码来源:EnhancedDirectoryFieldEditor.java

示例7: run

import org.eclipse.swt.widgets.DirectoryDialog; //导入方法依赖的package包/类
@Override
public void run() {
	Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
	dialog.setMessage("Select the configuration folder of the openHAB runtime");
	String selection = dialog.open();
	if(selection!=null) {
		try {
			File file = new File(selection);
			if(isValidConfigurationFolder(file)) {
				ConfigurationFolderProvider.saveFolderToPreferences(selection);
				ConfigurationFolderProvider.setRootConfigurationFolder(new File(selection));
				viewer.setInput(ConfigurationFolderProvider.getRootConfigurationFolder());
			} else {
				MessageDialog.openError(shell, "No valid configuration directory", "The chosen directory is not a valid openHAB configuration" +
						" directory. Please choose a different one.");
			}
		} catch (CoreException e) {
			IStatus status = new Status(IStatus.ERROR, UIActivator.PLUGIN_ID,  "An error occurred while opening the configuration folder", e);
			ErrorDialog.openError(shell, "Cannot open configuration folder!", null, status);
		}
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:24,代码来源:SelectConfigFolderAction.java

示例8: 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;
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:20,代码来源:LocalizedPathEditor.java

示例9: getDataDirectory

import org.eclipse.swt.widgets.DirectoryDialog; //导入方法依赖的package包/类
public static Path getDataDirectory() {
	String url = Activator.getCMakePath();
	if (url == null)
	{
		// create a dialog with ok and cancel buttons and a question icon
		DirectoryDialog dialog = new DirectoryDialog(Display.getDefault().getActiveShell(), SWT.ICON_QUESTION | SWT.OK| SWT.CANCEL);
		dialog.setText("Unable to find CMakeEnvironment");
		dialog.setMessage("Please specify path to the CMakeEnvironment");

		// open dialog and await user selection
		String returnCode = dialog.open();
		if(returnCode != null)
		{
			Activator.getDefault().getPreferenceStore().setValue("USE_CMAKE_PATH", returnCode);
		}
	}
		
	return new File(url).toPath();
}
 
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:20,代码来源:PluginDataIO.java

示例10: 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;
}
 
开发者ID:kartoFlane,项目名称:superluminal2,代码行数:34,代码来源:UIUtils.java

示例11: 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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:ClassPathBlock.java

示例12: 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;
  }
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:26,代码来源:DirectoryFieldEditor.java

示例13: 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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:SourceAttachmentBlock.java

示例14: 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);
    }
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:22,代码来源:NewProjectNameAndLocationWizardPage.java

示例15: 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);
    fileDialog.setMessage(Txt.s("Property.Xilinx.Path.BrowseDialog.Message"));
    if (startingDirectory != null)
        fileDialog.setFilterPath(startingDirectory.getPath());
    String dir = fileDialog.open();
    if (dir != null) {
        dir = dir.trim();
        if (dir.length() > 0)
            return new File(dir);
    }

    return null;
}
 
开发者ID:Elphel,项目名称:vdt-plugin,代码行数:22,代码来源:XilinxPathFieldEditor.java


注:本文中的org.eclipse.swt.widgets.DirectoryDialog.open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。