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);
}
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);
}
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;
}
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);
}
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
}
}
}
}
Aggregations