Java Code Examples for com.intellij.util.ReflectionUtil#resetField()
The following examples show how to use
com.intellij.util.ReflectionUtil#resetField() .
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: ReflectionUtilTest.java From consulo with Apache License 2.0 | 6 votes |
public void testResetField() throws Exception { final Reset reset = new Reset(); ReflectionUtil.resetField(reset, String.class, "STRING"); assertNull(reset.STRING); ReflectionUtil.resetField(reset, boolean.class, "BOOLEAN"); assertFalse(reset.BOOLEAN); ReflectionUtil.resetField(reset, int.class, "INT"); assertEquals(0, reset.INT); ReflectionUtil.resetField(reset, double.class, "DOUBLE"); assertEquals(0d, reset.DOUBLE); ReflectionUtil.resetField(reset, float.class, "FLOAT"); assertEquals(0f, reset.FLOAT); ReflectionUtil.resetField(Reset.class, String.class, "STATIC_STRING"); assertNull(Reset.STATIC_STRING); }
Example 2
Source File: PopupComponent.java From consulo with Apache License 2.0 | 5 votes |
public void hide(boolean dispose) { myPopup.hide(); Window wnd = getWindow(); if (wnd instanceof JWindow) { JRootPane rootPane = ((JWindow)wnd).getRootPane(); if (rootPane != null) { ReflectionUtil.resetField(rootPane, "clientProperties"); final Container cp = rootPane.getContentPane(); if (cp != null) { cp.removeAll(); } } } }
Example 3
Source File: SwingCleanuper.java From consulo with Apache License 2.0 | 5 votes |
private static void resetField(Object object, Class type, @NonNls String name) { try { ReflectionUtil.resetField(object, ReflectionUtil.findField(object.getClass(), type, name)); } catch (Exception e) { // Ignore } }
Example 4
Source File: SwingCleanuper.java From consulo with Apache License 2.0 | 4 votes |
private static void fixJTextComponentMemoryLeak() { final JTextComponent component = ReflectionUtil.getStaticFieldValue(JTextComponent.class, JTextComponent.class, "focusedComponent"); if (component != null && !component.isDisplayable()) { ReflectionUtil.resetField(JTextComponent.class, JTextComponent.class, "focusedComponent"); } }