protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { String jdkName = (String)value; if (jdkName == null || jdkName.length() == 0) jdkName = ""; Sdk jdk = GlobalAntConfiguration.findJdk(jdkName); if (jdk == null) { if (myProjectJdkName.length() > 0) { setIcon(AllIcons.General.Jdk); append(AntBundle.message("project.jdk.project.jdk.name.list.column.value", myProjectJdkName), selected && !(SystemInfo.isWinVistaOrNewer && UIManager.getLookAndFeel().getName().contains("Windows")) ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES); } else { setIcon(PlatformIcons.INVALID_ENTRY_ICON); append(AntBundle.message("project.jdk.not.specified.list.column.value"), SimpleTextAttributes.ERROR_ATTRIBUTES); } } else { OrderEntryAppearanceService.getInstance().forJdk(jdk, myInComboBox, selected, true).customize(this); } }
private Form(@NotNull final Project project) { myTabs = new Tab[]{ new PropertiesTab(), new ExecutionTab(GlobalAntConfiguration.getInstance(), project), new AdditionalClasspathTab(), new FiltersTab() }; myHeapSizeLabel.setLabelFor(myXmx); myWrapper = new TabbedPaneWrapper(this); myTabsPlace.setLayout(new BorderLayout()); myTabsPlace.add(myWrapper.getComponent(), BorderLayout.CENTER); myBinding.bindBoolean(myRunInBackground, AntBuildFileImpl.RUN_IN_BACKGROUND); myBinding.bindBoolean(myCloseOnNoError, AntBuildFileImpl.CLOSE_ON_NO_ERRORS); myBinding.bindInt(myXmx, AntBuildFileImpl.MAX_HEAP_SIZE); myBinding.bindInt(myXss, AntBuildFileImpl.MAX_STACK_SIZE); for(Tab tab : myTabs) { myWrapper.addTab(tab.getDisplayName(), tab.getComponent()); } }
private void saveAntInstallation(final AntInstallation antInstallation) { final GlobalAntConfiguration globalAntConfiguration = GlobalAntConfiguration.getInstance(); if (globalAntConfiguration == null) { return; } globalAntConfiguration.removeConfiguration(globalAntConfiguration.getConfiguredAnts() .get(antInstallation.getReference())); globalAntConfiguration.addConfiguration(antInstallation); }
RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCustomAnt, ComboboxWithBrowseButton ants, final GlobalAntConfiguration antConfiguration) { myAntConfiguration = antConfiguration; myComponents.add(useDefaultAnt); myUseCustomAnt = useCustomAnt; myComponents.add(myUseCustomAnt); myAnts = ants; myUseDefaultAnt = useDefaultAnt; ButtonGroup group = new ButtonGroup(); group.add(useDefaultAnt); group.add(myUseCustomAnt); myUseCustomAnt.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { updateEnableCombobox(); if (myUseCustomAnt.isSelected() && !myLoadingValues) myAnts.getComboBox().requestFocusInWindow(); } }); myAntsController = new ChooseAndEditComboBoxController<AntReference, AntReference>(myAnts, new ConvertingIterator.IdConvertor<AntReference>(), AntReference.COMPARATOR) { public Iterator<AntReference> getAllListItems() { return antConfiguration.getConfiguredAnts().keySet().iterator(); } public AntReference openConfigureDialog(AntReference reference, JComponent parent) { AntSetPanel antSetPanel = new AntSetPanel(); AntInstallation installation = myAntConfiguration.getConfiguredAnts().get(reference); if (installation == null) installation = myAntConfiguration.getConfiguredAnts().get(AntReference.BUNDLED_ANT); antSetPanel.reset(); antSetPanel.setSelection(installation); AntInstallation antInstallation = antSetPanel.showDialog(parent); return antInstallation != null ? antInstallation.getReference() : null; } }; myAntsController.setRenderer(new AntUIUtil.AntReferenceRenderer(myAntConfiguration)); }
public static void customizeReference(AntReference antReference, SimpleColoredComponent component, GlobalAntConfiguration configuration) { AntInstallation antInstallation = antReference.find(configuration); if (antInstallation != null) customizeAnt(antInstallation.getProperties(), component); else { component.setIcon(PlatformIcons.INVALID_ENTRY_ICON); component.append(antReference.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES); } }
public Form(final GlobalAntConfiguration antInstallation) { mySplitter.setShowDividerControls(true); mySplitter.setFirstComponent(myAnts); myGlobalWorkingProperties = new EditPropertyContainer(antInstallation.getProperties()); myRightPanel = new RightPanel(myBinding, myImmediateUpdater); mySplitter.setSecondComponent(myRightPanel.myWholePanel); myAnts.addAddAction(new NewAntFactory(myAnts)); myAnts.addRemoveButtonForAnt(antInstallation.IS_USER_ANT, AntBundle.message("remove.action.name")); myAnts.actionsBuilt(); JList list = myAnts.getList(); list.setCellRenderer(new AntUIUtil.AntInstallationRenderer(this)); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (myCurrent != null) myBinding.apply(getProperties(myCurrent)); myCurrent = myAnts.getSelectedItem(); if (myCurrent == null) { myBinding.loadValues(AbstractProperty.AbstractPropertyContainer.EMPTY); myBinding.beDisabled(); } else { if (antInstallation.IS_USER_ANT.value(myCurrent)) { myBinding.beEnabled(); } else { myBinding.beDisabled(); } myBinding.loadValues(getProperties(myCurrent)); } } }); }
public Form(final GlobalAntConfiguration antInstallation) { mySplitter.setProportion(myAccessors.getFloat("splitter", 0.3f)); mySplitter.setShowDividerControls(true); mySplitter.setFirstComponent(myAnts); myGlobalWorkingProperties = new EditPropertyContainer(antInstallation.getProperties()); myRightPanel = new RightPanel(myBinding, myImmediateUpdater); mySplitter.setSecondComponent(myRightPanel.myWholePanel); myAnts.addAddAction(new NewAntFactory(myAnts)); myAnts.addRemoveButtonForAnt(antInstallation.IS_USER_ANT, AntBundle.message("remove.action.name")); myAnts.actionsBuilt(); JList list = myAnts.getList(); list.setCellRenderer(new AntUIUtil.AntInstallationRenderer(this)); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (myCurrent != null) myBinding.apply(getProperties(myCurrent)); myCurrent = myAnts.getSelectedItem(); if (myCurrent == null) { myBinding.loadValues(AbstractProperty.AbstractPropertyContainer.EMPTY); myBinding.beDisabled(); } else { if (antInstallation.IS_USER_ANT.value(myCurrent)) { myBinding.beEnabled(); } else { myBinding.beDisabled(); } myBinding.loadValues(getProperties(myCurrent)); } } }); }
private void expandProperty(DataContext dataContext, BuildFileProperty property) throws Macro.ExecutionCancelledException { String value = property.getPropertyValue(); final MacroManager macroManager = GlobalAntConfiguration.getMacroManager(); value = macroManager.expandMacrosInString(value, true, dataContext); value = macroManager.expandMacrosInString(value, false, dataContext); myExpandedProperties.add("-D" + property.getPropertyName() + "=" + value); }
public FiltersTab() { myFiltersTable.getTableHeader().setReorderingAllowed(false); UIPropertyBinding.TableListBinding tableListBinding = getBinding().bindList(myFiltersTable, COLUMNS, AntBuildFileImpl.TARGET_FILTERS); tableListBinding.setColumnWidths(GlobalAntConfiguration.FILTERS_TABLE_LAYOUT); tableListBinding.setSortable(true); }
public ExecutionTab(final GlobalAntConfiguration antConfiguration, @NotNull final Project project) { myAntGlobalConfiguration = antConfiguration; myAntCommandLine.attachLabel(myAntCmdLineLabel); myAntCommandLine.setDialogCaption(AntBundle.message("run.execution.tab.ant.command.line.dialog.title")); setLabelFor(myJDKLabel, myJDKs); myJDKsController = new ChooseAndEditComboBoxController<Sdk, String>(myJDKs, new Convertor<Sdk, String>() { @Override public String convert(Sdk jdk) { return jdk != null ? jdk.getName() : ""; } }, String.CASE_INSENSITIVE_ORDER) { @Override public Iterator<Sdk> getAllListItems() { List<Sdk> sdksOfType = SdkTable.getInstance().getSdksOfType(JavaSdk.getInstance()); List<Sdk> controller = new ArrayList<Sdk>(sdksOfType); controller.add(0, null); return controller.iterator(); } @Override public Sdk openConfigureDialog(Sdk jdk, JComponent parent) { SingleSdkEditor editor = new SingleSdkEditor(jdk, myJDKs.getComboBox()); editor.show(); return editor.getSelectedSdk(); } }; UIPropertyBinding.Composite binding = getBinding(); binding.bindString(myAntCommandLine.getTextField(), AntBuildFileImpl.ANT_COMMAND_LINE_PARAMETERS); binding.bindString(myJDKs.getComboBox(), AntBuildFileImpl.CUSTOM_JDK_NAME); binding.addBinding(new RunWithAntBinding(myUseDefaultAnt, myUseCastomAnt, myAnts, myAntGlobalConfiguration)); }
public static void customizeReference(AntReference antReference, SimpleColoredComponent component, GlobalAntConfiguration configuration) { Sdk antInstallation = antReference.find(configuration); if(antInstallation != null) { customizeAnt(antInstallation, component); } else { component.setIcon(PlatformIcons.INVALID_ENTRY_ICON); component.append(antReference.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES); } }
@Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { String jdkName = (String) value; if(jdkName == null || jdkName.length() == 0) { jdkName = ""; } Sdk jdk = GlobalAntConfiguration.findJdk(jdkName); if(jdk == null) { if(myAutoSelectSdkName.length() > 0) { setIcon(AllIcons.General.Jdk); append("Auto-Selected: " + myAutoSelectSdkName, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); } else { setIcon(PlatformIcons.INVALID_ENTRY_ICON); append("Sdk not set", SimpleTextAttributes.ERROR_ATTRIBUTES); } } else { OrderEntryAppearanceService.getInstance().forSdk(jdk, myInComboBox, selected, true).customize(this); } }
public AntBuildTarget getTarget() { return GlobalAntConfiguration.getInstance().findTarget(getProject(), mySettings.myFileUrl, mySettings.myTargetName); }
public RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCastomAnt, ComboboxWithBrowseButton ants) { this(useDefaultAnt, useCastomAnt, ants, GlobalAntConfiguration.getInstance()); }
public AntReferenceRenderer(GlobalAntConfiguration configuration) { myConfiguration = configuration; }
public AntSetPanel() { this(GlobalAntConfiguration.getInstance()); }
AntSetPanel(GlobalAntConfiguration antConfiguration) { myAntConfiguration = antConfiguration; myForm = new Form(antConfiguration); }
RunWithAntBinding(JRadioButton useDefaultAnt, JRadioButton useCustomAnt, ComboboxWithBrowseButton ants, final GlobalAntConfiguration antConfiguration) { myAntConfiguration = antConfiguration; myComponents.add(useDefaultAnt); myUseCustomAnt = useCustomAnt; myComponents.add(myUseCustomAnt); myAnts = ants; myUseDefaultAnt = useDefaultAnt; ButtonGroup group = new ButtonGroup(); group.add(useDefaultAnt); group.add(myUseCustomAnt); myUseCustomAnt.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateEnableCombobox(); if(myUseCustomAnt.isSelected() && !myLoadingValues) { myAnts.getComboBox().requestFocusInWindow(); } } }); myAntsController = new ChooseAndEditComboBoxController<AntReference, AntReference>(myAnts, new ConvertingIterator.IdConvertor<AntReference> (), AntReference.COMPARATOR) { @Override public Iterator<AntReference> getAllListItems() { return antConfiguration.getConfiguredAnts().keySet().iterator(); } @Override public AntReference openConfigureDialog(AntReference reference, JComponent parent) { Sdk sdk = myAntConfiguration.getConfiguredAnts().get(reference); SingleSdkEditor editor = new SingleSdkEditor(sdk, parent); editor.show(); Sdk selectedSdk = editor.getSelectedSdk(); if(selectedSdk != null) { if(selectedSdk.isPredefined()) { return AntReference.BUNDLED_ANT; } return new AntReference.BindedReference(sdk); } else { return AntReference.BUNDLED_ANT; } } }; myAntsController.setRenderer(new AntUIUtil.AntReferenceRenderer(myAntConfiguration)); }
public PropertiesTab() { myPropertiesTable = new JBTable(); UIPropertyBinding.TableListBinding<BuildFileProperty> tableListBinding = getBinding().bindList(myPropertiesTable, PROPERTY_COLUMNS, AntBuildFileImpl.ANT_PROPERTIES); tableListBinding.setColumnWidths(GlobalAntConfiguration.PROPERTIES_TABLE_LAYOUT); myWholePanel = ToolbarDecorator.createDecorator(myPropertiesTable).setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { if(myPropertiesTable.isEditing() && !myPropertiesTable.getCellEditor().stopCellEditing()) { return; } BuildFileProperty item = new BuildFileProperty(); ListTableModel<BuildFileProperty> model = (ListTableModel<BuildFileProperty>) myPropertiesTable.getModel(); ArrayList<BuildFileProperty> items = new ArrayList<BuildFileProperty>(model.getItems()); items.add(item); model.setItems(items); int newIndex = model.indexOf(item); ListSelectionModel selectionModel = myPropertiesTable.getSelectionModel(); selectionModel.clearSelection(); selectionModel.setSelectionInterval(newIndex, newIndex); ColumnInfo[] columns = model.getColumnInfos(); for(int i = 0; i < columns.length; i++) { ColumnInfo column = columns[i]; if(column.isCellEditable(item)) { myPropertiesTable.requestFocusInWindow(); myPropertiesTable.editCellAt(newIndex, i); break; } } } }).disableUpDownActions().createPanel(); myWholePanel.setBorder(null); }