當前位置: 首頁>>代碼示例>>Java>>正文


Java SaveAsDialog.setOriginalName方法代碼示例

本文整理匯總了Java中org.eclipse.ui.dialogs.SaveAsDialog.setOriginalName方法的典型用法代碼示例。如果您正苦於以下問題:Java SaveAsDialog.setOriginalName方法的具體用法?Java SaveAsDialog.setOriginalName怎麽用?Java SaveAsDialog.setOriginalName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.dialogs.SaveAsDialog的用法示例。


在下文中一共展示了SaveAsDialog.setOriginalName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: opeSaveAsDialog

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
private IFile opeSaveAsDialog() {
	logger.debug("opeSaveAsDialog - Opening SaveAs dialog box.");
	SaveAsDialog obj = new SaveAsDialog(Display.getDefault().getActiveShell());
	IFile file=null;
	if (getEditorInput().getName().endsWith(".job"))
	{
		obj.setOriginalName(getEditorInput().getName());
	}
	else
		obj.setOriginalName(getEditorInput().getName() + ".job");
	oldFileName=getEditorInput().getName();
	obj.open();
	if (obj.getReturnCode() == 0) {
		validateLengthOfJobName(obj);
	}
	if(obj.getResult()!=null&&obj.getReturnCode()!=1) {
		IPath filePath = obj.getResult().removeFileExtension().addFileExtension("job");
		file= ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
	}
	
	return file;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:23,代碼來源:ELTGraphicalEditor.java

示例2: validateLengthOfJobName

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
/**
 * 
 * Validates length of job name
 * 
 * @param {@link SaveAsDialog}
 */
public void validateLengthOfJobName(SaveAsDialog saveAsDialog) {
	String jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
	while(jobName.length()>50)
	{
		jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
		if(jobName.length()>50)
		{
			MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
			messageBox.setText("Error");
			messageBox.setMessage("File Name Too Long");
			if(messageBox.open()==SWT.OK)
			{
				saveAsDialog.setOriginalName(jobName+".job");
				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(saveAsDialog.getResult());
				saveAsDialog.setOriginalFile(file);
				saveAsDialog.open();
				if(saveAsDialog.getReturnCode()==1)
					break;
			}
		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:29,代碼來源:ELTGraphicalEditor.java

示例3: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
public void doSaveAs() {
  SaveAsDialog saveas = new SaveAsDialog(getSite().getShell());
  IFile saveAs = getSaveAsFile();
  saveas.setOriginalFile(saveAs);
  saveas.setOriginalName(saveAs.getName());
  if (saveas.open() != SaveAsDialog.OK) {
    return;
  }

  // get the file relatively to the workspace.
  IFile saveFile = calcViewFile(saveas.getResult());
  // TODO: set up a progress monitor
  saveFile(saveFile, null, "saveAs");

  baseName = buildFileInputBaseName(saveFile);
  setPartName(saveFile.getName());

  FileEditorInput effInput = new FileEditorInput(saveFile);
  setInputWithNotify(effInput);
}
 
開發者ID:google,項目名稱:depan,代碼行數:22,代碼來源:ViewEditor.java

示例4: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
public void doSaveAs() {
  SaveAsDialog saveas = new SaveAsDialog(getSite().getShell());
  saveas.setOriginalFile(file);
  saveas.setOriginalName(propInfo.getName());
  if (saveas.open() != SaveAsDialog.OK) {
    return;
  }

  // get the file relatively to the workspace.
  IFile saveFile = WorkspaceTools.calcViewFile(
      saveas.getResult(), RelationSetResources.EXTENSION);
  // TODO: set up a progress monitor
  file = saveFile;
  handleDocumentChange();
  persistDocument(null);
}
 
開發者ID:google,項目名稱:depan,代碼行數:18,代碼來源:RelationDisplayEditor.java

示例5: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
public void doSaveAs() {
  SaveAsDialog saveas = new SaveAsDialog(getSite().getShell());
  saveas.setOriginalFile(file);
  saveas.setOriginalName(matcherInfo.getName());
  if (saveas.open() != SaveAsDialog.OK) {
    return;
  }

  // get the file relatively to the workspace.
  IFile saveFile = WorkspaceTools.calcViewFile(
      saveas.getResult(), GraphEdgeMatcherResources.EXTENSION);
  // TODO: set up a progress monitor
  file = saveFile;
  handleDocumentChange();
  persistDocument(null);
}
 
開發者ID:google,項目名稱:depan,代碼行數:18,代碼來源:EdgeMatcherEditor.java

示例6: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
public void doSaveAs() {
  SaveAsDialog saveas = new SaveAsDialog(getSite().getShell());
  saveas.setOriginalFile(file);
  saveas.setOriginalName(relSetInfo.getName());
  if (saveas.open() != SaveAsDialog.OK) {
    return;
  }

  // get the file relatively to the workspace.
  IFile saveFile = WorkspaceTools.calcViewFile(
      saveas.getResult(), RelationSetResources.EXTENSION);
  // TODO: set up a progress monitor
  file = saveFile;
  handleDocumentChange();
  persistDocument(null);
}
 
開發者ID:google,項目名稱:depan,代碼行數:18,代碼來源:RelationSetDescriptorEditor.java

示例7: run

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
public void run() {
	TreeSelection s = (TreeSelection) treeViewer.getSelection();
	TreePath[] p = s.getPaths();

	for (int i = 0; i < p.length; i++) {
		Object obj = p[i].getLastSegment();
		if (obj instanceof MDataAdapter) {
			SaveAsDialog saveAsDialog = new SaveAsDialog(Display.getDefault().getActiveShell());
			saveAsDialog.setOriginalName(((MDataAdapter) obj).getValue().getName().replace(" ", "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			saveAsDialog.open();
			IPath path = saveAsDialog.getResult();
			if (path != null)
				saveFile(obj, path);
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:18,代碼來源:ExportDataAdapterAction.java

示例8: doSaveAsDialog

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
private IFile doSaveAsDialog() {
  SaveAsDialog saveas = new SaveAsDialog(getSite().getShell());
  IFile saveAs = getSaveAsFile();
  saveas.setOriginalFile(saveAs);
  saveas.setOriginalName(saveAs.getName());
  if (saveas.open() != SaveAsDialog.OK) {
    return null;
  }

  // get the file relatively to the workspace.
  IFile saveFile = WorkspaceTools.calcViewFile(
      saveas.getResult(), NodeListDocument.EXTENSION);

  return saveFile;
}
 
開發者ID:google,項目名稱:depan,代碼行數:16,代碼來源:NodeListEditor.java

示例9: querySaveAsFilePath

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
private IPath querySaveAsFilePath() {
  SaveAsDialog dialog = new SaveAsDialog( getSite().getShell() );
  IEditorInput editorInput = getEditorInput();
  IFile originalFile = ResourceUtil.getFile( editorInput );
  if( originalFile != null ) {
    dialog.setOriginalFile( originalFile );
  } else {
    dialog.setOriginalName( editorInput.getName() );
  }
  int dialogResult = dialog.open();
  return dialogResult == Window.OK ? dialog.getResult() : null;
}
 
開發者ID:rherrmann,項目名稱:eclipse-extras,代碼行數:13,代碼來源:ImageViewerEditor.java

示例10: preDownload

import org.eclipse.ui.dialogs.SaveAsDialog; //導入方法依賴的package包/類
@Override
protected boolean preDownload(AFileResource fres) {
	SaveAsDialog saveAsDialog = new SaveAsDialog(Display.getDefault().getActiveShell());
	saveAsDialog.setOriginalName(AExporter.getNewFileName(fres.getValue(), "." + fres.getDefaultFileExtension()));
	if (saveAsDialog.open() == Dialog.OK) {
		path = saveAsDialog.getResult();
		return true;
	}
	return false;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:11,代碼來源:DownloadFileAction.java


注:本文中的org.eclipse.ui.dialogs.SaveAsDialog.setOriginalName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。