protected void importFromSources(File dir) { myRootDir = dir; try { myProject = doCreateProject(getIprFile()); myBuilder.setBaseProjectPath(dir.getAbsolutePath()); List<DetectedRootData> list = RootDetectionProcessor.detectRoots(dir); MultiMap<ProjectStructureDetector,DetectedProjectRoot> map = RootDetectionProcessor.createRootsMap(list); myBuilder.setupProjectStructure(map); for (ProjectStructureDetector detector : map.keySet()) { List<ModuleWizardStep> steps = detector.createWizardSteps(myBuilder, myBuilder.getProjectDescriptor(detector), EmptyIcon.ICON_16); for (ModuleWizardStep step : steps) { if (step instanceof AbstractStepWithProgress<?>) { performStep((AbstractStepWithProgress<?>)step); } } } myBuilder.commit(myProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void fillActions(final LookupElement element, Lookup lookup, Consumer<LookupElementAction> consumer) { final StaticallyImportable item = element.as(StaticallyImportable.CLASS_CONDITION_KEY); if (item == null || !item.canBeImported()) { return; } final Icon checkIcon = PlatformIcons.CHECK_ICON; final Icon icon = item.willBeImported() ? checkIcon : new EmptyIcon(checkIcon.getIconWidth(), checkIcon.getIconHeight()); consumer.consume(new LookupElementAction(icon, "Import statically") { @Override public Result performLookupAction() { item.setShouldBeImported(!item.willBeImported()); return new Result.ChooseItem(element); } }); }
@Override public void update(final Graphics g, final JComponent c) { myHiddenItem.setSelected(menuItem.isSelected()); if (UIUtil.isMurrineBasedTheme()) { acceleratorFont = menuItem.getFont(); final Color fg = GtkPaintingUtil.getForeground(myOriginalUI, menuItem); acceleratorForeground = UIUtil.mix(fg, menuItem.getBackground(), menuItem.isSelected() ? 0.4 : 0.2); disabledForeground = fg; } if (checkIcon != null && !(checkIcon instanceof IconWrapper) && !(checkIcon instanceof EmptyIcon)) { checkIcon = new IconWrapper(checkIcon, myOriginalUI); } super.update(g, c); }
public ActionButton(AnAction action) { myAction = action; Presentation presentation = action.getTemplatePresentation(); InplaceButton button = new InplaceButton(KeymapUtil.createTooltipText(presentation.getText(), action), EmptyIcon.ICON_16, this) { @Override public boolean isActive() { return LightToolWindow.this.isActive(); } }; button.setHoveringEnabled(!SystemInfo.isMac); setContent(button); Icon icon = presentation.getIcon(); Icon hoveredIcon = presentation.getHoveredIcon(); button.setIcons(icon, icon, hoveredIcon == null ? icon : hoveredIcon); }
protected static Icon getSmallApplicationIcon() { if (ourSmallAppIcon == null) { try { Icon appIcon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getIconUrl()); if (appIcon != null) { if (appIcon.getIconWidth() == JBUI.scale(16) && appIcon.getIconHeight() == JBUI.scale(16)) { ourSmallAppIcon = appIcon; } else { BufferedImage image = ImageUtil.toBufferedImage(IconUtil.toImage(appIcon)); image = Scalr.resize(image, Scalr.Method.ULTRA_QUALITY, UIUtil.isRetina() ? 32 : JBUI.scale(16)); ourSmallAppIcon = toRetinaAwareIcon(image); } } } catch (Exception e) {// } if (ourSmallAppIcon == null) { ourSmallAppIcon = EmptyIcon.ICON_16; } } return ourSmallAppIcon; }
private static int calculateCheckBoxIndent() { JCheckBox checkBox = new JCheckBox(); Icon icon = checkBox.getIcon(); int indent = 0; if (icon == null) { icon = UIManager.getIcon("CheckBox.icon"); } if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { icon = EmptyIcon.create(20, 18); } if (icon != null) { final Rectangle r1 = new Rectangle(checkBox.getWidth(), checkBox.getHeight()); JBInsets.removeFrom(r1, checkBox.getInsets()); final Rectangle iconRect = new Rectangle(); SwingUtilities.layoutCompoundLabel( checkBox, checkBox.getFontMetrics(checkBox.getFont()), checkBox.getText(), icon, checkBox.getVerticalAlignment(), checkBox.getHorizontalAlignment(), checkBox.getVerticalTextPosition(), checkBox.getHorizontalTextPosition(), r1, new Rectangle(), iconRect, checkBox.getText() == null ? 0 : checkBox.getIconTextGap()); indent = iconRect.x; } return indent + checkBox.getIconTextGap(); }
public void recalculateWidth() { ListModel model = myList.getModel(); myTitle.setIcon(EmptyIcon.ICON_16); myTitle.setFont(getTitleFont()); int index = 0; while (index < model.getSize()) { String title = getModel().titleIndex.getTitle(index); if (title != null) { myTitle.setText(title); } index++; } myTitle.setForeground(Gray._122); myTitle.setAlignmentY(BOTTOM_ALIGNMENT); }
public void recalculateWidth() { myLeftWidth = 16; ListModel model = myList.getModel(); myTitle.setIcon(EmptyIcon.ICON_16); myTitle.setFont(getTitleFont()); int index = 0; while (index < model.getSize()) { Object el = model.getElementAt(index); Object prev = index == 0 ? null : model.getElementAt(index - 1); String title = getTitle(index, el, prev); if (title != null) { myTitle.setText(title); myLeftWidth = Math.max(myLeftWidth, myTitle.getPreferredSize().width); } index++; } myLeftWidth += 10; myTitle.setForeground(Gray._122); myTitle.setAlignmentY(BOTTOM_ALIGNMENT); myLeftPanel.setBorder(new CompoundBorder(new CustomLineBorder(Gray._206, 0,0,0,1), new EmptyBorder(0,0,0,5))); }
public ActionButton(AnAction action) { myAction = action; Presentation presentation = action.getTemplatePresentation(); InplaceButton button = new InplaceButton(AnAction.createTooltipText(presentation.getText(), action), EmptyIcon.ICON_16, this) { @Override public boolean isActive() { return LightToolWindow.this.isActive(); } }; button.setHoveringEnabled(!SystemInfo.isMac); setContent(button); Icon icon = presentation.getIcon(); Icon hoveredIcon = presentation.getHoveredIcon(); button.setIcons(icon, icon, hoveredIcon == null ? icon : hoveredIcon); }
@Nonnull public Icon toIcon() { Icon mainIcon = null; if(myLayerIcons == null) { mainIcon = myMainIcon; } else { LayeredIcon layeredIcon = new LayeredIcon(myLayerIcons.size() + 1); layeredIcon.setIcon(myMainIcon, 0); for (int i = 0; i < myLayerIcons.size(); i++) { Icon icon = myLayerIcons.get(i); layeredIcon.setIcon(icon, i + 1); } mainIcon = layeredIcon; } if(myRightIcon == null) { return mainIcon == null ? EmptyIcon.ICON_16 : mainIcon; } else { RowIcon baseIcon = new RowIcon(2); baseIcon.setIcon(mainIcon, 0); baseIcon.setIcon(myRightIcon, 1); return baseIcon; } }
public PresentationModeProgressPanel(InlineProgressIndicator progress) { myProgress = progress; Font font = JBUI.Fonts.label(11); myText.setFont(font); myText2.setFont(font); myText.setIcon(JBUI.scale(EmptyIcon.create(1, 16))); myText2.setIcon(JBUI.scale(EmptyIcon.create(1, 16))); myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null); myUpdate = new Update("Update UI") { @Override public void run() { updateImpl(); } }; myEastButtons = myProgress.createEastButtons(); myButtonPanel.add(InlineProgressIndicator.createButtonPanel(myEastButtons.map(b -> b.button))); }
private void calcMaxIconSize(final ActionGroup actionGroup) { AnAction[] actions = actionGroup.getChildren(createActionEvent(actionGroup)); for (AnAction action : actions) { if (action == null) continue; if (action instanceof ActionGroup) { final ActionGroup group = (ActionGroup)action; if (!group.isPopup()) { calcMaxIconSize(group); continue; } } Icon icon = action.getTemplatePresentation().getIcon(); if (icon == null && action instanceof Toggleable) icon = EmptyIcon.ICON_16; if (icon != null) { final int width = icon.getIconWidth(); final int height = icon.getIconHeight(); if (myMaxIconWidth < width) { myMaxIconWidth = width; } if (myMaxIconHeight < height) { myMaxIconHeight = height; } } } }
private Icon calcIcon() { try { if(myFrame.isObsolete()) { return AllIcons.Debugger.Db_obsolete; } } catch (EvaluateException ignored) { } return EmptyIcon.create(6);//AllIcons.Debugger.StackFrame; }
public Icon getEmptyHandle() { if (myEmptyHandle == null) { final Icon expand = getExpandedHandle(); myEmptyHandle = expand != null ? EmptyIcon.create(expand) : EmptyIcon.create(0); } return myEmptyHandle; }
public PresentationModeProgressPanel(InlineProgressIndicator progress) { myProgress = progress; Font font = JBUI.Fonts.label(11); myText.setFont(font); myText2.setFont(font); myText.setIcon(EmptyIcon.create(1, 16)); myText2.setIcon(EmptyIcon.create(1, 16)); myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null); myUpdate = new Update("Update UI") { @Override public void run() { updateImpl(); } }; }
protected IconWithTextAction(String text, String description, Icon icon) { super(text, description, icon); if (icon == null) { getTemplatePresentation().setIcon(EmptyIcon.ICON_0); getTemplatePresentation().setDisabledIcon(EmptyIcon.ICON_0); } }
public void buildGroup(@NotNull ActionGroup actionGroup) { calcMaxIconSize(actionGroup); myEmptyIcon = myMaxIconHeight != -1 && myMaxIconWidth != -1 ? new EmptyIcon(myMaxIconWidth, myMaxIconHeight) : null; appendActionsFromGroup(actionGroup); if (myListModel.isEmpty()) { myListModel.add(new ActionItem(Utils.EMPTY_MENU_FILLER, Utils.NOTHING_HERE, null, false, null, false, null)); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { try { myIcon.paintIcon(c, g, x, y); } catch (Exception e) { EmptyIcon.ICON_0.paintIcon(c, g, x, y); } }
@Override public void installUI(final JComponent c) { super.installUI(c); myHiddenItem = new JCheckBoxMenuItem(); myOriginalUI.installUI(myHiddenItem); menuItem.setBorder(myHiddenItem.getBorder()); final Icon icon = getCheckIconFromContext(myOriginalUI, myHiddenItem); checkIcon = isCheckBoxItem() ? icon : EmptyIcon.create(icon); }
@Nullable private static Icon _getRawIcon(LookupElement item, boolean real) { if (item instanceof LookupItem) { Icon icon = (Icon)((LookupItem)item).getAttribute(LookupItem.ICON_ATTR); if (icon != null) return icon; } Object o = item.getObject(); if (!real) { if (item.getObject() instanceof String) { return EmptyIcon.ICON_0; } return new EmptyIcon(SAMPLE_ICON.getIconWidth() * 2, SAMPLE_ICON.getIconHeight()); } if (o instanceof Iconable && !(o instanceof PsiElement)) { return ((Iconable)o).getIcon(Iconable.ICON_FLAG_VISIBILITY); } final PsiElement element = item.getPsiElement(); if (element != null && element.isValid()) { return element.getIcon(Iconable.ICON_FLAG_VISIBILITY); } return null; }
public LookupActionsStep(Collection<LookupElementAction> actions, LookupImpl lookup, LookupElement lookupElement) { super(null, new ArrayList<LookupElementAction>(actions)); myLookup = lookup; myLookupElement = lookupElement; int w = 0, h = 0; for (LookupElementAction action : actions) { final Icon icon = action.getIcon(); if (icon != null) { w = Math.max(w, icon.getIconWidth()); h = Math.max(h, icon.getIconHeight()); } } myEmptyIcon = new EmptyIcon(w, h); }
public NavBarItem(NavBarPanel panel, Object object, int idx, Disposable parent) { myPanel = panel; myUI = panel.getNavBarUI(); myObject = object; myIndex = idx; isPopupElement = idx == -1; if (object != null) { NavBarPresentation presentation = myPanel.getPresentation(); myText = presentation.getPresentableText(object); Icon icon = presentation.getIcon(object); myIcon = icon != null ? icon : EmptyIcon.create(5); myAttributes = presentation.getTextAttributes(object, false); } else { myText = "Sample"; myIcon = PlatformIcons.DIRECTORY_CLOSED_ICON; myAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; } Disposer.register(parent == null ? panel : parent, this); setOpaque(false); setIpad(myUI.getElementIpad(isPopupElement)); if (!isPopupElement) { setMyBorder(null); setBorder(null); setPaintFocusBorder(false); } update(); }
@Override public void renderItem(ColoredListCellRenderer renderer) { if (myFrameworkTypeId != null) { renderer.append(myFrameworkTypeId, SimpleTextAttributes.ERROR_ATTRIBUTES); if (myFileUrl != null) { renderer.append(" in " + myFileUrl, SimpleTextAttributes.ERROR_ATTRIBUTES); } } else { renderer.append(myFileUrl, SimpleTextAttributes.ERROR_ATTRIBUTES); } renderer.setIcon(EmptyIcon.ICON_16); }
@Override protected void initComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { ErrorTreeElement element = getElement(value); if (element != null) { String[] text = element.getText(); if (text == null) { text = EMPTY_STRING_ARRAY; } if (text.length > 0 && text[0] == null) { text[0] = ""; } setText(text, ""); } Icon icon = null; if (element instanceof GroupingElement) { GroupingElement groupingElement = (GroupingElement)element; icon = groupingElement.getFile() != null ? groupingElement.getFile().getFileType().getIcon() : AllIcons.FileTypes.Java; } else if (element instanceof SimpleMessageElement || element instanceof NavigatableMessageElement) { ErrorTreeElementKind kind = element.getKind(); icon = getIconFor(kind); } if (icon == null) { icon = EmptyIcon.ICON_16; } setIcon(icon); }
@NotNull private static Icon getIconFor(@NotNull ErrorTreeElementKind kind) { switch (kind) { case ERROR: return AllIcons.General.BalloonError; case WARNING: return AllIcons.General.BalloonWarning; case INFO: return AllIcons.General.BalloonInformation; default: return EmptyIcon.ICON_16; } }
public MyCompositeTableCellRenderer(){ myPropertyNameRenderer = new ColoredTableCellRenderer() { protected void customizeCellRenderer( final JTable table, final Object value, final boolean selected, final boolean hasFocus, final int row, final int column ) { // We will append text later in the setPaintFocusBorder(false); setFocusBorderAroundIcon(true); } }; myErrorRenderer = new ColoredTableCellRenderer() { protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { setPaintFocusBorder(false); } }; myExpandIcon= UIUtil.isUnderDarcula() ? AllIcons.Mac.Tree_white_right_arrow : UIDesignerIcons.ExpandNode; myCollapseIcon=UIUtil.isUnderDarcula() ? AllIcons.Mac.Tree_white_down_arrow : UIDesignerIcons.CollapseNode; for(int i=0; i<myIndentIcons.length; i++) { myIndentIcons [i] = new EmptyIcon(myExpandIcon.getIconWidth() + 11 * i, myExpandIcon.getIconHeight()); } myIndentedExpandIcon = new IndentedIcon(myExpandIcon, 11); myIndentedCollapseIcon = new IndentedIcon(myCollapseIcon, 11); }
@NotNull private static Icon createEmptyIconLike(@NotNull String baseIconPath) { Icon baseIcon = IconLoader.findIcon(baseIconPath); if (baseIcon == null) { return EmptyIcon.ICON_16; } return new EmptyIcon(baseIcon.getIconWidth(), baseIcon.getIconHeight()); }
public void setEditor(@Nullable final EditorWithProviderComposite editor, final boolean focusEditor) { if (editor != null) { if (myTabbedPane == null) { myPanel.removeAll (); myPanel.add (new TCompForTablessMode(this, editor), BorderLayout.CENTER); myPanel.revalidate (); return; } final int index = findEditorIndex(editor); if (index != -1) { setSelectedEditor(editor, focusEditor); } else { Integer initialIndex = editor.getFile().getUserData(INITIAL_INDEX_KEY); int indexToInsert = 0; if (initialIndex == null) { int selectedIndex = myTabbedPane.getSelectedIndex(); if (selectedIndex >= 0) { indexToInsert = UISettings.getInstance().ACTIVATE_RIGHT_EDITOR_ON_CLOSE ? selectedIndex : selectedIndex + 1; } } else { indexToInsert = initialIndex; } final VirtualFile file = editor.getFile(); final Icon template = AllIcons.FileTypes.Text; myTabbedPane.insertTab(file, new EmptyIcon(template.getIconWidth(), template.getIconHeight()), new TComp(this, editor), null, indexToInsert); trimToSize(UISettings.getInstance().EDITOR_TAB_LIMIT, file, false); setSelectedEditor(editor, focusEditor); myOwner.updateFileIcon(file); myOwner.updateFileColor(file); } myOwner.setCurrentWindow(this, false); } myPanel.revalidate(); }
public void buildGroup(@NotNull ActionGroup actionGroup) { calcMaxIconSize(actionGroup); myEmptyIcon = myMaxIconHeight != -1 && myMaxIconWidth != -1 ? new EmptyIcon(myMaxIconWidth, myMaxIconHeight) : null; appendActionsFromGroup(actionGroup); if (myListModel.isEmpty()) { myListModel.add(new ActionItem(Utils.EMPTY_MENU_FILLER, Utils.NOTHING_HERE, false, null, false, null)); } }