本文整理匯總了Java中com.intellij.util.ui.UIUtil.findUltimateParent方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.findUltimateParent方法的具體用法?Java UIUtil.findUltimateParent怎麽用?Java UIUtil.findUltimateParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.ui.UIUtil
的用法示例。
在下文中一共展示了UIUtil.findUltimateParent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: revalidateAndRepaint
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
void revalidateAndRepaint(final boolean layoutNow) {
if (myVisibleInfos.isEmpty()) {
setOpaque(false);
final Component nonOpaque = UIUtil.findUltimateParent(this);
if (nonOpaque != null && getParent() != null) {
final Rectangle toRepaint = SwingUtilities.convertRectangle(getParent(), getBounds(), nonOpaque);
nonOpaque.repaint(toRepaint.x, toRepaint.y, toRepaint.width, toRepaint.height);
}
}
else {
setOpaque(true);
}
if (layoutNow) {
validate();
}
else {
revalidate();
}
repaint();
}
示例2: getIdeFrame
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public IdeFrame getIdeFrame(@Nullable final Project project) {
if (project != null) {
return getFrame(project);
}
final Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
final Component parent = UIUtil.findUltimateParent(window);
if (parent instanceof IdeFrame) return (IdeFrame)parent;
final Frame[] frames = Frame.getFrames();
for (Frame each : frames) {
if (each instanceof IdeFrame) {
return (IdeFrame)each;
}
}
return null;
}
示例3: findRoot
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Nullable
private static JRootPane findRoot(MouseEvent e) {
final Component parent = UIUtil.findUltimateParent(e.getComponent());
JRootPane root = null;
if (parent instanceof JWindow) {
root = ((JWindow)parent).getRootPane();
}
else if (parent instanceof JDialog) {
root = ((JDialog)parent).getRootPane();
}
else if (parent instanceof JFrame) {
root = ((JFrame)parent).getRootPane();
}
return root;
}
示例4: storeLastFocusedComponent
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private static void storeLastFocusedComponent(WindowEvent we) {
final Window eventWindow = we.getWindow();
if (we.getID() == WindowEvent.WINDOW_DEACTIVATED || we.getID() == WindowEvent.WINDOW_LOST_FOCUS) {
Component frame = UIUtil.findUltimateParent(eventWindow);
Component focusOwnerInDeactivatedWindow = eventWindow.getMostRecentFocusOwner();
IdeFrame[] allProjectFrames = WindowManager.getInstance().getAllProjectFrames();
if (focusOwnerInDeactivatedWindow != null) {
for (IdeFrame ideFrame : allProjectFrames) {
JFrame aFrame = WindowManager.getInstance().getFrame(ideFrame.getProject());
if (aFrame.equals(frame)) {
IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
if (focusManager instanceof FocusManagerImpl) {
((FocusManagerImpl)focusManager).setLastFocusedAtDeactivation(ideFrame, focusOwnerInDeactivatedWindow);
}
}
}
}
}
}
示例5: eventDispatched
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void eventDispatched(AWTEvent event) {
final Component ultimateParent = UIUtil.findUltimateParent(this);
final Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
// Un-idle this only if our ide window is active
if (ApplicationManager.getApplication().isActive() && ultimateParent == activeWindow) {
lastActivityAtMs = System.currentTimeMillis();
if (idle) {
idle = false;
setRunning(true);
}
}
}
示例6: findByComponent
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Nullable
private static IdeFocusManager findByComponent(Component c) {
final Component parent = UIUtil.findUltimateParent(c);
if (parent instanceof IdeFrame) {
return getInstanceSafe(((IdeFrame)parent).getProject());
}
return null;
}
示例7: delayedApplicationDeactivated
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void delayedApplicationDeactivated(IdeFrame ideFrame) {
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
Component parent = UIUtil.findUltimateParent(owner);
if (parent == ideFrame) {
myLastFocusedAtDeactivation.put(ideFrame, owner);
}
}
示例8: hasMnemonicInBalloons
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private static boolean hasMnemonicInBalloons(Container container, int code) {
final Component parent = UIUtil.findUltimateParent(container);
if (parent instanceof RootPaneContainer) {
final JLayeredPane pane = ((RootPaneContainer)parent).getLayeredPane();
for (Component component : pane.getComponents()) {
if (component instanceof ComponentWithMnemonics && component instanceof Container && hasMnemonic((Container)component, code)) {
return true;
}
}
}
return false;
}
示例9: show
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void show(final Component component, int x, int y) {
if (!component.isShowing()) {
//noinspection HardCodedStringLiteral
throw new IllegalArgumentException("component must be shown on the screen");
}
removeAll();
// Fill menu. Only after filling menu has non zero size.
int x2 = Math.max(0, Math.min(x, component.getWidth() - 1)); // fit x into [0, width-1]
int y2 = Math.max(0, Math.min(y, component.getHeight() - 1)); // fit y into [0, height-1]
myContext = myDataContextProvider != null ? myDataContextProvider.get() : DataManager.getInstance().getDataContext(component, x2, y2);
Utils.fillMenu(myGroup, this, true, myPresentationFactory, myContext, myPlace, false, false);
if (getComponentCount() == 0) {
return;
}
if (myApp != null) {
if (myApp.isActive()) {
Component frame = UIUtil.findUltimateParent(component);
if (frame instanceof IdeFrame) {
myFrame = (IdeFrame)frame;
}
myConnection = myApp.getMessageBus().connect();
myConnection.subscribe(ApplicationActivationListener.TOPIC, ActionPopupMenuImpl.this);
}
}
super.show(component, x, y);
}
示例10: getIdeFrame
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public IdeFrame getIdeFrame(DockContainer container) {
Component parent = UIUtil.findUltimateParent(container.getContainerComponent());
if (parent instanceof IdeFrame) {
return (IdeFrame)parent;
}
return null;
}
示例11: _restoreFocus
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private ActionCallback _restoreFocus() {
final List<FocusTrackback> stack = getCleanStack();
if (!stack.contains(this)) return ActionCallback.REJECTED;
Component toFocus = queryToFocus(stack, this, true);
final ActionCallback result = new ActionCallback();
if (toFocus != null) {
final Component ownerBySwing = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (ownerBySwing != null) {
final Window ownerBySwingWindow = SwingUtilities.getWindowAncestor(ownerBySwing);
if (ownerBySwingWindow != null && ownerBySwingWindow == SwingUtilities.getWindowAncestor(toFocus)) {
if (!UIUtil.isMeaninglessFocusOwner(ownerBySwing)) {
toFocus = ownerBySwing;
}
}
}
if (myParentWindow != null) {
final Window to = UIUtil.getWindow(toFocus);
if (to != null && UIUtil.findUltimateParent(to) == UIUtil.findUltimateParent(myParentWindow)) { // IDEADEV-34537
requestFocus(toFocus);
result.setDone();
}
} else {
requestFocus(toFocus);
result.setDone();
}
}
if (!result.isDone()) {
result.setRejected();
}
stack.remove(this);
dispose();
return result;
}
示例12: dispatchKeyEvent
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public boolean dispatchKeyEvent(@NotNull KeyEvent e) {
if (!QuickAccessSettings.getInstance().isEnabled()) {
return false;
}
Component frame = UIUtil.findUltimateParent(e.getComponent());
if (frame instanceof IdeFrame) {
Project project = ((IdeFrame)frame).getProject();
if (project != null && !project.isDefault()) {
return SwitchManager.getInstance(project).dispatchKeyEvent(e);
}
}
return false;
}
示例13: show
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void show(boolean requestFocus) {
JComponent toFocus = myRootContent.getTargetComponent() == myActiveContentComponent ? myActiveFocusedContent : myInactiveContentComponent;
final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myRootContent, toFocus);
builder.addListener(new JBPopupAdapter() {
public void onClosed(LightweightWindowEvent event) {
myProgressPanel.hideProcessPopup();
}
});
builder.setMovable(true);
builder.setResizable(true);
builder.setTitle(IdeBundle.message("progress.window.title"));
builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
builder.setCancelOnClickOutside(false);
builder.setRequestFocus(requestFocus);
builder.setBelongsToGlobalPopupStack(false);
builder.setLocateByContent(true);
builder.setCancelButton(new MinimizeButton("Hide"));
JFrame frame = (JFrame)UIUtil.findUltimateParent(myProgressPanel);
updateContentUI();
myActiveContentComponent.setBorder(null);
if (frame != null) {
Dimension contentSize = myRootContent.getPreferredSize();
Rectangle bounds = frame.getBounds();
int width = Math.max(bounds.width / 4, contentSize.width);
int height = Math.min(bounds.height / 4, contentSize.height);
int x = (int)(bounds.getMaxX() - width);
int y = (int)(bounds.getMaxY() - height);
myPopup = builder.createPopup();
StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar();
if (sb.isVisible()) {
y -= sb.getSize().height;
}
myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
} else {
myPopup = builder.createPopup();
myPopup.showInCenterOf(myProgressPanel.getRootPane());
}
}
示例14: dispatchKeyEvent
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyCode() != KeyEvent.VK_CONTROL &&
e.getKeyCode() != KeyEvent.VK_ALT &&
e.getKeyCode() != KeyEvent.VK_SHIFT &&
e.getKeyCode() != KeyEvent.VK_META) {
if (e.getModifiers() == 0) {
resetHoldState();
}
return false;
}
if (e.getID() != KeyEvent.KEY_PRESSED && e.getID() != KeyEvent.KEY_RELEASED) return false;
Component parent = UIUtil.findUltimateParent(e.getComponent());
if (parent instanceof IdeFrame) {
if (((IdeFrame)parent).getProject() != myProject) {
resetHoldState();
return false;
}
}
Set<Integer> vks = getActivateToolWindowVKs();
if (vks.isEmpty()) {
resetHoldState();
return false;
}
if (vks.contains(e.getKeyCode())) {
boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
int modifiers = e.getModifiers();
int mouseMask = InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK;
if ((e.getModifiersEx() & mouseMask) == 0) {
if (SwitchManager.areAllModifiersPressed(modifiers, vks) || !pressed) {
processState(pressed);
}
else {
resetHoldState();
}
}
}
return false;
}
示例15: getIdeFrameFromWindow
import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private static IdeFrame getIdeFrameFromWindow (Window window) {
final Component frame = UIUtil.findUltimateParent(window);
return (frame instanceof IdeFrame) ? (IdeFrame)frame : null;
}