@NotNull public final ClassLoader getClassLoader() { ClassLoader loader = myClassLoader; if (loader == null) { final XmlTag tag = getXmlTag(); final PsiFile containingFile = tag.getContainingFile(); final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile); if (buildFile != null) { loader = buildFile.getClassLoader(); } else { AntInstallation antInstallation = getAntInstallation(); loader = antInstallation.getClassLoader(); } myClassLoader = loader; } return loader; }
@Nullable public final Sdk getTargetJdk() { final XmlTag tag = getXmlTag(); final PsiFile containingFile = tag.getContainingFile(); final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile); if (buildFile != null) { String jdkName = AntBuildFileImpl.CUSTOM_JDK_NAME.get(buildFile.getAllOptions()); if (jdkName == null || jdkName.length() == 0) { jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(buildFile.getAllOptions()); } if (jdkName != null && jdkName.length() > 0) { return ProjectJdkTable.getInstance().findJdk(jdkName); } } return ProjectRootManager.getInstance(tag.getProject()).getProjectSdk(); }
private Map<String, String> getProperties() { Map<String, String> properties = myProperties; if (properties == null) { final ReflectedProject reflected = ReflectedProject.getProject(getClassLoader()); Map<String, String> externals = Collections.emptyMap(); final PsiFile containingFile = getXmlTag().getContainingFile(); if (containingFile != null) { final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile); if (buildFile != null) { externals = buildFile.getExternalProperties(); } } myProperties = (properties = loadPredefinedProperties(reflected.getProperties(), externals)); } return properties; }
private AntBuildMessageView(Project project, AntBuildFileBase buildFile, String[] targets) { super(new BorderLayout(2, 0)); myProject = project; myBuildFile = buildFile; myTargets = targets; setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); myPlainTextView = new PlainTextView(project); myTreeView = new TreeView(project, buildFile); myCardLayout = new CardLayout(); myContentPanel = new JPanel(myCardLayout); myContentPanel.add(myTreeView.getComponent(), myTreeView.getId()); myContentPanel.add(myPlainTextView.getComponent(), myPlainTextView.getId()); myMessagePanel = JBUI.Panels.simplePanel(myContentPanel); setVerboseMode(AntBuildFileImpl.VERBOSE.value(buildFile.getAllOptions())); add(createToolbarPanel(), BorderLayout.WEST); add(myMessagePanel, BorderLayout.CENTER); showAntView(AntBuildFileImpl.TREE_VIEW.value(buildFile.getAllOptions())); }
private AntBuildMessageView(Project project, AntBuildFileBase buildFile, String[] targets) { super(new BorderLayout(2, 0)); myProject = project; setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); myPlainTextView = new PlainTextView(project); myTreeView = new TreeView(project, buildFile); myMessagePanel = new JPanel(new BorderLayout()); myBuildFile = buildFile; myTargets = targets; showAntView(AntBuildFileImpl.TREE_VIEW.value(buildFile.getAllOptions())); setVerboseMode(AntBuildFileImpl.VERBOSE.value(buildFile.getAllOptions())); add(createToolbarPanel(), BorderLayout.WEST); add(myMessagePanel, BorderLayout.CENTER); }
@NotNull public final ClassLoader getClassLoader() { ClassLoader loader = myClassLoader; if (loader == null) { final XmlTag tag = getXmlTag(); final PsiFile containingFile = tag.getContainingFile(); final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile); if (buildFile != null) { loader = buildFile.getClassLoader(); } else { Sdk antInstallation = getAntInstallation(); loader = AntSdkClassLoaderUtil.getClassLoader(antInstallation); } myClassLoader = loader; } return loader; }
@Nullable public final Sdk getTargetJdk() { final XmlTag tag = getXmlTag(); final PsiFile containingFile = tag.getContainingFile(); final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile); if (buildFile != null) { String jdkName = AntBuildFileImpl.CUSTOM_JDK_NAME.get(buildFile.getAllOptions()); if (jdkName == null || jdkName.length() == 0) { jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(buildFile.getAllOptions()); } if (jdkName != null && jdkName.length() > 0) { return SdkTable.getInstance().findSdk(jdkName); } } return AntJavaSdkUtil.getBundleSdk(); }
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()); } }
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; }
@Override 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; }
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)); }
private void setAntProperties( final EditPropertyContainer editPropertyContainer, final File platformDir, final List<TargetFilter> filterList ) { AntBuildFileImpl.ADDITIONAL_CLASSPATH.set(editPropertyContainer, classPaths); AntBuildFileImpl.TREE_VIEW.set(editPropertyContainer, true); AntBuildFileImpl.TREE_VIEW_ANSI_COLOR.set(editPropertyContainer, true); AntBuildFileImpl.TREE_VIEW_COLLAPSE_TARGETS.set(editPropertyContainer, false); AntBuildFileImpl.ANT_INSTALLATION.set(editPropertyContainer, antInstallation); AntBuildFileImpl.ANT_REFERENCE.set(editPropertyContainer, antInstallation.getReference()); AntBuildFileImpl.RUN_WITH_ANT.set(editPropertyContainer, antInstallation); AntBuildFileImpl.MAX_HEAP_SIZE.set(editPropertyContainer, HybrisConstants.ANT_HEAP_SIZE_MB); AntBuildFileImpl.MAX_STACK_SIZE.set(editPropertyContainer, HybrisConstants.ANT_STACK_SIZE_MB); AntBuildFileImpl.RUN_IN_BACKGROUND.set(editPropertyContainer, false); AntBuildFileImpl.VERBOSE.set(editPropertyContainer, false); final ListProperty<BuildFileProperty> properties = AntBuildFileImpl.ANT_PROPERTIES; properties.clearList(editPropertyContainer); final BuildFileProperty platformHomeProperty = new BuildFileProperty(); platformHomeProperty.setPropertyName(HybrisConstants.ANT_PLATFORM_HOME); platformHomeProperty.setPropertyValue(platformDir.getAbsolutePath()); final BuildFileProperty antHomeProperty = new BuildFileProperty(); antHomeProperty.setPropertyName(HybrisConstants.ANT_HOME); antHomeProperty.setPropertyValue(antInstallation.getHomeDir()); final BuildFileProperty antOptsProperty = new BuildFileProperty(); antOptsProperty.setPropertyName(HybrisConstants.ANT_OPTS); antOptsProperty.setPropertyValue(HybrisConstants.ANT_XMX + HybrisConstants.ANT_HEAP_SIZE_MB + " " + HybrisConstants.ANT_ENCODING); final List<BuildFileProperty> buildFileProperties = new ArrayList<>(); buildFileProperties.add(platformHomeProperty); buildFileProperties.add(antHomeProperty); buildFileProperties.add(antOptsProperty); AntBuildFileImpl.ANT_PROPERTIES.set(editPropertyContainer, buildFileProperties); if (hybrisProjectDescriptor.getExternalConfigDirectory() != null) { AntBuildFileImpl.ANT_COMMAND_LINE_PARAMETERS.set(editPropertyContainer, HybrisConstants.ANT_HYBRIS_CONFIG_DIR + hybrisProjectDescriptor.getExternalConfigDirectory().getAbsolutePath()); } AntBuildFileImpl.TARGET_FILTERS.set(editPropertyContainer, filterList); }
public void addAllPropertiesTo(Collection<AbstractProperty> properties) { properties.add(AntBuildFileImpl.ANT_REFERENCE); }
public void apply(AbstractProperty.AbstractPropertyContainer container) { AntReference antReference = myUseDefaultAnt.isSelected() ? AntReference.PROJECT_DEFAULT : myAntsController.getSelectedItem(); AntBuildFileImpl.ANT_REFERENCE.set(container, antReference); }
@Override public void addAllPropertiesTo(Collection<AbstractProperty> properties) { properties.add(AntBuildFileImpl.ANT_REFERENCE); }
@Override public void apply(AbstractProperty.AbstractPropertyContainer container) { AntReference antReference = myUseDefaultAnt.isSelected() ? AntReference.PROJECT_DEFAULT : myAntsController.getSelectedItem(); AntBuildFileImpl.ANT_REFERENCE.set(container, antReference); }
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); }
public AdditionalClasspathTab() { getBinding().addBinding(myClasspath.setClasspathProperty(AntBuildFileImpl.ADDITIONAL_CLASSPATH)); }