1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.modules.websvc.editor.completion; 21 22 import org.netbeans.api.java.classpath.ClassPath; 23 // Retouche 24 //import org.netbeans.api.mdr.MDRepository; 25 //import org.netbeans.modules.javacore.api.JavaModel; 26 import org.netbeans.editor.BaseDocument; 27 import org.netbeans.modules.editor.NbEditorUtilities; 28 import org.openide.filesystems.FileObject; 29 import org.openide.loaders.DataObject; 30 31 public class JMIUtils { 32 // Retouche 33 // 34 // private static MDRepository repository = JavaModel.getJavaRepository(); 35 // 36 // private BaseDocument doc; 37 // private FileObject fileObject; 38 // 39 // public static synchronized JMIUtils get(BaseDocument doc) { 40 // JMIUtils utils = (JMIUtils)doc.getProperty(JMIUtils.class); 41 // if (utils == null) { 42 // utils = new JMIUtils(doc); 43 // doc.putProperty(JMIUtils.class, utils); 44 // } 45 // return utils; 46 // } 47 // 48 // private JMIUtils(BaseDocument doc){ 49 // this.doc = doc; 50 // DataObject dob = NbEditorUtilities.getDataObject(doc); 51 // if (dob != null) { 52 // FileObject fo = dob.getPrimaryFile(); 53 // ClassPath sourceCP = ClassPath.getClassPath(fo, ClassPath.SOURCE); 54 // if (sourceCP != null) { 55 // this.fileObject = sourceCP.findOwnerRoot(fo); 56 // } 57 // } 58 // } 59 // 60 // public void beginTrans(boolean write) { 61 // repository.beginTrans(write); 62 // if (fileObject != null) { 63 // try { 64 // // needs to be done in try..catch to make sure the transaction is closed 65 // // if this operation fails 66 // JavaModel.setClassPath(fileObject); 67 // } catch (RuntimeException e) { 68 // repository.endTrans(write); // fail if b==true (i.e. write transaction) 69 // throw e; 70 // } catch (Error e) { 71 // repository.endTrans(write); // fail if b==true (i.e. write transaction) 72 // throw e; 73 // } 74 // } // else -> global class path should be used 75 // } 76 // 77 // public void endTrans(boolean fail) { 78 // repository.endTrans(fail); 79 // } 80 } 81