1 11 package org.eclipse.pde.internal.core.schema; 12 13 import java.io.File ; 14 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.pde.core.plugin.IPluginModelBase; 17 import org.eclipse.pde.internal.core.*; 18 19 22 public abstract class DevelopmentSchemaDescriptor extends AbstractSchemaDescriptor { 23 28 public IPath getPluginRelativePath(String pluginId, IPath path) { 29 PluginModelManager manager = PDECore.getDefault().getModelManager(); 30 ModelEntry entry = manager.findEntry(pluginId); 31 if (entry==null) return null; 32 IPluginModelBase model = entry.getActiveModel(); 33 if (model==null) return null; 34 35 String location = model.getInstallLocation(); 36 IPath schemaPath = new Path(location).append(path); 37 if (schemaPath.toFile().exists()) 38 return schemaPath; 39 40 File sourceFile = getSourceLocationFile(model, path); 41 if (sourceFile != null && sourceFile.exists()) 42 return new Path(sourceFile.getAbsolutePath()); 43 return null; 44 } 45 46 private File getSourceLocationFile(IPluginModelBase model, IPath path) { 47 SourceLocationManager sourceManager = 48 PDECore.getDefault().getSourceLocationManager(); 49 return sourceManager.findSourceFile( 50 model.getPluginBase(), path); 51 } 52 } 53 | Popular Tags |