/** Initialize this plugin. */
 public synchronized void initialize() throws PluginException {
   _resources =
       new PluginResources(
           "net.sourceforge.squirrel_sql.plugins.swing-violation.swing-violation", this);
   EDTViolationRepaintManager manager = new EDTViolationRepaintManager(true, getApplication());
   RepaintManager.setCurrentManager(manager);
 }
Beispiel #2
0
  /** Creates a new, blank {@code G2DGLCanvas} using the given OpenGL capabilities. */
  public GLG2DCanvas(GLCapabilities capabilities) {
    canvas = createGLComponent(capabilities, null);

    /*
     * Set both canvas and drawableComponent to be the same size, but we never
     * draw the drawableComponent except into the canvas.
     */
    setLayout(new GLOverlayLayout());
    add((Component) canvas);

    setGLDrawing(true);

    RepaintManager.setCurrentManager(GLAwareRepaintManager.INSTANCE);
  }
 public static void main(String[] args) throws Exception {
   // set CheckThreadViolationRepaintManager
   RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
   // Valid code
   SwingUtilities.invokeAndWait(
       new Runnable() {
         public void run() {
           test();
         }
       });
   System.out.println("Valid code passed...");
   repaintTest();
   System.out.println("Repaint test - correct code");
   // Invalide code (stack trace expected)
   //        test();
   SwingUtilities.invokeAndWait(
       new Runnable() {
         public void run() {
           imageUpdateTest();
         }
       });
 }
  public ApplicationImpl(
      boolean isInternal,
      boolean isUnitTestMode,
      boolean isHeadless,
      boolean isCommandLine,
      @NotNull String appName) {
    super(null);

    getPicoContainer().registerComponentInstance(Application.class, this);

    CommonBundle.assertKeyIsFound = isUnitTestMode;

    if ((isInternal || isUnitTestMode)
        && !Comparing.equal("off", System.getProperty("idea.disposer.debug"))) {
      Disposer.setDebugMode(true);
    }
    myStartTime = System.currentTimeMillis();
    myName = appName;
    ApplicationManagerEx.setApplication(this);

    PluginsFacade.INSTANCE =
        new PluginsFacade() {
          public IdeaPluginDescriptor getPlugin(PluginId id) {
            return PluginManager.getPlugin(id);
          }

          public IdeaPluginDescriptor[] getPlugins() {
            return PluginManager.getPlugins();
          }
        };

    if (!isUnitTestMode && !isHeadless) {
      Toolkit.getDefaultToolkit().getSystemEventQueue().push(IdeEventQueue.getInstance());
      if (Patches.SUN_BUG_ID_6209673) {
        RepaintManager.setCurrentManager(new IdeRepaintManager());
      }
      IconLoader.activate();
    }

    myIsInternal = isInternal;
    myTestModeFlag = isUnitTestMode;
    myHeadlessMode = isHeadless;
    myCommandLineMode = isCommandLine;

    loadApplicationComponents();

    if (myTestModeFlag) {
      registerShutdownHook();
    }

    if (!isUnitTestMode && !isHeadless) {
      Disposer.register(this, Disposer.newDisposable(), "ui");

      StartupUtil.addExternalInstanceListener(
          new Consumer<List<String>>() {
            @Override
            public void consume(final List<String> args) {
              invokeLater(
                  new Runnable() {
                    @Override
                    public void run() {
                      final Project project = CommandLineProcessor.processExternalCommandLine(args);
                      final IdeFrame frame;
                      if (project != null) {
                        frame = WindowManager.getInstance().getIdeFrame(project);
                      } else {
                        frame = WindowManager.getInstance().getAllFrames()[0];
                      }
                      ((IdeFrameImpl) frame).requestFocus();
                    }
                  });
            }
          });
    }

    final String s = System.getProperty("jb.restart.code");
    if (s != null) {
      try {
        myRestartCode = Integer.parseInt(s);
      } catch (NumberFormatException ignore) {
      }
    }
  }