-/*******************************************************************************\r
- * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import org.eclipse.ui.IPartListener;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-\r
-/**\r
- * IPartListener that allows editor to load its content after the editorPart is activated.\r
- * \r
- * This is crucial with 3D graphics, which does not work if the editor part is activated\r
- * after the data has been loaded.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public abstract class EditorLoader implements IPartListener {\r
-\r
- boolean opened = false;\r
- boolean activated = false;\r
- \r
- public void partOpened(IWorkbenchPart part) {\r
- if (part.equals(getWorkbechPart())) {\r
- opened = true;\r
- }\r
- }\r
- \r
- public void partActivated(IWorkbenchPart part) {\r
- if (part.equals(getWorkbechPart())) {\r
- if (opened & !activated) {\r
- activated = true;\r
- load();\r
- }\r
- }\r
- }\r
- \r
- public void partBroughtToTop(IWorkbenchPart part) {}\r
- \r
- public void partClosed(IWorkbenchPart part) {}\r
- \r
- public void partDeactivated(IWorkbenchPart part) {}\r
- \r
- /**\r
- * Returns the IWorkbenchPart of the editor\r
- * @return\r
- */\r
- public abstract IWorkbenchPart getWorkbechPart();\r
- \r
- /**\r
- * Starts the content loading process\r
- */\r
- public abstract void load();\r
-}\r