Search in sources :

Example 31 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project intellij-community by JetBrains.

the class StatusBarUpdater method updateStatus.

private void updateStatus() {
    Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
    if (editor == null || !editor.getContentComponent().hasFocus()) {
        return;
    }
    final Document document = editor.getDocument();
    if (document instanceof DocumentEx && ((DocumentEx) document).isInBulkUpdate())
        return;
    int offset = editor.getCaretModel().getOffset();
    DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
    HighlightInfo info = ((DaemonCodeAnalyzerImpl) codeAnalyzer).findHighlightByOffset(document, offset, false, MIN);
    String text = info != null && info.getDescription() != null ? info.getDescription() : "";
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject);
    if (statusBar != null && !text.equals(statusBar.getInfo())) {
        statusBar.setInfo(text, "updater");
    }
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) Editor(com.intellij.openapi.editor.Editor) Document(com.intellij.openapi.editor.Document) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 32 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project intellij-idea-plugin-connector-for-aws-lambda by satr.

the class MessageHelper method showMessage.

private static void showMessage(final Project project, final MessageType messageType, final String format, final Object[] args) {
    StatusBar statusBar = windowManager.getStatusBar(project);
    if (statusBar == null || statusBar.getComponent() == null || isEmpty(format)) {
        return;
    }
    String message = String.format(format, args);
    jbPopupFactory.createHtmlTextBalloonBuilder(message, messageType, null).setFadeoutTime(7500).createBalloon().show(RelativePoint.getNorthEastOf(statusBar.getComponent()), Balloon.Position.atRight);
    if (messageType == MessageType.INFO) {
        log.info(message);
    } else if (messageType == MessageType.WARNING) {
        log.warn(message);
    } else {
        log.debug(message);
    }
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar)

Example 33 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudSdkServiceManager method openBackgroundProcessWindow.

/**
 * Exposes process window so that installation / dependent processes are explicitly visible.
 */
private void openBackgroundProcessWindow(Project project) {
    WindowManager windowManager = WindowManager.getInstance();
    StatusBar statusBar = windowManager.getStatusBar(project);
    if (statusBar != null && statusBar instanceof StatusBarEx) {
        ((StatusBarEx) statusBar).setProcessWindowOpen(true);
    }
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx) WindowManager(com.intellij.openapi.wm.WindowManager)

Example 34 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project azure-tools-for-java by Microsoft.

the class UpdateDeploymentForm method doOKAction.

@Override
protected void doOKAction() {
    String deploymentName = deploymentNode.getDeployment().name();
    final AzureString title = AzureOperationBundle.title("arm|deployment.update", deploymentName);
    AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
        EventUtil.executeWithLog(TelemetryConstants.ARM, TelemetryConstants.UPDATE_DEPLOYMENT, (operation -> {
            Deployment.Update update = deploymentNode.getDeployment().update();
            String templatePath = templateTextField.getText();
            update = update.withTemplate(IOUtils.toString(new FileReader(templatePath)));
            String parametersPath = parametersTextField.getText();
            if (!StringUtils.isEmpty(parametersPath)) {
                String parameters = IOUtils.toString(new FileReader(parametersPath));
                update = update.withParameters(DeploymentUtils.parseParameters(parameters));
            }
            update.withMode(DeploymentMode.INCREMENTAL).apply();
            UIUtils.showNotification(statusBar, NOTIFY_UPDATE_DEPLOYMENT_SUCCESS, MessageType.INFO);
        }), (e) -> {
            UIUtils.showNotification(statusBar, NOTIFY_UPDATE_DEPLOYMENT_FAIL + ", " + e.getMessage(), MessageType.ERROR);
        });
    }));
    close(OK_EXIT_CODE, true);
}
Also used : FileChooserDescriptorFactory(com.intellij.openapi.fileChooser.FileChooserDescriptorFactory) StringUtils(org.apache.commons.lang.StringUtils) MessageType(com.intellij.openapi.ui.MessageType) AzureOperationBundle(com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) DeploymentMode(com.microsoft.azure.management.resources.DeploymentMode) NOTIFY_UPDATE_DEPLOYMENT_FAIL(com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_FAIL) StatusBar(com.intellij.openapi.wm.StatusBar) Map(java.util.Map) NOTIFY_UPDATE_DEPLOYMENT_SUCCESS(com.microsoft.azure.toolkit.intellij.arm.action.UpdateDeploymentAction.NOTIFY_UPDATE_DEPLOYMENT_SUCCESS) Project(com.intellij.openapi.project.Project) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) DeploymentNode(com.microsoft.tooling.msservices.serviceexplorer.azure.arm.deployments.DeploymentNode) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) Deployment(com.microsoft.azure.management.resources.Deployment) UIUtils(com.microsoft.intellij.ui.util.UIUtils) WindowManager(com.intellij.openapi.wm.WindowManager) Collectors(java.util.stream.Collectors) IOUtils(org.apache.commons.io.IOUtils) Nullable(org.jetbrains.annotations.Nullable) Azure.az(com.microsoft.azure.toolkit.lib.Azure.az) List(java.util.List) EventType(com.microsoft.azuretools.telemetrywrapper.EventType) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) FileReader(java.io.FileReader) BROWSE_TEMPLATE_SAMPLES(com.microsoft.azuretools.telemetry.TelemetryConstants.BROWSE_TEMPLATE_SAMPLES) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) javax.swing(javax.swing) Deployment(com.microsoft.azure.management.resources.Deployment) FileReader(java.io.FileReader) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) AzureString(com.microsoft.azure.toolkit.lib.common.bundle.AzureString)

Example 35 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project azure-tools-for-java by Microsoft.

the class CreateDeploymentAction method doActionPerformed.

private void doActionPerformed(NodeActionEvent e, boolean isLoggedIn, Project project) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    try {
        if (isLoggedIn) {
            if (!AzureLoginHelper.isAzureSubsAvailableOrReportError(ERROR_CREATING_DEPLOYMENT)) {
                return;
            }
            CreateDeploymentForm createDeploymentForm = new CreateDeploymentForm(project);
            if (node instanceof ResourceManagementNode) {
                ResourceManagementNode rmNode = (ResourceManagementNode) node;
                createDeploymentForm.fillSubsAndRg(rmNode);
            }
            createDeploymentForm.show();
        }
    } catch (Exception ex) {
        AzurePlugin.log(ERROR_CREATING_DEPLOYMENT, ex);
        UIUtils.showNotification(statusBar, NOTIFY_CREATE_DEPLOYMENT_FAIL + ", " + ex.getMessage(), MessageType.ERROR);
    }
}
Also used : ResourceManagementNode(com.microsoft.tooling.msservices.serviceexplorer.azure.arm.ResourceManagementNode) CreateDeploymentForm(com.microsoft.azure.toolkit.intellij.arm.CreateDeploymentForm) StatusBar(com.intellij.openapi.wm.StatusBar)

Aggregations

StatusBar (com.intellij.openapi.wm.StatusBar)36 Project (com.intellij.openapi.project.Project)8 WindowManager (com.intellij.openapi.wm.WindowManager)6 Editor (com.intellij.openapi.editor.Editor)4 PsiElement (com.intellij.psi.PsiElement)4 FindManager (com.intellij.find.FindManager)3 FindModel (com.intellij.find.FindModel)3 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 IdeFrame (com.intellij.openapi.wm.IdeFrame)3 HighlightManager (com.intellij.codeInsight.highlighting.HighlightManager)2 Application (com.intellij.openapi.application.Application)2 Document (com.intellij.openapi.editor.Document)2 EditorColorsManager (com.intellij.openapi.editor.colors.EditorColorsManager)2 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)2 FileChooserDescriptorFactory (com.intellij.openapi.fileChooser.FileChooserDescriptorFactory)2 MessageType (com.intellij.openapi.ui.MessageType)2 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)2 HyperlinkLabel (com.intellij.ui.HyperlinkLabel)2