1 11 package org.eclipse.pde.internal.core.schema; 12 13 import java.net.*; 14 15 import org.eclipse.core.resources.*; 16 17 public class FileSchemaDescriptor extends DevelopmentSchemaDescriptor { 18 private IFile file; 19 20 public FileSchemaDescriptor(IFile file) { 21 this.file = file; 22 } 23 24 protected Schema createSchema() { 25 URL url = getSchemaURL(); 26 if (url==null) return null; 27 return new EditableSchema(this, url); 28 } 29 public IFile getFile() { 30 return file; 31 } 32 33 public String getPointId() { 34 IProject project = file.getProject(); 35 String projectName = project.getName(); 36 String fileName = file.getName(); 37 int dotLoc = fileName.lastIndexOf('.'); 38 return projectName + "."+fileName.substring(0, dotLoc); } 40 41 public URL getSchemaURL() { 42 try { 43 49 return new URL("file:"+file.getLocation().toOSString()); } catch (MalformedURLException e) { 51 } 52 return null; 53 } 54 55 public boolean isEnabled() { 56 return true; 57 } 58 } 59 | Popular Tags |