1 11 package org.eclipse.pde.internal.ui.model.bundle; 12 13 import java.io.*; 14 import java.util.jar.*; 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.jface.text.*; 17 import org.eclipse.pde.internal.core.*; 18 import org.eclipse.pde.internal.core.ibundle.*; 19 import org.eclipse.pde.internal.ui.model.*; 20 import org.osgi.framework.*; 21 22 public class BundleModel extends AbstractEditingModel implements IBundleModel { 23 24 private IBundle fBundle; 25 29 public BundleModel(IDocument document, boolean isReconciling) { 30 super(document, isReconciling); 31 fBundle = new Bundle(this); 32 } 33 36 protected NLResourceHelper createNLResourceHelper() { 37 return null; 38 } 39 42 public boolean isFragmentModel() { 43 return getBundle().getHeader(Constants.FRAGMENT_HOST) != null; 44 } 45 46 49 public void load(InputStream source, boolean outOfSync) throws CoreException { 50 try { 51 fLoaded = true; 52 ((Bundle)getBundle()).clearHeaders(); 53 ((Bundle)getBundle()).load(new Manifest(source)); 54 } catch (IOException e) { 55 fLoaded = false; 56 } 57 } 58 59 62 protected void adjustOffsets(IDocument document) { 63 ((Bundle)getBundle()).clearOffsets(); 64 ((Bundle)getBundle()).adjustOffsets(document); 65 ((Bundle)getBundle()).trim(); 66 } 67 70 public IBundle getBundle() { 71 return fBundle; 72 } 73 74 } 75 | Popular Tags |