com.intellij.ide.ui.UISettings Java Examples
The following examples show how to use
com.intellij.ide.ui.UISettings.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IJSwingUtilities.java From consulo with Apache License 2.0 | 6 votes |
public static void moveMousePointerOn(Component component) { if (component != null && component.isShowing()) { UISettings settings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance(); if (settings != null && settings.MOVE_MOUSE_ON_DEFAULT_BUTTON) { 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 } } } }
Example #2
Source File: LafManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void fireUpdate() { UISettings.getInstance().fireUISettingsChanged(); EditorFactory.getInstance().refreshAllEditors(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { FileStatusManager.getInstance(openProject).fileStatusesChanged(); DaemonCodeAnalyzer.getInstance(openProject).restart(); } for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) { if (frame instanceof IdeFrameEx) { ((IdeFrameEx)frame).updateView(); } } ActionToolbarImpl.updateAllToolbarsImmediately(); }
Example #3
Source File: CSharpNavBarExtension.java From consulo-csharp with Apache License 2.0 | 6 votes |
@Nullable @Override @RequiredReadAction public PsiElement adjustElement(PsiElement psiElement) { if(psiElement instanceof CSharpFile) { if(!UISettings.getInstance().getShowMembersInNavigationBar()) { return psiElement; } DotNetNamedElement element = CSharpPsiUtilImpl.findSingleElement((CSharpFile) psiElement); if(element != null) { return element; } } if(!UISettings.getInstance().getShowMembersInNavigationBar()) { return psiElement.getContainingFile(); } return super.adjustElement(psiElement); }
Example #4
Source File: DesktopFloatingDecorator.java From consulo with Apache License 2.0 | 6 votes |
@Override public void uiSettingsChanged(final UISettings uiSettings) { LOG.assertTrue(isDisplayable()); LOG.assertTrue(isShowing()); final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); myDelayAlarm.cancelAllRequests(); if (uiSettings.ENABLE_ALPHA_MODE) { if (!myInfo.isActive()) { windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, true); windowManager.setAlphaModeRatio(DesktopFloatingDecorator.this, uiSettings.ALPHA_MODE_RATIO); } } else { windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, false); } }
Example #5
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private Pair<BufferedImage, Reference<BufferedImage>> getImage(@Nullable Reference<BufferedImage> imageRef) { LOG.assertTrue(UISettings.getInstance().getAnimateWindows()); Window awtWindow = TargetAWT.to(myIdeFrame.getWindow()); BufferedImage image = SoftReference.dereference(imageRef); if (image == null || image.getWidth(null) < getWidth() || image.getHeight(null) < getHeight()) { final int width = Math.max(Math.max(1, getWidth()), awtWindow.getWidth()); final int height = Math.max(Math.max(1, getHeight()), awtWindow.getHeight()); if (SystemInfo.isWindows) { image = awtWindow.getGraphicsConfiguration().createCompatibleImage(width, height); } else { // Under Linux we have found that images created by createCompatibleImage(), // createVolatileImage(), etc extremely slow for rendering. TrueColor buffered image // is MUCH faster. // On Mac we create a retina-compatible image image = UIUtil.createImage(getGraphics(), width, height, BufferedImage.TYPE_INT_RGB); } imageRef = new SoftReference<>(image); } return Pair.create(image, imageRef); }
Example #6
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private void updateToolStripesVisibility() { boolean oldVisible = myLeftStripe.isVisible(); final boolean showButtons = !UISettings.getInstance().getHideToolStripes() && !UISettings.getInstance().getPresentationMode(); boolean visible = showButtons || myStripesOverlayed; myLeftStripe.setVisible(visible); myRightStripe.setVisible(visible); myTopStripe.setVisible(visible); myBottomStripe.setVisible(visible); boolean overlayed = !showButtons && myStripesOverlayed; myLeftStripe.setOverlayed(overlayed); myRightStripe.setOverlayed(overlayed); myTopStripe.setOverlayed(overlayed); myBottomStripe.setOverlayed(overlayed); if (oldVisible != visible) { revalidate(); repaint(); } }
Example #7
Source File: ThriftCompilerConfigurable.java From intellij-thrift with Apache License 2.0 | 6 votes |
void apply() { final ThriftConfig config = new ThriftConfig( StringUtils.trimToNull(tfThriftCompiler.getText()), cbNoWarn.isSelected(), cbStrict.isSelected(), cbVerbose.isSelected(), cbRecurse.isSelected(), cbDebug.isSelected(), cbAllowNegKeys.isSelected(), cbAllow64bitConsts.isSelected() ); plugin.setConfig(config); setModified(false); UISettings.getInstance().fireUISettingsChanged(); }
Example #8
Source File: DaemonTooltipWithActionRenderer.java From consulo with Apache License 2.0 | 6 votes |
private Font getActionFont() { Font toolTipFont = UIUtil.getToolTipFont(); if (toolTipFont == null || SystemInfo.isWindows) return toolTipFont; //if font was changed from default we dont have a good heuristic to customize it if (JBUI.Fonts.label() != toolTipFont || UISettings.getInstance().OVERRIDE_NONIDEA_LAF_FONTS) return toolTipFont; if (SystemInfo.isMac) { return toolTipFont.deriveFont(toolTipFont.getSize() - 1f); } if (SystemInfo.isLinux) { return toolTipFont.deriveFont(toolTipFont.getSize() - 1f); } return toolTipFont; }
Example #9
Source File: PluginsTableRenderer.java From consulo with Apache License 2.0 | 6 votes |
public PluginsTableRenderer(PluginDescriptor pluginDescriptor, boolean availableRender) { myPluginDescriptor = pluginDescriptor; final Font smallFont; if (SystemInfo.isMac) { smallFont = UIUtil.getLabelFont(UIUtil.FontSize.MINI); } else { smallFont = UIUtil.getLabelFont().deriveFont(Math.max(UISettings.getInstance().getFontSize() - JBUI.scale(3), JBUI.scaleFontSize(10))); } myName.setFont(UIUtil.getLabelFont().deriveFont(UISettings.getInstance().getFontSize())); myStatus.setFont(smallFont); myCategory.setFont(smallFont); myDownloads.setFont(smallFont); myStatus.setText(""); myCategory.setText(""); myLastUpdated.setFont(smallFont); if (!availableRender || !(pluginDescriptor instanceof PluginNode)) { myPanel.remove(myRightPanel); } myPanel.setBorder(UIUtil.isJreHiDPI(myPanel) ? JBUI.Borders.empty(4, 3) : JBUI.Borders.empty(2, 3)); }
Example #10
Source File: EditorHistoryManager.java From consulo with Apache License 2.0 | 6 votes |
@Inject EditorHistoryManager(@Nonnull Project project) { myProject = project; MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(UISettingsListener.TOPIC, new UISettingsListener() { @Override public void uiSettingsChanged(UISettings uiSettings) { trimToSize(); } }); connection.subscribe(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER, new FileEditorManagerListener.Before.Adapter() { @Override public void beforeFileClosed(@Nonnull FileEditorManager source, @Nonnull VirtualFile file) { updateHistoryEntry(file, false); } }); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyEditorManagerListener()); }
Example #11
Source File: CodeCompletionPanel.java From consulo with Apache License 2.0 | 6 votes |
public void apply() { CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance(); codeInsightSettings.COMPLETION_CASE_SENSITIVE = getCaseSensitiveValue(); codeInsightSettings.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = myCbSelectByChars.isSelected(); codeInsightSettings.AUTOCOMPLETE_ON_CODE_COMPLETION = myCbOnCodeCompletion.isSelected(); codeInsightSettings.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = myCbOnSmartTypeCompletion.isSelected(); codeInsightSettings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO = myCbShowFullParameterSignatures.isSelected(); codeInsightSettings.AUTO_POPUP_PARAMETER_INFO = myCbParameterInfoPopup.isSelected(); codeInsightSettings.AUTO_POPUP_COMPLETION_LOOKUP = myCbAutocompletion.isSelected(); codeInsightSettings.AUTO_POPUP_JAVADOC_INFO = myCbAutopopupJavaDoc.isSelected(); codeInsightSettings.PARAMETER_INFO_DELAY = getIntegerValue(myParameterInfoDelayField.getText(), 0); codeInsightSettings.JAVADOC_INFO_DELAY = getIntegerValue(myAutopopupJavaDocField.getText(), 0); UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = myCbSorting.isSelected(); final Project project = DataManager.getInstance().getDataContext(myPanel).getData(CommonDataKeys.PROJECT); if (project != null){ DaemonCodeAnalyzer.getInstance(project).settingsChanged(); } }
Example #12
Source File: StructureAwareNavBarModelExtension.java From consulo with Apache License 2.0 | 6 votes |
@Override @RequiredReadAction public PsiElement getLeafElement(@Nonnull DataContext dataContext) { if (UISettings.getInstance().getShowMembersInNavigationBar()) { PsiFile psiFile = dataContext.getData(CommonDataKeys.PSI_FILE); Editor editor = dataContext.getData(CommonDataKeys.EDITOR); if (psiFile == null || editor == null) return null; PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); if (psiElement != null && psiElement.getLanguage() == getLanguage()) { StructureViewModel model = buildStructureViewModel(psiFile, editor); if (model != null) { Object currentEditorElement = model.getCurrentEditorElement(); if (currentEditorElement instanceof PsiElement) { return ((PsiElement)currentEditorElement).getOriginalElement(); } } } } return null; }
Example #13
Source File: DesktopFloatingDecorator.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void show() { setFocusableWindowState(myInfo.isActive()); super.show(); final UISettings uiSettings = UISettings.getInstance(); if (uiSettings.ENABLE_ALPHA_MODE) { final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx(); windowManager.setAlphaModeEnabled(this, true); if (myInfo.isActive()) { windowManager.setAlphaModeRatio(this, 0.0f); } else { windowManager.setAlphaModeRatio(this, uiSettings.ALPHA_MODE_RATIO); } } paint(getGraphics()); // This prevents annoying flick setFocusableWindowState(true); uiSettings.addUISettingsListener(myUISettingsListener, myDelayAlarm); }
Example #14
Source File: SyntaxInfoBuilder.java From consulo with Apache License 2.0 | 5 votes |
Context(@Nonnull CharSequence charSequence, @Nonnull EditorColorsScheme scheme, int indentSymbolsToStrip) { myText = charSequence; myDefaultForeground = scheme.getDefaultForeground(); myDefaultBackground = scheme.getDefaultBackground(); int javaFontSize = scheme.getEditorFontSize(); float fontSize = SystemInfo.isMac || ApplicationManager.getApplication().isHeadlessEnvironment() ? javaFontSize : javaFontSize * 0.75f / UISettings.getDefFontScale(); // matching font size in external apps builder = new SyntaxInfo.Builder(myDefaultForeground, myDefaultBackground, fontSize); myIndentSymbolsToStrip = indentSymbolsToStrip; }
Example #15
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public List<String> getVisibleIdsOn(@Nonnull ToolWindowAnchor anchor, @Nonnull ToolWindowManager manager) { List<String> ids = new ArrayList<>(); for (WindowInfoImpl each : getAllInfos(anchor)) { final ToolWindow window = manager.getToolWindow(each.getId()); if (window == null) continue; if (window.isAvailable() || UISettings.getInstance().ALWAYS_SHOW_WINDOW_BUTTONS) { ids.add(each.getId()); } } return ids; }
Example #16
Source File: EditorHistoryManager.java From consulo with Apache License 2.0 | 5 votes |
/** * If total number of files in history more then <code>UISettings.RECENT_FILES_LIMIT</code> * then removes the oldest ones to fit the history to new size. */ private synchronized void trimToSize() { final int limit = UISettings.getInstance().RECENT_FILES_LIMIT + 1; while (myEntriesList.size() > limit) { HistoryEntry removed = myEntriesList.remove(0); removed.destroy(); } }
Example #17
Source File: DesktopEditorWindow.java From consulo with Apache License 2.0 | 5 votes |
private void processSiblingEditor(final DesktopEditorWithProviderComposite siblingEditor) { if (myTabbedPane != null && getTabCount() < UISettings.getInstance().getEditorTabLimit() && findFileComposite(siblingEditor.getFile()) == null || myTabbedPane == null && getTabCount() == 0) { setEditor(siblingEditor, true); } else { getManager().disposeComposite(siblingEditor); } }
Example #18
Source File: DesktopEditorsSplitters.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public T process(@Nullable Element element, @Nullable T context, UIAccess uiAccess) { if (element == null) { return null; } final Element splitterElement = element.getChild("splitter"); if (splitterElement != null) { final Element first = splitterElement.getChild("split-first"); final Element second = splitterElement.getChild("split-second"); return processSplitter(splitterElement, first, second, context, uiAccess); } final Element leaf = element.getChild("leaf"); if (leaf == null) { return null; } List<Element> fileElements = leaf.getChildren("file"); final List<Element> children = new ArrayList<>(fileElements.size()); // trim to EDITOR_TAB_LIMIT, ignoring CLOSE_NON_MODIFIED_FILES_FIRST policy int toRemove = fileElements.size() - UISettings.getInstance().EDITOR_TAB_LIMIT; for (Element fileElement : fileElements) { if (toRemove <= 0 || Boolean.valueOf(fileElement.getAttributeValue(PINNED)).booleanValue()) { children.add(fileElement); } else { toRemove--; } } return processFiles(children, context, leaf, uiAccess); }
Example #19
Source File: EditorComponentImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void updateUI() { // Don't use the default TextUI, BaseTextUI, which does a lot of unnecessary // work. We do however need to provide a TextUI implementation since some // screen reader support code will invoke it setUI(new EditorAccessibilityTextUI()); UISettings.setupEditorAntialiasing(this); invalidate(); }
Example #20
Source File: EditorTextField.java From consulo with Apache License 2.0 | 5 votes |
private void setupEditorFont(final EditorEx editor) { if (myInheritSwingFont) { ((DesktopEditorImpl)editor).setUseEditorAntialiasing(false); editor.getColorsScheme().setEditorFontName(getFont().getFontName()); editor.getColorsScheme().setEditorFontSize(getFont().getSize()); return; } UISettings settings = UISettings.getInstance(); if (settings.PRESENTATION_MODE) editor.setFontSize(settings.PRESENTATION_MODE_FONT_SIZE); }
Example #21
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void doLayout() { Dimension size = getSize(); if (!myTopStripe.isVisible()) { myTopStripe.setBounds(0, 0, 0, 0); myBottomStripe.setBounds(0, 0, 0, 0); myLeftStripe.setBounds(0, 0, 0, 0); myRightStripe.setBounds(0, 0, 0, 0); myLayeredPane.setBounds(0, 0, getWidth(), getHeight()); } else { Dimension topSize = myTopStripe.getPreferredSize(); Dimension bottomSize = myBottomStripe.getPreferredSize(); Dimension leftSize = myLeftStripe.getPreferredSize(); Dimension rightSize = myRightStripe.getPreferredSize(); myTopStripe.setBounds(0, 0, size.width, topSize.height); myLeftStripe.setBounds(0, topSize.height, leftSize.width, size.height - topSize.height - bottomSize.height); myRightStripe.setBounds(size.width - rightSize.width, topSize.height, rightSize.width, size.height - topSize.height - bottomSize.height); myBottomStripe.setBounds(0, size.height - bottomSize.height, size.width, bottomSize.height); if (UISettings.getInstance().getHideToolStripes() || UISettings.getInstance().getPresentationMode()) { myLayeredPane.setBounds(0, 0, size.width, size.height); } else { myLayeredPane.setBounds(leftSize.width, topSize.height, size.width - leftSize.width - rightSize.width, size.height - topSize.height - bottomSize.height); } } }
Example #22
Source File: TextPanel.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void paintComponent(final Graphics g) { String s = getText(); int panelWidth = getWidth(); int panelHeight = getHeight(); Color background = getBackground(); if (background != null && isOpaque()) { g.setColor(background); g.fillRect(0, 0, panelWidth, panelHeight); } if (s == null) return; Graphics2D g2 = (Graphics2D)g; g2.setFont(getFont()); UISettings.setupAntialiasing(g); Rectangle bounds = new Rectangle(panelWidth, panelHeight); int x = getTextX(g2); int maxWidth = panelWidth - x - getInsets().right; FontMetrics fm = g.getFontMetrics(); int textWidth = fm.stringWidth(s); if (textWidth > maxWidth) { s = truncateText(s, bounds, fm, new Rectangle(), new Rectangle(), maxWidth); } int y = UIUtil.getStringY(s, bounds, g2); Color foreground = isEnabled() ? getForeground() : UIUtil.getInactiveTextColor(); g2.setColor(foreground); g2.drawString(s, x, y); }
Example #23
Source File: MenuItemPresentationFactory.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void processPresentation(Presentation presentation) { if (!UISettings.getInstance().SHOW_ICONS_IN_MENUS || myForceHide) { presentation.setIcon(null); presentation.setDisabledIcon(null); presentation.setHoveredIcon(null); presentation.putClientProperty(HIDE_ICON, Boolean.TRUE); } }
Example #24
Source File: ColorProgressBar.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public Color produce() { UISettings settings = UISettings.getInstanceOrNull(); return settings == null || null == settings.COLOR_BLINDNESS ? new JBColor(new Color(0xd67b76), new Color(0xe55757)) : new JBColor(new Color(0xcc7447), new Color(0xcc7447)); }
Example #25
Source File: UniqueNameEditorTabTitleProvider.java From consulo with Apache License 2.0 | 5 votes |
@Override public String getEditorTabTitle(@Nonnull Project project, @Nonnull VirtualFile file) { UISettings uiSettings = UISettings.getInstanceOrNull(); if (uiSettings == null || !uiSettings.getShowDirectoryForNonUniqueFilenames() || DumbService.isDumb(project)) { return null; } // Even though this is a 'tab title provider' it is used also when tabs are not shown, namely for building IDE frame title. String uniqueName = uiSettings.getEditorTabPlacement() == UISettings.TABS_NONE ? UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file) : UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePathWithinOpenedFileEditors(project, file); uniqueName = getEditorTabText(uniqueName, File.separator, uiSettings.getHideKnownExtensionInTabs()); return uniqueName.equals(file.getName()) ? null : uniqueName; }
Example #26
Source File: IdeDocumentHistoryImpl.java From consulo with Apache License 2.0 | 5 votes |
public static void appendTimestamp(@Nonnull Project project, @Nonnull SimpleColoredComponent component, @Nonnull VirtualFile file) { if (!UISettings.getInstance().getShowInplaceComments()) { return; } try { Long timestamp = getInstance(project).getRecentFilesTimestamps().get(file.getPath()); if (timestamp != null) { component.append(" ").append(DateFormatUtil.formatPrettyDateTime(timestamp), SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES); } } catch (IOException e) { LOG.info("Cannot get a timestamp from a persistent hash map", e); } }
Example #27
Source File: RunAnythingPopupUI.java From consulo with Apache License 2.0 | 5 votes |
@Override public void installScrollingActions() { RunAnythingScrollingUtil.installActions(myResultsList, (JTextField)TargetAWT.to(getField()), () -> { myIsItemSelected = true; mySearchField.setValue(myLastInputText); clearSelection(); }, UISettings.getInstance().getCycleScrolling()); super.installScrollingActions(); }
Example #28
Source File: DialogUtil.java From consulo with Apache License 2.0 | 5 votes |
public static void setTextWithMnemonic(@Nonnull AbstractButton button, String text, char mn) { if (text != null) { final StringBuilder realText = new StringBuilder(); char mnemonic = '\0'; int index = -1; for (int i = 0; i < text.length(); i++) { final char ch = text.charAt(i); if (ch != mn) { realText.append(ch); } else if (i + 1 < text.length()) { mnemonic = text.charAt(i + 1); index = realText.length(); } } if (mnemonic != '\0') { button.setText(realText.toString()); if (UISettings.getShadowInstance().getDisableMnemonicsInControls()) { button.setMnemonic(0); button.setDisplayedMnemonicIndex(-1); button.setFocusable(true); } else { button.setMnemonic(mnemonic); button.setDisplayedMnemonicIndex(index); } } } }
Example #29
Source File: EditorUIUtil.java From consulo with Apache License 2.0 | 5 votes |
/** * This method has to be used for setting up antialiasing and rendering hints in * editors only. */ public static void setupAntialiasing(final Graphics g) { Graphics2D g2d = (Graphics2D)g; int lcdContrastValue = UIUtil.getLcdContrastValue(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, lcdContrastValue); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, AntialiasingTypeUtil.getKeyForCurrentScope(true)); UISettings.setupFractionalMetrics(g2d); }
Example #30
Source File: ScrollSettings.java From consulo with Apache License 2.0 | 5 votes |
static boolean isEligibleFor(Component component) { if (component == null || !component.isShowing()) return false; Application application = getApplication(); if (application == null || application.isUnitTestMode()) return false; if (PowerSaveMode.isEnabled()) return false; if (RemoteDesktopService.isRemoteSession()) return false; UISettings settings = UISettings.getInstanceOrNull(); return settings != null && settings.SMOOTH_SCROLLING; }