package de.ptb.epics.eve.editor;

import org.apache.log4j.Logger;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
import org.eclipse.ui.IWorkbenchPage;

/**
 * <code>EveEditorPerspectiveListener</code> listens to perspective changes of
 * the {@link EveEditorPerspective}.
 * <p>
 * 
 * @author Marcus Michalsky
 * @since 0.4.1
 */
public class EveEditorPerspectiveListener implements IPerspectiveListener {

	private static Logger logger = Logger
			.getLogger(EveEditorPerspectiveListener.class.getName());

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void perspectiveActivated(IWorkbenchPage page,
			IPerspectiveDescriptor perspective) {
		if (logger.isDebugEnabled()) {
			logger.debug("Perspective enabled: " + perspective.getId());
		}
		if (perspective.getId().equals("EveEditorPerpective")) {
			final String name = Activator.getDefault().getMeasuringStation()
					.getName() == null ? "" : Activator.getDefault()
					.getMeasuringStation().getName();
			page.getWorkbenchWindow().getShell().setText(
				Activator.getDefault().getDefaultWindowTitle()
					+ " - "
					+ name
					+ " (XML v"
					+ Activator.getDefault()
					.getMeasuringStation().getVersion()
					+ ")");
		}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void perspectiveChanged(IWorkbenchPage page,
			IPerspectiveDescriptor perspective, String changeId) {
	}
}
@@ -172,29 +172,108 @@
 pse.ui.I
-WorkbenchPage
+ViewReference;%0Aimport org.eclipse.ui.IWorkbenchPage;%0Aimport org.eclipse.ui.PartInitException
 ;%0A%0A/**%0A 
@@ -1306,16 +1306,304 @@
 + %22)%22);%0A
+%09%09%09%0A%09%09%09IViewReference%5B%5D references = page.getViewReferences();%0A%09%09%09for (IViewReference reference : references) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09page.showView(reference.getId(), null, %0A%09%09%09%09%09%09%09IWorkbenchPage.VIEW_CREATE);%0A%09%09%09%09%7D catch (PartInitException e) %7B%0A%09%09%09%09%09logger.error(e.getMessage(), e);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%0A

initialize views (in folders) when perspective is loaded