• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FileSaverDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.fileChooser.FileSaverDescriptor的典型用法代码示例。如果您正苦于以下问题:Java FileSaverDescriptor类的具体用法?Java FileSaverDescriptor怎么用?Java FileSaverDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileSaverDescriptor类属于com.intellij.openapi.fileChooser包,在下文中一共展示了FileSaverDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: browseForFile

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
private void browseForFile() {
  FileSaverDescriptor fileSaverDescriptor = new FileSaverDescriptor("Project location", "Please choose a location for your project");
  File currentPath = new File(myProjectLocation.getText());
  File parentPath = currentPath.getParentFile();
  if (parentPath == null) {
    String homePath = System.getProperty("user.home");
    parentPath = homePath == null ? new File("/") : new File(homePath);
  }
  VirtualFile parent = LocalFileSystem.getInstance().findFileByIoFile(parentPath);
  String filename = currentPath.getName();
  VirtualFileWrapper fileWrapper =
    FileChooserFactory.getInstance().createSaveFileDialog(fileSaverDescriptor, (Project)null).save(parent, filename);
  if (fileWrapper != null) {
    myProjectLocation.setText(fileWrapper.getFile().getAbsolutePath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConfigureAndroidProjectStep.java


示例2: getFileSaverListener

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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));
                }
            }
        }
    };
}
 
开发者ID:Microsoft,项目名称:Azure-Toolkit-for-IntelliJ,代码行数:19,代码来源:NewCertificateDialog.java


示例3: actionPerformed

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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);
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:23,代码来源:InitAction.java


示例4: actionPerformed

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
@Override
protected void actionPerformed(AnActionEvent event, Project project, Entity entity) {
    String name = entity.getPropertyValue("name");
    FileSaverDescriptor desc = new FileSaverDescriptor("Download Attachment", "Download attachment to the local filesystem.");
    final VirtualFileWrapper file = FileChooserFactory.getInstance().createSaveFileDialog(desc, project).save(lastDir, name.replaceFirst("\\.agmlink$", ""));
    if(file != null) {
        VirtualFile vf = file.getVirtualFile(true);
        if(vf == null) {
            Messages.showErrorDialog("Invalid file specified", "Error");
            return;
        }
        lastDir = vf.getParent();
        if (!name.endsWith(".agmlink") || file.getFile().getName().endsWith(".agmlink")) {
            // either regular file or we explicitly ask for .agmlink file
            ProgressManager.getInstance().run(new AttachmentDownloadTask(project, file.getFile(), name, Integer.valueOf(entity.getPropertyValue("file-size")), new EntityRef(entity.getPropertyValue("parent-type"), Integer.valueOf(entity.getPropertyValue("parent-id"))), null));
        } else {
            // download referenced content instead
            ProgressManager.getInstance().run(new AttachmentAgmLinkDownloadTask(project, file.getFile(), name, Integer.valueOf(entity.getPropertyValue("file-size")), new EntityRef(entity.getPropertyValue("parent-type"), Integer.valueOf(entity.getPropertyValue("parent-id"))), null));
        }
    }
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:22,代码来源:AttachmentDownloadAction.java


示例5: FileSaverDialogImpl

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
public FileSaverDialogImpl(@NotNull FileSaverDescriptor descriptor, @NotNull Component parent) {
  super(descriptor, parent);
  myDescriptor = descriptor;
  for (String ext : descriptor.getFileExtensions()) {
    myExtensions.addItem(ext);
  }
  setTitle(getChooserTitle(descriptor));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FileSaverDialogImpl.java


示例6: getFileToSelect

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
@Nullable
public static VirtualFile getFileToSelect(@NotNull FileChooserDescriptor descriptor, @Nullable Project project,
                                          @Nullable VirtualFile toSelect, @Nullable VirtualFile lastPath) {
  boolean chooseDir = descriptor instanceof FileSaverDescriptor;
  VirtualFile result;

  if (toSelect == null && lastPath == null) {
    result = project == null? null : project.getBaseDir();
  }
  else if (toSelect != null && lastPath != null) {
    if (Boolean.TRUE.equals(descriptor.getUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT))) {
      result = lastPath;
    }
    else {
      result = toSelect;
    }
  }
  else if (toSelect == null) {
    result = lastPath;
  }
  else {
    result = toSelect;
  }

  if (result != null) {
    if (chooseDir && !result.isDirectory()) {
      result = result.getParent();
    }
  }
  else if (SystemInfo.isUnix) {
    result = VfsUtil.getUserHomeDir();
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:FileChooserUtil.java


示例7: actionPerformed

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SaveFileListener.java


示例8: actionPerformed

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
  FileSaverDescriptor descriptor = new FileSaverDescriptor("Export Location", "Select a location for the exported device", "xml");
  String homePath = System.getProperty("user.home");
  File parentPath = homePath == null ? new File("/") : new File(homePath);
  VirtualFile parent = LocalFileSystem.getInstance().findFileByIoFile(parentPath);
  VirtualFileWrapper fileWrapper =
    FileChooserFactory.getInstance().createSaveFileDialog(descriptor, (Project)null).save(parent, "device.xml");
  Device device = myProvider.getDevice();
  if (device != null && fileWrapper != null) {
    DeviceManagerConnection.writeDevicesToFile(ImmutableList.of(device), fileWrapper.getFile());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ExportDeviceAction.java


示例9: pullRecording

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ScreenRecorderAction.java


示例10: doOKAction

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ScreenshotViewer.java


示例11: apply

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ApplyPatchSaveToFileExecutor.java


示例12: apply

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的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);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:ApplyPatchSaveToFileExecutor.java


示例13: getSouthernComponent

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
protected Component getSouthernComponent() {
    JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    final TroubleShootService troubleShootService = ApplicationManager.getApplication().getComponent(TroubleShootService.class);
    final JButton troubleshoot = new JButton(troubleShootService.isRunning()? "Stop Troubleshoot": "Troubleshoot");
    troubleshoot.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if(troubleshoot.getText().equals("Troubleshoot")) {
                if(!troubleShootService.isRunning()) {
                    if(Messages.showYesNoDialog("Do you want to log complete ALM server communication?", "Confirmation", null) == Messages.YES) {
                        FileSaverDescriptor desc = new FileSaverDescriptor("Log server communication", "Log server communication on the local filesystem.");
                        final VirtualFileWrapper file = FileChooserFactory.getInstance().createSaveFileDialog(desc, troubleshoot).save(null, "REST_log.txt");
                        if(file == null) {
                            return;
                        }

                        troubleShootService.start(file.getFile());
                        troubleshoot.setText("Stop Troubleshoot");
                    }
                }
            } else {
                troubleShootService.stop();
                troubleshoot.setText("Troubleshoot");
            }
        }
    });
    southPanel.add(troubleshoot);
    return southPanel;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:30,代码来源:AliConfigurable.java


示例14: getFileToSelect

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
@Nullable
public static VirtualFile getFileToSelect(@Nonnull FileChooserDescriptor descriptor, @Nullable Project project,
                                          @Nullable VirtualFile toSelect, @Nullable VirtualFile lastPath) {
  boolean chooseDir = descriptor instanceof FileSaverDescriptor;
  VirtualFile result;

  if (toSelect == null && lastPath == null) {
    result = project == null? null : project.getBaseDir();
  }
  else if (toSelect != null && lastPath != null) {
    if (Boolean.TRUE.equals(descriptor.getUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT))) {
      result = lastPath;
    }
    else {
      result = toSelect;
    }
  }
  else if (toSelect == null) {
    result = lastPath;
  }
  else {
    result = toSelect;
  }

  if (result != null) {
    if (chooseDir && !result.isDirectory()) {
      result = result.getParent();
    }
  }
  else if (SystemInfo.isUnix) {
    result = VfsUtil.getUserHomeDir();
  }

  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:FileChooserUtil.java


示例15: CreatePatchConfigurationPanel

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
public CreatePatchConfigurationPanel(@Nonnull final Project project) {
  myProject = project;
  initMainPanel();

  myFileNameField.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final FileSaverDialog dialog =
              FileChooserFactory.getInstance().createSaveFileDialog(
                      new FileSaverDescriptor("Save Patch to", ""), myMainPanel);
      final String path = FileUtil.toSystemIndependentName(getFileName());
      final int idx = path.lastIndexOf("/");
      VirtualFile baseDir = idx == -1 ? project.getBaseDir() :
                            (LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx))));
      baseDir = baseDir == null ? project.getBaseDir() : baseDir;
      final String name = idx == -1 ? path : path.substring(idx + 1);
      final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name);
      if (fileWrapper != null) {
        myFileNameField.setText(fileWrapper.getFile().getPath());
      }
    }
  });

  myFileNameField.setTextFieldPreferredWidth(TEXT_FIELD_WIDTH);
  myBasePathField.setTextFieldPreferredWidth(TEXT_FIELD_WIDTH);
  myBasePathField.addBrowseFolderListener(new TextBrowseFolderListener(FileChooserDescriptorFactory.createSingleFolderDescriptor()));
  myWarningLabel.setForeground(JBColor.RED);
  selectBasePath(ObjectUtils.assertNotNull(myProject.getBaseDir()));
  initEncodingCombo();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:CreatePatchConfigurationPanel.java


示例16: FileSaverDialogImpl

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
public FileSaverDialogImpl(@Nonnull FileSaverDescriptor descriptor, @Nonnull Component parent) {
  super(descriptor, parent);
  myDescriptor = descriptor;
  for (String ext : descriptor.getFileExtensions()) {
    myExtensions.addItem(ext);
  }
  setTitle(getChooserTitle(descriptor));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:FileSaverDialogImpl.java


示例17: getChooserTitle

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
private static String getChooserTitle(final FileSaverDescriptor descriptor) {
  final String title = descriptor.getTitle();
  return title != null ? title : UIBundle.message("file.chooser.save.dialog.default.title");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:FileSaverDialogImpl.java


示例18: createPanel

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
private JComponent createPanel(final Project project, final Consumer<Boolean> enableConsumer) {
  final JPanel main = new JPanel(new GridBagLayout());
  main.setMinimumSize(new Dimension(150, 50));
  final GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.insets = new Insets(2,2,2,2);
  gbc.anchor = GridBagConstraints.NORTHWEST;

  main.add(new JLabel("Remote URL: "), gbc);
  myUrlField = new JTextField(50);
  gbc.gridx ++;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.weightx = 1;
  main.add(myUrlField, gbc);
  gbc.gridx = 0;
  gbc.gridy ++;
  gbc.weightx = 0;
  gbc.fill = GridBagConstraints.NONE;
  main.add(new JLabel("Local Repository File: "), gbc);
  myLocalRepoFile = new TextFieldWithBrowseButton();
  myLocalRepoFile.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
              new FileSaverDescriptor("Fossil Clone", "Select local file"), project);
      final String path = FileUtil.toSystemIndependentName(myLocalRepoFile.getText().trim());
      final int idx = path.lastIndexOf("/");
      VirtualFile baseDir = idx == -1 ? project.getBaseDir() :
              (LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx))));
      baseDir = baseDir == null ? project.getBaseDir() : baseDir;
      final String name = idx == -1 ? path : path.substring(idx + 1);
      final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name);
      if (fileWrapper != null) {
        myLocalRepoFile.setText(fileWrapper.getFile().getPath());
      }
    }
  });

  gbc.weightx = 1;
  gbc.gridx ++;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  main.add(myLocalRepoFile, gbc);

  gbc.gridx = 0;
  gbc.gridy ++;
  gbc.fill = GridBagConstraints.NONE;
  main.add(new JLabel("Local Checkout Folder: "), gbc);
  myLocalPath = new TextFieldWithBrowseButton();
  myLocalPath.addBrowseFolderListener("Select Checkout Folder", null, project, new FileChooserDescriptor(false, true, false, false, false, false));
  /*myLocalPath.addBrowseFolderListener("Select Local File", "Select local file for clone", project,
          new FileSaverDescriptor("Fossil Clone", "Select local file", "checkout", ""));*/
  gbc.weightx = 1;
  gbc.gridx ++;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  main.add(myLocalPath, gbc);
  return main;
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:59,代码来源:CloneAndOpenAction.java


示例19: createPanel

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
private JComponent createPanel(final Project project, final Consumer<Boolean> enableConsumer) {
  final JPanel main = new JPanel(new GridBagLayout());
  main.setMinimumSize(new Dimension(150, 50));
  final GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.insets = new Insets(2,2,2,2);
  gbc.anchor = GridBagConstraints.NORTHWEST;

  main.add(new JLabel("Remote URL: "), gbc);
  myUrlField = new JTextField(50);
  gbc.gridx ++;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.weightx = 1;
  main.add(myUrlField, gbc);
  gbc.gridx = 0;
  gbc.gridy ++;
  gbc.weightx = 0;
  gbc.fill = GridBagConstraints.NONE;
  main.add(new JLabel("Local Folder: "), gbc);
  myLocalPath = new TextFieldWithBrowseButton();
  myLocalPath.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
              new FileSaverDescriptor("Fossil Clone", "Select local file"), project);
      final String path = FileUtil.toSystemIndependentName(myLocalPath.getText().trim());
      final int idx = path.lastIndexOf("/");
      VirtualFile baseDir = idx == -1 ? project.getBaseDir() :
              (LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx))));
      baseDir = baseDir == null ? project.getBaseDir() : baseDir;
      final String name = idx == -1 ? path : path.substring(idx + 1);
      final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name);
      if (fileWrapper != null) {
        myLocalPath.setText(fileWrapper.getFile().getPath());
      }
    }
  });
  /*myLocalPath.addBrowseFolderListener("Select Local File", "Select local file for clone", project,
          new FileSaverDescriptor("Fossil Clone", "Select local file", "checkout", ""));*/
  gbc.weightx = 1;
  gbc.gridx ++;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  main.add(myLocalPath, gbc);

  /*final ActionListener listener = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      enableConsumer.consume(!myUrlField.getText().isEmpty() && !myLocalPath.getText().isEmpty());
    }
  };
  myUrlField.addActionListener(listener);
  myLocalPath.addActionListener(listener);*/
  return main;
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:56,代码来源:CloneAction.java


示例20: createSaveFileDialog

import com.intellij.openapi.fileChooser.FileSaverDescriptor; //导入依赖的package包/类
@Nonnull
@Override
public FileSaverDialog createSaveFileDialog(@Nonnull FileSaverDescriptor descriptor, @Nullable Project project) {
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:WebFileChooserFactory.java



注:本文中的com.intellij.openapi.fileChooser.FileSaverDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OAuthHmacSigner类代码示例发布时间:2022-05-22
下一篇:
Java ProcessTools类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap