Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.ISafeRunnable


   * <code>handleException<code> method.
   *
   * @param runnable
   */
  protected static void safeRun(final Runnable runnable) {
    ISafeRunnable safeRunnable;
    if (runnable instanceof ISafeRunnable) {
      safeRunnable = (ISafeRunnable) runnable;
    } else {
      safeRunnable = new ISafeRunnable() {
        public void handleException(Throwable exception) {
          Policy
              .getLog()
              .log(
                  new Status(
View Full Code Here


   * <code>handleException<code> method.
   *
   * @param runnable
   */
  protected static void safeRun(final Runnable runnable) {
    ISafeRunnable safeRunnable;
    if (runnable instanceof ISafeRunnable) {
      safeRunnable = (ISafeRunnable) runnable;
    } else {
      safeRunnable = new ISafeRunnable() {
        public void handleException(Throwable exception) {
          Policy
              .getLog()
              .log(
                  new Status(
View Full Code Here

    }

    final Object[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++) {
      final ICommandListener listener = (ICommandListener) listeners[i];
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
        }

        public void run() throws Exception {
          listener.commandChanged(commandEvent);
View Full Code Here

   */
  private void notifyListeners(final OperationHistoryEvent event) {
    if (event.getOperation() instanceof IAdvancedUndoableOperation) {
      final IAdvancedUndoableOperation advancedOp = (IAdvancedUndoableOperation) event
          .getOperation();
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
          if (DEBUG_OPERATION_HISTORY_UNEXPECTED) {
            Tracing
                .printTrace(
                    "OPERATIONHISTORY", //$NON-NLS-1$
                    "Exception during notification callback " + exception); //$NON-NLS-1$
          }
        }

        public void run() throws Exception {
          advancedOp.aboutToNotify(event);
        }
      });
    }
    final Object[] listenerArray = listeners.getListeners();
    for (int i = 0; i < listenerArray.length; i++) {
      final IOperationHistoryListener listener = (IOperationHistoryListener) listenerArray[i];
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
          if (DEBUG_OPERATION_HISTORY_UNEXPECTED) {
            Tracing
                .printTrace(
                    "OPERATIONHISTORY", //$NON-NLS-1$
View Full Code Here

      return null;
    }
  }

  private void disposePart(final IWorkbenchPart part) {
    SafeRunner.run(new ISafeRunnable() {
      @Override
      public void run() {
        IWorkbenchPartSite partSite = part.getSite();
        part.dispose();
        if (partSite instanceof MultiPageEditorSite) {
View Full Code Here

    }
  }
 
  for (int i= 0; i < listeners.size(); i++) {
    final ITypeHierarchyChangedListener listener= (ITypeHierarchyChangedListener)listeners.get(i);
    SafeRunner.run(new ISafeRunnable() {
      public void handleException(Throwable exception) {
        Util.log(exception, "Exception occurred in listener of Type hierarchy change notification"); //$NON-NLS-1$
      }
      public void run() throws Exception {
        listener.typeHierarchyChanged(TypeHierarchy.this);
View Full Code Here

    if (participants == null) return;

    final ReconcileContext context = new ReconcileContext(this, workingCopy);
    for (int i = 0, length = participants.length; i < length; i++) {
      final CompilationParticipant participant = participants[i];
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
          if (exception instanceof Error) {
            throw (Error) exception; // errors are not supposed to be caught
          } else if (exception instanceof OperationCanceledException)
            throw (OperationCanceledException) exception;
View Full Code Here

        Runnable runnable = new Runnable() {
          public void run() {
            Object[] listeners= fListenerList.getListeners();
            for (int i= 0; i < listeners.length; i++) {
              final IContentChangeListener contentChangeListener = (IContentChangeListener)listeners[i];
              SafeRunner.run(new ISafeRunnable() {
                public void run() throws Exception {
                  (contentChangeListener).contentChanged(element);
                }
                public void handleException(Throwable exception) {
                  // Logged by safe runner
View Full Code Here

protected void notifyChanged(final BufferChangedEvent event) {
  ArrayList listeners = this.changeListeners;
  if (listeners != null) {
    for (int i = 0, size = listeners.size(); i < size; ++i) {
      final IBufferChangedListener listener = (IBufferChangedListener) listeners.get(i);
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
          Util.log(exception, "Exception occurred in listener of buffer change notification"); //$NON-NLS-1$
        }
        public void run() throws Exception {
          listener.bufferChanged(event);
View Full Code Here

    if (participants == null) return;

    final ReconcileContext context = new ReconcileContext(this, workingCopy);
    for (int i = 0, length = participants.length; i < length; i++) {
      final CompilationParticipant participant = participants[i];
      SafeRunner.run(new ISafeRunnable() {
        public void handleException(Throwable exception) {
          if (exception instanceof Error) {
            throw (Error) exception; // errors are not supposed to be caught
          } else if (exception instanceof OperationCanceledException)
            throw (OperationCanceledException) exception;
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.ISafeRunnable

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.