private AntBuildFileBase registerAntInstallation( final File platformDir, final File extensionDir, final List<String> desiredTargets ) { final AntBuildFileBase antBuildFile = findBuildFile(extensionDir); if (antBuildFile == null) { return null; } final List<TargetFilter> filterList = getFilteredTargets(antBuildFile, desiredTargets); final AbstractProperty.AbstractPropertyContainer allOptions = antBuildFile.getAllOptions(); final EditPropertyContainer editPropertyContainer = new EditPropertyContainer(allOptions); setAntProperties(editPropertyContainer, platformDir, filterList); editPropertyContainer.apply(); return antBuildFile; }
public static boolean canShowRequest(DiffRequest request) { boolean isFile = false; DiffContent[] contents = request.getContents(); for (int i = 0; i < contents.length; i++) { DiffContent content = contents[i]; VirtualFile file = content.getFile(); if (file != null && file.isInLocalFileSystem() && ! file.isDirectory()) { isFile = true; break; } } AbstractProperty.AbstractPropertyContainer config = DiffManagerImpl.getInstanceEx().getProperties(); if (isFile && DiffManagerImpl.ENABLE_FILES.value(config)) return false; if (! isFile && DiffManagerImpl.ENABLE_FOLDERS.value(config)) return false; return ! (DiffViewerType.merge.equals(request.getType()) && contentsWriteable(request)); }
public static void addPropertyListener(final AbstractProperty<Boolean> property, final TestFrameworkPropertyListener<Boolean> propertyListener, final TestFrameworkRunningModel model, final boolean sendValue) { final TestConsoleProperties properties = model.getProperties(); if (sendValue) { properties.addListenerAndSendValue(property, propertyListener); } else { properties.addListener(property, propertyListener); } Disposer.register(model, new Disposable() { public void dispose() { properties.removeListener(property, propertyListener); } }); }
public void loadValues(AbstractProperty.AbstractPropertyContainer container) { if (myColumnWidthProperty != null) { BaseTableView.restoreWidth(myColumnWidthProperty.get(container), getComponent().getColumnModel()); } myModel.setItems(myProperty.getModifiableList(container)); if (myModel.isSortable()) { final ColumnInfo[] columnInfos = myModel.getColumnInfos(); int sortByColumn = -1; for (int idx = 0; idx < columnInfos.length; idx++) { ColumnInfo columnInfo = columnInfos[idx]; if (columnInfo.isSortable()) { sortByColumn = idx; break; } } } TableUtil.ensureSelectionExists(getComponent()); }
@Override public List<File> get(AbstractProperty.AbstractPropertyContainer container) { List<File> classpath = new ArrayList<File>(); collectClasspath(classpath, ADDITIONAL_CLASSPATH, container); Sdk antInstallation = ANT_INSTALLATION.get(container); if(antInstallation != null) { VirtualFile[] virtualFiles = antInstallation.getRootProvider().getFiles(BinariesOrderRootType.getInstance()); for(VirtualFile virtualFile : virtualFiles) { VirtualFile localFile = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile); if(localFile != null) { classpath.add(VfsUtil.virtualToIoFile(localFile)); } } } return classpath; }
public <T> void addListener(@NotNull AbstractProperty<T> property, @NotNull TestFrameworkPropertyListener<T> listener) { List<TestFrameworkPropertyListener> listeners = myListeners.get(property); if (listeners == null) { myListeners.put(property, (listeners = ContainerUtil.newArrayList())); } listeners.add(listener); }
@Override protected <T> void onPropertyChanged(@NotNull AbstractProperty<T> property, T value) { List<TestFrameworkPropertyListener> listeners = myListeners.get(property); if (listeners != null) { for (Object o : listeners.toArray()) { @SuppressWarnings("unchecked") TestFrameworkPropertyListener<T> listener = (TestFrameworkPropertyListener<T>)o; listener.onChanged(value); } } }
@Override protected Object getValueOf(@NotNull AbstractProperty<Boolean> property) { Object value = myValues.get(property); if (value == null) { String stringValue = myStorage.get(property.getName()); value = stringValue != null ? Boolean.valueOf(stringValue) : property.getDefault(this); myValues.put(property, (Boolean)value); } return value; }
@Nullable private String getReportFilePath() { final AbstractProperty.AbstractPropertyContainer properties = getProperties(); if (properties instanceof GradleConsoleProperties) { GradleConsoleProperties gradleConsoleProperties = (GradleConsoleProperties)properties; final File testReport = gradleConsoleProperties.getGradleTestReport(); if (testReport != null && testReport.isFile()) return testReport.getPath(); } return null; }
private AbstractProperty.AbstractPropertyContainer containerOf(AbstractProperty property) { for (AbstractProperty.AbstractPropertyContainer container : myContainers) { if (container.hasProperty(property)) return container; } if (ApplicationManager.getApplication() != null) LOG.error("Unknown property: " + property.getName()); return new ExternalizablePropertyContainer(); }
@Nullable public static AntInstallation findAnt(AbstractProperty<AntReference> property, AbstractProperty.AbstractPropertyContainer container) { GlobalAntConfiguration antConfiguration = GlobalAntConfiguration.INSTANCE.get(container); LOG.assertTrue(antConfiguration != null); AntReference antReference = property.get(container); if (antReference == PROJECT_DEFAULT) { antReference = AntConfigurationImpl.DEFAULT_ANT.get(container); } if (antReference == null) return null; return antReference.find(antConfiguration); }
public static AntInstallation findNotNullAnt(AbstractProperty<AntReference> property, AbstractProperty.AbstractPropertyContainer container, GlobalAntConfiguration antConfiguration) throws CantRunException { AntReference antReference = property.get(container); if (antReference == PROJECT_DEFAULT) antReference = AntConfigurationImpl.DEFAULT_ANT.get(container); if (antReference == null) throw new CantRunException(AntBundle.message("cant.run.ant.no.ant.configured.error.message")); AntInstallation antInstallation = antReference.find(antConfiguration); if (antInstallation == null) { throw new CantRunException(AntBundle.message("cant.run.ant.ant.reference.is.not.configured.error.message", antReference.getName())); } return antInstallation; }
public void loadValues(AbstractProperty.AbstractPropertyContainer container) { myLoadingValues = true; AntReference antReference = AntBuildFileImpl.ANT_REFERENCE.get(container); boolean isDefault = AntReference.PROJECT_DEFAULT == antReference; myUseDefaultAnt.setSelected(isDefault); myUseCustomAnt.setSelected(!isDefault); AntReference selection = isDefault ? null : antReference; myAntsController.resetList(selection); updateEnableCombobox(); myLoadingValues = false; }
protected Object getValueOf(AbstractProperty property) { if (myModifications.containsKey(property)) return myModifications.get(property); AbstractProperty.AbstractPropertyContainer container = findContainerOf(property); if (container == null) return property.getDefault(this); Object originalValue = delegateGet(container, property); property.copy(originalValue); return originalValue; }
public void apply() { for (AbstractProperty property : myModifications.keySet()) { AbstractProperty.AbstractPropertyContainer container = findContainerOf(property); if (container != null) delegateSet(container, property, myModifications.get(property)); } myModifications.clear(); }
@Nullable private AbstractProperty.AbstractPropertyContainer findContainerOf(AbstractProperty property) { if (myParent.hasProperty(property)) return myParent; for (AbstractProperty.AbstractPropertyContainer original : myOriginals) { if (original.hasProperty(property)) return original; } return null; }
public void reset(AbstractProperty.AbstractPropertyContainer options) { String projectJdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(options); myJDKsController.setRenderer(new AntUIUtil.ProjectJdkRenderer(true, projectJdkName)); super.reset(options); myJDKsController.resetList(null); myProjectDefaultAnt = AntConfigurationImpl.DEFAULT_ANT.get(options); updateDefaultAnt(); }
public AntInstallationRenderer(PropertiesEditor<AntInstallation> editor) { myEditor = editor != null ? editor : new PropertiesEditor<AntInstallation>(){ public AbstractProperty.AbstractPropertyContainer getProperties(AntInstallation antInstallation) { return antInstallation.getProperties(); } }; }
public static void customizeAnt(AbstractProperty.AbstractPropertyContainer antProperties, SimpleColoredComponent component) { component.setIcon(AntIcons.AntInstallation); String name = AntInstallation.NAME.get(antProperties); component.append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES); String versionString = AntInstallation.VERSION.get(antProperties); if (name.indexOf(versionString) == -1) component.append(" (" + versionString + ")", SimpleTextAttributes.SYNTHETIC_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 void applyModifications() { if (myCurrent != null) myBinding.apply(getProperties(myCurrent)); ArrayList<AbstractProperty> properties = new ArrayList<AbstractProperty>(); myBinding.addAllPropertiesTo(properties); for (AntInstallation ant : myWorkingProperties.keySet()) { EditPropertyContainer container = myWorkingProperties.get(ant); container.apply(); } myGlobalWorkingProperties.apply(); }
public void apply(AbstractProperty.AbstractPropertyContainer container) { int value; try { value = Integer.parseInt(getComponent().getText()); } catch (NumberFormatException e) { return; } // TODO[dyoma] report error getProperty().set(container, value); }
public void apply(AbstractProperty.AbstractPropertyContainer container) { ListModel model = myList.getModel(); ArrayList<Item> list = new ArrayList<Item>(); for (int i = 0; i < model.getSize(); i++) { list.add((Item)model.getElementAt(i)); } myProperty.set(container, list); }
public void loadValues(AbstractProperty.AbstractPropertyContainer container) { DefaultListModel model = getModel(); model.clear(); Iterator iterator = getProperty().getIterator(container); while (iterator.hasNext()) { Object item = iterator.next(); model.addElement(item); } ScrollingUtil.ensureSelectionExists(getList()); }
public <T> void addListener(final AbstractProperty<T> property, final TestFrameworkPropertyListener<T> listener) { ArrayList<TestFrameworkPropertyListener> listeners = myListeners.get(property); if (listeners == null) { listeners = new ArrayList<TestFrameworkPropertyListener>(); myListeners.put(property, listeners); } listeners.add(listener); }
protected <T> void onPropertyChanged(final AbstractProperty<T> property, final T value) { final ArrayList<TestFrameworkPropertyListener> listeners = myListeners.get(property); if (listeners == null) return; final Object[] propertyListeners = listeners.toArray(); for (Object propertyListener : propertyListeners) { final TestFrameworkPropertyListener<T> listener = (TestFrameworkPropertyListener<T>)propertyListener; listener.onChanged(value); } }
@Override protected Object getValueOf(final AbstractProperty<Boolean> property) { Object value = myValues.get(property); if (value == null) { final String stringValue = myStorage.get(property.getName()); value = stringValue != null ? parseValue(stringValue) : property.getDefault(this); myValues.put(property, (Boolean)value); } return value; }