1 19 20 26 package org.netbeans.modules.xml.wsdl.ui.extensibility.model.impl; 27 28 import org.netbeans.modules.xml.wsdl.ui.extensibility.model.WSDLExtensibilityElements; 29 import org.netbeans.modules.xml.wsdl.ui.extensibility.model.WSDLExtensibilityElementsFactory; 30 import org.openide.filesystems.Repository; 31 import org.openide.loaders.DataFolder; 32 import org.openide.util.NbBundle; 33 34 35 41 public class WSDLExtensibilityElementsFactoryImpl extends WSDLExtensibilityElementsFactory { 42 43 private static final String DEFAULT_FOLDER = "WSDLEditor"; 45 private WSDLExtensibilityElements mElements; 46 47 public WSDLExtensibilityElementsFactoryImpl() { 48 DataFolder wsdlEditorFolder = getRootFolder(DEFAULT_FOLDER); 49 if(wsdlEditorFolder == null) { 50 throw new IllegalStateException (NbBundle.getMessage(WSDLExtensibilityElementsFactoryImpl.class, "ERR_MSG_NO_FOLDER_FOUND", DEFAULT_FOLDER)); 51 } 52 53 mElements = new WSDLExtensibilityElementsImpl(wsdlEditorFolder); 54 } 55 56 private DataFolder getRootFolder(String folderName) { 57 try { 58 org.openide.filesystems.FileObject fo = 59 Repository.getDefault().getDefaultFileSystem().findResource(folderName); 60 61 if (fo == null) { 62 throw new Exception (NbBundle.getMessage(WSDLExtensibilityElementsFactoryImpl.class, "ERR_MSG_FOLDERN_NOT_FOUND", folderName)); 63 } 64 65 return DataFolder.findFolder(fo); 66 } catch (Exception ex) { 67 throw new InternalError (NbBundle.getMessage(WSDLExtensibilityElementsFactoryImpl.class, "ERR_MSG_FOLDERN_NOT_FOUND", folderName)); 68 } 69 } 70 71 72 public WSDLExtensibilityElements getWSDLExtensibilityElements() { 73 return mElements; 74 } 75 } 76 | Popular Tags |