本文整理汇总了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;
}
示例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;
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}