Example usage for org.eclipse.jdt.core IElementChangedListener elementChanged

List of usage examples for org.eclipse.jdt.core IElementChangedListener elementChanged

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IElementChangedListener elementChanged.

Prototype

public void elementChanged(ElementChangedEvent event);

Source Link

Document

Notifies that one or more attributes of one or more Java elements have changed.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.DeltaProcessor.java

License:Open Source License

private void notifyListeners(IJavaElementDelta deltaToNotify, int eventType,
        IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {
    final ElementChangedEvent extraEvent = new ElementChangedEvent(deltaToNotify, eventType);
    for (int i = 0; i < listenerCount; i++) {
        if ((listenerMask[i] & eventType) != 0) {
            final IElementChangedListener listener = listeners[i];
            long start = -1;
            if (VERBOSE) {
                System.out.print("Listener #" + (i + 1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
                start = System.currentTimeMillis();
            }/*from w ww  .  ja  v  a 2s.c om*/
            // wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
            SafeRunner.run(new ISafeRunnable() {
                public void handleException(Throwable exception) {
                    Util.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$
                }

                public void run() throws Exception {
                    PerformanceStats stats = null;
                    if (PERF) {
                        //                     stats = PerformanceStats.getStats(JavaModelManager.DELTA_LISTENER_PERF, listener);
                        //                     stats.startRun();
                    }
                    listener.elementChanged(extraEvent);
                    if (PERF) {
                        stats.endRun();
                    }
                }
            });
            if (VERBOSE) {
                System.out.println(" -> " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
    }
}

From source file:com.salesforce.ide.ui.editors.ForceIdeEditorsPlugin.java

License:Open Source License

public static void fire(final ElementChangedEvent extraEvent) {
    for (int i = 0; i < elementChangedListenerCount; i++) {
        if ((elementChangedListenerMasks[i] & extraEvent.getType()) != 0) {
            final IElementChangedListener listener = elementChangedListeners[i];

            // wrap callbacks with Safe runnable for subsequent listeners to
            // be called when some are causing grief
            SafeRunner.run(new ISafeRunnable() {
                public void handleException(Throwable exception) {
                    // Util.log(exception, "Exception occurred in listener
                    // of Java element change notification"); //$NON-NLS-1$
                }/*  ww w  .  j  a v a 2 s . c  om*/

                public void run() throws Exception {
                    listener.elementChanged(extraEvent);
                }
            });

        }
    }
}