### Eclipse Workspace Patch 1.0 #P org.jboss.tools.vpe Index: src/org/jboss/tools/vpe/editor/VpeController.java =================================================================== --- src/org/jboss/tools/vpe/editor/VpeController.java (revision 37160) +++ src/org/jboss/tools/vpe/editor/VpeController.java (working copy) @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.MenuManager; @@ -241,6 +242,8 @@ // contains vpe update delau time in miliseconds private int vpeUpdateDelayTime; + private ListenerList updateListeners = new ListenerList(); + public VpeController(VpeEditorPart editPart) { this.editPart = editPart; @@ -1403,6 +1406,7 @@ visualRefreshImpl(); monitor.done(); setSynced(true); + notifyVpeUpdateListeners(); return Status.OK_STATUS; } }; @@ -1596,6 +1600,7 @@ switcher.stopActiveEditor(); } monitor.done(); + notifyVpeUpdateListeners(); return Status.OK_STATUS; } @@ -2245,5 +2250,26 @@ public VpeDropWindow getDropWindow() { return dropWindow; } - + + /** + * Adds an event listener which is notified at the end + * of VPE update/refresh jobs. This allows clients to know when + * changing of the visual part is completed. + * + * @since 3.3 + */ + public void addVpeRefreshListener(final IVpeUpdateListener listener) { + updateListeners.add(listener); + } + + /** @since 3.3 */ + public void removeVpeRefreshListener(final IVpeUpdateListener listener) { + updateListeners.remove(listener); + } + + private void notifyVpeUpdateListeners() { + for (Object listener : updateListeners.getListeners()) { + ((IVpeUpdateListener) listener).vpeUpdated(); + } + } } Index: src/org/jboss/tools/vpe/editor/IVpeUpdateListener.java =================================================================== --- src/org/jboss/tools/vpe/editor/IVpeUpdateListener.java (revision 0) +++ src/org/jboss/tools/vpe/editor/IVpeUpdateListener.java (working copy) @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2007-2011 Red Hat, Inc. + * Distributed under license by Red Hat, Inc. All rights reserved. + * This program is made available under the terms of the + * Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributor: + * Red Hat, Inc. - initial API and implementation + ******************************************************************************/ +package org.jboss.tools.vpe.editor; + +/** + * Fired at the end of the VPE update/refresh jobs. + * + * @since 3.3 + * @author Maxim Shmidov + */ +public interface IVpeUpdateListener { + void vpeUpdated(); +}