Search in sources :

Example 86 with FileChooserDescriptor

use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project android by JetBrains.

the class ImportSourceLocationStep method setupSourceLocationControls.

private void setupSourceLocationControls() {
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
    descriptor.setTitle("Select Source Location");
    descriptor.setDescription("Select existing ADT or Gradle project to import as a new subproject");
    mySourceLocation.addBrowseFolderListener(new TextBrowseFolderListener(descriptor));
    mySourceLocation.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            invalidate();
        }
    });
    applyBackgroundOperationResult(checkPath(mySourceLocation.getText()));
    myErrorWarning.setIcon(null);
    myErrorWarning.setText(null);
}
Also used : FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) TextBrowseFolderListener(com.intellij.openapi.ui.TextBrowseFolderListener) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 87 with FileChooserDescriptor

use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project intellij-plugins by JetBrains.

the class FlexLibraryRootsComponentDescriptor method createAttachFilesChooserDescriptor.

@NotNull
@Override
public FileChooserDescriptor createAttachFilesChooserDescriptor(String libraryName) {
    FileChooserDescriptor d = super.createAttachFilesChooserDescriptor(libraryName);
    d.setTitle(UIBundle.message("file.chooser.default.title"));
    d.setDescription(FlexBundle.message("choose.library.files.description", ApplicationNamesInfo.getInstance().getFullProductName()));
    return d;
}
Also used : FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 88 with FileChooserDescriptor

use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project intellij-plugins by JetBrains.

the class FlexmojosSdkType method getHomeChooserDescriptor.

@NotNull
public FileChooserDescriptor getHomeChooserDescriptor() {
    final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, false, false, false, false) {

        public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
            return false;
        }
    };
    descriptor.setTitle("SDK of this type can only be created automatically during Maven project import.");
    return descriptor;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 89 with FileChooserDescriptor

use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project intellij-plugins by JetBrains.

the class SelectDirWithFlashBuilderProjectsStep method setupInitialPathComponent.

private void setupInitialPathComponent() {
    myInitialPathComponent.getComponent().getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        protected void textChanged(final DocumentEvent e) {
            onInitialPathChanged();
        }
    });
    final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, false) {

        public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
            return (super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || FlashBuilderProjectFinder.isFlashBuilderProject(file)) || FlashBuilderProjectFinder.hasArchiveExtension(file.getPath()));
        }

        public Icon getIcon(final VirtualFile file) {
            // do not use Flash Builder specific icon for zip
            return !file.isDirectory() && (FlashBuilderProjectFinder.hasFxpExtension(file.getPath()) || FlashBuilderProjectFinder.isFlashBuilderProject(file)) ? dressIcon(file, getBuilder().getIcon()) : super.getIcon(file);
        }
    };
    myInitialPathComponent.getComponent().addBrowseFolderListener(FlexBundle.message("select.flash.builder.workspace.or.project"), null, getWizardContext().getProject(), descriptor);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 90 with FileChooserDescriptor

use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project android by JetBrains.

the class FileChooserActionListener method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (myFilePathProperty == null) {
        return;
    }
    final FileChooserDescriptor descriptor = MockupFileHelper.getFileChooserDescriptor();
    VirtualFile selectedFile = myFilePathProperty.getValue() != null ? VfsUtil.findFileByIoFile(new File(FileUtil.toSystemIndependentName(myFilePathProperty.getValue())), false) : ourLastOpenedFile;
    FileChooser.chooseFile(descriptor, null, null, selectedFile, (virtualFile) -> {
        ourLastOpenedFile = virtualFile;
        if (myComponent != null && myComponent.isRoot()) {
            openDeviceChoiceDialog(virtualFile, myFilePathProperty, myCropProperty);
        } else {
            saveMockupFile(virtualFile, myFilePathProperty, myCropProperty);
            if (e == null) {
                return;
            }
            final TextAccessor textAccessor = e.getSource() instanceof TextAccessor ? ((TextAccessor) e.getSource()) : null;
            if (textAccessor != null) {
                textAccessor.setText(virtualFile.getPath());
            }
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) TextAccessor(com.intellij.ui.TextAccessor) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)143 VirtualFile (com.intellij.openapi.vfs.VirtualFile)97 NotNull (org.jetbrains.annotations.NotNull)35 Project (com.intellij.openapi.project.Project)21 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)19 Nullable (org.jetbrains.annotations.Nullable)18 ActionEvent (java.awt.event.ActionEvent)17 File (java.io.File)17 ActionListener (java.awt.event.ActionListener)16 DocumentEvent (javax.swing.event.DocumentEvent)13 DocumentAdapter (com.intellij.ui.DocumentAdapter)10 ArrayList (java.util.ArrayList)10 FileChooser (com.intellij.openapi.fileChooser.FileChooser)9 List (java.util.List)9 IOException (java.io.IOException)8 JBLabel (com.intellij.ui.components.JBLabel)7 javax.swing (javax.swing)7 Module (com.intellij.openapi.module.Module)5 StringUtil (com.intellij.openapi.util.text.StringUtil)5 JBTable (com.intellij.ui.table.JBTable)5