Package org.rssowl.core.util

Examples of org.rssowl.core.util.LoggingSafeRunnable


        if (task == null)
          return Status.OK_STATUS;

        /* Perform the Operation if not yet Cancelled */
        if (!monitor.isCanceled()) {
          SafeRunner.run(new LoggingSafeRunnable() {
            public void run() throws Exception {
              IStatus status = task.run(monitor);

              /* Log anything that is an Error or Warning */
              if (status.getSeverity() == IStatus.ERROR || status.getSeverity() == IStatus.WARNING)
View Full Code Here


      Activator.safeLogInfo(NLS.bind("End: Backup and Delete Profile ({0})", backupCandidate.getName())); //$NON-NLS-1$
    }
  }

  void dropDatabaseForTests() throws PersistenceException {
    SafeRunner.run(new LoggingSafeRunnable() {
      public void run() throws Exception {

        /* Shutdown DB */
        shutdown();

View Full Code Here

   * org.rssowl.core.persist.event.runnable.EventType)
   */
  public final void fireEvents(final Set<E> events, final EventType eventType) {
    Assert.isNotNull(eventType, "eventType"); //$NON-NLS-1$
    for (final L listener : fEntityListeners) {
      SafeRunner.run(new LoggingSafeRunnable() {
        public void run() throws Exception {
          switch (eventType) {
            case PERSIST:
              listener.entitiesAdded(events);
              break;
View Full Code Here

    Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance(), URLTransfer.getInstance() };

    /* Drag Support */
    fViewer.addDragSupport(ops, transfers, new DragSourceListener() {
      public void dragStart(final DragSourceEvent event) {
        SafeRunner.run(new LoggingSafeRunnable() {
          public void run() throws Exception {
            LocalSelectionTransfer.getTransfer().setSelection(fViewer.getSelection());
            LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
            event.doit = true;
          }
        });
      }

      public void dragSetData(final DragSourceEvent event) {
        SafeRunner.run(new LoggingSafeRunnable() {
          public void run() throws Exception {

            /* Set Selection using LocalSelectionTransfer */
            if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType))
              event.data = LocalSelectionTransfer.getTransfer().getSelection();

            /* Set Text using Text- or URLTransfer */
            else if (TextTransfer.getInstance().isSupportedType(event.dataType) || URLTransfer.getInstance().isSupportedType(event.dataType))
              setTextData(event);
          }
        });
      }

      public void dragFinished(DragSourceEvent event) {
        SafeRunner.run(new LoggingSafeRunnable() {
          public void run() throws Exception {
            LocalSelectionTransfer.getTransfer().setSelection(null);
            LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
          }
        });
View Full Code Here

    ViewerDropAdapter dropAdapter = new ViewerDropAdapter(fViewer) {
      @Override
      public boolean validateDrop(final Object target, int operation, TransferData transferType) {
        if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
          final boolean[] result = new boolean[] { false };
          SafeRunner.run(new LoggingSafeRunnable() {
            public void run() throws Exception {
              ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
              if (selection instanceof IStructuredSelection) {
                List<?> draggedObjects = ((IStructuredSelection) selection).toList();
                result[0] = isValidDrop(draggedObjects, target);
              }
            }
          });

          return result[0];
        }

        return false;
      }

      @Override
      public boolean performDrop(final Object data) {
        if (data instanceof IStructuredSelection) {
          SafeRunner.run(new LoggingSafeRunnable() {
            public void run() throws Exception {
              IStructuredSelection selection = (IStructuredSelection) data;
              List<?> draggedObjects = selection.toList();
              perfromDrop(draggedObjects, getCurrentTarget());
            }
View Full Code Here

  /* Process Message in Safe-Runnable */
  private void safeProcess(final Socket socket, final String message) {
    final boolean isDisplayOperation = isDisplayOperation(message);
    final boolean isResourceOperation = !isDisplayOperation && isResourceOperation(message);

    LoggingSafeRunnable runnable = new LoggingSafeRunnable() {
      public void run() throws Exception {

        /* This is a Display-Operation */
        if (isDisplayOperation)
          processDisplayOperation(socket, message);

        /* This is a Resource-Operation */
        else if (isResourceOperation)
          processResourceOperation(socket, message);

        /* This is a startup handshake */
        else
          processHandshake(message);
      }
    };

    /*
     * For some reason using SafeRunner from this method can cause in a Classloader deadlock
     * where Equinox will terminate classloading after 5000 ms to avoid it. This happens when
     * two instances of RSSOwl start at the same time, e.g. when clicking the icon twice.
     */
    if (!isDisplayOperation && !isResourceOperation) {
      try {
        runnable.run();
      } catch (Exception e) {
        runnable.handleException(e);
      }
    } else
      SafeRunner.run(runnable);
  }
View Full Code Here

      protected IStatus run(IProgressMonitor monitor) {
        fBatchInProcess.set(false);
        fForceQuickUpdate.set(false);

        /* Update all saved searches */
        SafeRunner.run(new LoggingSafeRunnable() {
          public void run() throws Exception {
            if (!Controller.getDefault().isShuttingDown())
              updateSavedSearches(true);
          }
        });
View Full Code Here

    notifyRedoPerformed();
  }

  private void notifyUndoPerformed() {
    for (final IUndoRedoListener listener : fListeners) {
      SafeRunnable.run(new LoggingSafeRunnable() {
        public void run() throws Exception {
          listener.undoPerformed();
        }
      });
    }
View Full Code Here

    }
  }

  private void notifyRedoPerformed() {
    for (final IUndoRedoListener listener : fListeners) {
      SafeRunnable.run(new LoggingSafeRunnable() {
        public void run() throws Exception {
          listener.redoPerformed();
        }
      });
    }
View Full Code Here

    }
  }

  private void notifyOperationAdded() {
    for (final IUndoRedoListener listener : fListeners) {
      SafeRunnable.run(new LoggingSafeRunnable() {
        public void run() throws Exception {
          listener.operationAdded();
        }
      });
    }
View Full Code Here

TOP

Related Classes of org.rssowl.core.util.LoggingSafeRunnable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.