1 /******************************************************************************* 2 * Copyright (c) 2013 EclipseSource and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Jonas Helming <jhelming@eclipsesource.com> 13 ******************************************************************************/ 14 15 package org.eclipse.e4.tools.compat.parts; 16 17 import org.eclipse.core.runtime.IProgressMonitor; 18 import org.eclipse.e4.tools.services.IDirtyProviderService; 19 import org.eclipse.ui.IEditorPart; 20 import org.eclipse.ui.PartInitException; 21 import org.eclipse.ui.part.MultiPageEditorPart; 22 23 public abstract class DIMultiPageEditorPart extends MultiPageEditorPart 24 implements IDirtyProviderService { 25 addPage(Class<T> clazz)26 public <T> int addPage(Class<T> clazz) throws PartInitException { 27 DIEditorPart<T> part = new DIEditorPart<T>(clazz) {}; 28 return addPage(part, getEditorInput()); 29 30 } 31 DIMultiPageEditorPart()32 public DIMultiPageEditorPart() { 33 } 34 35 @Override doSave(IProgressMonitor monitor)36 public void doSave(IProgressMonitor monitor) { 37 for (int i = 0; i < getPageCount(); i++) { 38 IEditorPart e = getEditor(i); 39 e.doSave(monitor); 40 } 41 } 42 43 } 44