public Map<String, ?> getOptions() { final Map<String, Object> strings = new HashMap<String, Object>(); if (myDisableAbstractElements.isSelected()) { strings.put(DISABLE_ABSTRACT_ELEMENTS, Boolean.TRUE); } strings.put(ANY_PROCESS_CONTENTS, myAnyProcessContents.getSelectedItem()); strings.put(ANY_ATTRIBUTE_PROCESS_CONTENTS, myAnyAttributeProcessContents.getSelectedItem()); return strings; }
@NotNull private String selectedCompiler() { Object item = myCompilerCombo.getSelectedItem(); return item != null && item instanceof String ? (String) item : GoBuildTargetSettings.ANY_COMPILER; }
@Nullable public String getFileTypeMask() { if (myEnableFileNameFilterCb.isSelected()) { return (String) myFileFilter.getSelectedItem(); } return null; }
@NotNull private static String selected(@NotNull ComboBox comboBox, @NotNull String defaultValue) { Object item = comboBox.getSelectedItem(); if (item != null && item instanceof String) { return defaultValue.equals(item) ? GoBuildTargetSettings.DEFAULT : (String) item; } return GoBuildTargetSettings.DEFAULT; }
@Override public void apply() { if (myJavaModuleFacet.getModule() instanceof Solution) { SolutionDescriptor descriptor = (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor(); descriptor.setCompileInMPS(myCheckBox.isSelected()); descriptor.setKind((SolutionKind) myComboBox.getSelectedItem()); } myPathsTableModel.apply(); myLibraryTableModel.apply(); }
@Override public boolean isModified() { boolean solutionCheck = false; if (myJavaModuleFacet.getModule() instanceof Solution) { SolutionDescriptor descriptor = (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor(); solutionCheck = descriptor.getCompileInMPS() != myCheckBox.isSelected() || descriptor.getKind() != myComboBox.getSelectedItem(); } return myPathsTableModel.isModified() || myLibraryTableModel.isModified() || solutionCheck; }
@Nullable private DependencyOnPlugin editPluginDependency( @NotNull JComponent parent, @NotNull final DependencyOnPlugin original) { List<String> pluginIds = new ArrayList<String>(getPluginNameByIdMap().keySet()); if (!original.getPluginId().isEmpty() && !pluginIds.contains(original.getPluginId())) { pluginIds.add(original.getPluginId()); } Collections.sort( pluginIds, new Comparator<String>() { @Override public int compare(String o1, String o2) { return getPluginNameById(o1).compareToIgnoreCase(getPluginNameById(o2)); } }); final ComboBox pluginChooser = new ComboBox(ArrayUtilRt.toStringArray(pluginIds), 250); pluginChooser.setRenderer( new ListCellRendererWrapper<String>() { @Override public void customize( JList list, String value, int index, boolean selected, boolean hasFocus) { setText(getPluginNameById(value)); } }); new ComboboxSpeedSearch(pluginChooser) { @Override protected String getElementText(Object element) { return getPluginNameById((String) element); } }; pluginChooser.setSelectedItem(original.getPluginId()); final JBTextField minVersionField = new JBTextField(StringUtil.notNullize(original.getMinVersion())); final JBTextField maxVersionField = new JBTextField(StringUtil.notNullize(original.getMaxVersion())); final JBTextField channelField = new JBTextField(StringUtil.notNullize(original.getChannel())); minVersionField.getEmptyText().setText("<any>"); minVersionField.setColumns(10); maxVersionField.getEmptyText().setText("<any>"); maxVersionField.setColumns(10); channelField.setColumns(10); JPanel panel = FormBuilder.createFormBuilder() .addLabeledComponent("Plugin:", pluginChooser) .addLabeledComponent("Minimum version:", minVersionField) .addLabeledComponent("Maximum version:", maxVersionField) .addLabeledComponent("Channel:", channelField) .getPanel(); final DialogBuilder dialogBuilder = new DialogBuilder(parent).title("Required Plugin").centerPanel(panel); dialogBuilder.setPreferredFocusComponent(pluginChooser); pluginChooser.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialogBuilder.setOkActionEnabled( !StringUtil.isEmpty((String) pluginChooser.getSelectedItem())); } }); if (dialogBuilder.show() == DialogWrapper.OK_EXIT_CODE) { return new DependencyOnPlugin( ((String) pluginChooser.getSelectedItem()), StringUtil.nullize(minVersionField.getText().trim()), StringUtil.nullize(maxVersionField.getText().trim()), StringUtil.nullize(channelField.getText().trim())); } return null; }
public Object getSelectedBreakpoint() { return ((BreakpointItem) myComboBox.getSelectedItem()).getBreakpoint(); }