use of com.microsoft.azuretools.ijidea.actions.SelectSubscriptionsAction in project azure-tools-for-java by Microsoft.
the class ServerExplorerToolWindowFactory method addToolbarItems.
private void addToolbarItems(ToolWindow toolWindow, final AzureModule azureModule) {
if (toolWindow instanceof ToolWindowEx) {
ToolWindowEx toolWindowEx = (ToolWindowEx) toolWindow;
try {
Runnable forceRefreshTitleActions = () -> {
try {
toolWindowEx.setTitleActions(new AnAction("Refresh", "Refresh Azure Nodes List", null) {
@Override
public void actionPerformed(AnActionEvent event) {
azureModule.load(true);
}
@Override
public void update(AnActionEvent e) {
boolean isDarkTheme = DefaultLoader.getUIHelper().isDarkTheme();
e.getPresentation().setIcon(UIHelperImpl.loadIcon(isDarkTheme ? RefreshableNode.REFRESH_ICON_DARK : RefreshableNode.REFRESH_ICON_LIGHT));
}
}, new AzureSignInAction(), new SelectSubscriptionsAction());
} catch (Exception e) {
AzurePlugin.log(e.getMessage(), e);
}
};
AuthMethodManager.getInstance().addSignInEventListener(forceRefreshTitleActions);
AuthMethodManager.getInstance().addSignOutEventListener(forceRefreshTitleActions);
forceRefreshTitleActions.run();
} catch (Exception e) {
AzurePlugin.log(e.getMessage(), e);
}
}
}
Aggregations