use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project android by JetBrains.
the class AnalyzeApkAction method promptUserForApk.
@Nullable
private static VirtualFile promptUserForApk(Project project) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileDescriptor().withDescription("Select APK to analyze").withFileFilter(file -> ApkFileSystem.EXTENSIONS.contains(file.getExtension()));
VirtualFile apk = FileChooser.chooseFile(descriptor, project, getLastSelectedApk(project));
if (apk != null) {
saveLastSelectedApk(project, apk);
}
return apk;
}
use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project intellij-leiningen-plugin by derkork.
the class LeiningenSettings method createComponent.
public JComponent createComponent() {
JPanel outerPanel = new JPanel(new BorderLayout());
JPanel leinPanel = new JPanel(new FormLayout("80dlu, fill:80dlu:grow, 20dlu, 80dlu", "p,p,p"));
CellConstraints c = new CellConstraints();
int row = 1;
leinPanel.add(new JBLabel("Leiningen executable:"), c.xy(1, row));
this.leinBinSelectorField = new TextFieldWithBrowseButton();
leinBinSelectorField.addBrowseFolderListener("Select the Leiningen executable", "'lein' on Linux/MacOS, 'lein.bat' on Windows. ", null, new FileChooserDescriptor(true, false, false, false, false, false));
leinPanel.add(leinBinSelectorField, c.xy(2, row));
row++;
leinPanel.add(new JBLabel("Leiningen Home:"), c.xy(1, row));
this.leinHomeSelectorField = new TextFieldWithBrowseButton();
leinHomeSelectorField.addBrowseFolderListener("Select the Leiningen home directory", "usually at $USER_HOME/.lein", null, new FileChooserDescriptor(false, true, false, false, false, false));
leinPanel.add(leinHomeSelectorField, c.xy(2, row));
this.overrideLeinHome = new JBCheckBox();
leinPanel.add(overrideLeinHome, c.xy(3, row));
leinPanel.add(new JBLabel("Override"), c.xy(4, row));
row++;
leinPanel.add(new JBLabel("Leiningen Jar:"), c.xy(1, row));
this.leinJarSelectorField = new TextFieldWithBrowseButton();
leinJarSelectorField.addBrowseFolderListener("Select the Leiningen Jar", "usually at $USER_HOME/.lein/self-installs/leinigen-VERSION-standalone.jar", null, new FileChooserDescriptor(true, false, true, true, false, false));
leinPanel.add(leinJarSelectorField, c.xy(2, row));
this.overrideLeinJar = new JBCheckBox();
leinPanel.add(overrideLeinJar, c.xy(3, row));
leinPanel.add(new JBLabel("Override"), c.xy(4, row));
outerPanel.add(leinPanel, BorderLayout.NORTH);
myWatcher = new UserActivityWatcher();
myWatcher.register(outerPanel);
myWatcher.addUserActivityListener(new UserActivityListener() {
public void stateChanged() {
changed = true;
leinJarSelectorField.setEnabled(overrideLeinJar.isSelected());
leinHomeSelectorField.setEnabled(overrideLeinHome.isSelected());
}
});
return outerPanel;
}
use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project intellij-community by JetBrains.
the class ElementWithManifestPropertiesPanel method chooseManifest.
private void chooseManifest() {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || file.getName().equalsIgnoreCase(ManifestFileUtil.MANIFEST_FILE_NAME));
}
};
descriptor.setTitle("Specify Path to MANIFEST.MF File");
final VirtualFile file = FileChooser.chooseFile(descriptor, myContext.getProject(), null);
if (file == null)
return;
ManifestFileUtil.addManifestFileToLayout(file.getPath(), myContext, myElement);
updateManifest();
myContext.getThisArtifactEditor().updateLayoutTree();
}
use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project android by JetBrains.
the class ConfigureAvdOptionsStep method bindComponents.
private void bindComponents() {
myBindings.bindTwoWay(new TextProperty(myAvdDisplayName), getModel().avdDisplayName());
myBindings.bind(new TextProperty(myAvdId), new StringExpression(getModel().avdDisplayName()) {
@NotNull
@Override
public String get() {
String displayName = getModel().avdDisplayName().get();
getModel().avdId().set(StringUtil.isNotEmpty(displayName) ? AvdWizardUtils.cleanAvdName(connection, displayName, !displayName.equals(myOriginalName)) : "");
return getModel().avdId().get();
}
});
myBindings.bindTwoWay(new TextProperty(mySystemImageName), getModel().systemImageName());
myBindings.bindTwoWay(new TextProperty(mySystemImageDetails), getModel().systemImageDetails());
myBindings.bindTwoWay(new SelectedProperty(myQemu2CheckBox), getModel().useQemu2());
myBindings.bindTwoWay(new SelectedItemProperty<Integer>(myCoreCount), getModel().cpuCoreCount());
myBindings.bindTwoWay(myRamStorage.storage(), getModel().getAvdDeviceData().ramStorage());
myBindings.bindTwoWay(myVmHeapStorage.storage(), getModel().vmHeapStorage());
myBindings.bindTwoWay(myInternalStorage.storage(), getModel().internalStorage());
myBindings.bindTwoWay(myBuiltInSdCardStorage.storage(), new OptionalToValuePropertyAdapter<Storage>(getModel().sdCardStorage()));
myBindings.bindTwoWay(new SelectedItemProperty<GpuMode>(myHostGraphics), getModel().hostGpuMode());
myBindings.bindTwoWay(new SelectedProperty(myDeviceFrameCheckbox), getModel().hasDeviceFrame());
myBindings.bindTwoWay(new SelectedItemProperty<File>(mySkinComboBox.getComboBox()), getModel().getAvdDeviceData().customSkinFile());
myOrientationToggle.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
ScreenOrientation orientation = myOrientationToggle.getSelectedElement();
if (orientation == null) {
getModel().selectedAvdOrientation().set(ScreenOrientation.PORTRAIT);
} else {
getModel().selectedAvdOrientation().set(orientation);
}
}
});
FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, true);
}
};
fileChooserDescriptor.setHideIgnored(false);
myExternalSdCard.addBrowseFolderListener("Select SD Card", "Select an existing SD card image", myProject, fileChooserDescriptor);
myBindings.bindTwoWay(new TextProperty(myExternalSdCard.getTextField()), getModel().externalSdCardLocation());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdCamera>(new SelectedItemProperty<AvdCamera>(myFrontCameraCombo)), getModel().selectedFrontCamera());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdCamera>(new SelectedItemProperty<AvdCamera>(myBackCameraCombo)), getModel().selectedBackCamera());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdNetworkSpeed>(new SelectedItemProperty<AvdNetworkSpeed>(mySpeedCombo)), getModel().selectedNetworkSpeed());
myBindings.bindTwoWay(new OptionalToValuePropertyAdapter<AvdNetworkLatency>(new SelectedItemProperty<AvdNetworkLatency>(myLatencyCombo)), getModel().selectedNetworkLatency());
myBindings.bindTwoWay(new SelectedProperty(myEnableComputerKeyboard), getModel().enableHardwareKeyboard());
myBindings.bindTwoWay(new SelectedProperty(myExternalRadioButton), getModel().useExternalSdCard());
myBindings.bindTwoWay(new SelectedProperty(myBuiltInRadioButton), getModel().useBuiltInSdCard());
myCheckSdForChanges = true;
}
use of com.intellij.openapi.fileChooser.FileChooserDescriptor in project android by JetBrains.
the class ModuleDependenciesPanel method addFileDependency.
private void addFileDependency() {
FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, true, false, false);
VirtualFile buildFile = myGradleBuildFile.getFile();
VirtualFile parent = buildFile.getParent();
descriptor.setRoots(parent);
VirtualFile virtualFile = FileChooser.chooseFile(descriptor, myProject, null);
if (virtualFile != null) {
String path = VfsUtilCore.getRelativePath(virtualFile, parent, '/');
if (path == null) {
path = virtualFile.getPath();
}
myModel.addItem(new ModuleDependenciesTableItem(new Dependency(Dependency.Scope.COMPILE, Dependency.Type.FILES, path)));
}
myModel.fireTableDataChanged();
}
Aggregations