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


Java FileDialog.setText方法代码示例

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


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

示例1: importText

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
protected void importText() {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Open");
		String[] filterExt = { "*.txt;*.TXT" };
		String[] filterNames = { "TXT files" };
		fd.setFilterExtensions(filterExt);
		fd.setFilterNames(filterNames);
		String lastPath = Config.getInstance().getString(Config.LAST_OPEN_TEXT_PATH);
		if (lastPath != null && !lastPath.isEmpty())
			fd.setFileName(lastPath);
		String selected = fd.open();
		if (selected != null) {
			importTextFile(new File(selected));
			Config.getInstance().putValue(Config.LAST_OPEN_TEXT_PATH, selected);
			try {
				Config.getInstance().save();
			} catch (IOException e) {
				// The user do not NEED to know about this...
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:24,代码来源:PmTrans.java

示例2: updateFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
protected void updateFile ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.APPLICATION_MODAL | SWT.SAVE );

    dlg.setFilterExtensions ( new String[] { Messages.FileSelectionPage_FilterExtension } );
    dlg.setFilterNames ( new String[] { Messages.FileSelectionPage_FilterName } );
    dlg.setOverwrite ( true );
    dlg.setText ( Messages.FileSelectionPage_FileDialog_Text );

    final String fileName = dlg.open ();
    if ( fileName == null )
    {
        setFile ( null );
        update ();
    }
    else
    {
        setFile ( new File ( fileName ) );
        update ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:FileSelectionPage.java

示例3: openNewAudio

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
protected void openNewAudio() {
	FileDialog fd = new FileDialog(shell, SWT.OPEN);
	fd.setText("Select the audio file");
	String[] filterExt = { "*.wav;*.WAV;*.mp3;*.MP3", "*.*" };
	String[] filterNames = { "WAV and MP3 files", "All files" };
	fd.setFilterExtensions(filterExt);
	fd.setFilterNames(filterNames);
	String lastPath = Config.getInstance().getString(Config.LAST_OPEN_AUDIO_PATH);
	if (lastPath != null && lastPath.isEmpty())
		fd.setFileName(lastPath);
	String selected = fd.open();
	if (selected != null) {
		closePlayer();
		openAudioFile(new File(selected));
		Config.getInstance().putValue(Config.LAST_OPEN_AUDIO_PATH, selected);
		try {
			Config.getInstance().save();
		} catch (IOException e) {
			// The user do not NEED to know about this...
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:23,代码来源:PmTrans.java

示例4: openTranscription

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void openTranscription() {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Select the transcription file");
		String[] filterExt = { "*.xpmt;*.XPMT" };
		String[] filterNames = { "pmTrans transcription files" };
		fd.setFilterExtensions(filterExt);
		fd.setFilterNames(filterNames);
		String lastPath = Config.getInstance().getString(Config.LAST_OPEN_TEXT_PATH);
		if (lastPath != null && !lastPath.isEmpty())
			fd.setFileName(lastPath);
		String selected = fd.open();
		if (selected != null) {
			openTranscriptionFile(new File(selected));
			Config.getInstance().putValue(Config.LAST_OPEN_TEXT_PATH, selected);
			try {
				Config.getInstance().save();
			} catch (IOException e) {
				// The user do not NEED to know about this...
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:24,代码来源:PmTrans.java

示例5: importTextFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
protected void importTextFile(File f) {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Import text");
		fd.setFilterExtensions(new String[] { "*.txt;*.TXT" });
		fd.setFilterNames(new String[] { "Plain text files (*.txt)" });
		String selected = fd.open();
		if (selected != null) {
			try {
				textEditor.importText(new File(selected));
			} catch (IOException e) {
				e.printStackTrace();
				MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
				diag.setMessage("Unable to open file " + transcriptionFile.getPath());
				diag.open();
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:20,代码来源:PmTrans.java

示例6: saveAs

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
/**
 * Handle SaveAs.
 */
protected void saveAs() {
	FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
	fileDialog.setFilterPath(userPreferences.getSaveDirectory());
	fileDialog.setFileName(Host.getFileName(disks[0].getFilename()));
	fileDialog.setText(textBundle.get("SaveDiskImageAsPrompt")); //$NON-NLS-1$
	String fullpath = fileDialog.open();
	userPreferences.setSaveDirectory(fileDialog.getFilterPath());
	if (fullpath == null) {
		return;	// user pressed cancel
	}
	try {
		disks[0].saveAs(fullpath);
		diskWindow.setStandardWindowTitle();
		saveToolItem.setEnabled(disks[0].hasChanged());
	} catch (IOException ex) {
		showSaveError(ex);
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:22,代码来源:DiskExplorerTab.java

示例7: changeImage

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
private void changeImage(boolean big){
	NodeImageConfig currentNodeConfig=this.getCurrentNodeConfig();
	if(currentNodeConfig==null)return;
	FileDialog dialog=new FileDialog(getShell());
	if(big){
		dialog.setText("请选择一张22*22px大小的png格式图标!");
	}else{
		dialog.setText("请选择一张16*16px大小的png格式图标!");			
	}
	dialog.setFilterExtensions(new String[]{"*.png"});
	String fileName=dialog.open();
	if(fileName==null){
		return;
	}
	Image img=Activator.getImageFromLocal(fileName);
	if(big){
		currentNodeConfig.setCustomImage(img);
		currentNodeConfig.setCustomImagePath(fileName);
	}else{
		currentNodeConfig.setCustomSmallImage(img);
		currentNodeConfig.setCustomSmallImagePath(fileName);
	}
	tableViewer.refresh();
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:DesignerPreferencePage.java

示例8: showOpenFilesDialog

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public static ArrayList<String> showOpenFilesDialog(Shell shell, String title, String filterPath, String[] exts) {
	FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
	fd.setOverwrite(true); // prompt user if file exists!
	fd.setText(title);
	if (filterPath == null)
		filterPath = System.getProperty("user.dir");
	fd.setFilterPath(filterPath);
	if (exts == null)
		exts = new String[]{"*.*"};
	fd.setFilterExtensions(exts);
	
	ArrayList<String> files = new ArrayList<String>();
    if (fd.open() != null) {
      String[] names = fd.getFileNames();
      for (int i = 0, n = names.length; i < n; i++) {
        StringBuffer buf = new StringBuffer(fd.getFilterPath());
        if (buf.charAt(buf.length() - 1) != File.separatorChar)
          buf.append(File.separatorChar);
        buf.append(names[i]);
        files.add(buf.toString());
      }
    }
    System.out.println(files);

	return files;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:27,代码来源:DialogUtil.java

示例9: promptForExportFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public static String promptForExportFile(final Shell shell) {
    final FileDialog dlg = new FileDialog(shell, SWT.SAVE);
    dlg.setFilterNames(new String[] {
        "*.zip" //$NON-NLS-1$
    });
    dlg.setFilterExtensions(new String[] {
        "*.zip" //$NON-NLS-1$
    });

    final SupportProvider supportProvider =
        SupportManager.getInstance().getSupportProviderCache().getSupportProvider();
    if (supportProvider == null) {
        throw new IllegalStateException();
    }
    final SimpleDateFormat dateFormat = new SimpleDateFormat(EXPORT_FILE_DATE_FORMAT);
    final String name = supportProvider.getExportFilenamePrefix() + dateFormat.format(new Date()) + ".zip"; //$NON-NLS-1$

    dlg.setFileName(name);
    dlg.setText(Messages.getString("InternalSupportUtils.DialogTitle")); //$NON-NLS-1$
    return dlg.open();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:22,代码来源:InternalSupportUtils.java

示例10: widgetSelected

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void widgetSelected( SelectionEvent event){
   FileDialog fd = new FileDialog(st.getShell(), SWT.OPEN);
   fd.setText("Add File Parameter");
   fd.setFilterExtensions(CoreConstants.FILE_FILTER_EXT);
   String file = fd.open();

   if (file != null) {
      if (manager.isMultipart()) {
         st.setText(st.getText() + CoreConstants.FILE_PREFIX + file);
      } else {
         try {
            st.setText(readFileAsString(file));
         } catch (IOException e) {
            // ignore
         }
      }
      // model.fireExecute(new ModelEvent(ModelEvent.BODY_FOCUS_LOST,
      // model));
      // // force body to refresh itself
      // model.fireExecute(new ModelEvent(ModelEvent.PARAMS_FOCUS_LOST,
      // model));
   }
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:24,代码来源:ParamsAttachManager.java

示例11: run

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void run(){

      try {

         FileDialog fileDialog = new FileDialog(view.getSite().getShell(), SWT.SAVE);

         fileDialog.setFileName("http4e.jmx");
         fileDialog.setFilterNames(new String[] { "JMeter File *.jmx (Run the script with \"jmeter-t.cmd\")" });
         fileDialog.setFilterExtensions(new String[] { "*.jmx" });
         fileDialog.setText("Save As JMeter script (Run the script with \"jmeter-t.cmd\")");
         fileDialog.setFilterPath(getUserHomeDir());

         String path = fileDialog.open();
         if (path != null) {
            HdViewPart hdView = (HdViewPart) view;
            BaseUtils.writeJMX(path, hdView.getFolderView().getModel());
            updateUserHomeDir(path);
         }

      } catch (Exception e) {
         ExceptionHandler.handle(e);
      }
   }
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:24,代码来源:ExportJMeterAction.java

示例12: run

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void run(){

      try {

         FileDialog fileDialog = new FileDialog(view.getSite().getShell(), SWT.SAVE);

         fileDialog.setFileName("sessions.http4e");
         fileDialog.setFilterNames(new String[] { "HTTP4e File *.http4e (HTTP4e all tab sessions)" });
         fileDialog.setFilterExtensions(new String[] { "*.http4e" });
         fileDialog.setText("Save As HTTP4e replay script");
         fileDialog.setFilterPath(getUserHomeDir());

         String path = fileDialog.open();
         if (path != null) {
            HdViewPart hdView = (HdViewPart) view;
            BaseUtils.writeHttp4eSessions(path, hdView.getFolderView().getModel());
            updateUserHomeDir(path);
         }

      } catch (Exception e) {
         ExceptionHandler.handle(e);
      }
   }
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:24,代码来源:ExportHTTP4eAction.java

示例13: sendFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void sendFile() {
	if (this.selectedPeer == null) return;
	
	FileDialog fd = new FileDialog(shlSimpleChatExample, SWT.OPEN);
       fd.setText("Choose a file to send");
       String selected = fd.open();

       if (selected == null) return;
       
       Path path = FileSystems.getDefault().getPath(selected);
       OpenOption[] read = { StandardOpenOption.READ };
       try {
		FileChannel fileChannel = FileChannel.open(path, read);
				
		this.selectedPeer.sendFile(fileChannel, path.getFileName().toString(), (int)fileChannel.size());
       } catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ls1intum,项目名称:jReto,代码行数:20,代码来源:SimpleChatUI.java

示例14: onSave

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
public void onSave() {
	FileDialog fd = new FileDialog(board.getControl().getShell(), SWT.SAVE);
	fd.setText("Save To PGN");
	fd.setFilterPath("");
	String[] filterExt = { "*.pgn", "*.*" };
	fd.setFilterExtensions(filterExt);
	final String selected = fd.open();

	if (selected != null) {
		String pgn = getCursor().toPgn();
		FileWriter writer = null;

		try {
			writer = new FileWriter(selected);
			writer.write(pgn);
			writer.flush();
		} catch (IOException ioe) {
			Raptor.getInstance().onError("Error saving pgn file.", ioe);
		} finally {
			try {
				writer.close();
			} catch (Throwable t) {
			}
		}
	}
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:27,代码来源:InactiveController.java

示例15: onSelectBrowseFile

import org.eclipse.swt.widgets.FileDialog; //导入方法依赖的package包/类
private void onSelectBrowseFile() {

		final String fileExtension = _exportExtensionPoint.getFileExtension();

		final FileDialog dialog = new FileDialog(_dlgContainer.getShell(), SWT.SAVE);
		dialog.setText(Messages.dialog_export_file_dialog_text);

		dialog.setFilterPath(getExportPathName());
		dialog.setFilterExtensions(new String[] { fileExtension });
		dialog.setFileName("*." + fileExtension);//$NON-NLS-1$

		final String selectedFilePath = dialog.open();

		if (selectedFilePath != null) {
			setErrorMessage(null);
			_comboFile.setText(new Path(selectedFilePath).toFile().getName());
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:19,代码来源:DialogExportTour.java


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