Search in sources :

Example 6 with StatusBar

use of com.intellij.openapi.wm.StatusBar in project GsonFormat by zzz40500.

the class Toast method make.

/**
     * Display simple notification of given type
     *
     * @param project
     * @param type
     * @param text
     */
public static void make(Project project, JComponent jComponent, MessageType type, String text) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, type, null).setFadeoutTime(7500).createBalloon().show(RelativePoint.getCenterOf(jComponent), Balloon.Position.above);
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar)

Example 7 with StatusBar

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

the class PackageFileAction method setStatusText.

private static void setStatusText(Project project, List<VirtualFile> files) {
    if (!files.isEmpty()) {
        StringBuilder fileNames = new StringBuilder();
        for (VirtualFile file : files) {
            if (fileNames.length() != 0)
                fileNames.append(", ");
            fileNames.append("'").append(file.getName()).append("'");
        }
        String time = TIME_FORMAT.format(Clock.getTime());
        final String statusText = CompilerBundle.message("status.text.file.has.been.packaged", files.size(), fileNames, time);
        final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
        if (statusBar != null) {
            statusBar.setInfo(statusText);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 8 with StatusBar

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

the class EscapeHandler method execute.

@Override
public void execute(Editor editor, DataContext dataContext) {
    editor.setHeaderComponent(null);
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project != null) {
        HighlightManagerImpl highlightManager = (HighlightManagerImpl) HighlightManager.getInstance(project);
        if (highlightManager != null && highlightManager.hideHighlights(editor, HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_ANY_KEY)) {
            StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
            if (statusBar != null) {
                statusBar.setInfo("");
            }
            FindManager findManager = FindManager.getInstance(project);
            if (findManager != null) {
                FindModel model = findManager.getFindNextModel(editor);
                if (model != null) {
                    model.setSearchHighlighters(false);
                    findManager.setFindNextModel(model);
                }
            }
            return;
        }
    }
    myOriginalHandler.execute(editor, dataContext);
}
Also used : Project(com.intellij.openapi.project.Project) FindManager(com.intellij.find.FindManager) FindModel(com.intellij.find.FindModel) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 9 with StatusBar

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

the class DvcsUtil method getSelectedFile.

/**
   * Returns the currently selected file, based on which VcsBranch or StatusBar components will identify the current repository root.
   */
@Nullable
@CalledInAwt
public static VirtualFile getSelectedFile(@NotNull Project project) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    final FileEditor fileEditor = StatusBarUtil.getCurrentFileEditor(project, statusBar);
    VirtualFile result = null;
    if (fileEditor != null) {
        if (fileEditor instanceof TextEditor) {
            Document document = ((TextEditor) fileEditor).getEditor().getDocument();
            result = FileDocumentManager.getInstance().getFile(document);
        } else if (fileEditor instanceof ImageFileEditor) {
            result = ((ImageFileEditor) fileEditor).getImageEditor().getFile();
        }
    }
    if (result == null) {
        final FileEditorManager manager = FileEditorManager.getInstance(project);
        if (manager != null) {
            Editor editor = manager.getSelectedTextEditor();
            if (editor != null) {
                result = FileDocumentManager.getInstance().getFile(editor.getDocument());
            }
        }
    }
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ImageFileEditor(org.intellij.images.editor.ImageFileEditor) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) ImageFileEditor(org.intellij.images.editor.ImageFileEditor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) Document(com.intellij.openapi.editor.Document) TextEditor(com.intellij.openapi.fileEditor.TextEditor) ImageFileEditor(org.intellij.images.editor.ImageFileEditor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) Editor(com.intellij.openapi.editor.Editor) StatusBar(com.intellij.openapi.wm.StatusBar) CalledInAwt(org.jetbrains.annotations.CalledInAwt) Nullable(org.jetbrains.annotations.Nullable)

Example 10 with StatusBar

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

the class DvcsStatusWidget method installWidgetToStatusBar.

private void installWidgetToStatusBar(@NotNull final Project project, @NotNull final StatusBarWidget widget) {
    ApplicationManager.getApplication().invokeLater(() -> {
        StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
        if (statusBar != null && !isDisposed()) {
            statusBar.addWidget(widget, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project);
            subscribeToMappingChanged();
            subscribeToRepoChangeEvents(project);
            update();
        }
    }, project.getDisposed());
}
Also used : StatusBar(com.intellij.openapi.wm.StatusBar)

Aggregations

StatusBar (com.intellij.openapi.wm.StatusBar)28 Project (com.intellij.openapi.project.Project)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 WindowManager (com.intellij.openapi.wm.WindowManager)3 CalledInAwt (org.jetbrains.annotations.CalledInAwt)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 DaemonCodeAnalyzer (com.intellij.codeInsight.daemon.DaemonCodeAnalyzer)1 Printable (com.intellij.execution.testframework.Printable)1 Printer (com.intellij.execution.testframework.Printer)1