1 11 package org.eclipse.ui.internal.part; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.ui.IActionBars; 15 import org.eclipse.ui.IEditorInput; 16 import org.eclipse.ui.IEditorPart; 17 import org.eclipse.ui.IEditorSite; 18 import org.eclipse.ui.IMemento; 19 import org.eclipse.ui.IViewPart; 20 import org.eclipse.ui.IViewSite; 21 import org.eclipse.ui.IWorkbenchPartSite; 22 import org.eclipse.ui.PartInitException; 23 import org.eclipse.ui.internal.components.framework.ComponentException; 24 import org.eclipse.ui.internal.part.services.NullActionBars; 25 import org.eclipse.ui.internal.part.services.PartToViewActionBarsAdapter; 26 27 33 public class NewPartToOldAdapter extends NewPartToWorkbenchPartAdapter implements IViewPart, IEditorPart { 34 35 private CompatibilityPartSite site; 36 37 44 public NewPartToOldAdapter( 45 StandardWorkbenchServices services, 46 IPartPropertyProvider propertyProvider, 47 boolean isView) throws ComponentException { 48 super(propertyProvider); 49 50 IActionBars actionBars; 51 52 if (isView) { 53 actionBars = new PartToViewActionBarsAdapter(services.getActionBars(), 54 services.getStatusHandler(), services.getStatusFactory()); 55 } else { 56 actionBars = new NullActionBars(); 57 } 58 59 this.site = new CompatibilityPartSite( 60 services, this, null, actionBars); 61 } 62 63 66 public IWorkbenchPartSite getSite() { 67 return site; 68 } 69 70 73 public Object getAdapter(Class adapter) { 74 if (adapter == IViewPart.class || adapter == IEditorPart.class) { 75 return this; 76 } 77 78 return site.getAdapter(adapter); 79 } 80 81 84 public IViewSite getViewSite() { 85 return site; 86 } 87 88 91 public void init(IViewSite site) throws PartInitException { 92 } 94 95 98 public void init(IViewSite site, IMemento memento) throws PartInitException { 99 } 101 102 105 public void saveState(IMemento memento) { 106 } 108 109 112 public IEditorSite getEditorSite() { 113 return site; 114 } 115 116 119 public void init(IEditorSite site, IEditorInput input) throws PartInitException { 120 } 122 123 126 public void doSave(IProgressMonitor monitor) { 127 128 } 129 130 133 public void doSaveAs() { 134 135 } 136 137 140 public boolean isSaveAsAllowed() { 141 return false; 142 } 143 144 147 public boolean isSaveOnCloseNeeded() { 148 return false; 149 } 150 151 } 152 | Popular Tags |