Search in sources :

Example 16 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class EditorTabbedContainer method updateTabBorder.

private void updateTabBorder() {
    if (!myProject.isOpen())
        return;
    ToolWindowManagerEx mgr = (ToolWindowManagerEx) ToolWindowManager.getInstance(myProject);
    String[] ids = mgr.getToolWindowIds();
    Insets border = JBUI.emptyInsets();
    UISettings uiSettings = UISettings.getInstance();
    List<String> topIds = mgr.getIdsOn(ToolWindowAnchor.TOP);
    List<String> bottom = mgr.getIdsOn(ToolWindowAnchor.BOTTOM);
    List<String> rightIds = mgr.getIdsOn(ToolWindowAnchor.RIGHT);
    List<String> leftIds = mgr.getIdsOn(ToolWindowAnchor.LEFT);
    if (!uiSettings.getHideToolStripes() && !uiSettings.getPresentationMode()) {
        border.top = !topIds.isEmpty() ? 1 : 0;
        border.bottom = !bottom.isEmpty() ? 1 : 0;
        border.left = !leftIds.isEmpty() ? 1 : 0;
        border.right = !rightIds.isEmpty() ? 1 : 0;
    }
    for (String each : ids) {
        ToolWindow eachWnd = mgr.getToolWindow(each);
        if (eachWnd == null || !eachWnd.isAvailable())
            continue;
        if (eachWnd.isVisible() && eachWnd.getType() == ToolWindowType.DOCKED) {
            ToolWindowAnchor eachAnchor = eachWnd.getAnchor();
            if (eachAnchor == ToolWindowAnchor.TOP) {
                border.top = 0;
            } else if (eachAnchor == ToolWindowAnchor.BOTTOM) {
                border.bottom = 0;
            } else if (eachAnchor == ToolWindowAnchor.LEFT) {
                border.left = 0;
            } else if (eachAnchor == ToolWindowAnchor.RIGHT) {
                border.right = 0;
            }
        }
    }
    myTabs.getPresentation().setPaintBorder(border.top, border.left, border.right, border.bottom).setTabSidePaintBorder(5);
}
Also used : UISettings(com.intellij.ide.ui.UISettings) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 17 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class EditorWindow method getFileIcon.

/**
   * @return icon which represents file's type and modification status
   */
private Icon getFileIcon(@NotNull final VirtualFile file) {
    if (!file.isValid()) {
        Icon fakeIcon = FileTypes.UNKNOWN.getIcon();
        assert fakeIcon != null : "Can't find the icon for unknown file type";
        return fakeIcon;
    }
    final Icon baseIcon = IconUtil.getIcon(file, Iconable.ICON_FLAG_READ_STATUS, getManager().getProject());
    int count = 1;
    final Icon pinIcon;
    final EditorComposite composite = findFileComposite(file);
    if (composite != null && composite.isPinned()) {
        count++;
        pinIcon = AllIcons.Nodes.TabPin;
    } else {
        pinIcon = null;
    }
    final Icon modifiedIcon;
    UISettings settings = UISettings.getInstance();
    if (settings.getMarkModifiedTabsWithAsterisk() || !settings.getHideTabsIfNeed()) {
        modifiedIcon = settings.getMarkModifiedTabsWithAsterisk() && composite != null && composite.isModified() ? MODIFIED_ICON : GAP_ICON;
        count++;
    } else {
        modifiedIcon = null;
    }
    if (count == 1)
        return baseIcon;
    int i = 0;
    final LayeredIcon result = new LayeredIcon(count);
    int xShift = !settings.getHideTabsIfNeed() ? 4 : 0;
    result.setIcon(baseIcon, i++, xShift, 0);
    if (pinIcon != null)
        result.setIcon(pinIcon, i++, xShift, 0);
    if (modifiedIcon != null)
        result.setIcon(modifiedIcon, i++);
    return JBUI.scale(result);
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) UISettings(com.intellij.ide.ui.UISettings) EmptyIcon(com.intellij.util.ui.EmptyIcon) LayeredIcon(com.intellij.ui.LayeredIcon)

Example 18 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class EditorWindow method calcIndexToSelect.

private int calcIndexToSelect(VirtualFile fileBeingClosed, final int fileIndex) {
    final int currentlySelectedIndex = myTabbedPane.getSelectedIndex();
    if (currentlySelectedIndex != fileIndex) {
        // if the file being closed is not currently selected, keep the currently selected file open
        return currentlySelectedIndex;
    }
    UISettings uiSettings = UISettings.getInstance();
    if (uiSettings.getActiveMruEditorOnClose()) {
        // try to open last visited file
        final VirtualFile[] histFiles = EditorHistoryManager.getInstance(getManager().getProject()).getFiles();
        for (int idx = histFiles.length - 1; idx >= 0; idx--) {
            final VirtualFile histFile = histFiles[idx];
            if (histFile.equals(fileBeingClosed)) {
                continue;
            }
            final EditorWithProviderComposite editor = findFileComposite(histFile);
            if (editor == null) {
                // ????
                continue;
            }
            final int histFileIndex = findComponentIndex(editor.getComponent());
            if (histFileIndex >= 0) {
                // if the file being closed is located before the hist file, then after closing the index of the histFile will be shifted by -1
                return histFileIndex;
            }
        }
    } else if (uiSettings.getActiveRigtEditorOnClose() && fileIndex + 1 < myTabbedPane.getTabCount()) {
        return fileIndex + 1;
    }
    // by default select previous neighbour
    if (fileIndex > 0) {
        return fileIndex - 1;
    }
    // do nothing
    return -1;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) UISettings(com.intellij.ide.ui.UISettings)

Example 19 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class FloatingDecorator method show.

@Override
public final void show() {
    setFocusableWindowState(myInfo.isActive());
    super.show();
    final UISettings uiSettings = UISettings.getInstance();
    if (uiSettings.getEnableAlphaMode()) {
        final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
        windowManager.setAlphaModeEnabled(this, true);
        if (myInfo.isActive()) {
            windowManager.setAlphaModeRatio(this, 0.0f);
        } else {
            windowManager.setAlphaModeRatio(this, uiSettings.getAlphaModeRatio());
        }
    }
    // This prevents annoying flick
    paint(getGraphics());
    setFocusableWindowState(true);
    ApplicationManager.getApplication().getMessageBus().connect(myDelayAlarm).subscribe(UISettingsListener.TOPIC, myUISettingsListener);
}
Also used : UISettings(com.intellij.ide.ui.UISettings) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx)

Example 20 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class IJSwingUtilities method moveMousePointerOn.

public static void moveMousePointerOn(Component component) {
    if (component != null && component.isShowing()) {
        UISettings settings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance();
        if (settings != null && settings.getMoveMouseOnDefaultButton()) {
            Point point = component.getLocationOnScreen();
            int dx = component.getWidth() / 2;
            int dy = component.getHeight() / 2;
            try {
                new Robot().mouseMove(point.x + dx, point.y + dy);
            } catch (AWTException ignored) {
            // robot is not available
            }
        }
    }
}
Also used : UISettings(com.intellij.ide.ui.UISettings)

Aggregations

UISettings (com.intellij.ide.ui.UISettings)38 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)8 Project (com.intellij.openapi.project.Project)4 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)3 RichCopySettings (com.intellij.openapi.editor.richcopy.settings.RichCopySettings)3 VcsApplicationSettings (com.intellij.openapi.vcs.VcsApplicationSettings)3 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 HyperlinkEvent (javax.swing.event.HyperlinkEvent)2 DaemonCodeAnalyzerSettings (com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings)1 QuickDocOnMouseOverManager (com.intellij.codeInsight.documentation.QuickDocOnMouseOverManager)1 ColorBlindness (com.intellij.ide.ui.ColorBlindness)1 UISettingsListener (com.intellij.ide.ui.UISettingsListener)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 Application (com.intellij.openapi.application.Application)1 ApplicationManager.getApplication (com.intellij.openapi.application.ApplicationManager.getApplication)1