public void focusList() { myExcludePackagesList.setSelectedIndex(0); myExcludePackagesList.requestFocus(); }
private void setVersion(@Nullable String version) { if (version == null) { myVersionLabel.setText("N/A"); myVersionLabel.setForeground(JBColor.RED); } else { myVersionLabel.setText(version); myVersionLabel.setForeground(myDefaultLabelColor); } ((CardLayout)myVersionPanel.getLayout()).show(myVersionPanel, VERSION_RESULT); }
/** * Returns currently selected template. * * @return template or null if none selected */ @Nullable public IgnoreSettings.UserTemplate getCurrentItem() { int index = myList.getSelectedIndex(); if (index == -1) { return null; } return myListModel.get(index); }
@Override public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { if (editor == null || myTestingPackageName != null) { renamePackagesInDirectory(project, file.getContainingDirectory(), myTestingPackageName != null ? myTestingPackageName : myPackageName); return; } JBList list = new JBList(myPackages); list.installCellRenderer(o -> { JBLabel label = new JBLabel(o.toString()); label.setBorder(IdeBorderFactory.createEmptyBorder(2, 4, 2, 4)); return label; }); JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Choose package name").setItemChoosenCallback(() -> { String name = (String)list.getSelectedValue(); if (name != null) { renamePackagesInDirectory(project, file.getContainingDirectory(), name); } }).createPopup().showInBestPositionFor(editor); }
@Override public boolean isModified() { return !getUserDefinedUrls().equals(myLibrariesService.getLibraryRootUrls()) || myLibrariesService instanceof GoApplicationLibrariesService && ((GoApplicationLibrariesService)myLibrariesService).isUseGoPathFromSystemEnvironment() != myUseEnvGoPathCheckBox.isSelected(); }
private void createUIComponents() { myVersionLabel = new JBLabel(); myDefaultLabelColor = myVersionLabel.getForeground(); myVersionPanel = new JPanel(new JBCardLayout()); JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon("Getting Go version"); gettingVersionPanel.add(gettingVersionIcon); gettingVersionPanel.add(new JLabel("Getting...")); myVersionPanel.add(gettingVersionPanel, VERSION_GETTING); myVersionPanel.add(myVersionLabel, VERSION_RESULT); setVersion(null); }
private void resetLibrariesFromEnvironment() { if (myLibrariesService instanceof GoApplicationLibrariesService) { myUseEnvGoPathCheckBox.setSelected(((GoApplicationLibrariesService)myLibrariesService).isUseGoPathFromSystemEnvironment()); if (((GoApplicationLibrariesService)myLibrariesService).isUseGoPathFromSystemEnvironment()) { addReadOnlyPaths(); } else { removeReadOnlyPaths(); } } }
@Override protected void applyEditorTo(@NotNull GoAppEngineRunConfiguration configuration) throws ConfigurationException { configuration.setHost(StringUtil.nullize(myHostField.getText().trim())); configuration.setPort(StringUtil.nullize(myPortField.getText().trim())); configuration.setAdminPort(StringUtil.nullize(myAdminPortField.getText().trim())); configuration.setConfigFile(StringUtil.nullize(myConfigFileField.getText().trim())); myCommonSettingsPanel.applyEditorTo(configuration); }
public VimSettingsPanel(@NotNull VimShortcutConflictsTable.Model model) { myShortcutConflictsTable = new VimShortcutConflictsTable(model); setLayout(new BorderLayout()); final JScrollPane scrollPane = new JBScrollPane(myShortcutConflictsTable); scrollPane.setBorder(new LineBorder(UIUtil.getBorderColor())); final JPanel conflictsPanel = new JPanel(new BorderLayout()); final String title = String.format("Shortcut Conflicts for Active Keymap"); conflictsPanel.setBorder(IdeBorderFactory.createTitledBorder(title, false)); conflictsPanel.add(scrollPane); add(conflictsPanel, BorderLayout.CENTER); } }
private void addExcludedPackage(@Nullable String packageName) { if (StringUtil.isEmpty(packageName)) return; int index = -Arrays.binarySearch(myExcludePackagesModel.toArray(), packageName) - 1; if (index >= 0) { myExcludePackagesModel.add(index, packageName); ScrollingUtil.ensureIndexIsVisible(myExcludePackagesList, index, 0); } myExcludePackagesList.clearSelection(); myExcludePackagesList.setSelectedValue(packageName, true); myExcludePackagesList.requestFocus(); } }
@Override protected void resetEditorFrom(@NotNull GoAppEngineRunConfiguration configuration) { myHostField.setText(StringUtil.notNullize(configuration.getHost())); myPortField.setText(StringUtil.notNullize(configuration.getPort())); myAdminPortField.setText(StringUtil.notNullize(configuration.getAdminPort())); myConfigFileField.getChildComponent().setText(StringUtil.notNullize(configuration.getConfigFile())); myCommonSettingsPanel.resetEditorFrom(configuration); }
@Override public void reset() { myCbShowImportPopup.setSelected(myCodeInsightSettings.isShowImportPopup()); myCbAddUnambiguousImports.setSelected(myCodeInsightSettings.isAddUnambiguousImportsOnTheFly()); myExcludePackagesModel = new DefaultListModel(); for (String name : myExcludedSettings.getExcludedPackages()) { myExcludePackagesModel.add(myExcludePackagesModel.size(), name); } myExcludePackagesList.setModel(myExcludePackagesModel); }
/** Constructs CRUD panel with list listener for editor updating. */ public TemplatesListPanel() { super(null, ContainerUtil.newArrayList()); myList.addListSelectionListener(e -> { boolean enabled = myListModel.size() > 0; editorPanel.setEnabled(enabled); if (enabled) { IgnoreSettings.UserTemplate template = getCurrentItem(); editorPanel.setContent(template != null ? template.getContent() : ""); } }); }
/** * Returns selected {@link IgnoreSettings.UserTemplate} elements. * * @return {@link IgnoreSettings.UserTemplate} list */ public List<IgnoreSettings.UserTemplate> getCurrentItems() { List<IgnoreSettings.UserTemplate> list = ContainerUtil.newArrayList(); int[] ids = myList.getSelectedIndices(); for (int i = 0; i < ids.length; i++) { list.add(getList().get(i)); } return list; } }
@Override public void apply() throws ConfigurationException { myLibrariesService.setLibraryRootUrls(getUserDefinedUrls()); if (myLibrariesService instanceof GoApplicationLibrariesService) { ((GoApplicationLibrariesService)myLibrariesService).setUseGoPathFromSystemEnvironment(myUseEnvGoPathCheckBox.isSelected()); } }
private void createUIComponents() { myVersionLabel = new JBLabel(); myDefaultLabelColor = myVersionLabel.getForeground(); myVersionPanel = new JPanel(new JBCardLayout()); JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon("Getting Ballerina version"); gettingVersionPanel.add(gettingVersionIcon); gettingVersionPanel.add(new JLabel("Getting...")); myVersionPanel.add(gettingVersionPanel, VERSION_GETTING); myVersionPanel.add(myVersionLabel, VERSION_RESULT); setVersion(null); }
private void resetLibrariesFromEnvironment() { if (myLibrariesService instanceof BallerinaApplicationLibrariesService) { myUseEnvBallerinaPathCheckBox.setSelected(((BallerinaApplicationLibrariesService) myLibrariesService) .isUseBallerinaPathFromSystemEnvironment()); if (((BallerinaApplicationLibrariesService) myLibrariesService).isUseBallerinaPathFromSystemEnvironment()) { addReadOnlyPaths(); } else { removeReadOnlyPaths(); } } }
private void setVersion(@Nullable String version) { if (version == null) { myVersionLabel.setText("N/A"); myVersionLabel.setForeground(JBColor.RED); } else { myVersionLabel.setText(version); myVersionLabel.setForeground(myDefaultLabelColor); } ((CardLayout) myVersionPanel.getLayout()).show(myVersionPanel, VERSION_RESULT); }
@Override public boolean isModified() { return !getUserDefinedUrls().equals(myLibrariesService.getLibraryRootUrls()) || myLibrariesService instanceof BallerinaApplicationLibrariesService && ((BallerinaApplicationLibrariesService) myLibrariesService) .isUseBallerinaPathFromSystemEnvironment() != myUseEnvBallerinaPathCheckBox.isSelected(); }
@Override public void apply() throws ConfigurationException { myLibrariesService.setLibraryRootUrls(getUserDefinedUrls()); if (myLibrariesService instanceof BallerinaApplicationLibrariesService) { ((BallerinaApplicationLibrariesService) myLibrariesService).setUseBallerinaPathFromSystemEnvironment (myUseEnvBallerinaPathCheckBox.isSelected()); } }