List of usage examples for com.intellij.openapi.fileChooser FileChooserDescriptorFactory createSingleFileNoJarsDescriptor
public static FileChooserDescriptor createSingleFileNoJarsDescriptor()
From source file:com.android.tools.idea.npw.assetstudio.ui.ImageAssetBrowser.java
License:Apache License
public ImageAssetBrowser() { addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); final TextProperty imagePathText = new TextProperty(getTextField()); myBindings.bind(imagePathText, myImageAsset.imagePath().transform(File::getAbsolutePath)); myBindings.bind(myImageAsset.imagePath(), imagePathText.transform(File::new)); InvalidationListener onImageChanged = new InvalidationListener() { @Override//from w w w.j a va 2 s . co m public void onInvalidated(@NotNull ObservableValue<?> sender) { ActionEvent e = new ActionEvent(ImageAssetBrowser.this, ActionEvent.ACTION_PERFORMED, null); for (ActionListener listener : myListeners) { listener.actionPerformed(e); } } }; myImageAsset.imagePath().addListener(onImageChanged); }
From source file:com.android.tools.idea.npw.IconStep.java
License:Apache License
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public IconStep(Key<TemplateEntry> templateKey, Key<SourceProvider> sourceProviderKey, Disposable disposable) { super(disposable); myTemplateKey = templateKey;/*from w ww . j a v a 2 s . c om*/ mySourceProviderKey = sourceProviderKey; myUpdateQueue = new MergingUpdateQueue("asset.studio", 200, true, null, this, null, false); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ApiComboBoxItem(font, font, 1, 1)); if (font.equals(myState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); setBodyComponent(myPanel); }
From source file:com.android.tools.idea.uibuilder.mockup.MockupFileHelper.java
License:Apache License
public static FileChooserDescriptor getFileChooserDescriptor() { return FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor() .withFileFilter(file -> VALID_EXTENSION.contains(file.getExtension())) .withTitle("Choose Mockup File").withDescription("PSD, JPEG, PNG are accepted"); }
From source file:com.android.tools.idea.wizard.AssetSetStep.java
License:Apache License
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public AssetSetStep(TemplateWizardState state, @Nullable Project project, @Nullable Module module, @Nullable Icon sidePanelIcon, UpdateListener updateListener, @Nullable VirtualFile invocationTarget) { super(state, project, module, sidePanelIcon, updateListener); myAssetGenerator = new AssetStudioAssetGenerator(state); if (invocationTarget != null && module != null) { AndroidFacet facet = AndroidFacet.getInstance(myModule); if (facet != null) { mySourceProvider = Iterators.getNext( IdeaSourceProvider.getSourceProvidersForFile(facet, invocationTarget, null).iterator(), null);/*from w w w . j a v a 2 s. c o m*/ } } myUpdateQueue = new MergingUpdateQueue("asset.studio", 200, true, null, this, null, false); register(ATTR_TEXT, myText); register(ATTR_SCALING, myCropRadioButton, Scaling.CROP); register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER); register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE); register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE); register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE); register(ATTR_PADDING, myPaddingSlider); register(ATTR_TRIM, myTrimBlankSpace); register(ATTR_FONT, myFontFamily); register(ATTR_SOURCE_TYPE, myImageRadioButton, AssetStudioAssetGenerator.SourceType.IMAGE); register(ATTR_SOURCE_TYPE, myClipartRadioButton, AssetStudioAssetGenerator.SourceType.CLIPART); register(ATTR_SOURCE_TYPE, myTextRadioButton, AssetStudioAssetGenerator.SourceType.TEXT); register(ATTR_FOREGROUND_COLOR, myForegroundColor); register(ATTR_BACKGROUND_COLOR, myBackgroundColor); register(ATTR_ASSET_TYPE, myAssetTypeComboBox); register(ATTR_ASSET_THEME, myChooseThemeComboBox); register(ATTR_ASSET_NAME, myResourceNameField); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myTemplateState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); populateComboBox(myAssetTypeComboBox, AssetType.class); populateComboBox(myChooseThemeComboBox, ActionBarIconGenerator.Theme.class); }
From source file:com.android.tools.idea.wizard.IconStep.java
License:Apache License
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public IconStep(Key<TemplateEntry> templateKey, Key<SourceProvider> sourceProviderKey, @Nullable SourceProvider[] sourceProviders, Disposable disposable) { super(disposable); myTemplateKey = templateKey;//from w w w . j a v a2 s . co m mySourceProviderKey = sourceProviderKey; mySourceProviders = sourceProviders; myScalingButtons = new JComponent[] { myCropRadioButton, myCenterRadioButton }; myShapeButtons = new JComponent[] { myNoneRadioButton, mySquareRadioButton, myCircleRadioButton }; myUpdateQueue = new MergingUpdateQueue("asset.studio", 200, true, null, this, null, false); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); setBodyComponent(myPanel); }
From source file:com.android.tools.idea.wizard.LauncherIconStep.java
License:Apache License
public LauncherIconStep(LauncherIconWizardState state, @Nullable Project project, @Nullable Icon sidePanelIcon, UpdateListener updateListener) { super(state, project, sidePanelIcon, updateListener); myWizardState = state;//from www. j a va 2 s. co m register(ATTR_TEXT, myText); register(ATTR_SCALING, myCropRadioButton, Scaling.CROP); register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER); register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE); register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE); register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE); register(ATTR_PADDING, myPaddingSlider); register(ATTR_TRIM, myTrimBlankSpace); register(ATTR_FONT, myFontFamily); register(ATTR_SOURCE_TYPE, myImageRadioButton, LauncherIconWizardState.SourceType.IMAGE); register(ATTR_SOURCE_TYPE, myClipartRadioButton, LauncherIconWizardState.SourceType.CLIPART); register(ATTR_SOURCE_TYPE, myTextRadioButton, LauncherIconWizardState.SourceType.TEXT); register(ATTR_IMAGE_PATH, myImageFile); register(ATTR_FOREGROUND_COLOR, myForegroundColor); register(ATTR_BACKGROUND_COLOR, myBackgroundColor); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myWizardState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); }
From source file:com.android.tools.idea.wizard.RasterAssetSetStep.java
License:Apache License
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public RasterAssetSetStep(TemplateWizardState state, @Nullable Project project, @Nullable Module module, @Nullable Icon sidePanelIcon, UpdateListener updateListener, @Nullable VirtualFile invocationTarget) { super(state, project, module, sidePanelIcon, updateListener, invocationTarget); // Speed the scrolling of myScrollPane myScrollPane.getVerticalScrollBar().setUnitIncrement(16); register(ATTR_TEXT, myText);/* w w w.j av a2 s . c om*/ register(ATTR_SCALING, myCropRadioButton, Scaling.CROP); register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER); register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE); register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE); register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE); register(ATTR_SHAPE, myVerticalRadioButton, GraphicGenerator.Shape.VRECT); register(ATTR_SHAPE, myHorizontalRadioButton, GraphicGenerator.Shape.HRECT); register(ATTR_DOGEAR, myDogEarEffectCheckBox); register(ATTR_PADDING, myPaddingSlider); register(ATTR_TRIM, myTrimBlankSpace); register(ATTR_FONT, myFontFamily); register(ATTR_SOURCE_TYPE, myImageRadioButton, AssetStudioAssetGenerator.SourceType.IMAGE); register(ATTR_SOURCE_TYPE, myClipartRadioButton, AssetStudioAssetGenerator.SourceType.CLIPART); register(ATTR_SOURCE_TYPE, myTextRadioButton, AssetStudioAssetGenerator.SourceType.TEXT); register(ATTR_FOREGROUND_COLOR, myForegroundColor); register(ATTR_BACKGROUND_COLOR, myBackgroundColor); register(ATTR_ASSET_TYPE, myAssetTypeComboBox); register(ATTR_ASSET_THEME, myChooseThemeComboBox); register(ATTR_ASSET_NAME, myResourceNameField); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myTemplateState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); populateComboBox(myAssetTypeComboBox, AssetType.class); populateComboBox(myChooseThemeComboBox, ActionBarIconGenerator.Theme.class); }
From source file:com.atlassian.clover.idea.config.LicenseConfigPanel.java
License:Open Source License
private boolean loadLicenseFile() { final VirtualFile[] vf = FileChooser.chooseFiles(this, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); if (vf.length == 1 && !vf[0].isDirectory()) { try {/* w w w .j a v a 2 s. c o m*/ byte[] contents = vf[0].contentsToByteArray(); setLicenseText(new String(contents, "UTF-8")); return true; } catch (IOException e1) { JOptionPane.showMessageDialog(null, e1.getMessage(), "Loading license file", JOptionPane.ERROR_MESSAGE); } } return false; }
From source file:com.intellij.debugger.ui.ExportDialog.java
License:Apache License
protected JComponent createNorthPanel() { JPanel box = new JPanel(new BorderLayout()); box.add(new JLabel(DebuggerBundle.message("label.threads.export.dialog.file")), BorderLayout.WEST); myTfFilePath = new TextFieldWithBrowseButton(); myTfFilePath.addBrowseFolderListener(null, null, myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); box.add(myTfFilePath, BorderLayout.CENTER); JPanel panel = new JPanel(new BorderLayout()); panel.add(box, BorderLayout.CENTER); panel.add(Box.createVerticalStrut(7), BorderLayout.SOUTH); return panel; }
From source file:com.intellij.execution.applet.AppletConfigurable.java
License:Apache License
public AppletConfigurable(final Project project) { myProject = project;/* w w w .j a va2 s .co m*/ myClassNameLabel.setLabelFor(myClassName.getChildComponent()); myHtmlFileLabel.setLabelFor(myHtmlFile.getTextField()); myWidthLabel.setLabelFor(myWidth); myHeightLabel.setLabelFor(myHeight); myModuleSelector = new ConfigurationModuleSelector(project, getModuleComponent()); myTablePlace.setLayout(new BorderLayout()); myParameters = new ListTableModel<AppletConfiguration.AppletParameter>(PARAMETER_COLUMNS); myTable = new TableView(myParameters); myTable.getEmptyText().setText(ExecutionBundle.message("no.parameters")); myTablePlace.add(ToolbarDecorator.createDecorator(myTable).setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { addParameter(); } }).setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { removeParameter(); } }).disableUpDownActions().createPanel(), BorderLayout.CENTER); myAppletRadioButtonGroup = new ButtonGroup(); myAppletRadioButtonGroup.add(myMainClass); myAppletRadioButtonGroup.add(myURL); getVMParametersComponent().setDialogCaption(myVMParameters.getRawText()); myMainClass.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { changePanel(); } }); myURL.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { changePanel(); } }); getPolicyFileComponent().addBrowseFolderListener( ExecutionBundle.message("select.applet.policy.file.dialog.title"), null, myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); getHtmlPathComponent().addBrowseFolderListener(ExecutionBundle.message("choose.html.file.dialog.title"), null, myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); ClassBrowser.createAppletClassBrowser(myProject, myModuleSelector).setField(getClassNameComponent()); myHTMLOptions.setVisible(false); setAnchor(myVMParameters.getLabel()); }