/** * The constructor * * @param project the context project */ public GitVcsPanel(@NotNull Project project) { myVcs = GitVcs.getInstance(project); myAppSettings = GitVcsApplicationSettings.getInstance(); myProjectSettings = GitVcsSettings.getInstance(project); myProject = project; mySSHExecutableComboBox.addItem(IDEA_SSH); mySSHExecutableComboBox.addItem(NATIVE_SSH); mySSHExecutableComboBox.setSelectedItem( GitVcsSettings.isDefaultIdeaSsh() ? IDEA_SSH : NATIVE_SSH); mySSHExecutableComboBox.setToolTipText( GitBundle.message( "git.vcs.config.ssh.mode.tooltip", ApplicationNamesInfo.getInstance().getFullProductName())); myTestButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); myConvertTextFilesComboBox.addItem(CRLF_DO_NOT_CONVERT); myConvertTextFilesComboBox.addItem(CRLF_CONVERT_TO_PROJECT); myConvertTextFilesComboBox.addItem(CRLF_ASK); myConvertTextFilesComboBox.setSelectedItem(CRLF_ASK); myGitField.addBrowseFolderListener( GitBundle.getString("find.git.title"), GitBundle.getString("find.git.description"), project, new FileChooserDescriptor(true, false, false, false, false, false)); }
/** * return the String id of the chosen server name * * @return the server name */ public String getServer() { Object selected = serverSelector.getSelectedItem(); if (selected == null) { return null; } AddeServer server; if (selected instanceof AddeServer) { server = (AddeServer) selected; return server.getName(); } String serverName = selected.toString(); server = getIdv().getIdvChooserManager().addAddeServer(serverName); addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); Object selectedGroup = groupSelector.getSelectedItem(); AddeServer.Group group = null; if (selectedGroup != null) { group = getIdv() .getIdvChooserManager() .addAddeServerGroup(server, selectedGroup.toString(), getGroupType()); } boolean old = ignoreStateChangedEvents; ignoreStateChangedEvents = true; GuiUtils.setListData(serverSelector, addeServers); serverSelector.setSelectedItem(server); setGroups(); if (group != null) { groupSelector.setSelectedItem(group); } ignoreStateChangedEvents = old; return server.getName(); }
public void loadData(SettingConfig settingConfig) { TEXT_dir.setText(settingConfig.dir); try { SELECT_logBuffer.setSelectedItem(SizeType.get(settingConfig.logBuffer).getName()); } catch (Exception e) { } try { SELECT_delay.setSelectedItem(settingConfig.delay + ""); } catch (Exception e) { } CHK_seek.setSelected(settingConfig.seek); CHK_showLineNumber.setSelected(settingConfig.showLineNumber); CHK_softWrap.setSelected(settingConfig.softWrap); TEXT_seekPos.setText(settingConfig.seekPos + ""); try { SELECT_seekType.setSelectedItem(settingConfig.seekType.name()); } catch (Exception e) { } try { SELECT_charset.setSelectedItem(settingConfig.charset.getName()); } catch (Exception e) { } TEXT_limit.setText(settingConfig.overflowNum + ""); checkSeek(); }
public void display(ResultSet rs) { try { boolean recordNumber = rs.next(); if (recordNumber) { payNo = rs.getString(1); pasNo = rs.getString(2); pasName = rs.getString(3); mode = rs.getString(4); dt = rs.getString(5); amount = rs.getString(6); rev = rs.getString(7); text1.setText(payNo); combo1.setSelectedItem(pasNo); combo2.setSelectedItem(pasName); combo4.setSelectedItem(mode); p_date.setText(dt); combo8.setSelectedItem(amount); combo3.setSelectedItem(rev); } else { JOptionPane.showMessageDialog( null, "Record Not found", "ERROR", JOptionPane.DEFAULT_OPTION); } } catch (SQLException sqlex) { sqlex.printStackTrace(); } }
public void VaciarCampos() { jtxtCodigo.setText(""); jcbOrigen.setSelectedItem("Medellín"); jcbDestino.setSelectedItem("Bogotá"); jtxtPrecio.setText(""); jcbEstado.setSelectedItem("Activo"); }
/** * Method performed when button clicked. * * @param event event that triggers action, here clicking of the button. */ public void actionPerformed(ActionEvent event) { if (choiceBox.getSelectedItem().equals(CUSTOM)) { JFileChooser chooser = new JFileChooser(System.getProperty("user.home")); int returnVal = chooser.showOpenDialog(settingsPanel); if (returnVal == JFileChooser.APPROVE_OPTION) { specifiedOntology = CUSTOM; openFile = chooser.getSelectedFile(); choiceBox.setEditable(true); choiceBox.setSelectedItem(openFile.toString()); choiceBox.setEditable(false); def = false; if (((String) choiceBox.getSelectedItem()).endsWith(".obo")) { settingsPanel.getNamespacePanel().choiceBox.setEnabled(true); } else { settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } if (returnVal == JFileChooser.CANCEL_OPTION) { choiceBox.setSelectedItem(NONE); specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } else if (choiceBox.getSelectedItem().equals(NONE)) { specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } else { specifiedOntology = (String) choiceBox.getSelectedItem(); def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } }
private void resetFromFile(@NotNull VirtualFile file, @NotNull Project project) { final Module moduleForFile = ModuleUtilCore.findModuleForFile(file, project); if (moduleForFile == null) { return; } final VirtualFile parent = file.getParent(); if (parent == null) { return; } if (myModule == null) { final Object prev = myModuleCombo.getSelectedItem(); myModuleCombo.setSelectedItem(moduleForFile); if (!moduleForFile.equals(myModuleCombo.getSelectedItem())) { myModuleCombo.setSelectedItem(prev); return; } } else if (!myModule.equals(moduleForFile)) { return; } final JCheckBox checkBox = myCheckBoxes.get(parent.getName()); if (checkBox == null) { return; } for (JCheckBox checkBox1 : myCheckBoxes.values()) { checkBox1.setSelected(false); } checkBox.setSelected(true); myFileNameCombo.getEditor().setItem(file.getName()); }
protected void load() { nameField.setText(data.name); costField.setValue(data.cost); colorBox.setSelectedItem(data.color); charField.setValue(data.text); weightField.setValue(data.weight); spellBox.setSelectedItem(data.spell); }
/** {@inheritDoc} */ @Override protected void updateValue() { Object value = getValue(currentKey); if (value != null && !value.equals(EMPTY)) { multiConfValuesBox.setSelectedItem(value); } else { multiConfValuesBox.setSelectedItem(EMPTY); // clear } }
/** * Set calendar to this week's Monday; set year and week combo boxes to the currently set date; * set the date labels appropriately; and, refresh the review table. */ private void updateYearWeekDates() { yearWeekCalendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); yearWeekCalendar.set(Calendar.HOUR_OF_DAY, 0); yearWeekCalendar.set(Calendar.MINUTE, 0); yearWeekCalendar.set(Calendar.SECOND, 0); yearWeekCalendar.set(Calendar.MILLISECOND, 0); yearCB.setSelectedItem(yearWeekCalendar.get(Calendar.YEAR)); weekCB.setSelectedItem(yearWeekCalendar.get(Calendar.WEEK_OF_YEAR)); fromDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, 7); toDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, -7); refreshReviewTable(); }
public void setCompilerLibraryById(LibraryId id) { if (id.isEmpty()) { // myCompilerLibrary.addItem(null); myCompilerLibrary.setSelectedItem(null); } else { LibraryDescriptor descriptor = findLibraryDescriptorFor(id); if (descriptor == null) { LibraryDescriptor newId = LibraryDescriptor.createFor(id); myCompilerLibrary.addItem(newId); myCompilerLibrary.setSelectedItem(newId); } else { myCompilerLibrary.setSelectedItem(descriptor); } } }
public void updateFrom(CvsApplicationLevelConfiguration config) { myPServerSettingsPanel.updateFrom(config); myCharset.setSelectedItem(config.ENCODING); myUseGZIPCompression.setSelected(config.USE_GZIP); myLogOutput.setSelected(config.DO_OUTPUT); mySendEnvironment.setSelected(config.SEND_ENVIRONMENT_VARIABLES_TO_SERVER); }
@Override public void keyPressed(KeyEvent evt) { if (evt.isConsumed()) return; Component comp = getFocusOwner(); if (evt.getKeyCode() == KeyEvent.VK_ENTER && enterEnabled) { while (comp != null) { if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isEditable()) { Object selected = combo.getEditor().getItem(); if (selected != null) combo.setSelectedItem(selected); } if (combo.isPopupVisible()) { evt.consume(); combo.setPopupVisible(false); } return; } // TODO: add other classes that need custom key handling here. comp = comp.getParent(); } evt.consume(); ok(); } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE || isCloseBufferShortcut(evt)) { evt.consume(); if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isPopupVisible()) combo.setPopupVisible(false); else cancel(); } else cancel(); } }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR); Color fillColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE); String fontName = (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME); FigureEnumeration fe = view().selection(); while (fe.hasNextFigure()) { Figure f = fe.nextFigure(); frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR); fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR); arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE); fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute("FrameColor"); Color fillColor = (Color) AttributeFigure.getDefaultAttribute("FillColor"); Color textColor = (Color) AttributeFigure.getDefaultAttribute("TextColor"); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute("ArrowMode"); String fontName = (String) AttributeFigure.getDefaultAttribute("FontName"); FigureEnumeration k = view().selectionElements(); while (k.hasMoreElements()) { Figure f = k.nextFigure(); frameColor = (Color) f.getAttribute("FrameColor"); fillColor = (Color) f.getAttribute("FillColor"); textColor = (Color) f.getAttribute("TextColor"); arrowMode = (Integer) f.getAttribute("ArrowMode"); fontName = (String) f.getAttribute("FontName"); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); // fTextColor.select(ColorMap.colorIndex(textColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
@Override public JComponent createOptionsPanel() { final JFormattedTextField valueField = prepareNumberEditor("m_limit"); final JComboBox comboBox = new ComboBox( new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED}); comboBox.setRenderer( new ListCellRendererWrapper() { @Override public void customize( JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof Scope) setText(((Scope) value).getText()); } }); comboBox.setSelectedItem(ignoreScope); comboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ignoreScope = (Scope) comboBox.getSelectedItem(); } }); comboBox.setPrototypeDisplayValue(Scope.PROTECTED); final FormBuilder formBuilder = FormBuilder.createFormBuilder(); formBuilder.addLabeledComponent(getConfigurationLabel(), valueField); formBuilder.addLabeledComponent( InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox); final JPanel panel = new JPanel(new BorderLayout()); panel.add(formBuilder.getPanel(), BorderLayout.NORTH); return panel; }
@Override protected void resetEditorFrom(@NotNull ErlangConsoleRunConfiguration config) { myModuleComboBox.removeAllItems(); for (final Module module : config.getValidModules()) { if (ModuleType.get(module) == ErlangModuleType.getInstance()) { myModuleComboBox.addItem(module); } } myModuleComboBox.setSelectedItem(myInitialModule); //noinspection unchecked myModuleComboBox.setRenderer(getListCellRendererWrapper()); myWorkingDirPathField.setText(config.getWorkingDirPath()); myModuleComboBox.setSelectedItem(config.getConfigurationModule().getModule()); myConsoleArgsEditor.setText(config.getConsoleArgs()); }
public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int rowIndex, int vColIndex) { box.setSelectedItem(value); return box; }
private void setUpBrowserCombobox() { for (BrowsersConfiguration.BrowserFamily family : BrowsersConfiguration.getInstance().getActiveBrowsers()) { browserComboBox.addItem(family); } browserComboBox.setRenderer( new ListCellRendererWrapper<BrowsersConfiguration.BrowserFamily>(browserComboBox) { @Override public void customize( JList list, BrowsersConfiguration.BrowserFamily family, int index, boolean selected, boolean hasFocus) { if (family != null) { setText(family.getName()); setIcon(family.getIcon()); } } }); if (browserComboBox.getItemCount() < 2) { browserComboBox.setVisible(false); browserComboBox.setVisible(false); } else { browserComboBox.setSelectedItem(0); } }
public void reset() { basePackageField.setText(myData.getBasePackage()); myFSCRadioButton.setSelected(myData.getFsc()); myRunSeparateCompilerRadioButton.setSelected(!myData.getFsc()); updateLibrariesList(); setCompilerLibraryById( new LibraryId(myData.getCompilerLibraryName(), myData.getCompilerLibraryLevel())); myMaximumHeapSize.setText(Integer.toString(myData.getMaximumHeapSize())); myVmParameters.setText(myData.getVmOptions()); myEnableWarnings.setSelected(myData.getWarnings()); myDeprecationWarnings.setSelected(myData.getDeprecationWarnings()); myUncheckedWarnings.setSelected(myData.getUncheckedWarnings()); myOptimiseBytecode.setSelected(myData.getOptimiseBytecode()); myExplainTypeErrors.setSelected(myData.getExplainTypeErrors()); myEnableContinuations.setSelected(myData.getContinuations()); myDebuggingInfoLevel.setSelectedItem(myData.getDebuggingInfoLevel()); myCompilerOptions.setText(myData.getCompilerOptions()); myPlugins = new ArrayList( CompilerPlugin.fromPaths(myData.getPluginPaths(), myEditorContext.getModule())); getPluginsModel().setItems(myPlugins); }
@Override protected JComponent createNorthPanel() { JBLabel descriptionLabel = new JBLabel("<html>" + makeDescription() + "</html>"); final JComboBox repositorySelector = new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class)); repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector)); repositorySelector.setSelectedItem(myInitialRepository); repositorySelector.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<GitCommit> commits = myCommits.get((GitRepository) repositorySelector.getSelectedItem()); myCommitListWithDiffPanel.setCommits(new ArrayList<GitCommit>(commits)); } }); JPanel repoSelectorPanel = new JPanel(new BorderLayout()); JBLabel label = new JBLabel("Repository: "); label.setLabelFor(repoSelectorPanel); repoSelectorPanel.add(label, BorderLayout.WEST); repoSelectorPanel.add(repositorySelector); if (myRepositories.size() < 2) { repoSelectorPanel.setVisible(false); } JPanel northPanel = new JPanel(new BorderLayout()); northPanel.add(descriptionLabel); northPanel.add(repoSelectorPanel, BorderLayout.SOUTH); return northPanel; }
/** * _more_ * * @param values _more_ * @return _more_ */ public JComboBox getFileCountWidget(int[] values) { if (fileCountWidget == null) { TwoFacedObject selected = null; Vector items = new Vector(); for (int i = 0; i < values.length; i++) { String label; if (values[i] == Integer.MAX_VALUE) { label = "All Files"; } else if (values[i] == 0) { label = "Use Selected File"; } else if (values[i] == 1) { label = "Use Most Recent File"; } else { label = "Use Most Recent " + values[i] + " Files"; } TwoFacedObject tfo = new TwoFacedObject(label, new Integer(values[i])); if (values[i] == fileCount) { selected = tfo; } items.add(tfo); } fileCountWidget = new JComboBox(items); if (selected == null) { selected = new TwoFacedObject("Use Most Recent " + fileCount + " Files", new Integer(fileCount)); } fileCountWidget.setSelectedItem(selected); } return fileCountWidget; }
/** * Setup root chooser with specified elements and link selection to the current branch label. * * @param project a context project * @param roots git roots for the project * @param defaultRoot a default root * @param gitRootChooser git root selector * @param currentBranchLabel current branch label (might be null) */ public static void setupRootChooser( @NotNull final Project project, @NotNull final List<VirtualFile> roots, @Nullable final VirtualFile defaultRoot, @NotNull final JComboBox gitRootChooser, @Nullable final JLabel currentBranchLabel) { for (VirtualFile root : roots) { gitRootChooser.addItem(root); } gitRootChooser.setRenderer(getVirtualFileListCellRenderer(gitRootChooser.getRenderer())); gitRootChooser.setSelectedItem(defaultRoot != null ? defaultRoot : roots.get(0)); if (currentBranchLabel != null) { final ActionListener listener = new ActionListener() { public void actionPerformed(final ActionEvent e) { VirtualFile root = (VirtualFile) gitRootChooser.getSelectedItem(); assert root != null : "The root must not be null"; GitRepository repo = GitRepositoryManager.getInstance(project).getRepositoryForRoot(root); assert repo != null : "The repository must not be null"; GitBranch current = repo.getCurrentBranch(); if (current == null) { currentBranchLabel.setText(NO_CURRENT_BRANCH); } else { currentBranchLabel.setText(current.getName()); } } }; listener.actionPerformed(null); gitRootChooser.addActionListener(listener); } }
@Override void doPropertyChange(PropertyChangeEvent evt) { super.doPropertyChange(evt); if (checkIsFieldChange(Field.NACHNAME, evt)) { txtNachname.setText(personModel.getNachname()); } else if (checkIsFieldChange(Field.VORNAME, evt)) { txtVorname.setText(personModel.getVorname()); } else if (checkIsFieldChange(Field.STRASSE_HAUSNUMMER, evt)) { txtStrasseHausnummer.setText(personModel.getStrasseHausnummer()); } else if (checkIsFieldChange(Field.PLZ, evt)) { txtPlz.setText(personModel.getPlz()); } else if (checkIsFieldChange(Field.ORT, evt)) { txtOrt.setText(personModel.getOrt()); } else if (checkIsFieldChange(Field.GEBURTSDATUM, evt)) { // nicht alle Subklassen von Person haben ein Geburtsdatum if (txtGeburtsdatum != null) { txtGeburtsdatum.setText(asString(personModel.getGeburtsdatum())); } } else if (checkIsFieldChange(Field.FESTNETZ, evt)) { txtFestnetz.setText(personModel.getFestnetz()); } else if (checkIsFieldChange(Field.NATEL, evt)) { txtNatel.setText(personModel.getNatel()); } else if (checkIsFieldChange(Field.EMAIL, evt)) { txtEmail.setText(personModel.getEmail()); } else if (checkIsFieldChange(Field.ANREDE, evt)) { // nicht alle Subklassen von Person haben eine Anrede if (comboBoxAnrede != null) { comboBoxAnrede.setSelectedItem(personModel.getAnrede()); } } }
private AppEngineSupportConfigurable(FrameworkSupportModel model) { super(AppEngineSupportProvider.this, model); mySdkEditor = new AppEngineSdkEditor(model.getProject()); mySdkPanel.add( LabeledComponent.create(mySdkEditor.getMainComponent(), "Google App Engine SDK:"), BorderLayout.CENTER); PersistenceApiComboboxUtil.setComboboxModel(myPersistenceApiComboBox, true); if (model.isFrameworkSelected(JPA_PROVIDER_ID)) { myPersistenceApiComboBox.setSelectedItem(PersistenceApi.JPA.getDisplayName()); } model.addFrameworkListener(this); myErrorLabel = new HyperlinkLabel(); myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning); myErrorLabel.setVisible(false); myErrorLabel.setHyperlinkTarget(AppEngineSdkUtil.APP_ENGINE_DOWNLOAD_URL); myErrorPanel.add(BorderLayout.CENTER, myErrorLabel); final Component component = mySdkEditor.getComboBox().getEditor().getEditorComponent(); if (component instanceof JTextComponent) { ((JTextComponent) component) .getDocument() .addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { checkSdk(); } }); } checkSdk(); }
/** * Get the image group from the gui. * * @return The iamge group. */ protected String getGroup() { Object selected = groupSelector.getSelectedItem(); if (selected == null) { return null; } if (selected instanceof AddeServer.Group) { AddeServer.Group group = (AddeServer.Group) selected; return group.getName(); } String groupName = selected.toString().trim(); if ((groupName.length() > 0)) { // Force the get in case they typed a server name getServer(); AddeServer server = getAddeServer(); if (server != null) { AddeServer.Group group = getIdv().getIdvChooserManager().addAddeServerGroup(server, groupName, getGroupType()); if (!group.getActive()) { getIdv().getIdvChooserManager().activateAddeServerGroup(server, group); } // Now put the list of groups back in to the selector setGroups(); groupSelector.setSelectedItem(group); } } return groupName; }
public void testModulesSelector() throws ConfigurationException { if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return; Module module1 = getModule1(); Module module2 = getModule2(); JUnitConfigurable editor = new JUnitConfigurable(myProject); try { JUnitConfiguration configuration = createConfiguration(findTestA(module2)); editor.getComponent(); // To get all the watchers installed. Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration); JComboBox comboBox = editor.getModulesComponent(); configurable.reset(); assertFalse(configurable.isModified()); assertEquals(module2.getName(), ((Module) comboBox.getSelectedItem()).getName()); assertEquals( ModuleManager.getInstance(myProject).getModules().length + 1, comboBox.getModel().getSize()); // no module comboBox.setSelectedItem(module1); assertTrue(configurable.isModified()); configurable.apply(); assertFalse(configurable.isModified()); assertEquals( Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules())); } finally { Disposer.dispose(editor); } }
public DataSourceQueryChooserDialog( Collection dataSourceQueryChoosers, Frame frame, String title, boolean modal) { super(frame, title, modal); init(dataSourceQueryChoosers); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { okCancelPanel.setOKPressed(false); } }); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { // User may have hit OK, got a validation-error dialog, then hit the // X button. [Jon Aquino] okCancelPanel.setOKPressed(false); } }); // Set the selected item to trigger the event that sets the panel. [Jon Aquino] formatComboBox.setSelectedItem(formatComboBox.getItemAt(0)); }
/** * Setup remotes combobox. The default remote for the current branch is selected by default. * * @param project the project * @param root the git root * @param currentBranch the current branch * @param remoteCombobox the combobox to update * @param fetchUrl if true, the fetch url is shown for remotes, push otherwise */ public static void setupRemotes( final Project project, final VirtualFile root, final String currentBranch, final JComboBox remoteCombobox, final boolean fetchUrl) { try { List<GitDeprecatedRemote> remotes = GitDeprecatedRemote.list(project, root); String remote = null; if (currentBranch != null) { remote = GitConfigUtil.getValue(project, root, "branch." + currentBranch + ".remote"); } remoteCombobox.setRenderer( getGitRemoteListCellRenderer(remote, fetchUrl, remoteCombobox.getRenderer())); GitDeprecatedRemote toSelect = null; remoteCombobox.removeAllItems(); for (GitDeprecatedRemote r : remotes) { remoteCombobox.addItem(r); if (r.name().equals(remote)) { toSelect = r; } } if (toSelect != null) { remoteCombobox.setSelectedItem(toSelect); } } catch (VcsException e) { GitVcs.getInstance(project) .showErrors(Collections.singletonList(e), GitBundle.getString("pull.retrieving.remotes")); } }
public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { ((JComboBox) editorComponent).removeAllItems(); if (options.containTrait(table.getValueAt(row, 0).toString())) { if (column == 5) { for (Object ob : options.getPartitionTraitsSubstitutionModels()) { ((JComboBox) editorComponent).addItem(ob); } } else if (column == 6) { for (Object ob : options.getPartitionTraitsClockModels()) { ((JComboBox) editorComponent).addItem(ob); } } } else { if (column == 5) { for (Object ob : options.getPartitionNonTraitsSubstitutionModels()) { ((JComboBox) editorComponent).addItem(ob); } } else if (column == 6) { for (Object ob : options.getPartitionNonTraitsClockModels()) { ((JComboBox) editorComponent).addItem(ob); } } } // if (((JComboBox) editorComponent).contains(value)) // todo need validate whether // value in the editorComponent ((JComboBox) editorComponent).setSelectedItem(value); delegate.setValue(value); return editorComponent; }