本文整理汇总了Java中com.intellij.openapi.fileChooser.FileSaverDialog.save方法的典型用法代码示例。如果您正苦于以下问题:Java FileSaverDialog.save方法的具体用法?Java FileSaverDialog.save怎么用?Java FileSaverDialog.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileChooser.FileSaverDialog
的用法示例。
在下文中一共展示了FileSaverDialog.save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileSaverListener
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
private ActionListener getFileSaverListener(final TextFieldWithBrowseButton field, final TextFieldWithBrowseButton fieldToUpdate,
final String suffixToReplace, final String suffix) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
new FileSaverDescriptor(message("newCertDlgBrwFldr"), "", suffixToReplace), field);
final VirtualFile baseDir = myProject.getBaseDir();
final VirtualFileWrapper save = dialog.save(baseDir, "");
if (save != null) {
field.setText(FileUtil.toSystemDependentName(save.getFile().getAbsolutePath()));
if (fieldToUpdate.getText().isEmpty()) {
fieldToUpdate.setText(Utils.replaceLastSubString(field.getText(), suffixToReplace, suffix));
}
}
}
};
}
示例2: actionPerformed
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
final Project project = PlatformDataKeys.PROJECT.getData(anActionEvent.getDataContext());
if (project == null) return;
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(new FileSaverDescriptor("Init Fossil Repository",
"Select file where to create new Fossil repository."), project);
final VirtualFileWrapper wrapper = dialog.save(null, null);
if (wrapper == null) return;
final Task.Backgroundable task = new Task.Backgroundable(project, "Init Fossil Repository", false, PerformInBackgroundOption.ALWAYS_BACKGROUND) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
try {
new CheckoutUtil(project).initRepository(wrapper.getFile());
VcsBalloonProblemNotifier.showOverVersionControlView(project, "Fossil repository successfully created: " + wrapper.getFile().getPath(), MessageType.INFO);
} catch (VcsException e) {
VcsBalloonProblemNotifier.showOverVersionControlView(project, "Fossil repository not created: " + e.getMessage(), MessageType.ERROR);
}
}
};
ProgressManager.getInstance().run(task);
}
示例3: actionPerformed
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
String path = myTextField.getText().trim();
if (path.length() == 0) {
String defaultLocation = getDefaultLocation();
path = defaultLocation != null && defaultLocation.length() > 0
? defaultLocation
: SystemProperties.getUserHome();
}
File file = new File(path);
if (!file.exists()) {
path = SystemProperties.getUserHome();
}
FileSaverDescriptor descriptor = new FileSaverDescriptor(myDialogTitle, "Save as *." + myExtension, myExtension);
FileSaverDialog saveFileDialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, myContentPanel);
VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(file.exists() ? file : new File(path));
if (vf == null) {
vf = VfsUtil.getUserHomeDir();
}
VirtualFileWrapper result = saveFileDialog.save(vf, null);
if (result == null || result.getFile() == null) {
return;
}
myTextField.setText(result.getFile().getPath());
}
示例4: pullRecording
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
private void pullRecording() {
FileSaverDescriptor descriptor = new FileSaverDescriptor("Save As", "", "mp4");
FileSaverDialog saveFileDialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, myProject);
VirtualFile baseDir = ourLastSavedFolder != null ? ourLastSavedFolder : VfsUtil.getUserHomeDir();
VirtualFileWrapper fileWrapper = saveFileDialog.save(baseDir, getDefaultFileName());
if (fileWrapper == null) {
return;
}
File f = fileWrapper.getFile();
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourLastSavedFolder = VfsUtil.findFileByIoFile(f.getParentFile(), false);
new PullRecordingTask(myProject, myDevice, f.getAbsolutePath()).queue();
}
示例5: doOKAction
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
@Override
protected void doOKAction() {
FileSaverDescriptor descriptor =
new FileSaverDescriptor(AndroidBundle.message("android.ddms.screenshot.save.title"), "", SdkConstants.EXT_PNG);
FileSaverDialog saveFileDialog = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, myProject);
VirtualFile baseDir = ourLastSavedFolder != null ? ourLastSavedFolder : myProject.getBaseDir();
VirtualFileWrapper fileWrapper = saveFileDialog.save(baseDir, getDefaultFileName());
if (fileWrapper == null) {
return;
}
myScreenshotFile = fileWrapper.getFile();
try {
ImageIO.write(myDisplayedImageRef.get(), SdkConstants.EXT_PNG, myScreenshotFile);
}
catch (IOException e) {
Messages.showErrorDialog(myProject,
AndroidBundle.message("android.ddms.screenshot.save.error", e),
AndroidBundle.message("android.ddms.actions.screenshot"));
return;
}
VirtualFile virtualFile = fileWrapper.getVirtualFile();
if (virtualFile != null) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourLastSavedFolder = virtualFile.getParent();
}
super.doOKAction();
}
示例6: apply
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
@Override
public void apply(MultiMap<VirtualFile, TextFilePatchInProgress> patchGroups,
LocalChangeList localList,
String fileName,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) {
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
new FileSaverDescriptor("Save Patch to", ""), myProject);
final VirtualFile baseDir = myProject.getBaseDir();
final VirtualFileWrapper save = dialog.save(baseDir, "TheirsChanges.patch");
if (save != null) {
final CommitContext commitContext = new CommitContext();
final VirtualFile baseForPatch = myBaseForPatch == null ? baseDir : myBaseForPatch;
try {
final List<FilePatch> textPatches = patchGroupsToOneGroup(patchGroups, baseForPatch);
commitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false);
PatchWriter.writePatches(myProject, save.getFile().getPath(), textPatches, commitContext, CharsetToolkit.UTF8_CHARSET);
}
catch (final IOException e) {
LOG.info(e);
WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
@Override
public void run() {
Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", e.getMessage()), CommonBundle.getErrorTitle());
}
}, null, myProject);
}
}
}
示例7: apply
import com.intellij.openapi.fileChooser.FileSaverDialog; //导入方法依赖的package包/类
@Override
public void apply(MultiMap<VirtualFile, FilePatchInProgress> patchGroups,
LocalChangeList localList,
String fileName,
TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) {
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
new FileSaverDescriptor("Save patch to", ""), myProject);
final VirtualFile baseDir = myProject.getBaseDir();
final VirtualFileWrapper save = dialog.save(baseDir, "TheirsChanges.patch");
if (save != null && save.getFile() != null) {
final CommitContext commitContext = new CommitContext();
final VirtualFile baseForPatch = myBaseForPatch == null ? baseDir : myBaseForPatch;
try {
final List<FilePatch> textPatches = patchGroupsToOneGroup(patchGroups, baseForPatch);
commitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false);
PatchWriter.writePatches(myProject, save.getFile().getPath(), textPatches, commitContext, CharsetToolkit.UTF8_CHARSET);
}
catch (final IOException e) {
LOG.info(e);
WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
public void run() {
Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", e.getMessage()), CommonBundle.getErrorTitle());
}
}, null, myProject);
}
}
}