1 11 package org.eclipse.pde.internal.ui.editor; 12 import org.eclipse.pde.internal.ui.PDEPlugin; 13 import org.eclipse.pde.internal.ui.editor.context.InputContext; 14 import org.eclipse.ui.PartInitException; 15 import org.eclipse.ui.forms.editor.IFormPage; 16 17 public abstract class MultiSourceEditor extends PDEFormEditor { 18 protected void addSourcePage(String contextId) { 19 InputContext context = fInputContextManager.findContext(contextId); 20 if (context == null) 21 return; 22 PDESourcePage sourcePage; 23 if (findPage(contextId)!=null) return; 25 sourcePage = createSourcePage(this, contextId, context.getInput().getName(), context.getId()); 26 sourcePage.setInputContext(context); 27 try { 28 addPage(sourcePage, context.getInput()); 29 } catch (PartInitException e) { 30 PDEPlugin.logException(e); 31 } 32 } 33 34 protected void removePage(String pageId) { 35 IFormPage page = findPage(pageId); 36 if (page == null) 37 return; 38 if (page.isDirty()) { 39 } else { 41 removePage(page.getIndex()); 42 if (!page.isEditor()) 43 page.dispose(); 44 } 45 } 46 47 protected PDESourcePage createSourcePage(PDEFormEditor editor, String title, String name, String contextId) { 48 return new GenericSourcePage(editor, title, name); 49 } 50 } 51 | Popular Tags |