Skip to content

Commit

Permalink
Merge branch 'endgame-july'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flanker32 committed Jul 30, 2021
2 parents 3b30e6d + 48853aa commit f84e65d
Show file tree
Hide file tree
Showing 331 changed files with 6,479 additions and 8,503 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
All notable changes to "Azure Toolkit for IntelliJ IDEA" will be documented in this file.

- [Change Log](#change-log)
- [3.55.0](#3550)
- [3.54.0](#3540)
- [3.53.0](#3530)
- [3.52.0](#3520)
Expand Down Expand Up @@ -69,6 +70,31 @@ All notable changes to "Azure Toolkit for IntelliJ IDEA" will be documented in t
- [3.0.7](#307)
- [3.0.6](#306)

## 3.55.0
### Added
- New Azure Resource Connector explorer for connection management
- List all resource connections connected to project
- Create new connections between Azure resources and module in project
- Edit/Delete existing connections
- Navigate to resource properties view of an existing connection
- Support native proxy settings in IntelliJ
- Add unified `Open In Portal` support for Web App/VM/Resource Group in Azure explorer

### Changed
- Enhance toolkit setting panel with more configuration
- Enhance resource loading performance in Azure explorer
- Support turn off Azure SDK deprecation notification
- Support create Azure Spring Cloud app in Azure explorer
- Update Azure icons to new style

### Fixed
- [#5439](https://github.com/microsoft/azure-tools-for-java/issues/5439) Fix project already disposed excpetion while loading azure sdk reference book meta data
- [PR#5437](https://github.com/microsoft/azure-tools-for-java/pull/5437) Fix exception while edit json in service principal dialog
- [PR#5476](https://github.com/microsoft/azure-tools-for-java/pull/5476) Fix url render issue for toolkit notification
- [PR#5535](https://github.com/microsoft/azure-tools-for-java/pull/5535) Fix evaluate effective pom will break app service/spring cloud deployment
- [PR#5563](https://github.com/microsoft/azure-tools-for-java/pull/5563) Fix exception: type HTTP is not compatible with address null
- [PR#5579](https://github.com/microsoft/azure-tools-for-java/pull/5579) Fix reporting error in azure explorer before sign in

## 3.54.0
### Added
- User would be reminded if deprecated Azure SDK libs are used in project.
Expand Down
4 changes: 2 additions & 2 deletions PluginsAndFeatures/AddLibrary/AzureLibraries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>com.microsoft.azuretools</groupId>
<artifactId>utils</artifactId>
<version>3.54.0</version>
<version>3.55.0</version>
</parent>
<groupId>com.microsoft.azuretools</groupId>
<artifactId>com.microsoft.azuretools.sdk.lib</artifactId>
Expand All @@ -38,7 +38,7 @@
<organization><name>Microsoft Corp.</name></organization>

<properties>
<azuretool.version>3.54.0</azuretool.version>
<azuretool.version>3.55.0</azuretool.version>
<azuretool.sdk.version>3.25.0.qualifier</azuretool.sdk.version>
</properties>
<dependencies>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
import com.intellij.ui.components.fields.ExtendableTextField;
import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager;
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
import com.microsoft.azure.toolkit.lib.common.utils.TailingDebouncer;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import rx.Observable;
import rx.schedulers.Schedulers;

import javax.accessibility.AccessibleRelation;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.swing.*;
Expand Down Expand Up @@ -56,10 +55,7 @@ public abstract class AzureComboBox<T> extends ComboBox<T> implements AzureFormI
private boolean required;
private Object value;
private boolean valueNotSet = true;
private String label;
@Nullable
@Setter
protected Boolean valueFixed;
protected boolean enabled = true;
@Getter
@Setter
private Supplier<? extends List<? extends T>> itemsLoader;
Expand All @@ -73,7 +69,7 @@ public AzureComboBox(boolean refresh) {
this.init();
this.refresher = new TailingDebouncer(this::doRefreshItems, DEBOUNCE_DELAY);
if (refresh) {
AzureTaskManager.getInstance().runLater(this::refreshItems, AzureTask.Modality.ANY);
this.refreshItems();
}
}

Expand Down Expand Up @@ -108,8 +104,7 @@ public void customize(@Nonnull final JList<? extends T> l, final T t, final int
this.addPopupMenuListener(new AzureComboBoxPopupMenuListener());
}
final TailingDebouncer valueDebouncer = new TailingDebouncer(() -> {
@SuppressWarnings("unchecked")
final ValueListener<T>[] listeners = this.listenerList.getListeners(ValueListener.class);
@SuppressWarnings("unchecked") final ValueListener<T>[] listeners = this.listenerList.getListeners(ValueListener.class);
for (final ValueListener<T> listener : listeners) {
listener.onValueChanged(this.getValue());
}
Expand All @@ -118,9 +113,6 @@ public void customize(@Nonnull final JList<? extends T> l, final T t, final int
if (e.getStateChange() == ItemEvent.SELECTED) {
this.refreshValue();
}
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
valueDebouncer.debounce();
}
});
}

Expand All @@ -136,7 +128,7 @@ public void setValue(final T val) {

public void setValue(final T val, final Boolean fixed) {
Optional.ofNullable(fixed).ifPresent(f -> {
this.valueFixed = fixed;
this.setEnabled(!fixed);
this.setEditable(!f);
});
this.valueNotSet = false;
Expand All @@ -150,7 +142,7 @@ public void setValue(final ItemReference<T> val) {

public void setValue(final ItemReference<T> val, final Boolean fixed) {
Optional.ofNullable(fixed).ifPresent(f -> {
this.valueFixed = fixed;
this.setEnabled(!fixed);
this.setEditable(!f);
});
this.valueNotSet = false;
Expand All @@ -159,23 +151,27 @@ public void setValue(final ItemReference<T> val, final Boolean fixed) {
}

private void refreshValue() {
if (Objects.equals(this.value, this.getSelectedItem())) {
return;
}
final List<T> items = this.getItems();
if (!this.valueNotSet && this.value instanceof AzureComboBox.ItemReference) {
items.stream().filter(i -> ((ItemReference<?>) this.value).is(i)).findFirst().ifPresent(this::setValue);
}
if (this.valueNotSet && this.value == null && !items.isEmpty()) {
super.setSelectedItem(items.get(0));
} else if (items.contains(this.value)) {
super.setSelectedItem(this.value);
} else if (value instanceof Draft) {
// todo: unify model for custom created resource
super.addItem((T) value);
super.setSelectedItem(value);
if (this.valueNotSet) {
if (this.getItemCount() > 0 && this.getSelectedIndex() != 0) {
super.setSelectedIndex(0);
}
} else {
super.setSelectedItem(null);
final Object selected = this.getSelectedItem();
if (Objects.equals(selected, this.value) || (this.value instanceof ItemReference && ((ItemReference<?>) this.value).is(selected))) {
return;
}
final List<T> items = this.getItems();
if (this.value instanceof AzureComboBox.ItemReference) {
items.stream().filter(i -> ((ItemReference<?>) this.value).is(i)).findFirst().ifPresent(this::setValue);
} else if (this.value instanceof Draft) {
// todo: unify model for custom created resource
super.addItem((T) this.value);
super.setSelectedItem(this.value);
} else if (items.contains(this.value)) {
super.setSelectedItem(this.value);
} else {
super.setSelectedItem(null);
}
}
}

Expand All @@ -189,16 +185,16 @@ public void refreshItems() {
}

@AzureOperation(
name = "common|combobox.load_items",
params = {"this.label()"},
type = AzureOperation.Type.ACTION
name = "common|combobox.load_items",
params = {"this.getLabel()"},
type = AzureOperation.Type.ACTION
)
private void doRefreshItems() {
try {
this.setLoading(true);
final List<? extends T> items = this.loadItemsInner();
this.setLoading(false);
AzureTaskManager.getInstance().runLater(() -> this.setItems(items), AzureTask.Modality.ANY);
this.setItems(items);
} catch (final Exception e) {
final Throwable rootCause = ExceptionUtils.getRootCause(e);
if (rootCause instanceof InterruptedIOException || rootCause instanceof InterruptedException) {
Expand All @@ -217,26 +213,45 @@ public List<T> getItems() {
return result;
}

protected void setItems(final List<? extends T> items) {
this.removeAllItems();
items.forEach(super::addItem);
this.refreshValue();
protected synchronized void setItems(final List<? extends T> items) {
SwingUtilities.invokeLater(() -> {
final DefaultComboBoxModel<T> model = (DefaultComboBoxModel<T>) this.getModel();
model.removeAllElements();
model.addAll(items);
this.refreshValue();
});
}

public void clear() {
this.setItems(Collections.emptyList());
this.value = null;
this.valueNotSet = true;
final DefaultComboBoxModel<T> model = (DefaultComboBoxModel<T>) this.getModel();
model.removeAllElements();
this.refreshValue();
}

protected void setLoading(final boolean loading) {
AzureTaskManager.getInstance().runLater(() -> {
SwingUtilities.invokeLater(() -> {
if (loading) {
this.setEnabled(false);
super.setEnabled(false);
this.setEditor(this.loadingSpinner);
} else {
this.setEnabled(!Objects.equals(valueFixed, true));
super.setEnabled(this.enabled);
this.setEditor(this.inputEditor);
}
}, AzureTask.Modality.ANY);
this.repaint();
});
}

@Override
public void setEnabled(boolean b) {
this.enabled = b;
super.setEnabled(b);
}

@Override
public boolean isEnabled() {
return this.enabled || super.isEnabled();
}

protected String getItemText(Object item) {
Expand Down Expand Up @@ -324,10 +339,10 @@ protected JTextField createEditorComponent() {
protected ExtendableTextComponent.Extension getExtension() {
final ExtendableTextComponent.Extension extension = AzureComboBox.this.getExtension();
return extension == null ? null : ExtendableTextComponent.Extension.create(
extension.getIcon(true), extension.getTooltip(), () -> {
AzureComboBox.this.hidePopup();
extension.getActionOnClick().run();
});
extension.getIcon(true), extension.getTooltip(), () -> {
AzureComboBox.this.hidePopup();
extension.getActionOnClick().run();
});
}
}

Expand All @@ -344,7 +359,7 @@ public void setItem(Object item) {

protected ExtendableTextComponent.Extension getExtension() {
return ExtendableTextComponent.Extension.create(
new AnimatedIcon.Default(), null, null);
new AnimatedIcon.Default(), null, null);
}
}

Expand All @@ -359,7 +374,7 @@ public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
itemList = AzureComboBox.this.getItems();
// todo: support customized combo box filter
comboFilterListener = new ComboFilterListener(itemList,
(item, input) -> StringUtils.containsIgnoreCase(getItemText(item), input));
(item, input) -> StringUtils.containsIgnoreCase(getItemText(item), input));
getEditorComponent().getDocument().addDocumentListener(comboFilterListener);
}

Expand Down Expand Up @@ -397,28 +412,23 @@ public ComboFilterListener(List<? extends T> list, BiPredicate<? super T, ? supe

@Override
protected void textChanged(@Nonnull final DocumentEvent documentEvent) {
AzureTaskManager.getInstance().runLater(() -> {
SwingUtilities.invokeLater(() -> {
try {
final String text = documentEvent.getDocument().getText(0, documentEvent.getDocument().getLength());
list.stream().filter(item -> filter.test(item, text) && !getItems().contains(item)).forEach(AzureComboBox.this::addItem);
getItems().stream().filter(item -> !filter.test(item, text)).forEach(AzureComboBox.this::removeItem);
} catch (BadLocationException e) {
// swallow exception and show all items
}
}, AzureTask.Modality.ANY);
});
}
}

public void setLabel(final String label) {
this.label = label;
}

public String getLabel() {
return Optional.ofNullable(this.label).orElse("");
}

private String label() {
return Optional.ofNullable(this.label).orElse(this.getClass().getSimpleName());
final JLabel label = (JLabel) this.getClientProperty(AccessibleRelation.LABELED_BY);
return Optional.ofNullable(label).map(JLabel::getText)
.map(t -> t.endsWith(":") ? t.substring(0, t.length() - 1) : t)
.orElse(this.getClass().getSimpleName());
}

public static class ItemReference<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.microsoft.azure.toolkit.lib.common.form.AzureForm;
import com.microsoft.azure.toolkit.lib.common.form.AzureFormInput;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

Expand All @@ -24,7 +25,8 @@ default T getData() {

@Override
default List<AzureFormInput<?>> getInputs() {
return Collections.emptyList();
Collections.emptyList().addAll(new ArrayList<>());
return new ArrayList<>();
}

// CHECKSTYLE IGNORE check FOR NEXT 1 LINES
Expand Down
Loading

0 comments on commit f84e65d

Please sign in to comment.