1 23 package org.enhydra.kelp.forte.services; 24 import org.openide.TopManager; 26 import org.openide.compiler.CompilerType; 27 import org.openide.cookies.CompilerCookie; 28 import org.openide.loaders.CompilerSupport; 29 import org.openide.loaders.DataObject; 30 import org.openide.loaders.MultiDataObject.Entry; 31 32 37 public class XMLCCompilerSupport extends CompilerSupport { 38 private Entry sourceEntry; 39 40 43 protected XMLCCompilerSupport(Entry entry, Class cookie) { 44 super(entry, cookie); 45 sourceEntry = entry; 46 } 47 48 protected final Entry getSourceEntry() { 49 return sourceEntry; 50 } 51 52 55 protected CompilerType defaultCompilerType() { 56 57 return (CompilerType) TopManager.getDefault().getServices().find(XMLCCompilerType.class); 59 } 60 61 64 65 73 74 79 80 public boolean isUpToDate() { 81 82 DataObject d = getSourceEntry().getDataObject(); 84 85 if (d.isModified()) { 86 return false; 87 } 88 CompilerCookie ccookie = 89 (CompilerCookie) d.getCookie(CompilerCookie.Compile.class); 90 91 if (ccookie == null) { 92 return false; 93 } 94 org.openide.compiler.CompilerJob j = 95 new org.openide.compiler.CompilerJob(org.openide.compiler.Compiler.DEPTH_ONE); 96 97 return j.isUpToDate(); 98 } 99 100 107 108 public static class Compile extends XMLCCompilerSupport 109 implements CompilerCookie.Compile { 110 111 116 public Compile(Entry entry) { 117 super(entry, CompilerCookie.Compile.class); 118 } 119 } 120 121 124 public static class Build extends XMLCCompilerSupport 125 implements CompilerCookie.Build { 126 127 132 public Build(Entry entry) { 133 super(entry, CompilerCookie.Build.class); 134 } 135 136 } 137 138 141 public static class Clean extends XMLCCompilerSupport 142 implements CompilerCookie.Clean { 143 144 149 public Clean(Entry entry) { 150 super(entry, CompilerCookie.Clean.class); 151 } 152 153 } 154 } 155 | Popular Tags |