當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil類代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil類的具體用法?Java UIUtil怎麽用?Java UIUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UIUtil類屬於com.intellij.util.ui包,在下文中一共展示了UIUtil類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onProcessList

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Override
public void onProcessList(Set<LogProcess> processList) {
    ApplicationManager.getApplication().executeOnPooledThread(() -> {
        final List<LogProcess> sortedList = new ArrayList<>(processList);
        sortedList.sort((l, r) -> {
            int c = l.getProcessName().compareTo(r.getProcessName());
            if (c == 0) {
                c = l.getProcessID() < r.getProcessID() ? -1 : 1;
            }
            return c;
        });
        UIUtil.invokeLaterIfNeeded(() -> {
            processListModel.removeAllElements();

            for (LogProcess client : sortedList) {
                processListModel.addElement(client);
            }
        });
    });

}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:22,代碼來源:LogView.java

示例2: refresh

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
/**
 * Refreshes the log console in background
 */
void refresh(final String task) {
    SingleTaskBackgroundExecutor.executeIfPossible(myProject, new SingleTaskBackgroundExecutor.BackgroundTask() {
        @Override
        public void run(ProgressIndicator progressIndicator) {
            try {
                UIUtil.invokeAndWaitIfNeeded((Runnable) () -> {
                    progressIndicator.setFraction(0);
                    doFilter(progressIndicator);
                });
            } catch (Throwable ex) {
                debug("Exception " + ex.getMessage());
            }
        }

        @Override
        public String getTaskName() {
            return task;
        }
    });
}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:24,代碼來源:LogView.java

示例3: updateProcessList

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
/**
 * Updates the process list
 */
public void updateProcessList() {
    if (logListener != null) {
        UIUtil.invokeLaterIfNeeded(() -> {
            try {
                if (device != null && logListener != null) {
                    List<Client> clients = Lists.newArrayList(device.getClients());
                    clients.sort(new ClientCellRenderer.ClientComparator());
                    logListener.onProcessList(toLogProcess(clients));
                }
            } catch (Exception ignored) {

            }
        });
    }
}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:19,代碼來源:DeviceLogDataProvider.java

示例4: createGist

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
/**
 * Create gist and returns the gist url
 */
public void createGist(Project project, final String content, final GistListener gistListener) {
    SingleTaskBackgroundExecutor.executeIfPossible(project, progressIndicator -> {
        try {
            String json = getCreateGistJson(content);
            UIUtil.invokeLaterIfNeeded(() -> progressIndicator.setFraction(.4));
            String result = callGistApi(json, gistListener);
            UIUtil.invokeLaterIfNeeded(() -> progressIndicator.setFraction(.8));
            if (result != null) {
                gistListener.onGistCreated(result);
            } else {
                gistListener.onGistFailed("Failed to share");
            }
            UIUtil.invokeLaterIfNeeded(() -> progressIndicator.setFraction(1));
        } catch (Exception ex) {
            gistListener.onGistFailed(ex.getMessage());
        }

    });
}
 
開發者ID:josesamuel,項目名稱:logviewer,代碼行數:23,代碼來源:GistCreator.java

示例5: createCustomPanel

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Nullable
@Override
protected JComponent createCustomPanel() {
  myIconProjectsLabel = new JBLabel("Icon Projects:", SwingConstants.RIGHT);
  myIconProjects = TextFieldWithAutoCompletion.create(
    myProject,
    Collections.emptyList(),
    true,
    myRepository.getIconProjects()
  );
  JBLabel descLabel = new JBLabel();
  descLabel.setCopyable(true);
  descLabel.setText("Only one icon is shown for each task. " +
                    "This icon is extracted from the projects the task belongs to.<br>" +
                    "You can specify the projects whose icons will be used first. " +
                    "Separate multiple projects with commas.");
  descLabel.setComponentStyle(UIUtil.ComponentStyle.SMALL);
  return FormBuilder.createFormBuilder()
    .addLabeledComponent(myIconProjectsLabel, myIconProjects)
    .addComponentToRightColumn(descLabel)
    .getPanel();
}
 
開發者ID:mmm444,項目名稱:ijphab,代碼行數:23,代碼來源:PhabricatorRepositoryEditor.java

示例6: createIssuesComponentsTreeView

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
private JComponent createIssuesComponentsTreeView() {
    issuesCount = new JBLabel("Issues (0) ");

    JPanel componentsTreePanel = new JBPanel(new BorderLayout()).withBackground(UIUtil.getTableBackground());
    JLabel componentsTreeTitle = new JBLabel(" Components Tree");
    componentsTreeTitle.setFont(componentsTreeTitle.getFont().deriveFont(TITLE_FONT_SIZE));
    componentsTreePanel.add(componentsTreeTitle, BorderLayout.LINE_START);
    componentsTreePanel.add(issuesCount, BorderLayout.LINE_END);

    issuesCountPanel = new JBPanel().withBackground(UIUtil.getTableBackground());
    issuesCountPanel.setLayout(new BoxLayout(issuesCountPanel, BoxLayout.Y_AXIS));
    issuesComponentsTree.setCellRenderer(new IssuesTreeCellRenderer());
    issuesComponentsTree.expandRow(0);
    issuesComponentsTree.setRootVisible(false);
    issuesTreeExpansionListener = new IssuesTreeExpansionListener(issuesComponentsTree, issuesCountPanel, issuesCountPanels);

    JBPanel treePanel = new JBPanel(new BorderLayout()).withBackground(UIUtil.getTableBackground());
    TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(issuesComponentsTree);
    treePanel.add(treeSpeedSearch.getComponent(), BorderLayout.WEST);
    treePanel.add(issuesCountPanel, BorderLayout.CENTER);
    JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(treePanel);
    treeScrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_BAR_SCROLLING_UNITS);
    return new TitledPane(JSplitPane.VERTICAL_SPLIT, TITLE_LABEL_SIZE, componentsTreePanel, treeScrollPane);
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:25,代碼來源:XrayToolWindow.java

示例7: createLicensesComponentsTreeView

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
private JComponent createLicensesComponentsTreeView() {
    JPanel componentsTreePanel = new JBPanel(new BorderLayout());
    componentsTreePanel.setBackground(UIUtil.getTableBackground());
    JLabel componentsTreeTitle = new JBLabel(" Components Tree");
    componentsTreeTitle.setFont(componentsTreeTitle.getFont().deriveFont(TITLE_FONT_SIZE));
    componentsTreePanel.add(componentsTreeTitle, BorderLayout.WEST);

    licensesComponentsTree.expandRow(0);
    licensesComponentsTree.setRootVisible(false);
    licensesComponentsTree.setCellRenderer(new LicensesTreeCellRenderer());
    TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(licensesComponentsTree);
    JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(treeSpeedSearch.getComponent());
    treeScrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_BAR_SCROLLING_UNITS);
    return new TitledPane(JSplitPane.VERTICAL_SPLIT, TITLE_LABEL_SIZE, componentsTreePanel, treeScrollPane);

}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:17,代碼來源:XrayToolWindow.java

示例8: addJtext

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
private static void addJtext(JPanel panel, int place, String header, String text) {
    JLabel headerLabel = new JBLabel(header);
    headerLabel.setOpaque(true);
    headerLabel.setBackground(UIUtil.getTableBackground());
    headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.ipadx = 20;
    c.ipady = 3;

    c.gridy = place;
    panel.add(headerLabel, c);

    c.gridx = 1;
    c.weightx = 0.9;
    panel.add(createJTextArea(text, true), c);
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:20,代碼來源:DetailsViewFactory.java

示例9: getModuleNameAndPath

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@NotNull
protected String getModuleNameAndPath(@NotNull final HybrisModuleDescriptor moduleDescriptor) {
    Validate.notNull(moduleDescriptor);

    final StringBuilder builder = new StringBuilder();
    builder.append(moduleDescriptor.getName());

    final Font font = getComponent().getFont();
    final BufferedImage img = UIUtil.createImage(1, 1, BufferedImage.TYPE_INT_ARGB);
    final FontMetrics fm = img.getGraphics().getFontMetrics(font);

    final int currentWidth = fm.stringWidth(builder.toString());
    final int spaceWidth = fm.charWidth(' ');
    final int spaceCount = (COLUMN_WIDTH - currentWidth) / spaceWidth;

    for (int index = 0; index < spaceCount; index++) {
        builder.append(' ');
    }

    builder.append(" (");
    builder.append(moduleDescriptor.getRelativePath());
    builder.append(')');

    return builder.toString();
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:26,代碼來源:AbstractSelectModulesToImportStep.java

示例10: getAntTreeBuilder

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Nullable
private static AbstractTreeBuilder getAntTreeBuilder(final AntExplorer antExplorer) {
    final JTree tree = UIUtil.findComponentOfType(antExplorer, JTree.class);

    if (tree == null) {
        LOG.info("Cannot get tree object from AntExplorer");
        return null;
    }
    final AbstractTreeBuilder antTreeBuilder = AbstractTreeBuilder.getBuilderFor(tree);

    if (antTreeBuilder == null) {
        LOG.info("Cannot get Ant tree builder");
        return null;
    }
    if (antTreeBuilder.isDisposed()) {
        LOG.info("Ant tree builder is disposed");
        return null;
    }
    return antTreeBuilder;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:21,代碼來源:AntTreeUpdatingHack.java

示例11: customizeCellRenderer

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
    Color bgColor = UIUtil.getListBackground();
    setPaintFocusBorder(hasFocus && UIUtil.isToUseDottedCellBorder());

    if (value instanceof SearchResultElement) {
        SearchResultElement element = (SearchResultElement) value;
        String stringKeyText = "(" + element.getName() + ")";
        String text = new StringEllipsisPolicy().ellipsizeText(element.getValue(), matcher);

        SimpleTextAttributes nameAttributes = new SimpleTextAttributes(Font.PLAIN, list.getForeground());
        SpeedSearchUtil.appendColoredFragmentForMatcher(text, this, nameAttributes, matcher, bgColor, selected);
        append(" " + stringKeyText, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
    }

    setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
}
 
開發者ID:hoai265,項目名稱:SearchResourcePlugin,代碼行數:18,代碼來源:ResultElementListCellRenderer.java

示例12: mouseClicked

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() == 1 && isEnabled()) {
    final com.jetbrains.edu.learning.courseFormat.tasks.Task task = StudyUtils.getCurrentTask(myProject);
    if (task != null && task.getStatus() != StudyStatus.Solved) {
      final ProgressIndicatorBase progress = new ProgressIndicatorBase();
      progress.setText(EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION);
      ProgressManager.getInstance().run(new Task.Backgroundable(myProject,
                                                                EduAdaptiveStepicConnector.LOADING_NEXT_RECOMMENDATION) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(false);
          ApplicationManager.getApplication().invokeLater(()->setBackground(UIUtil.getLabelBackground()));
          EduAdaptiveStepicConnector.addNextRecommendedTask(StepicAdaptiveReactionsPanel.this.myProject, task.getLesson(), indicator,
                                                            myReaction);
          StepicAdaptiveReactionsPanel.this.setEnabledRecursive(true);
        }
      });
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:22,代碼來源:StepicAdaptiveReactionsPanel.java

示例13: updateAdvancedSettings

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
private void updateAdvancedSettings(Course selectedCourse) {
  myAdvancedSettingsPlaceholder.setVisible(true);
  myLocationField.getComponent().setText(nameToLocation(selectedCourse.getName()));
  EduPluginConfigurator configurator = EduPluginConfigurator.INSTANCE.forLanguage(selectedCourse.getLanguageById());
  if (configurator == null) {
    return;
  }
  EduCourseProjectGenerator generator = configurator.getEduCourseProjectGenerator();
  if (generator == null) {
    return;
  }
  LabeledComponent<JComponent> component = generator.getLanguageSettingsComponent(selectedCourse);
  myAdvancedSettings.removeAll();
  myAdvancedSettings.add(myLocationField, BorderLayout.NORTH);
  if (component != null) {
    myAdvancedSettings.add(component, BorderLayout.SOUTH);
    UIUtil.mergeComponentsWithAnchor(myLocationField, component);
  }
  myAdvancedSettings.revalidate();
  myAdvancedSettings.repaint();
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:22,代碼來源:EduCoursesPanel.java

示例14: createUIComponents

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
private void createUIComponents() {
  mySearchField = new FilterComponent("Edu.NewCourse", 5, true) {
    @Override
    public void filter() {
      String filter = getFilter();
      List<Course> filtered = new ArrayList<>();
      for (Course course : myCourses) {
        if (accept(filter, course)) {
          filtered.add(course);
        }
      }
      updateModel(filtered, null);
    }
  };
  UIUtil.setBackgroundRecursively(mySearchField, UIUtil.getTextFieldBackground());
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:17,代碼來源:EduCoursesPanel.java

示例15: createTaskInfoPanel

import com.intellij.util.ui.UIUtil; //導入依賴的package包/類
@Override
public JComponent createTaskInfoPanel(Project project) {
  myTaskTextPane = new JTextPane();
  final JBScrollPane scrollPane = new JBScrollPane(myTaskTextPane);
  myTaskTextPane.setContentType(new HTMLEditorKit().getContentType());
  final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  int fontSize = editorColorsScheme.getEditorFontSize();
  final String fontName = editorColorsScheme.getEditorFontName();
  final Font font = new Font(fontName, Font.PLAIN, fontSize);
  String bodyRule = "body { font-family: " + font.getFamily() + "; " +
                    "font-size: " + font.getSize() + "pt; }" +
                    "pre {font-family: Courier; display: inline; ine-height: 50px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}" +
                    "code {font-family: Courier; display: flex; float: left; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}";
  ((HTMLDocument)myTaskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
  myTaskTextPane.setEditable(false);
  if (!UIUtil.isUnderDarcula()) {
    myTaskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
  }
  myTaskTextPane.setBorder(new EmptyBorder(20, 20, 0, 10));
  myTaskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  return scrollPane;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:25,代碼來源:StudySwingToolWindow.java


注:本文中的com.intellij.util.ui.UIUtil類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。