Beispiel #1
0
  static boolean customThemeDialog(Component parent) {

    Color customColor =
        JColorChooser.showDialog(
            parent,
            Locale.explain("ui.chooseBase"), // $NON-NLS-1$
            ShadeConfig.theme.get().getBase());
    if (customColor != null) {
      CUSTOM.getLookAndFeel().setBase(customColor);
      return true;
    }

    return false;
  }
Beispiel #2
0
  /**
   * Add a request to the stack of requests to execute in the update thread.
   *
   * @param uiRequest The request to execute in the update thread.
   */
  public void request(Request uiRequest) {

    UpdateRequest newRequest =
        new UpdateRequest(
            uiRequest,
            new RuntimeException(
                Locale.explain("err.originates")
                    + Thread.currentThread().getName())); // $NON-NLS-1$

    /* Don't process a request if the next pending or currently executing request is the same. */
    if (newRequest.equals(currentRequest) || requests.contains(newRequest)) return;

    /* Add this request to the request list. */
    synchronized (requests) {
      try {
        if (!requests.offer(newRequest, 500, TimeUnit.MILLISECONDS))
          throw new InterruptedException("Maximum wait time elapsed.");
      } catch (InterruptedException e) {
        logger.err(e, "err.updateQueueFull", newRequest);
      }
    }
  }