1 11 package org.eclipse.pde.internal.core.plugin; 12 13 import java.io.PrintWriter ; 14 import java.io.Serializable ; 15 16 import org.eclipse.pde.core.ISourceObject; 17 import org.eclipse.pde.core.IWritable; 18 import org.eclipse.pde.core.plugin.IPlugin; 19 import org.eclipse.pde.core.plugin.IPluginBase; 20 import org.eclipse.pde.core.plugin.IPluginImport; 21 import org.eclipse.pde.core.plugin.IPluginModelBase; 22 23 public class ImportObject extends PluginReference implements IWritable, Serializable , IWritableDelimiter { 24 25 private static final long serialVersionUID = 1L; 26 private IPluginImport iimport; 27 28 public ImportObject() { 29 super(); 30 } 31 public ImportObject(IPluginImport iimport) { 32 super(iimport.getId()); 33 this.iimport = iimport; 34 } 35 public ImportObject(IPluginImport iimport, IPlugin plugin) { 36 super(plugin); 37 this.iimport = iimport; 38 } 39 public IPluginImport getImport() { 40 return iimport; 41 } 42 public boolean equals(Object object) { 43 if (object instanceof ImportObject) { 44 ImportObject io = (ImportObject)object; 45 if (iimport.equals(io.getImport())) 46 return true; 47 } 48 return false; 49 } 50 51 54 public void write(String indent, PrintWriter writer) { 55 iimport.write(indent, writer); 56 } 57 58 public Object getAdapter(Class key) { 59 if (key.equals(ISourceObject.class)) { 60 if (iimport instanceof ISourceObject) 61 return iimport; 62 } 63 return super.getAdapter(key); 64 } 65 66 69 public void reconnect(IPluginModelBase model) { 70 super.reconnect(model); 71 IPluginBase parent = model.getPluginBase(); 73 if (iimport instanceof PluginImport) { 76 ((PluginImport)iimport).reconnect(model, parent); 77 } 78 } 79 80 83 public void writeDelimeter(PrintWriter writer) { 84 if (iimport instanceof PluginImport) { 87 ((PluginImport)iimport).writeDelimeter(writer); 88 } 89 } 90 91 } 92 | Popular Tags |