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


Java SaveAsDialog.open方法代码示例

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


在下文中一共展示了SaveAsDialog.open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs ()
{
    SaveAsDialog saveAsDialog = new SaveAsDialog ( getSite ().getShell () );
    saveAsDialog.open ();
    IPath path = saveAsDialog.getResult ();
    if ( path != null )
    {
        IFile file = ResourcesPlugin.getWorkspace ().getRoot ().getFile ( path );
        if ( file != null )
        {
            doSaveAs ( URI.createPlatformResourceURI ( file.getFullPath ().toString (), true ), new FileEditorInput ( file ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:ProtocolEditor.java

示例3: execute

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
protected void execute(IAction action)
	throws InvocationTargetException, InterruptedException {
	ISVNProperty svnProperty = getSelectedSvnProperties()[0];

	SaveAsDialog dialog = new SaveAsDialog(getShell());

	if (dialog.open() != SaveAsDialog.OK)
		return;

	IFile file =
		ResourcesPlugin.getWorkspace().getRoot().getFile(
			dialog.getResult());
	try {
		ByteArrayInputStream is =
			new ByteArrayInputStream(svnProperty.getData());
		file.create(is, true, null);
	} catch (CoreException e) {
		throw new InvocationTargetException(e);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:21,代码来源:SVNPropertySaveAction.java

示例4: 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

示例5: 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

示例6: 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

示例7: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
@Override
public void doSaveAs() {
	SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
	saveAsDialog.setOriginalFile(((FileEditorInput) getEditorInput()).getFile());
	saveAsDialog.open();
	IPath path = saveAsDialog.getResult();
	if (path != null) {
		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
		if (file != null) {
			IFileEditorInput modelFile = new FileEditorInput(file);
			setInputWithNotify(modelFile);
			setInput(modelFile);
			setPartName(file.getName());
			IProgressMonitor progressMonitor = getEditorSite().getActionBars().getStatusLineManager().getProgressMonitor();
			doSave(progressMonitor);
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:DataAdapterEditorPart.java

示例8: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
@Override
public void doSaveAs() {
	URI chartURI = getChartURI(true);
	SaveAsDialog dlg = new SaveAsDialog(getSite().getShell());
	dlg.setOriginalFile(EMFUtils.getFile(chartURI));
	if (dlg.open() == Window.OK) {
		IPath path = dlg.getResult();
		URI newChartURI = EMFUtils.getURI(path);
		try {
			Resource resource = timelineModel.eResource();
			resource.setURI(newChartURI);
			resource.save(null);
			dirtyMonitor.resetDirty();
			setChartURI(newChartURI);
			setInput(new FileEditorInput(EMFUtils.getFile(newChartURI)));
			setPartName(newChartURI.lastSegment());
		} catch (IOException e) {
			LogUtil.error(e);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:22,代码来源:ChartEditor.java

示例9: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public void doSaveAs()
{
	SaveAsDialog dialog = new SaveAsDialog(getSite().getShell());
	dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
	dialog.open();

	IPath path = dialog.getResult();
	if (path == null) // user clicked cancel
		return;

	IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
	super.setInput(new FileEditorInput(file));
	doSave(null);
	setPartName(file.getName());
}
 
开发者ID:ArchieProject,项目名称:Archie-Smart-IDE,代码行数:20,代码来源:TimEditor.java

示例10: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
@Override
public void doSaveAs() {
	SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
	saveAsDialog.create();
	saveAsDialog.setMessage(EcoreEditorPlugin.INSTANCE.getString("_UI_SaveAs_message"));
	saveAsDialog.open();
	IPath path = saveAsDialog.getResult();
	if (path != null) {
		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
		if (file != null) {
			ResourceSet resourceSet = editingDomain.getResourceSet();
			Resource currentResource = resourceSet.getResources().get(0);
			URI newURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
			
			Resource newResource = resourceSet.createResource(newURI);
			newResource.getContents().addAll(EcoreUtil.copyAll(currentResource.getContents()));
			resourceSet.getResources().remove(0);
			resourceSet.getResources().move(0, newResource);

			IFileEditorInput modelFile = new FileEditorInput(file);
			setInputWithNotify(modelFile);
			setPartName(file.getName());
			doSave(getActionBars().getStatusLineManager().getProgressMonitor());
		}
	}
}
 
开发者ID:abelgomez,项目名称:emf.utils,代码行数:27,代码来源:ReadOnlyEcoreEditor.java

示例11: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs() {
	SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
	saveAsDialog.open();
	IPath path = saveAsDialog.getResult();
	if (path != null) {
		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
		if (file != null) {
			doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
		}
	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:19,代码来源:Time4sysEditor.java

示例12: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void doSaveAs() {
    SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
    saveAsDialog.open();
    IPath path = saveAsDialog.getResult();
    if (path != null) {
        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
        if (file != null) {
            doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
        }
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:20,代码来源:GenconfEditor.java

示例13: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs() {
	SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
	saveAsDialog.open();
	IPath path = saveAsDialog.getResult();
	if (path != null) {
		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
		if (file != null) {
			doSaveAs(URI.createPlatformResourceURI(file.getFullPath()
					.toString(), true), new FileEditorInput(file));
		}
	}
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:Securebpmn2Editor.java

示例14: promptForFile

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/** Prompt for file name used to 'save'
 *  @param shell Shell
 *  @param orig_input Original input
 *  @return File in workspace or <code>null</code>
 */
public static IFile promptForFile(final Shell shell, final IEditorInput orig_input)
{
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

    final SaveAsDialog dlg = new SaveAsDialog(shell);
    dlg.setBlockOnOpen(true);
    if (orig_input instanceof FileEditorInput)
    {
        IPath orig_path = ((FileEditorInput)orig_input).getFile().getFullPath();
        // Propose new file extension
        if (! DisplayModel.FILE_EXTENSION.equals(orig_path.getFileExtension()))
            orig_path = orig_path.removeFileExtension().addFileExtension(DisplayModel.FILE_EXTENSION);
        dlg.setOriginalFile(root.getFile(orig_path));
    }
    if (dlg.open() != Window.OK)
        return null;

    // Path to the new resource relative to the workspace
    IPath path = dlg.getResult();
    if (path == null)
        return null;
    // Assert correct file extension.
    // If not display or class file, make it a display file.
    final String ext = path.getFileExtension();
    if (! (DisplayModel.FILE_EXTENSION.equals(ext) ||
           WidgetClassSupport.FILE_EXTENSION.equals(ext)))
        path = path.removeFileExtension().addFileExtension(DisplayModel.FILE_EXTENSION);
    return root.getFile(path);
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:35,代码来源:DisplayEditorPart.java

示例15: doSaveAs

import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs()
{
	SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
	saveAsDialog.open();
	IPath path = saveAsDialog.getResult();
	if (path != null) {
		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
		if (file != null) {
			doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:20,代码来源:BtsmodelEditor.java


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