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


Java UIUtil.getParentOfType方法代碼示例

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


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

示例1: rebuildListContent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void rebuildListContent() {
    ArrayList<Item> items = new ArrayList<>();
    int i = 0;
    List<Data> contents = new ArrayList<>(getContents());
    for (Data content : contents) {
        String fullString = getStringRepresentationFor(content);
        if (fullString != null) {
            fullString = StringUtil.convertLineSeparators(fullString);
            String shortString = getShortStringFor(content, fullString);
            items.add(new Item(i++, shortString, fullString));
        }
    }
    myAllContents = contents;
    FilteringListModel listModel = (FilteringListModel) myList.getModel();
    ((CollectionListModel) listModel.getOriginalModel()).removeAll();
    listModel.addAll(items);
    ListWithFilter listWithFilter = UIUtil.getParentOfType(ListWithFilter.class, myList);
    if (listWithFilter != null) {
        listWithFilter.getSpeedSearch().update();
        if (listModel.getSize() == 0) listWithFilter.resetFilter();
    }
}
 
開發者ID:vsch,項目名稱:MissingInActions,代碼行數:23,代碼來源:ContentChooser.java

示例2: layoutContainer

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void layoutContainer(Container parent) {
  JBViewport viewport = (JBViewport)parent;
  Component view = viewport.getView();
  JBScrollPane scrollPane = UIUtil.getParentOfType(JBScrollPane.class, parent);
  // do not force viewport size on editor component, e.g. EditorTextField and LanguageConsole
  if (view == null || scrollPane == null || view instanceof TypingTarget) {
    super.layoutContainer(parent);
    return;
  }

  Dimension size = doSuperLayoutContainer(viewport);

  Dimension visible = viewport.getExtentSize();
  if (scrollPane.getHorizontalScrollBarPolicy() == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
    size.width = visible.width;
  }
  if (scrollPane.getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) {
    size.height = visible.height;
  }
  viewport.setViewSize(size);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:JBViewport.java

示例3: fireSelectedEditorChanged

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void fireSelectedEditorChanged(final FileEditor oldSelectedEditor, final FileEditor newSelectedEditor){
  if ((!EventQueue.isDispatchThread() || !myFileEditorManager.isInsideChange()) && !Comparing.equal(oldSelectedEditor, newSelectedEditor)) {
    myFileEditorManager.notifyPublisher(new Runnable() {
      @Override
      public void run() {
        final FileEditorManagerEvent event = new FileEditorManagerEvent(myFileEditorManager, myFile, oldSelectedEditor, myFile, newSelectedEditor);
        final FileEditorManagerListener publisher = myFileEditorManager.getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER);
        publisher.selectionChanged(event);
      }
    });
    final JComponent component = newSelectedEditor.getComponent();
    final EditorWindowHolder holder = UIUtil.getParentOfType(EditorWindowHolder.class, component);
    if (holder != null) {
      ((FileEditorManagerImpl)myFileEditorManager).addSelectionRecord(myFile, holder.getEditorWindow());
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:EditorComposite.java

示例4: update

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
  Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  e.getPresentation().setEnabled(false);
  if (focusOwner instanceof JComponent && SpeedSearchBase.hasActiveSpeedSearch((JComponent)focusOwner)) {
    return;
  }

  if (StackingPopupDispatcher.getInstance().isPopupFocused()) return;
  JTree tree = UIUtil.getParentOfType(JTree.class, focusOwner);
  JTable table = UIUtil.getParentOfType(JTable.class, focusOwner);
  
  if (tree != null || table != null) {
    if (hasNoEditingTreesOrTablesUpward(focusOwner)) {
      e.getPresentation().setEnabled(true);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:DialogWrapperPeerImpl.java

示例5: autoscroll

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private boolean autoscroll() {
  JScrollPane scrollPane = UIUtil.getParentOfType(JScrollPane.class, myLatestDragEvent.getComponent());
  if (scrollPane == null) return false;

  boolean scrolled = scroll(scrollPane.getVerticalScrollBar(), myVerticalScrollDelta);
  scrolled |= scroll(scrollPane.getHorizontalScrollBar(), myHorizontalScrollDelta);
  return scrolled;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:JBAutoscroller.java

示例6: actionPerformed

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  JComponent button = (JComponent)e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY);
  if (button == null) {
    Component contextComponent = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
    JRootPane rootPane = UIUtil.getParentOfType(JRootPane.class, contextComponent);
    if (rootPane != null) {
      button = (ComboBoxButton)
        UIUtil.uiTraverser().withRoot(rootPane).bfsTraversal().filter(new Condition<Component>() {
          @Override
          public boolean value(Component component) {
            return component instanceof ComboBoxButton && ((ComboBoxButton)component).getMyAction() == ComboBoxAction.this;
          }
        }).first();
    }
    if (button == null) return;
  }
  if (!button.isShowing()) return;
  if (button instanceof ComboBoxButton) {
    ((ComboBoxButton)button).showPopup();
  } else {
    DataContext context = e.getDataContext();
    Project project = e.getProject();
    if (project == null) return;
    DefaultActionGroup group = createPopupActionGroup(button);
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
      myPopupTitle, group, context, false, shouldShowDisabledActions(), false, null, getMaxRows(), getPreselectCondition());
    popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
    popup.showCenteredInCurrentWindow(project);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:ComboBoxAction.java

示例7: isEditorComponentActive

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public boolean isEditorComponentActive() {
  ApplicationManager.getApplication().assertIsDispatchThread();

  Component owner = getFocusManager().getFocusOwner();
  EditorsSplitters splitters = UIUtil.getParentOfType(EditorsSplitters.class, owner);
  return splitters != null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ToolWindowManagerImpl.java

示例8: uiSettingsChanged

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void uiSettingsChanged(UISettings source) {
  setMemoryIndicatorVisible(source.SHOW_MEMORY_INDICATOR);
  updateToolbarVisibility();
  updateStatusBarVisibility();
  for (IdeRootPaneNorthExtension component : myNorthComponents) {
    component.uiSettingsChanged(source);
  }
  IdeFrame frame = UIUtil.getParentOfType(IdeFrame.class, this);
  BalloonLayout layout = frame != null ? frame.getBalloonLayout() : null;
  if (layout instanceof BalloonLayoutImpl) ((BalloonLayoutImpl)layout).queueRelayout();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:IdeRootPane.java

示例9: fireSelectionChanged

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void fireSelectionChanged(final EditorComposite newSelectedComposite) {
  final Trinity<VirtualFile, FileEditor, FileEditorProvider> oldData = extract(SoftReference.dereference(myLastSelectedComposite));
  final Trinity<VirtualFile, FileEditor, FileEditorProvider> newData = extract(newSelectedComposite);
  myLastSelectedComposite = newSelectedComposite == null ? null : new WeakReference<EditorComposite>(newSelectedComposite);
  final boolean filesEqual = oldData.first == null ? newData.first == null : oldData.first.equals(newData.first);
  final boolean editorsEqual = oldData.second == null ? newData.second == null : oldData.second.equals(newData.second);
  if (!filesEqual || !editorsEqual) {
    if (oldData.first != null && newData.first != null) {
      for (FileEditorAssociateFinder finder : Extensions.getExtensions(FileEditorAssociateFinder.EP_NAME)) {
        VirtualFile associatedFile = finder.getAssociatedFileToOpen(myProject, oldData.first);

        if (Comparing.equal(associatedFile, newData.first)) {
          return;
        }
      }
    }

    final FileEditorManagerEvent event =
      new FileEditorManagerEvent(this, oldData.first, oldData.second, oldData.third, newData.first, newData.second, newData.third);
    final FileEditorManagerListener publisher = getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER);

    if (newData.first != null) {
      final JComponent component = newData.second.getComponent();
      final EditorWindowHolder holder = UIUtil.getParentOfType(EditorWindowHolder.class, component);
      if (holder != null) {
        addSelectionRecord(newData.first, holder.getEditorWindow());
      }
    }
    notifyPublisher(new Runnable() {
      @Override
      public void run() {
        publisher.selectionChanged(event);
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:37,代碼來源:FileEditorManagerImpl.java

示例10: getEditorWindow

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Nullable
private static EditorWindow getEditorWindow(AnActionEvent e) {
  final Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component != null) {
    final EditorsSplitters splitters = UIUtil.getParentOfType(EditorsSplitters.class, component);
    if (splitters != null) {
      return splitters.getCurrentWindow();
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:ReopenClosedTabAction.java

示例11: createUI

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
public static ComponentUI createUI(JComponent c) {
  if (UIUtil.getParentOfType(CellRendererPane.class, c) != null) {
    c.setBorder(null);
  }
  return new DarculaCheckBoxUI();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:DarculaCheckBoxUI.java

示例12: getBackgroundColor

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private Color getBackgroundColor(boolean enabled, final EditorColorsScheme colorsScheme){
  if (myEnforcedBgColor != null) return myEnforcedBgColor;
  if (UIUtil.getParentOfType(CellRendererPane.class, this) != null && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) {
    return getParent().getBackground();
  }

  if (UIUtil.isUnderDarcula()/* || UIUtil.isUnderIntelliJLaF()*/) return UIUtil.getTextFieldBackground();

  return enabled
         ? colorsScheme.getDefaultBackground()
         : UIUtil.getInactiveTextFieldBackgroundColor();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:EditorTextField.java

示例13: actionPerformed

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  final Component c = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (c != null) {
    final JTree tree = UIUtil.getParentOfType(JTree.class, c);
    if (tree != null) {
      TreeUtil.expandAll(tree);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ExpandAll.java

示例14: updateScroller

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public static void updateScroller(@NotNull JTable table) {
  JScrollPane scrollPane = UIUtil.getParentOfType(JScrollPane.class, table);
  if (scrollPane != null) {
    scrollPane.revalidate();
    scrollPane.repaint();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:TableUtil.java

示例15: isSearchActive

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public static boolean isSearchActive(JList list) {
  final ListWithFilter listWithFilter = UIUtil.getParentOfType(ListWithFilter.class, list);
  return listWithFilter != null && listWithFilter.mySpeedSearch.searchFieldShown;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:ListWithFilter.java


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