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


Java FileDialog.getFileName方法代码示例

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


在下文中一共展示了FileDialog.getFileName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public boolean write(StyledText textArea, File file)// �˷����������ļ��л����п��ٱ����ļ�
{
	File f = null;
	if (file == null) {

		FileDialog saveDialog = new FileDialog(black, SWT.SAVE);

		saveDialog.setFilterExtensions(filterExtensionsForSaveAs);

		saveDialog.open();
		if (saveDialog.getFileName().length() > 0) {
			f = new File(saveDialog.getFilterPath() + "/"
					+ saveDialog.getFileName());
			// .setCurrentFileSaveLocation(fullScreenWord.getCurrentEditFile().getAbsolutePath());
		} else {
			return false;
		}

	} else
		f = file;

	inputAndOutput(f, 1);

	return true;
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:26,代码来源:io.java

示例2: saveAllAsTextToOneFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void saveAllAsTextToOneFile() {
	if (b.fileindex.size() == 0)
		return;

	FileDialog fd = getFileDialog("����ΪTXT�ļ�", "", b, SWT.SAVE, new String[] { "*.txt" });

	if (fd.getFileNames().length == 1) {
		File f = new File(fd.getFilterPath() + System.getProperty("file.separator") + fd.getFileName());
		b.saveCurrentFile(false, false);
		findinfo_[] text = getAllTextFromProject(true, false);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < text.length; i++) {
			if (text[i].stringbuilder != null)
				sb.append(text[i].stringbuilder.toString());
		}
		ioThread io = new ioThread(b);
		if (io.writeTextFile(f, sb.toString(), "utf-8"))
			getMessageBox("", "����ɹ�");
		else
			getMessageBox("", "����ʧ��");
	}

}
 
开发者ID:piiiiq,项目名称:Black,代码行数:24,代码来源:blackAction.java

示例3: showOpenFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
/**
 * Show a file open dialog that filters for files with the given extension.
 *
 * @param extension file extension, with or without leading '.'
 * @param initialDir initial directory to display; if {@code null} the initial directory
 *        will be the user's default directory
 * @param parent parent GUI component (may be {@code null})
 *
 * @return the selected file or null if the user cancelled the selection
 * @throws java.awt.HeadlessException if run in an unsupported environment
 */
public static File showOpenFile( String extension, File initialDir, Shell parent ) {
    JFileDataStoreChooser dialog = new JFileDataStoreChooser(parent, SWT.OPEN, extension);
    FileDialog fileDialogInternal = dialog.getFileDialog();
    if (initialDir != null) {
        if (initialDir.isDirectory()) {
            fileDialogInternal.setFilterPath(initialDir.getAbsolutePath());
        } else {
            fileDialogInternal.setFilterPath(initialDir.getParentFile().getAbsolutePath());
        }
    }

    fileDialogInternal.open();
    String filePath = fileDialogInternal.getFileName();
    File file = new File(filePath);
    return file;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:28,代码来源:JFileDataStoreChooser.java

示例4: saveAsText

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void saveAsText() {
	if (b.currentEditFile == null || b.text == null)
		return;
	FileDialog fd = getFileDialog("ת��Ϊtxt�ļ�", getShowNameByRealName(b.getCurrentEditFile().getName()), b, SWT.SAVE,
			new String[] { "*.txt" });
	if (fd.getFileNames().length == 1) {
		File f = new File(fd.getFilterPath() + System.getProperty("file.separator") + fd.getFileName());
		if (saveCurrentFileAsTXT(f, "utf-8"))
			getMessageBox("", "ת��ɹ�");
		else
			getMessageBox("", "ת��ʧ��");
	}
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:14,代码来源:blackAction.java

示例5: setLastLocation

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public static void setLastLocation(FileDialog dialog, String selected) {
	if (!Misc.isNullOrEmpty(selected))
		lastLocation = selected.substring(0, selected.lastIndexOf(File.separatorChar));
	else if (!Misc.isNullOrEmpty(dialog.getFileName()))
		lastLocation = dialog.getFileName();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:7,代码来源:FontListFieldEditor.java


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