bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
private Block( Node var, ICallable method, IRubyObject self, Frame frame, Scope scope, RubyModule klass, Iter iter, DynamicVariableSet dynamicVars) { assert method != null; this.var = var; this.method = method; this.self = self; this.frame = frame; this.scope = scope; this.klass = klass; this.iter = iter; this.dynamicVariables = dynamicVars; }
|
private Block( Node var, ICallable method, IRubyObject self, Frame frame, Scope scope, RubyModule klass, Iter iter, DynamicVariableSet dynamicVars) { this.var = var; this.method = method; this.self = self; this.frame = frame; this.scope = scope; this.klass = klass; this.iter = iter; this.dynamicVariables = dynamicVars; }
| 3,229,766
|
public Block cloneBlock() { Block newBlock = new Block(var, method, self, frame, scope, klass, iter, new DynamicVariableSet(dynamicVariables)); newBlock.isLambda = isLambda; if (getNext() != null) { newBlock.setNext(getNext()); } return newBlock; }
|
public Block cloneBlock() { Block newBlock = new Block(var, method, self, frame, cref, scope, klass, iter, new DynamicVariableSet(dynamicVariables)); newBlock.isLambda = isLambda; if (getNext() != null) { newBlock.setNext(getNext()); } return newBlock; }
| 3,229,768
|
public HTMLReport(Map coverageData, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = CoverageUnmarshaller.parse(coverageData); removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
|
public HTMLReport(Map coverageData, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = CoverageUnmarshaller.parse(coverageData); removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
| 3,229,770
|
public HTMLReport(Map coverageData, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = CoverageUnmarshaller.parse(coverageData); removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
|
public HTMLReport(Map coverageData, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = CoverageUnmarshaller.parse(coverageData); removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
| 3,229,771
|
protected HashMap buildChainHash(Collection chains) { HashMap map = new HashMap(); Iterator iter = chains.iterator(); while (iter.hasNext()) { LayoutChainData p = (LayoutChainData) iter.next(); Integer id = new Integer(p.getID()); map.put(id,p); } return map; }
|
protected HashMap buildChainHash(Collection chains) { HashMap map = new HashMap(); Iterator iter = chains.iterator(); while (iter.hasNext()) { LayoutChainData p = (LayoutChainData) iter.next(); Integer id = new Integer(p.getID()); map.put(id,p); } return map; }
| 3,229,772
|
protected void buildExecutionHashes(Collection executions) { chainExecutionHashesByID = new HashMap(); executionsByDatasetID = new HashMap(); executionsByChainID = new HashMap(); Iterator iter = executions.iterator(); while (iter.hasNext()) { // hash by execution id ChainExecutionData p = (ChainExecutionData) iter.next(); Integer id = new Integer(p.getID()); chainExecutionHashesByID.put(id,p); // by dataset id DatasetData d = p.getDataset(); id = new Integer(d.getID()); updateExecutionHash(executionsByDatasetID,id,p); LayoutChainData c = (LayoutChainData) p.getChain(); id = new Integer(c.getID()); updateExecutionHash(executionsByChainID,id,p); } }
|
protected void buildExecutionHashes(Collection executions) { chainExecutionHashesByID = new HashMap(); executionsByDatasetID = new HashMap(); executionsByChainID = new HashMap(); Iterator iter = executions.iterator(); while (iter.hasNext()) { // hash by execution id ChainExecutionData p = (ChainExecutionData) iter.next(); Integer id = new Integer(p.getID()); chainExecutionHashesByID.put(id,p); // by dataset id DatasetData d = p.getDataset(); id = new Integer(d.getID()); updateExecutionHash(executionsByDatasetID,id,p); LayoutChainData c = (LayoutChainData) p.getChain(); id = new Integer(c.getID()); updateExecutionHash(executionsByChainID,id,p); } }
| 3,229,773
|
public void setAnalysisNodes(HashMap analysisNodes) { this.analysisNodes = analysisNodes; }
|
public void setAnalysisNodes(HashMap analysisNodes) { this.analysisNodes = analysisNodes; }
| 3,229,774
|
private void updateExecutionHash(HashMap map, Integer id,ChainExecutionData p) { ArrayList execs = null; Object obj = map.get(id); if (obj == null) execs = new ArrayList(); else execs = (ArrayList) obj; execs.add(p); map.put(id,execs); }
|
private void updateExecutionHash(HashMap map, Integer id,ChainExecutionData p) { ArrayList execs = null; Object obj = map.get(id); if (obj == null) execs = new ArrayList(); else execs = (ArrayList) obj; execs.add(p); map.put(id,execs); }
| 3,229,775
|
public ChainExecutionsLoadedEvent(HashMap executionsByDataset, HashMap executionsByChain,HashMap executionsByID) { super(); setSource(executionsByDataset); this.executionsByChain = executionsByChain; this.executionsByID = executionsByID; }
|
public ChainExecutionsLoadedEvent(HashMap executionsByDataset, HashMap executionsByChain,HashMap executionsByID) { super(); setSource(executionsByDataset); this.executionsByChain = executionsByChain; this.executionsByID = executionsByID; }
| 3,229,776
|
private void init() { ThreadContext tc = getCurrentContext(); nilObject = new RubyNil(this); trueObject = new RubyBoolean(this, true); falseObject = new RubyBoolean(this, false); verbose = falseObject; debug = falseObject; javaSupport = new JavaSupport(this); initLibraries(); tc.preInitCoreClasses(); initCoreClasses(); RubyGlobal.createGlobals(this); topSelf = TopSelfFactory.createTopSelf(this); tc.preInitBuiltinClasses(objectClass, topSelf); initBuiltinClasses(); getObject().defineConstant("TOPLEVEL_BINDING", newBinding()); // Load additional definitions and hacks from etc.rb getLoadService().smartLoad("builtin/etc.rb"); }
|
private void init() { ThreadContext tc = getCurrentContext(); nilObject = new RubyNil(this); trueObject = new RubyBoolean(this, true); falseObject = new RubyBoolean(this, false); verbose = falseObject; debug = falseObject; javaSupport = new JavaSupport(this); initLibraries(); tc.preInitCoreClasses(); initCoreClasses(); topSelf = TopSelfFactory.createTopSelf(this); tc.preInitBuiltinClasses(objectClass, topSelf); initBuiltinClasses(); getObject().defineConstant("TOPLEVEL_BINDING", newBinding()); // Load additional definitions and hacks from etc.rb getLoadService().smartLoad("builtin/etc.rb"); }
| 3,229,777
|
private RenderRGBWaveTask[] makeRndTasks(PlaneDef planeDef, RGBBuffer renderedDataBuf) { ArrayList tasks = new ArrayList(3); //Get all objects we need to create the tasks. Plane2D wData; QuantumManager qManager = renderer.getQuantumManager(); ChannelBinding[] cBindings = renderer.getChannelBindings(); CodomainChain cc = renderer.getCodomainChain(); PixelBuffer pixels = renderer.getPixels(); Pixels metadata = renderer.getMetadata(); RenderingStats performanceStats = renderer.getStats(); //Create a task for each active wavelength. for (int w = 0; w < cBindings.length; w++) { if (tasks.size() == 3) break; //We only render 3 w at most. if (cBindings[w].getActive().booleanValue()) { //Get the raw data. performanceStats.startIO(w); wData = Helper.createPlane(planeDef, w, metadata, pixels); performanceStats.endIO(w); //Create a rendering task for this wavelength. tasks.add(new RenderRGBWaveTask( getColorBand(renderedDataBuf, cBindings[w].getColor()), wData, qManager.getStrategyFor(w), cc, cBindings[w].getColor().getAlpha().intValue(), sizeX1, sizeX2)); } } //Turn the list into an array an return it. RenderRGBWaveTask[] t = new RenderRGBWaveTask[tasks.size()]; return (RenderRGBWaveTask[]) tasks.toArray(t); }
|
private RenderRGBWaveTask[] makeRndTasks(PlaneDef planeDef, RGBBuffer renderedDataBuf) { ArrayList tasks = new ArrayList(3); //Get all objects we need to create the tasks. Plane2D wData; QuantumManager qManager = renderer.getQuantumManager(); ChannelBinding[] cBindings = renderer.getChannelBindings(); CodomainChain cc = renderer.getCodomainChain(); PixelBuffer pixels = renderer.getPixels(); Pixels metadata = renderer.getMetadata(); RenderingStats performanceStats = renderer.getStats(); //Create a task for each active wavelength. for (int w = 0; w < cBindings.length; w++) { if (tasks.size() == 3) break; //We only render 3 w at most. if (cBindings[w].getActive().booleanValue()) { //Get the raw data. performanceStats.startIO(w); wData = PlaneFactory.createPlane(planeDef, w, metadata, pixels); performanceStats.endIO(w); //Create a rendering task for this wavelength. tasks.add(new RenderRGBWaveTask( getColorBand(renderedDataBuf, cBindings[w].getColor()), wData, qManager.getStrategyFor(w), cc, cBindings[w].getColor().getAlpha().intValue(), sizeX1, sizeX2)); } } //Turn the list into an array an return it. RenderRGBWaveTask[] t = new RenderRGBWaveTask[tasks.size()]; return (RenderRGBWaveTask[]) tasks.toArray(t); }
| 3,229,779
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
|
RGBBufferrender(Rendererctx,PlaneDefplaneDef) throwsIOException,QuantizationException { //Settherenderingcontextforthecurrentinvocation. renderer=ctx;RenderingStatsperformanceStats=renderer.getStats(); //InitializesizeX1andsizeX2accordingtotheplanedefinitionand //createtheRGBbuffer. initAxesSize(planeDef,renderer.getMetadata());performanceStats.startMalloc();RGBBufferrenderedDataBuf=newRGBBuffer(sizeX1,sizeX2);performanceStats.endMalloc();//Processeachactivewavelength.IftheirnumberN>1,then//processN-1asyncandoneinthecurrentthread.IfN=1,//justusethecurrentthread.RenderRGBWaveTask[]tasks=makeRndTasks(planeDef,renderedDataBuf);performanceStats.startRendering();intn=tasks.length;Future[]rndTskFutures=newFuture[n];//[0]unused.//j.mCmdProcessorprocessor=Env.getProcessor();ExecutorServiceprocessor=Executors.newCachedThreadPool();//FIXMEfastenough?while(0<--n)rndTskFutures[n]=processor.submit(tasks[n]);//j.mexec(tasks[n]);if(n==0)tasks[0].call();//Waitforallforkedtasks(ifany)tocomplete.processor.shutdown();//j.m//j.mTODOprocessor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS);for(n=1;n<rndTskFutures.length;++n){try{rndTskFutures[n].get();//j.mResult();}catch(Exceptione){if(einstanceofQuantizationException)throw(QuantizationException)e;throw(RuntimeException)e;//B/ccall()onlythrowsQuantizationException,itmustbeRE.}}performanceStats.endRendering(); //Done. returnrenderedDataBuf; }
| 3,229,780
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
| 3,229,781
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
| 3,229,782
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
|
RGBBuffer render(Renderer ctx, PlaneDef planeDef) throws IOException, QuantizationException { //Set the rendering context for the current invocation. renderer = ctx; RenderingStats performanceStats = renderer.getStats(); //Initialize sizeX1 and sizeX2 according to the plane definition and //create the RGB buffer. initAxesSize(planeDef, renderer.getMetadata()); performanceStats.startMalloc(); RGBBuffer renderedDataBuf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc(); //Process each active wavelength. If their number N > 1, then //process N-1 async and one in the current thread. If N = 1, //just use the current thread. RenderRGBWaveTask[] tasks = makeRndTasks(planeDef, renderedDataBuf); performanceStats.startRendering(); int n = tasks.length; Future[] rndTskFutures = new Future[n]; //[0] unused. //j.m CmdProcessor processor = Env.getProcessor(); ExecutorService processor = Executors.newCachedThreadPool();//FIXME fast enough? while (0 < --n) rndTskFutures[n] = processor.submit(tasks[n]);// j.m exec(tasks[n]); if (n == 0) tasks[0].call(); //Wait for all forked tasks (if any) to complete. processor.shutdown();//j.m //j.mTODO processor.awaitTermination(Long.MAX_VALUE,TimeUnit.SECONDS); for (n = 1; n < rndTskFutures.length; ++n) { try { rndTskFutures[n].get();//j.m Result(); } catch (Exception e) { if (e instanceof QuantizationException) throw (QuantizationException) e; throw (RuntimeException) e; //B/c call() only throws QuantizationException, it must be RE. } } performanceStats.endRendering(); //Done. return renderedDataBuf; }
| 3,229,783
|
public static String getXsdType(Type type) { String name = type.getName(); String xsdType = (String) XSD_TYPES.get(name); if (xsdType == null) { xsdType = "xsd:string"; } return xsdType; }
|
public static String getXsdType(Type type) { String name = type.getName(); String xsdType = (String) XSD_TYPES.get(name); if (xsdType == null) { xsdType = "xs:string"; } return xsdType; }
| 3,229,784
|
public static void createReadline(IRuby runtime) { try { Class readline = Class.forName("org.gnu.readline.Readline"); Class readlineLib = Class.forName("org.gnu.readline.ReadlineLibrary"); readline.getMethod("load",new Class[]{readlineLib}).invoke(null,new Object[]{readlineLib.getMethod("byName",new Class[]{String.class}).invoke(null,new Object[]{"GnuReadline"})}); readline.getMethod("initReadline",new Class[]{String.class}).invoke(null,new Object[]{"Ruby"}); readlineMeth = readline.getMethod("readline",new Class[]{String.class,Boolean.TYPE}); addToHistMeth = readline.getMethod("addToHistory",new Class[]{String.class}); RubyModule mReadline = runtime.defineModule("Readline"); CallbackFactory readlinecb = runtime.callbackFactory(Readline.class); mReadline.defineMethod("readline",readlinecb.getSingletonMethod("s_readline",IRubyObject.class,IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("readline")}); IRubyObject hist = runtime.getObject().callMethod("new"); mReadline.setConstant("HISTORY",hist); hist.defineSingletonMethod("push",readlinecb.getSingletonMethod("s_push",IRubyObject.class)); hist.defineSingletonMethod("pop",readlinecb.getSingletonMethod("s_pop")); } catch(Exception e) { throw runtime.newLoadError("Missing libreadline-java library; see Readline-HOWTO.txt in docs"); } }
|
public static void createReadline(IRuby runtime) { try { Class readline = Class.forName("org.gnu.readline.Readline"); Class readlineLib = Class.forName("org.gnu.readline.ReadlineLibrary"); readline.getMethod("load",new Class[]{readlineLib}).invoke(null,new Object[]{readlineLib.getMethod("byName",new Class[]{String.class}).invoke(null,new Object[]{"GnuReadline"})}); readline.getMethod("initReadline",new Class[]{String.class}).invoke(null,new Object[]{"Ruby"}); readlineMeth = readline.getMethod("readline",new Class[]{String.class,Boolean.TYPE}); addToHistMeth = readline.getMethod("addToHistory",new Class[]{String.class}); RubyModule mReadline = runtime.defineModule("Readline"); CallbackFactory readlinecb = runtime.callbackFactory(Readline.class); mReadline.defineMethod("readline",readlinecb.getSingletonMethod("s_readline",IRubyObject.class,IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("readline")}); IRubyObject hist = runtime.getObject().callMethod("new"); mReadline.setConstant("HISTORY",hist); hist.defineSingletonMethod("push",readlinecb.getSingletonMethod("s_push",IRubyObject.class)); hist.defineSingletonMethod("pop",readlinecb.getSingletonMethod("s_pop")); } catch(Exception e) { throw runtime.newLoadError("Missing libreadline-java library; see Readline-HOWTO.txt in docs"); } }
| 3,229,785
|
public static IRubyObject s_push(IRubyObject recv, IRubyObject line) throws Exception { addToHistMeth.invoke(null,new Object[]{line.toString()}); return recv.getRuntime().getNil(); }
|
public static IRubyObject s_push(IRubyObject recv, IRubyObject line) throws Exception { readline.getHistory().addToHistory(line.toString()); return recv.getRuntime().getNil(); }
| 3,229,786
|
public static IRubyObject s_readline(IRubyObject recv, IRubyObject prompt, IRubyObject add_to_hist) { IRubyObject line = recv.getRuntime().getNil(); try { String v = (String)readlineMeth.invoke(null,new Object[]{prompt.toString(),new Boolean(add_to_hist.isTrue())}); if(null != v) { line = recv.getRuntime().newString(v); } } catch(Exception ioe) { return recv.getRuntime().getNil(); } if(line.isNil()) { return recv.getRuntime().newString(""); } return line; }
|
public static IRubyObject s_readline(IRubyObject recv, IRubyObject prompt, IRubyObject add_to_hist) throws IOException { IRubyObject line = recv.getRuntime().getNil(); try { String v = (String)readlineMeth.invoke(null,new Object[]{prompt.toString(),new Boolean(add_to_hist.isTrue())}); if(null != v) { line = recv.getRuntime().newString(v); } } catch(Exception ioe) { return recv.getRuntime().getNil(); } if(line.isNil()) { return recv.getRuntime().newString(""); } return line; }
| 3,229,787
|
public static IRubyObject s_readline(IRubyObject recv, IRubyObject prompt, IRubyObject add_to_hist) { IRubyObject line = recv.getRuntime().getNil(); try { String v = (String)readlineMeth.invoke(null,new Object[]{prompt.toString(),new Boolean(add_to_hist.isTrue())}); if(null != v) { line = recv.getRuntime().newString(v); } } catch(Exception ioe) { return recv.getRuntime().getNil(); } if(line.isNil()) { return recv.getRuntime().newString(""); } return line; }
|
public static IRubyObject s_readline(IRubyObject recv, IRubyObject prompt, IRubyObject add_to_hist) { IRubyObject line = recv.getRuntime().getNil(); try { String v = (String)readlineMeth.invoke(null,new Object[]{prompt.toString(),new Boolean(add_to_hist.isTrue())}); if(null != v) { line = recv.getRuntime().newString(v); } } catch(Exception ioe) { return recv.getRuntime().getNil(); } if(line.isNil()) { return recv.getRuntime().newString(""); } return line; }
| 3,229,788
|
public RubyObject call(Ruby ruby, RubyObject recv, String id, RubyPointer args, boolean noSuper) { if (args == null) { args = new RubyPointer(); } CRefNode savedCref = null; // +++ = null; List valueList = null; ruby.getScope().push(); CRefNode lRefValue = getRefValue(); if (lRefValue != null) { savedCref = ruby.getCRef(); // s.a. ruby.setCRef(lRefValue); ruby.getRubyFrame().setCbase(lRefValue); } if (getTable() != null) { valueList = new ArrayList(Collections.nCopies(getTable().size(), ruby.getNil())); ruby.getScope().setLocalValues(valueList); ruby.getScope().setLocalNames(getTable()); } else { valueList = null; //ruby.getScope().getLocalValues(); ruby.getScope().setLocalValues(null); ruby.getScope().setLocalNames(null); } Node callBody = getNextNode(); Node callNode = null; if (callBody.getType() == Constants.NODE_ARGS) { callNode = callBody; callBody = null; } else if (callBody.getType() == Constants.NODE_BLOCK) { callNode = callBody.getHeadNode(); callBody = callBody.getNextNode(); } RubyVarmap.push(ruby); // PUSH_TAG(PROT_FUNC); try { if (callNode != null) { //if (call_node.getType() != Constants.NODE_ARGS) { // rb_bug("no argument-node"); //} int i = callNode.getCount(); if (i > (args != null ? args.size() : 0)) { int size = 0; if (args != null) size = args.size(); throw new RubyArgumentException(ruby, getFile() + ":" + getLine() +"wrong # of arguments(" + size + " for " + i + ")"); } if (callNode.getRest() == -1) { int opt = i; Node optNode = callNode.getOptNode(); while (optNode != null) { opt++; optNode = optNode.getNextNode(); } if (opt < (args != null ? args.size() : 0)) { throw new RubyArgumentException(ruby, "wrong # of arguments(" + args.size() + " for " + opt + ")"); } // +++ ruby.getRubyFrame().setArgs(valueList != null ? new DelegateList(valueList, 2, valueList.size()) : null); // --- } if (valueList != null) { if (i > 0) { for (int j = 0; j < i; j++) { valueList.set(j + 2, args.get(j)); } } args.inc(i); if (callNode.getOptNode() != null) { Node optNode = callNode.getOptNode(); while (optNode != null && args.size() != 0) { ((AssignableNode) optNode.getHeadNode()).assign(ruby, recv, args.getRuby(0), true); args.inc(1); optNode = optNode.getNextNode(); } recv.eval(optNode); } if (callNode.getRest() >= 0) { RubyArray array = null; if (args.size() > 0) { array = RubyArray.newArray(ruby, args); } else { array = RubyArray.newArray(ruby, 0); } valueList.set(callNode.getRest(), array); } } } return recv.eval(callBody); } catch (ReturnException rExcptn) { // +++ jpetersen return ((RubyArray) rExcptn.getReturnValue()).pop(); // --- } finally { RubyVarmap.pop(ruby); ruby.getScope().pop(); if (savedCref != null) { ruby.setCRef(savedCref); } } }
|
public RubyObject call(Ruby ruby, RubyObject recv, String id, RubyPointer args, boolean noSuper) { if (args == null) { args = new RubyPointer(); } CRefNode savedCref = null; // +++ = null; List valueList = null; ruby.getScope().push(); CRefNode lRefValue = getRefValue(); if (lRefValue != null) { savedCref = ruby.getCRef(); // s.a. ruby.setCRef(lRefValue); ruby.getRubyFrame().setCbase(lRefValue); } if (getTable() != null) { valueList = new ArrayList(Collections.nCopies(getTable().size(), ruby.getNil())); ruby.getScope().setLocalValues(valueList); ruby.getScope().setLocalNames(getTable()); } else { valueList = null; //ruby.getScope().getLocalValues(); ruby.getScope().setLocalValues(null); ruby.getScope().setLocalNames(null); } Node callBody = getNextNode(); Node callNode = null; if (callBody.getType() == Constants.NODE_ARGS) { callNode = callBody; callBody = null; } else if (callBody.getType() == Constants.NODE_BLOCK) { callNode = callBody.getHeadNode(); callBody = callBody.getNextNode(); } RubyVarmap.push(ruby); // PUSH_TAG(PROT_FUNC); try { if (callNode != null) { //if (call_node.getType() != Constants.NODE_ARGS) { // rb_bug("no argument-node"); //} int i = callNode.getCount(); if (i > (args != null ? args.size() : 0)) { int size = 0; if (args != null) size = args.size(); throw new RubyArgumentException(ruby, getFile() + ":" + getLine() +"wrong # of arguments(" + size + " for " + i + ")"); } if (callNode.getRest() == -1) { int opt = i; Node optNode = callNode.getOptNode(); while (optNode != null) { opt++; optNode = optNode.getNextNode(); } if (opt < (args != null ? args.size() : 0)) { throw new RubyArgumentException(ruby, "wrong # of arguments(" + args.size() + " for " + opt + ")"); } // +++ ruby.getRubyFrame().setArgs(valueList != null ? new DelegateList(valueList, 2, valueList.size()) : null); // --- } if (valueList != null) { if (i > 0) { for (int j = 0; j < i; j++) { valueList.set(j + 2, args.get(j)); } } args.inc(i); if (callNode.getOptNode() != null) { Node optNode = callNode.getOptNode(); while (optNode != null && args.size() != 0) { ((AssignableNode) optNode.getHeadNode()).assign(ruby, recv, args.getRuby(0), true); args.inc(1); optNode = optNode.getNextNode(); } recv.eval(optNode); } if (callNode.getRest() >= 0) { RubyArray array = null; if (args.size() > 0) { array = RubyArray.newArray(ruby, args); } else { array = RubyArray.newArray(ruby, 0); } valueList.set(callNode.getRest(), array); } } } return recv.eval(callBody); } catch (ReturnException rExcptn) { // +++ jpetersen return ((RubyArray) rExcptn.getReturnValue()).pop(); // --- } finally { RubyVarmap.pop(ruby); ruby.getScope().pop(); if (savedCref != null) { ruby.setCRef(savedCref); } } }
| 3,229,789
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
| 3,229,793
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, exception)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
| 3,229,794
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); exception.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
| 3,229,795
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
|
public void handleNativeException(Exception excptn) { Class excptnClass = excptn.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, excptn)}); } else { StringWriter stackTrace = new StringWriter(); excptn.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(excptn.getClass()).append("\'; Message: "); sb.append(excptn.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
| 3,229,796
|
public static RubySymbol unmarshalFrom(UnmarshalStream input) throws java.io.IOException { return RubySymbol.newSymbol(input.getRuby(), input.unmarshalString()); }
|
public static RubySymbol unmarshalFrom(UnmarshalStream input) throws java.io.IOException { return RubySymbol.newSymbol(input.getRuntime(), input.unmarshalString()); }
| 3,229,797
|
public Object invoke(MethodInvocation arg0) throws Throwable { Experimenter o = (Experimenter) ht.load(Experimenter.class,0); ExperimenterGroup g = (ExperimenterGroup) ht.load(ExperimenterGroup.class,0); CurrentDetails.setOwner(o); CurrentDetails.setGroup(g); EventType test = (EventType) ht.execute(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.createQuery( "from EventType where value = 'Test'"); return q.uniqueResult(); } }); CurrentDetails.newEvent(test); return arg0.proceed(); }
|
public Object invoke(MethodInvocation arg0) throws Throwable { Experimenter o = (Experimenter) ht.load(Experimenter.class,0); ExperimenterGroup g = (ExperimenterGroup) ht.load(ExperimenterGroup.class,0); CurrentDetails.setOwner(o); CurrentDetails.setGroup(g); EventType test = (EventType) ht.execute(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.createQuery( "from EventType where value = 'Test'"); return q.uniqueResult(); } }); CurrentDetails.newEvent(test); return arg0.proceed(); }
| 3,229,798
|
public Object invoke(MethodInvocation arg0) throws Throwable { Experimenter o = (Experimenter) ht.load(Experimenter.class,0); ExperimenterGroup g = (ExperimenterGroup) ht.load(ExperimenterGroup.class,0); CurrentDetails.setOwner(o); CurrentDetails.setGroup(g); EventType test = (EventType) ht.execute(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.createQuery( "from EventType where value = 'Test'"); return q.uniqueResult(); } }); CurrentDetails.newEvent(test); return arg0.proceed(); }
|
public Object invoke(MethodInvocation arg0) throws Throwable { Experimenter o = (Experimenter) ht.load(Experimenter.class,0); ExperimenterGroup g = (ExperimenterGroup) ht.load(ExperimenterGroup.class,0); CurrentDetails.setOwner(o); CurrentDetails.setGroup(g); EventType test = (EventType) ht.execute(new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query q = session.createQuery( "from EventType where value = 'Test'"); return q.uniqueResult(); } }); CurrentDetails.newEvent(test); return arg0.proceed(); }
| 3,229,799
|
public void execute() { ZoomVisitor visitor = new ZoomVisitor(model); Browser browser = model.getBrowser(); ImageDisplay selectedDisplay = browser.getSelectedDisplay(); if (selectedDisplay.getParentDisplay() == null) return; selectedDisplay.accept(visitor); if (selectedDisplay instanceof ImageSet) { Layout layout = LayoutFactory.createLayout( LayoutFactory.SQUARY_LAYOUT); layout.visit((ImageSet) selectedDisplay); } }
|
public void execute() { ZoomVisitor visitor = new ZoomVisitor(model); Browser browser = model.getBrowser(); ImageDisplay selectedDisplay = browser.getSelectedDisplay(); if (selectedDisplay.getParentDisplay() == null) return; selectedDisplay.accept(visitor); if (selectedDisplay instanceof ImageSet) { Layout layout = LayoutFactory.createLayout( LayoutFactory.SQUARY_LAYOUT); layout.visit((ImageSet) selectedDisplay); } }
| 3,229,800
|
public void populateMenuBar(MenuManager menuBar) { noteMenu = new MenuManager("&Note"); menuBar.add(noteMenu); addNoteSubmenu = new MenuManager("&Add Note"); addNoteSubmenu.add(addNoteAfter); addNoteSubmenu.add(addNoteUnder); noteMenu.add(addNoteSubmenu); moveNoteSubmenu = new MenuManager("&Move Note"); moveNoteSubmenu.add(moveNoteLeft); moveNoteSubmenu.add(moveNoteRight); moveNoteSubmenu.add(moveNoteUp); moveNoteSubmenu.add(moveNoteDown); noteMenu.add(moveNoteSubmenu); noteMenu.add(removeNotes); noteMenu.add(renameNote); }
|
public void populateMenuBar(MenuManager menuBar) { noteMenu = new MenuManager("&Note"); menuBar.add(noteMenu); addNoteSubmenu = new MenuManager("&Add Note"); addNoteSubmenu.add(addNoteAfter); addNoteSubmenu.add(addNoteUnder); noteMenu.add(addNoteSubmenu); moveNoteSubmenu = new MenuManager("&Move Note"); moveNoteSubmenu.add(moveNoteLeft); moveNoteSubmenu.add(moveNoteRight); moveNoteSubmenu.add(moveNoteUp); moveNoteSubmenu.add(moveNoteDown); noteMenu.add(moveNoteSubmenu); noteMenu.add(removeNotes); noteMenu.add(renameNote); }
| 3,229,801
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
| 3,229,802
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
| 3,229,803
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
|
public void populateTreeContextMenu(MenuManager treeContextMenu) { addNoteTreeSubmenu = new MenuManager("&Add Note"); addNoteTreeSubmenu.add(addNoteAfter); addNoteTreeSubmenu.add(addNoteUnder); treeContextMenu.add(addNoteTreeSubmenu); moveNoteTreeSubmenu = new MenuManager("&Move Note"); moveNoteTreeSubmenu.add(moveNoteLeft); moveNoteTreeSubmenu.add(moveNoteRight); moveNoteTreeSubmenu.add(moveNoteUp); moveNoteTreeSubmenu.add(moveNoteDown); treeContextMenu.add(moveNoteTreeSubmenu); treeContextMenu.add(removeNotes); treeContextMenu.add(renameNote); }
| 3,229,804
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
| 3,229,805
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
| 3,229,806
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
|
public void update() { if (tree.hasFocus()) { removeNotes.setEnabled(true); if (tree.getSelectionCount() == 1) { addNoteSubmenu.setVisible(true); moveNoteSubmenu.setVisible(true); removeNotes.setText("Remove Note"); renameNote.setEnabled(true); } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setText("Remove Notes"); renameNote.setEnabled(false); } } else { addNoteSubmenu.setVisible(false); moveNoteSubmenu.setVisible(false); removeNotes.setEnabled(false); renameNote.setEnabled(false); } }
| 3,229,807
|
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document document = new Document(); Note root = new Note("root", document, ""); LinkedList<Note> roots = new LinkedList<Note>(); roots.add(root); // Listener and Dispatcher Dispatcher dispatcher = new Dispatcher(); Listener listener = new Listener(dispatcher); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(sashForm, listener); tree.loadTree(roots); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); // Finish SashForm sashForm.setWeights(new int[] {20, 80}); // Controllers dispatcher.registerController(new MainController(this)); dispatcher.registerController(new MainMenuController(this)); dispatcher.registerController(new TreeController(tree, dispatcher)); }
|
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document document = new Document(); Note root = new Note("root", document, ""); LinkedList<Note> roots = new LinkedList<Note>(); roots.add(root); // Listener and Dispatcher Dispatcher dispatcher = new Dispatcher(); Listener listener = new Listener(dispatcher); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(sashForm, listener); tree.loadTree(roots); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); // Finish SashForm sashForm.setWeights(new int[] {20, 80}); // Controllers dispatcher.registerController(new MainController(this)); dispatcher.registerController(new MainMenuController(this)); dispatcher.registerController(new TreeController(tree, dispatcher)); }
| 3,229,810
|
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document document = new Document(); Note root = new Note("root", document, ""); LinkedList<Note> roots = new LinkedList<Note>(); roots.add(root); // Listener and Dispatcher Dispatcher dispatcher = new Dispatcher(); Listener listener = new Listener(dispatcher); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(sashForm, listener); tree.loadTree(roots); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); // Finish SashForm sashForm.setWeights(new int[] {20, 80}); // Controllers dispatcher.registerController(new MainController(this)); dispatcher.registerController(new MainMenuController(this)); dispatcher.registerController(new TreeController(tree, dispatcher)); }
|
public DisplayedDocument(Shell shell) { // Shell this.shell = shell; shell.setText("Koala Notes"); shell.setLayout(new FillLayout(SWT.VERTICAL)); // Document document = new Document(); Note root = new Note("root", document, ""); LinkedList<Note> roots = new LinkedList<Note>(); roots.add(root); // Listener and Dispatcher Dispatcher dispatcher = new Dispatcher(); Listener listener = new Listener(dispatcher); // Menu mainMenu = new MainMenu(shell, listener); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); // Tree tree = new NoteTree(sashForm, listener); tree.loadTree(roots); tree.init(); // TabFolder tabFolder = new NoteTabFolder(sashForm, listener); // Finish SashForm sashForm.setWeights(new int[] {20, 80}); // Controllers dispatcher.registerController(new MainController(this)); dispatcher.registerController(new MainMenuController(this)); dispatcher.registerController(new TreeController(tree, dispatcher)); }
| 3,229,811
|
public PermissionData( Permissions permissions ) { this.p = permissions; }
|
public PermissionData( Permissions permissions ) { this.p = permissions; }
| 3,229,812
|
public ReflectionCallbackMethod(Class klass, String methodName) { this(klass, methodName, (Class[]) null, false, false); }
|
public ReflectionCallbackMethod(Class klass, String methodName) { this(klass, methodName, (Class[]) null, false, false); }
| 3,229,813
|
public static RubyClass createJavaClassClass(Ruby runtime, RubyModule javaModule) { RubyClass result = javaModule.defineClassUnder("JavaClass", runtime.getClasses().getObjectClass()); CallbackFactory callbackFactory = runtime.callbackFactory(JavaClass.class); result.includeModule(runtime.getClasses().getComparableModule()); JavaObject.registerRubyMethods(runtime, result); result.defineSingletonMethod("for_name", callbackFactory.getSingletonMethod("for_name", IRubyObject.class)); result.defineMethod("public?", callbackFactory.getMethod("public_p")); result.defineMethod("final?", callbackFactory.getMethod("final_p")); result.defineMethod("interface?", callbackFactory.getMethod("interface_p")); result.defineMethod("array?", callbackFactory.getMethod("array_p")); result.defineMethod("name", callbackFactory.getMethod("name")); result.defineMethod("to_s", callbackFactory.getMethod("name")); result.defineMethod("superclass", callbackFactory.getMethod("superclass")); result.defineMethod("<=>", callbackFactory.getMethod("op_cmp", IRubyObject.class)); result.defineMethod("java_instance_methods", callbackFactory.getMethod("java_instance_methods")); result.defineMethod("java_class_methods", callbackFactory.getMethod("java_class_methods")); result.defineMethod("java_method", callbackFactory.getOptMethod("java_method")); result.defineMethod("constructors", callbackFactory.getMethod("constructors")); result.defineMethod("constructor", callbackFactory.getOptMethod("constructor")); result.defineMethod("array_class", callbackFactory.getMethod("array_class")); result.defineMethod("new_array", callbackFactory.getMethod("new_array", IRubyObject.class)); result.defineMethod("fields", callbackFactory.getMethod("fields")); result.defineMethod("field", callbackFactory.getMethod("field", IRubyObject.class)); result.defineMethod("interfaces", callbackFactory.getMethod("interfaces")); result.defineMethod("primitive?", callbackFactory.getMethod("primitive_p")); result.defineMethod("assignable_from?", callbackFactory.getMethod("assignable_from_p", IRubyObject.class)); result.defineMethod("component_type", callbackFactory.getMethod("component_type")); result.defineMethod("declared_instance_methods", callbackFactory.getMethod("declared_instance_methods")); result.defineMethod("declared_class_methods", callbackFactory.getMethod("declared_class_methods")); result.defineMethod("declared_fields", callbackFactory.getMethod("declared_fields")); result.defineMethod("declared_field", callbackFactory.getMethod("declared_field", IRubyObject.class)); result.defineMethod("declared_constructors", callbackFactory.getMethod("declared_constructors")); result.defineMethod("declared_constructor", callbackFactory.getOptMethod("declared_constructor")); result.defineMethod("declared_method", callbackFactory.getOptMethod("declared_method")); result.getMetaClass().undefineMethod("new"); return result; }
|
public static RubyClass createJavaClassClass(Ruby runtime, RubyModule javaModule) { RubyClass result = javaModule.defineClassUnder("JavaClass", runtime.getClasses().getJavaObjectClass()); CallbackFactory callbackFactory = runtime.callbackFactory(JavaClass.class); result.includeModule(runtime.getClasses().getComparableModule()); JavaObject.registerRubyMethods(runtime, result); result.defineSingletonMethod("for_name", callbackFactory.getSingletonMethod("for_name", IRubyObject.class)); result.defineMethod("public?", callbackFactory.getMethod("public_p")); result.defineMethod("final?", callbackFactory.getMethod("final_p")); result.defineMethod("interface?", callbackFactory.getMethod("interface_p")); result.defineMethod("array?", callbackFactory.getMethod("array_p")); result.defineMethod("name", callbackFactory.getMethod("name")); result.defineMethod("to_s", callbackFactory.getMethod("name")); result.defineMethod("superclass", callbackFactory.getMethod("superclass")); result.defineMethod("<=>", callbackFactory.getMethod("op_cmp", IRubyObject.class)); result.defineMethod("java_instance_methods", callbackFactory.getMethod("java_instance_methods")); result.defineMethod("java_class_methods", callbackFactory.getMethod("java_class_methods")); result.defineMethod("java_method", callbackFactory.getOptMethod("java_method")); result.defineMethod("constructors", callbackFactory.getMethod("constructors")); result.defineMethod("constructor", callbackFactory.getOptMethod("constructor")); result.defineMethod("array_class", callbackFactory.getMethod("array_class")); result.defineMethod("new_array", callbackFactory.getMethod("new_array", IRubyObject.class)); result.defineMethod("fields", callbackFactory.getMethod("fields")); result.defineMethod("field", callbackFactory.getMethod("field", IRubyObject.class)); result.defineMethod("interfaces", callbackFactory.getMethod("interfaces")); result.defineMethod("primitive?", callbackFactory.getMethod("primitive_p")); result.defineMethod("assignable_from?", callbackFactory.getMethod("assignable_from_p", IRubyObject.class)); result.defineMethod("component_type", callbackFactory.getMethod("component_type")); result.defineMethod("declared_instance_methods", callbackFactory.getMethod("declared_instance_methods")); result.defineMethod("declared_class_methods", callbackFactory.getMethod("declared_class_methods")); result.defineMethod("declared_fields", callbackFactory.getMethod("declared_fields")); result.defineMethod("declared_field", callbackFactory.getMethod("declared_field", IRubyObject.class)); result.defineMethod("declared_constructors", callbackFactory.getMethod("declared_constructors")); result.defineMethod("declared_constructor", callbackFactory.getOptMethod("declared_constructor")); result.defineMethod("declared_method", callbackFactory.getOptMethod("declared_method")); result.getMetaClass().undefineMethod("new"); return result; }
| 3,229,814
|
public void load(String fileName) throws InitException, IOException { load(fileName,this.getClass().getClassLoader()); }
|
public void load(String fileName) throws InitException, IOException { load(fileName,this.getClass().getClassLoader()); }
| 3,229,815
|
public int parseString(final RubyYaccLexer lexer, LexerSource src) { char c; int space = 0; StringBuffer buffer = new StringBuffer(100); if (func == -1) return Tokens.tSTRING_END; c = src.read(); if ((func & RubyYaccLexer.STR_FUNC_QWORDS) != 0 && Character.isWhitespace(c)) { do { c = src.read(); } while (Character.isWhitespace(c)); space = 1; } if (c == term && nest == 0) { if ((func & RubyYaccLexer.STR_FUNC_QWORDS) != 0) { func = -1; return ' '; } if ((func & RubyYaccLexer.STR_FUNC_REGEXP) != 0) { lexer.yaccValue = new RegexpNode(src.getPosition(), buffer.toString(), parseRegexpFlags(src)); return Tokens.tREGEXP_END; } return Tokens.tSTRING_END; } if (space != 0) { src.unread(c); return ' '; } if ((func & RubyYaccLexer.STR_FUNC_EXPAND) != 0 && c == '#') { c = src.read(); switch (c) { case '$': case '@': src.unread(c); return Tokens.tSTRING_DVAR; case '{': return Tokens.tSTRING_DBEG; } buffer.append('#'); } src.unread(c); if (parseStringIntoBuffer(src, buffer) == 0) { throw new SyntaxException(src.getPosition(), "unterminated string meets end of file"); } lexer.yaccValue = buffer.toString(); return Tokens.tSTRING_CONTENT; }
|
public int parseString(final RubyYaccLexer lexer, LexerSource src) { char c; int space = 0; StringBuffer buffer = new StringBuffer(100); if (func == -1) return Tokens.tSTRING_END; c = src.read(); if ((func & RubyYaccLexer.STR_FUNC_QWORDS) != 0 && Character.isWhitespace(c)) { do { c = src.read(); } while (Character.isWhitespace(c)); space = 1; } if (c == term && nest == 0) { if ((func & RubyYaccLexer.STR_FUNC_QWORDS) != 0) { func = -1; return ' '; } if ((func & RubyYaccLexer.STR_FUNC_REGEXP) != 0) { lexer.yaccValue = new RegexpNode(src.getPosition(), buffer.toString(), parseRegexpFlags(src)); return Tokens.tREGEXP_END; } return Tokens.tSTRING_END; } if (space != 0) { src.unread(c); return ' '; } if ((func & RubyYaccLexer.STR_FUNC_EXPAND) != 0 && c == '#') { c = src.read(); switch (c) { case '$': case '@': src.unread(c); return Tokens.tSTRING_DVAR; case '{': return Tokens.tSTRING_DBEG; } buffer.append('#'); } src.unread(c); if (parseStringIntoBuffer(src, buffer) == 0) { throw new SyntaxException(src.getPosition(), "unterminated string meets end of file"); } lexer.yaccValue = new Token(buffer.toString(), lexer.getPosition(null, false)); return Tokens.tSTRING_CONTENT; }
| 3,229,817
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,818
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,819
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,820
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,821
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,822
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null), "Invalid escape character syntax"); default : return c; } }
|
public char readEscape() { char c = read(); switch (c) { case '\\' : // backslash return c; case 'n' : // newline return '\n'; case 't' : // horizontal tab return '\t'; case 'r' : // carriage return return '\r'; case 'f' : // form feed return '\f'; case 'v' : // vertical tab return '\u0013'; case 'a' : // alarm(bell) return '\u0007'; case 'e' : // escape return '\u0033'; case '0' : case '1' : case '2' : case '3' : // octal constant case '4' : case '5' : case '6' : case '7' : unread(c); return scanOct(3); case 'x' : // hex constant int hexOffset = getColumn(); char hexValue = scanHex(2); // No hex value after the 'x'. if (hexOffset == getColumn()) { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return hexValue; case 'b' : // backspace return '\010'; case 's' : // space return ' '; case 'M' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } else if ((c = read()) == '\\') { return (char) (readEscape() | 0x80); } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) ((c & 0xff) | 0x80); case 'C' : if ((c = read()) != '-') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } case 'c' : if ((c = read()) == '\\') { c = readEscape(); } else if (c == '?') { return '\u0177'; } else if (c == '\0') { throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); } return (char) (c & 0x9f); case '\0' : throw new SyntaxException(getPosition(null, false), "Invalid escape character syntax"); default : return c; } }
| 3,229,823
|
public void addImage(byte[] imageData, String contentType) { List l = getImages(); if (l == null) { l = new ArrayList(); } ContentItemField field = new ContentItemFieldBean(); field.setBinaryValue(imageData); field.setFieldType(contentType); field.setOrderNo(l.size()); l.add(field); setImages(l); }
|
public void addImage(byte[] imageData, String contentType) { List l = getImages(); if (l == null) { l = new ArrayList(); } ContentItemField field = new ContentItemFieldBean(); field.setBinaryValue(imageData); field.setFieldType(contentType); field.setOrderNo(l.size()); l.add(field); setImages(l); }
| 3,229,824
|
public void clear() { super.clear(); setHeadline(null); setTeaser(null); setBody(null); setAuthor(null); setSource(null); setComment(null); setImages(null); setFilename(null);// setFolderLocation(null); _isUpdated = false; setFolderLocation(null); }
|
public void clear() { super.clear(); setHeadline(null); setTeaser(null); setBody(null); setAuthor(null); setSource(null); setComment(null); setImages(null); setFilename(null);// setFolderLocation(null); _isUpdated = false; setFolderLocation(null); }
| 3,229,825
|
public String getAsXML() throws IOException, XMLException { XMLParser builder = new XMLParser(); XMLElement bodyElement = null; prettifyBody(); String bodyString = getBody(); if(bodyString != null && !bodyString.trim().equals("")){ XMLDocument bodyDoc = builder.parse(new ByteArrayInputStream(bodyString.getBytes("UTF-8"))); bodyElement = bodyDoc.getRootElement(); } XMLElement root = new XMLElement("article",idegaXMLNameSpace); XMLElement contentLanguage = new XMLElement(FIELDNAME_CONTENT_LANGUAGE,idegaXMLNameSpace).setText(getContentLanguage()); XMLElement headline = new XMLElement(FIELDNAME_HEADLINE,idegaXMLNameSpace).setText(getHeadline()); XMLElement teaser = new XMLElement(FIELDNAME_TEASER,idegaXMLNameSpace).setText(getTeaser()); XMLElement author = new XMLElement(FIELDNAME_AUTHOR,idegaXMLNameSpace).setText(getAuthor()); XMLElement source = new XMLElement(FIELDNAME_SOURCE,idegaXMLNameSpace).setText(getSource()); XMLElement articleComment = new XMLElement("article_comment",idegaXMLNameSpace).setText(getComment()); XMLElement body = new XMLElement(FIELDNAME_BODY,idegaXMLNameSpace); if(bodyElement != null){ body.addContent(bodyElement); } root.addContent(contentLanguage); root.addContent(headline); root.addContent(teaser); root.addContent(body); root.addContent(author); root.addContent(source); root.addContent(articleComment); XMLDocument doc = new XMLDocument(root); XMLOutput outputter = new XMLOutput(); return outputter.outputString(doc); }
|
public String getAsXML() throws IOException, XMLException { XMLParser builder = new XMLParser(); XMLElement bodyElement = null; prettifyBody(); String bodyString = getBody(); if(bodyString != null && !bodyString.trim().equals("")){ XMLDocument bodyDoc = builder.parse(new ByteArrayInputStream(bodyString.getBytes("UTF-8"))); bodyElement = bodyDoc.getRootElement(); } XMLElement root = new XMLElement("article",idegaXMLNameSpace); XMLElement contentLanguage = new XMLElement(FIELDNAME_CONTENT_LANGUAGE,idegaXMLNameSpace).setText(getContentLanguage()); XMLElement headline = new XMLElement(FIELDNAME_HEADLINE,idegaXMLNameSpace).setText(getHeadline()); XMLElement teaser = new XMLElement(FIELDNAME_TEASER,idegaXMLNameSpace).setText(getTeaser()); XMLElement author = new XMLElement(FIELDNAME_AUTHOR,idegaXMLNameSpace).setText(getAuthor()); XMLElement source = new XMLElement(FIELDNAME_SOURCE,idegaXMLNameSpace).setText(getSource()); XMLElement articleComment = new XMLElement("article_comment",idegaXMLNameSpace).setText(getComment()); XMLElement body = new XMLElement(FIELDNAME_BODY,idegaXMLNameSpace); if(bodyElement != null){ body.addContent(bodyElement); } root.addContent(contentLanguage); root.addContent(headline); root.addContent(teaser); root.addContent(body); root.addContent(author); root.addContent(source); root.addContent(articleComment); XMLDocument doc = new XMLDocument(root); XMLOutput outputter = new XMLOutput(); return outputter.outputString(doc); }
| 3,229,826
|
public String getAuthor() { return (String)getValue(FIELDNAME_AUTHOR); }
|
public String getAuthor() { return (String)getValue(FIELDNAME_AUTHOR); }
| 3,229,827
|
public String getBody() { return (String)getValue(FIELDNAME_BODY); }
|
public String getBody() { return (String)getValue(FIELDNAME_BODY); }
| 3,229,828
|
public String getComment() { return (String)getValue(FIELDNAME_COMMENT); }
|
public String getComment() { return (String)getValue(FIELDNAME_COMMENT); }
| 3,229,829
|
public String[] getContentFieldNames(){ return ATTRIBUTE_ARRAY; }
|
public String[] getContentFieldNames(){ return ATTRIBUTE_ARRAY; }
| 3,229,830
|
public String getContentItemPrefix() { return "article_"; }
|
public String getContentItemPrefix() { return "article_"; }
| 3,229,831
|
public String getContentLanguage() { return (String)getValue(FIELDNAME_CONTENT_LANGUAGE); }
|
public String getContentLanguage() { return (String)getValue(FIELDNAME_CONTENT_LANGUAGE); }
| 3,229,832
|
public String getHeadline() { return (String)getValue(FIELDNAME_HEADLINE); }
|
public String getHeadline() { return (String)getValue(FIELDNAME_HEADLINE); }
| 3,229,833
|
public List getImages() { return getItemFields(FIELDNAME_IMAGES); }
|
public List getImages() { return getItemFields(FIELDNAME_IMAGES); }
| 3,229,834
|
public String getLanguageChange() { return (String)getValue(FIELDNAME_LANGUAGE_CHANGE); }
|
public String getLanguageChange() { return (String)getValue(FIELDNAME_LANGUAGE_CHANGE); }
| 3,229,835
|
public String getSource() { return (String)getValue(FIELDNAME_SOURCE); }
|
public String getSource() { return (String)getValue(FIELDNAME_SOURCE); }
| 3,229,836
|
public String getTeaser() { return (String)getValue(FIELDNAME_TEASER); }
|
public String getTeaser() { return (String)getValue(FIELDNAME_TEASER); }
| 3,229,837
|
public String[] getToolbarActions(){ //return ACTION_ARRAY; return super.getToolbarActions(); }
|
public String[] getToolbarActions(){ //return ACTION_ARRAY; return super.getToolbarActions(); }
| 3,229,838
|
public boolean isUpdated() { return _isUpdated; }
|
public boolean isUpdated() { return _isUpdated; }
| 3,229,839
|
public boolean load(WebdavExtendedResource webdavResource) throws IOException { XMLParser builder = new XMLParser(); XMLDocument bodyDoc = null; try { WebdavResource theArticle = null; if(webdavResource.isCollection()){ IWContext iwc = IWContext.getInstance(); WebdavResources resources = webdavResource.getChildResources(); String userLanguageArticleName = getArticleName(iwc.getCurrentLocale()); String systemLanguageArticleName = getArticleName(iwc.getIWMainApplication().getDefaultLocale()); if(resources.isThereResourceName(userLanguageArticleName)){ //the language that the user has selected theArticle = resources.getResource(userLanguageArticleName); } else if(resources.isThereResourceName(systemLanguageArticleName)){ //the language that is default for the system theArticle = resources.getResource(systemLanguageArticleName); } else { // take the first language Enumeration en = resources.getResources(); if(en.hasMoreElements()){ theArticle = (WebdavResource)en.nextElement(); } } } else { theArticle = webdavResource; } if(theArticle!=null && !theArticle.isCollection()){ setArticleResourcePath(theArticle.getPath()); bodyDoc = builder.parse(new ByteArrayInputStream(theArticle.getMethodDataAsString().getBytes("UTF-8"))); } else { bodyDoc = null; } } catch (XMLException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } if(bodyDoc!=null){ XMLElement rootElement = bodyDoc.getRootElement(); try { XMLElement language = rootElement.getChild(FIELDNAME_CONTENT_LANGUAGE,idegaXMLNameSpace); if(language != null){ setContentLanguage(language.getText()); } else { setContentLanguage(null); } }catch(Exception e) { setContentLanguage(null); } try { XMLElement headline = rootElement.getChild(FIELDNAME_HEADLINE,idegaXMLNameSpace); if(headline != null){ setHeadline(headline.getText()); } else { setHeadline(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setHeadline(""); } try { XMLElement teaser = rootElement.getChild(FIELDNAME_TEASER,idegaXMLNameSpace); if(teaser != null){ setTeaser(teaser.getText()); } else { setTeaser(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setTeaser(""); } try { XMLElement author = rootElement.getChild(FIELDNAME_AUTHOR,idegaXMLNameSpace); if(author != null){ setAuthor(author.getText()); } else { setAuthor(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setAuthor(""); } //Parse out the body try { XMLNamespace htmlNamespace = new XMLNamespace("http://www.w3.org/1999/xhtml"); XMLElement bodyElement = rootElement.getChild(FIELDNAME_BODY,idegaXMLNameSpace); XMLElement htmlElement = bodyElement.getChild("html",htmlNamespace); XMLElement htmlBodyElement = htmlElement.getChild("body",htmlNamespace); String bodyValue = htmlBodyElement.getContentAsString(); setBody(bodyValue); }catch(Exception e) { //Nullpointer could occur if field isn't used // e.printStackTrace(); Logger log = Logger.getLogger(this.getClass().toString()); log.warning("Body of article is empty"); setBody(""); } try { XMLElement source = rootElement.getChild(FIELDNAME_SOURCE,idegaXMLNameSpace); if(source != null){ setSource(source.getText()); } else { setSource(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used setSource(""); } try { XMLElement comment = rootElement.getChild(FIELDNAME_ARTICLE_COMMENT,idegaXMLNameSpace); if(comment != null){ setComment(comment.getText()); } else { setComment(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setComment(""); } } else { //article not found Logger log = Logger.getLogger(this.getClass().toString()); log.warning("Article xml file was not found"); setRendered(false); return false; } return true;// setFilename();// setFolderLocation(bodyElement.getChild(FIELDNAME_FOLDER_LOCATION,idegans).getText()); }
|
public boolean load(WebdavExtendedResource webdavResource) throws IOException { XMLParser builder = new XMLParser(); XMLDocument bodyDoc = null; try { WebdavResource theArticle = null; if(webdavResource.isCollection()){ IWContext iwc = IWContext.getInstance(); WebdavResources resources = webdavResource.getChildResources(); String userLanguageArticleName = getArticleName(iwc.getCurrentLocale()); String systemLanguageArticleName = getArticleName(iwc.getIWMainApplication().getDefaultLocale()); if(resources.isThereResourceName(userLanguageArticleName)){ //the language that the user has selected theArticle = resources.getResource(userLanguageArticleName); } else if(resources.isThereResourceName(systemLanguageArticleName)){ //the language that is default for the system theArticle = resources.getResource(systemLanguageArticleName); } else { // take the first language Enumeration en = resources.getResources(); if(en.hasMoreElements()){ theArticle = (WebdavResource)en.nextElement(); } } } else { theArticle = webdavResource; } if(theArticle!=null && !theArticle.isCollection()){ setArticleResourcePath(theArticle.getPath()); bodyDoc = builder.parse(new ByteArrayInputStream(theArticle.getMethodDataAsString().getBytes("UTF-8"))); } else { bodyDoc = null; } } catch (XMLException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } if(bodyDoc!=null){ XMLElement rootElement = bodyDoc.getRootElement(); try { XMLElement language = rootElement.getChild(FIELDNAME_CONTENT_LANGUAGE,idegaXMLNameSpace); if(language != null){ setContentLanguage(language.getText()); } else { setContentLanguage(null); } }catch(Exception e) { setContentLanguage(null); } try { XMLElement headline = rootElement.getChild(FIELDNAME_HEADLINE,idegaXMLNameSpace); if(headline != null){ setHeadline(headline.getText()); } else { setHeadline(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setHeadline(""); } try { XMLElement teaser = rootElement.getChild(FIELDNAME_TEASER,idegaXMLNameSpace); if(teaser != null){ setTeaser(teaser.getText()); } else { setTeaser(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setTeaser(""); } try { XMLElement author = rootElement.getChild(FIELDNAME_AUTHOR,idegaXMLNameSpace); if(author != null){ setAuthor(author.getText()); } else { setAuthor(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setAuthor(""); } //Parse out the body try { XMLNamespace htmlNamespace = new XMLNamespace("http://www.w3.org/1999/xhtml"); XMLElement bodyElement = rootElement.getChild(FIELDNAME_BODY,idegaXMLNameSpace); XMLElement htmlElement = bodyElement.getChild("html",htmlNamespace); XMLElement htmlBodyElement = htmlElement.getChild("body",htmlNamespace); String bodyValue = htmlBodyElement.getContentAsString(); setBody(bodyValue); }catch(Exception e) { //Nullpointer could occur if field isn't used // e.printStackTrace(); Logger log = Logger.getLogger(this.getClass().toString()); log.warning("Body of article is empty"); setBody(""); } try { XMLElement source = rootElement.getChild(FIELDNAME_SOURCE,idegaXMLNameSpace); if(source != null){ setSource(source.getText()); } else { setSource(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used setSource(""); } try { XMLElement comment = rootElement.getChild(FIELDNAME_ARTICLE_COMMENT,idegaXMLNameSpace); if(comment != null){ setComment(comment.getText()); } else { setComment(""); } }catch(Exception e) { //Nullpointer could occur if field isn't used e.printStackTrace(); setComment(""); } } else { //article not found Logger log = Logger.getLogger(this.getClass().toString()); log.warning("Article xml file was not found"); setRendered(false); return false; } return true;// setFilename();// setFolderLocation(bodyElement.getChild(FIELDNAME_FOLDER_LOCATION,idegans).getText()); }
| 3,229,840
|
private void makesureStandardFolderisCreated() { IWUserContext iwuc = getIWUserContext(); IWSlideService slideService = getIWSlideService(iwuc); String contentFolderPath = ArticleUtil.getContentRootPath(); String articlePath = ArticleUtil.getArticleRootPath(); try { //first make the folder: slideService.createAllFoldersInPathAsRoot(articlePath); //was not used? slideService.getWebdavResourceAuthenticatedAsRoot(contentFolderPath); AccessControlList aclList = slideService.getAccessControlList(contentFolderPath); AuthenticationBusiness authBusiness = ((IWSlideServiceBean)slideService).getAuthenticationBusiness(); String editorRoleUri = authBusiness.getRoleURI(StandardRoles.ROLE_KEY_EDITOR); Ace editorAce = new Ace(editorRoleUri); editorAce.addPrivilege(Privilege.READ); editorAce.addPrivilege(Privilege.WRITE); //editorAce.addPrivilege(Privilege.READ); //editorAce.setInherited(true); AccessControlEntry editorEntry = new AccessControlEntry(editorAce,AccessControlEntry.PRINCIPAL_TYPE_ROLE); aclList.add(editorEntry); String authorRoleUri = authBusiness.getRoleURI(StandardRoles.ROLE_KEY_AUTHOR); Ace authorAce = new Ace(authorRoleUri); authorAce.addPrivilege(Privilege.READ); authorAce.addPrivilege(Privilege.WRITE); //editorAce.addPrivilege(Privilege.READ); //editorAce.setInherited(true); AccessControlEntry authorEntry = new AccessControlEntry(authorAce,AccessControlEntry.PRINCIPAL_TYPE_ROLE); aclList.add(authorEntry); slideService.storeAccessControlList(aclList); //debug: aclList = slideService.getAccessControlList(contentFolderPath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|
private void makesureStandardFolderisCreated() { IWUserContext iwuc = getIWUserContext(); IWSlideService slideService = getIWSlideService(iwuc); String contentFolderPath = ArticleUtil.getContentRootPath(); String articlePath = ArticleUtil.getArticleRootPath(); try { //first make the folder: slideService.createAllFoldersInPathAsRoot(articlePath); //was not used? slideService.getWebdavResourceAuthenticatedAsRoot(contentFolderPath); AccessControlList aclList = slideService.getAccessControlList(contentFolderPath); AuthenticationBusiness authBusiness = ((IWSlideServiceBean)slideService).getAuthenticationBusiness(); String editorRoleUri = authBusiness.getRoleURI(StandardRoles.ROLE_KEY_EDITOR); Ace editorAce = new Ace(editorRoleUri); editorAce.addPrivilege(Privilege.READ); editorAce.addPrivilege(Privilege.WRITE); //editorAce.addPrivilege(Privilege.READ); //editorAce.setInherited(true); AccessControlEntry editorEntry = new AccessControlEntry(editorAce,AccessControlEntry.PRINCIPAL_TYPE_ROLE); aclList.add(editorEntry); String authorRoleUri = authBusiness.getRoleURI(StandardRoles.ROLE_KEY_AUTHOR); Ace authorAce = new Ace(authorRoleUri); authorAce.addPrivilege(Privilege.READ); authorAce.addPrivilege(Privilege.WRITE); //editorAce.addPrivilege(Privilege.READ); //editorAce.setInherited(true); AccessControlEntry authorEntry = new AccessControlEntry(authorAce,AccessControlEntry.PRINCIPAL_TYPE_ROLE); aclList.add(authorEntry); slideService.storeAccessControlList(aclList); //debug: aclList = slideService.getAccessControlList(contentFolderPath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
| 3,229,841
|
protected void prettifyBody() { String body = getBody(); if(body!=null){// System.out.println("ArticleIn = "+articleIn); //Use JTidy to clean up the html Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setXmlOut(true); tidy.setCharEncoding(Configuration.UTF8); ByteArrayInputStream bais; try { bais = new ByteArrayInputStream(body.getBytes("UTF-8")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); tidy.parse(bais, baos); body = baos.toString("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } // System.out.println("ArticleOut = "+articleOut); setBody(body); } }
|
protected void prettifyBody() { String body = getBody(); if(body!=null){// System.out.println("ArticleIn = "+articleIn); //Use JTidy to clean up the html Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setXmlOut(true); tidy.setCharEncoding(Configuration.UTF8); ByteArrayInputStream bais; try { bais = new ByteArrayInputStream(body.getBytes("UTF-8")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); tidy.parse(bais, baos); body = baos.toString("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } // System.out.println("ArticleOut = "+articleOut); setBody(body); } }
| 3,229,842
|
public void removeImage(Integer imageNumber) { int imageNo = imageNumber.intValue(); try { List l = getImages(); l.remove(imageNo); for (int i = 0; i < l.size(); i++) { ContentItemField field = (ContentItemField) l.get(i); field.setOrderNo(i); } } catch (Exception e) {} }
|
public void removeImage(Integer imageNumber) { int imageNo = imageNumber.intValue(); try { List l = getImages(); l.remove(imageNo); for (int i = 0; i < l.size(); i++) { ContentItemField field = (ContentItemField) l.get(i); field.setOrderNo(i); } } catch (Exception e) {} }
| 3,229,843
|
public void setAuthor(String s) { setValue(FIELDNAME_AUTHOR, s); }
|
public void setAuthor(String s) { getLocalizedArticle().setAuthor(s); }
| 3,229,844
|
public void setBody(String body) { setValue(FIELDNAME_BODY, body);// if (null != articleIn) {//// System.out.println("ArticleIn = "+articleIn);// //Use JTidy to clean up the html// Tidy tidy = new Tidy();// tidy.setXHTML(true);// tidy.setXmlOut(true);// ByteArrayInputStream bais = new ByteArrayInputStream(articleIn.getBytes());// ByteArrayOutputStream baos = new ByteArrayOutputStream();// tidy.parse(bais, baos);// String articleOut = baos.toString();//// System.out.println("ArticleOut = "+articleOut);// setValue(FIELDNAME_BODY, articleOut);//// setValue(FIELDNAME_BODY, articleIn);// }// else {// setValue(FIELDNAME_BODY, null);// } }
|
public void setBody(String body) { setValue(FIELDNAME_BODY, body);// if (null != articleIn) {//// System.out.println("ArticleIn = "+articleIn);// //Use JTidy to clean up the html// Tidy tidy = new Tidy();// tidy.setXHTML(true);// tidy.setXmlOut(true);// ByteArrayInputStream bais = new ByteArrayInputStream(articleIn.getBytes());// ByteArrayOutputStream baos = new ByteArrayOutputStream();// tidy.parse(bais, baos);// String articleOut = baos.toString();//// System.out.println("ArticleOut = "+articleOut);// setValue(FIELDNAME_BODY, articleOut);//// setValue(FIELDNAME_BODY, articleIn);// }// else {// setValue(FIELDNAME_BODY, null);// } }
| 3,229,845
|
public void setComment(String s) { setValue(FIELDNAME_COMMENT, s); }
|
public void setComment(String s) { setValue(FIELDNAME_COMMENT, s); }
| 3,229,846
|
public void setHeadline(String s) { setValue(FIELDNAME_HEADLINE, s); }
|
public void setHeadline(String s) { setValue(FIELDNAME_HEADLINE, s); }
| 3,229,847
|
public void setImages(List l) { setItemFields(FIELDNAME_IMAGES, l); }
|
public void setImages(List l) { setItemFields(FIELDNAME_IMAGES, l); }
| 3,229,848
|
public void setLanguageChange(String s) { setValue(FIELDNAME_LANGUAGE_CHANGE, s); }
|
public void setLanguageChange(String s) { setValue(FIELDNAME_LANGUAGE_CHANGE, s); }
| 3,229,849
|
protected void setPublished(){ setStatus(ContentItemCase.STATUS_PUBLISHED); }
|
protected void setPublished(){ setStatus(ContentItemCase.STATUS_PUBLISHED); }
| 3,229,850
|
public void setSource(String s) { setValue(FIELDNAME_SOURCE, s); }
|
public void setSource(String s) { setValue(FIELDNAME_SOURCE, s); }
| 3,229,851
|
public void setTeaser(String s) { setValue(FIELDNAME_TEASER, s); }
|
public void setTeaser(String s) { getLocalizedArticle().setTeaser(s); }
| 3,229,852
|
public void setUpdated(boolean b) { _isUpdated = b; }
|
public void setUpdated(boolean b) { _isUpdated = b; }
| 3,229,853
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 3,229,854
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 3,229,855
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 3,229,856
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if ( (getHeadline()==null) || (getHeadline().trim().equals("")) ) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; }// if (getBody().trim().equals("")) {// addErrorKey(KEY_ERROR_BODY_EMPTY);// storeOk = false;// } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } if(storeOk){ try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML(); ByteArrayInputStream utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); // System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(rootResource.putMethod(filePath,utf8stream)){ rootResource.proppatchMethod(filePath,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } else{ utf8stream = new ByteArrayInputStream(article.getBytes("UTF-8")); String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,utf8stream); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { //load(filePath); ArticleItemBean newBean = new ArticleItemBean(); newBean.load(filePath); } catch (Exception e) { //storeOk = false; //e.printStackTrace(); throw new ArticleStoreException(e.getMessage()); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } catch (XMLException e) { storeOk = false; e.printStackTrace(); } } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 3,229,857
|
protected void tryPublish(){ //TODO: Implement publishing here: setPublished(); }
|
protected void tryPublish(){ //TODO: Implement publishing here: setPublished(); }
| 3,229,858
|
public RubyFixnum length() { long size = 0; if (begin.funcall(">", end).isTrue()) { return new RubyFixnum(getRuby(), 0); } if (begin instanceof RubyFixnum && end instanceof RubyFixnum) { size = ((RubyNumeric) end).getLongValue() - ((RubyNumeric) begin).getLongValue(); if (!isExclusive) { size++; } } return new RubyFixnum(getRuby(), size); }
|
public RubyFixnum length() { long size = 0; if (begin.funcall(">", end).isTrue()) { return RubyFixnum.newFixnum(getRuby(), 0); } if (begin instanceof RubyFixnum && end instanceof RubyFixnum) { size = ((RubyNumeric) end).getLongValue() - ((RubyNumeric) begin).getLongValue(); if (!isExclusive) { size++; } } return new RubyFixnum(getRuby(), size); }
| 3,229,859
|
public RubyFixnum length() { long size = 0; if (begin.funcall(">", end).isTrue()) { return new RubyFixnum(getRuby(), 0); } if (begin instanceof RubyFixnum && end instanceof RubyFixnum) { size = ((RubyNumeric) end).getLongValue() - ((RubyNumeric) begin).getLongValue(); if (!isExclusive) { size++; } } return new RubyFixnum(getRuby(), size); }
|
public RubyFixnum length() { long size = 0; if (begin.funcall(">", end).isTrue()) { return new RubyFixnum(getRuby(), 0); } if (begin instanceof RubyFixnum && end instanceof RubyFixnum) { size = ((RubyNumeric) end).getLongValue() - ((RubyNumeric) begin).getLongValue(); if (!isExclusive) { size++; } } return RubyFixnum.newFixnum(getRuby(), size); }
| 3,229,860
|
public void makePizza() { System.out.println("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size); }
|
public void makePizza() { log.info("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size); }
| 3,229,861
|
public void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage img = model.getDisplayedImage(); if (img == null) return; Graphics2D g2D = (Graphics2D) g; ImagePaintingFactory.setGraphicRenderingSettings(g2D); g2D.drawImage(img, null, 0, 0); if (model.isUnitBar()) { String value = model.getUnitBarValue(); if (value != null) { int size = (int) (model.getUnitBarSize()); int width, height; width = img.getWidth(); height = img.getHeight(); Rectangle imgRect = new Rectangle(0, 0, width, height); Rectangle viewRect = view.getViewport().getBounds(); if (imgRect.contains(viewRect)) { JViewport port = view.getViewport(); width = (int) port.getViewPosition().getX()+port.getWidth(); height = (int) port.getViewPosition().getY()+ port.getHeight(); } else { if (viewRect.width < imgRect.width) width = viewRect.width; if (viewRect.height < imgRect.height) height = viewRect.height; } ImagePaintingFactory.paintScaleBar(g2D, width-size-10, height-10, size, value); } } }
|
public void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage img = model.getDisplayedImage(); if (img == null) return; Graphics2D g2D = (Graphics2D) g; ImagePaintingFactory.setGraphicRenderingSettings(g2D); g2D.drawImage(img, null, 0, 0); if (model.isUnitBar()) { String value = model.getUnitBarValue(); if (value != null) { int size = (int) (model.getUnitBarSize()); int width, height; width = img.getWidth(); height = img.getHeight(); Rectangle imgRect = new Rectangle(0, 0, width, height); Rectangle viewRect = view.getViewport().getBounds(); if (imgRect.contains(viewRect)) { JViewport port = view.getViewport(); width = (int) port.getViewPosition().getX()+port.getWidth(); height = (int) port.getViewPosition().getY()+ port.getHeight(); } else { if (viewRect.width < imgRect.width) width = viewRect.width; if (viewRect.height < imgRect.height) height = viewRect.height; } ImagePaintingFactory.paintScaleBar(g2D, width-size-10, height-10, size, value); } } }
| 3,229,862
|
public void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage img = model.getDisplayedImage(); if (img == null) return; Graphics2D g2D = (Graphics2D) g; ImagePaintingFactory.setGraphicRenderingSettings(g2D); g2D.drawImage(img, null, 0, 0); if (model.isUnitBar()) { String value = model.getUnitBarValue(); if (value != null) { int size = (int) (model.getUnitBarSize()); int width, height; width = img.getWidth(); height = img.getHeight(); Rectangle imgRect = new Rectangle(0, 0, width, height); Rectangle viewRect = view.getViewport().getBounds(); if (imgRect.contains(viewRect)) { JViewport port = view.getViewport(); width = (int) port.getViewPosition().getX()+port.getWidth(); height = (int) port.getViewPosition().getY()+ port.getHeight(); } else { if (viewRect.width < imgRect.width) width = viewRect.width; if (viewRect.height < imgRect.height) height = viewRect.height; } ImagePaintingFactory.paintScaleBar(g2D, width-size-10, height-10, size, value); } } }
|
public void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage img = model.getDisplayedImage(); if (img == null) return; Graphics2D g2D = (Graphics2D) g; ImagePaintingFactory.setGraphicRenderingSettings(g2D); g2D.drawImage(img, null, 0, 0); if (model.isUnitBar()) { String value = model.getUnitBarValue(); if (value != null) { int size = (int) (model.getUnitBarSize()); int width, height; width = img.getWidth(); height = img.getHeight(); Rectangle imgRect = new Rectangle(0, 0, width, height); Rectangle viewRect = view.getViewport().getBounds(); if (imgRect.contains(viewRect)) { JViewport port = view.getViewport(); width = (int) port.getViewPosition().getX()+port.getWidth(); height = (int) port.getViewPosition().getY()+ port.getHeight(); } else { if (viewRect.width < imgRect.width) width = viewRect.width; if (viewRect.height < imgRect.height) height = viewRect.height; } ImagePaintingFactory.paintScaleBar(g2D, width-size-10, height-10, size, value); } } }
| 3,229,863
|
public void testThumbnailsDirect() throws Exception { RenderingDef def = qs .findAll(RenderingDef.class, null).get(0); Pixels p = qs.get(Pixels.class, def.getPixels().getId()); tb.getThumbnailDirect(p, def, 8, 8); }
|
public void testThumbnailsDirect() throws Exception { RenderingDef def = qs .findAll(RenderingDef.class, null).get(0); Pixels p = qs.get(Pixels.class, def.getPixels().getId()); tb.getThumbnailDirect(p, def, 8, 8); }
| 3,229,864
|
protected void onSetUp() throws Exception { iQuery = (LocalQuery) applicationContext.getBean("queryService"); iUpdate = (LocalUpdate) applicationContext.getBean("updateService"); iAnalysis= (IAnalysis) applicationContext.getBean("analysisService"); login("root","system","Test"); }
|
protected void onSetUp() throws Exception { iQuery = (LocalQuery) applicationContext.getBean("queryService"); iUpdate = (LocalUpdate) applicationContext.getBean("updateService"); iAnalysis = (IAnalysis) applicationContext.getBean("analysisService"); iPojos = (IPojos) applicationContext.getBean("pojosService"); login("root","system","Test"); }
| 3,229,865
|
public void buildGUI() { Container content = getContentPane(); content.setLayout(new BorderLayout()); chainCanvas = new ChainPaletteCanvas(dataManager); chainCanvas.setContents(dataManager.getChains()); long start; if (ChainBuilderAgent.DEBUG) start = System.currentTimeMillis(); chainCanvas.layoutContents(); if (ChainBuilderAgent.DEBUG) { long end; end = System.currentTimeMillis()-start; System.err.println("time to layout chains is "+end); } chainCanvas.completeInitialization(); setSize(new Dimension(ModulePaletteWindow.SIDE,ModulePaletteWindow.SIDE)); content.add(chainCanvas); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (chainCanvas != null) chainCanvas.scaleToResize(); } }); }
|
public void buildGUI() { Container content = getContentPane(); content.setLayout(new BorderLayout()); chainCanvas = new ChainPaletteCanvas(dataManager); chainCanvas.setContents(dataManager.getChains()); long start; if (ChainBuilderAgent.DEBUG) start = System.currentTimeMillis(); chainCanvas.layoutContents(); if (ChainBuilderAgent.DEBUG_TIMING) { long end; end = System.currentTimeMillis()-start; System.err.println("time to layout chains is "+end); } chainCanvas.completeInitialization(); setSize(new Dimension(ModulePaletteWindow.SIDE,ModulePaletteWindow.SIDE)); content.add(chainCanvas); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (chainCanvas != null) chainCanvas.scaleToResize(); } }); }
| 3,229,866
|
public void buildGUI() { Container content = getContentPane(); content.setLayout(new BorderLayout()); chainCanvas = new ChainPaletteCanvas(dataManager); chainCanvas.setContents(dataManager.getChains()); long start; if (ChainBuilderAgent.DEBUG) start = System.currentTimeMillis(); chainCanvas.layoutContents(); if (ChainBuilderAgent.DEBUG) { long end; end = System.currentTimeMillis()-start; System.err.println("time to layout chains is "+end); } chainCanvas.completeInitialization(); setSize(new Dimension(ModulePaletteWindow.SIDE,ModulePaletteWindow.SIDE)); content.add(chainCanvas); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (chainCanvas != null) chainCanvas.scaleToResize(); } }); }
|
public void buildGUI() { Container content = getContentPane(); content.setLayout(new BorderLayout()); chainCanvas = new ChainPaletteCanvas(dataManager); chainCanvas.setContents(dataManager.getChains()); long start; if (ChainBuilderAgent.DEBUG) start = System.currentTimeMillis(); chainCanvas.layoutContents(); if (ChainBuilderAgent.DEBUG) { long end; end = System.currentTimeMillis()-start; System.err.println("time to layout chains is "+end); } chainCanvas.completeInitialization(); setSize(new Dimension(ModulePaletteWindow.SIDE,ModulePaletteWindow.SIDE)); content.add(chainCanvas); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (chainCanvas != null) chainCanvas.scaleToResize(); } }); }
| 3,229,867
|
public static IRubyObject new_array(IRubyObject recv, IRubyObject object) { return object.callMethod("to_a"); }
|
public static IRubyObject new_array(IRubyObject recv, IRubyObject object) { IRubyObject value = object.convertToTypeWithCheck("Array", "to_ary"); if (value.isNil()) { ICallable method = object.getMetaClass().searchMethod("to_a"); if (method.getImplementationClass() == recv.getRuntime().getKernel()) { return recv.getRuntime().newArray(object); } value = object.callMethod("to_a"); if (value.getMetaClass() != recv.getRuntime().getClass("Array")) { throw recv.getRuntime().newTypeError("`to_a' did not return Array"); } } return value; }
| 3,229,868
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again List toReset = new ArrayList(); for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); toReset.add(key.channel()); } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); toReset.add(key.channel()); } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
| 3,229,869
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again List toReset = new ArrayList(); for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); toReset.add(key.channel()); } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again List toReset = new ArrayList(); for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); SelectableChannel channel = key.channel(); synchronized(channel.blockingLock()) { boolean blocking = ((RubyIO) key.attachment()).getBlocking(); key.cancel(); channel.configureBlocking(blocking); } } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
| 3,229,870
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again List toReset = new ArrayList(); for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); toReset.add(key.channel()); } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
|
public static IRubyObject select_static(IRuby runtime, IRubyObject[] args) { try { boolean atLeastOneDescriptor = false; Selector selector = Selector.open(); if (!args[0].isNil()) { atLeastOneDescriptor = true; // read for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT); } } if (args.length > 1 && !args[1].isNil()) { atLeastOneDescriptor = true; // write for (Iterator i = ((RubyArray) args[0]).getList().iterator(); i.hasNext(); ) { IRubyObject obj = (IRubyObject) i.next(); registerSelect(selector, obj, SelectionKey.OP_WRITE); } } if (args.length > 2 && !args[2].isNil()) { atLeastOneDescriptor = true; // Java's select doesn't do anything about this, so we leave it be. } long timeout = 0; if(args.length > 3 && !args[3].isNil()) { if (args[3] instanceof RubyFloat) { timeout = Math.round(((RubyFloat) args[3]).getDoubleValue() * 1000); } else { timeout = Math.round(((RubyFixnum) args[3]).getDoubleValue() * 1000); } if (timeout < 0) { throw runtime.newArgumentError("negative timeout given"); } } if (!atLeastOneDescriptor) { return runtime.getNil(); } if(args.length > 3) { selector.select(timeout); } else { selector.select(); } List r = new ArrayList(); List w = new ArrayList(); List e = new ArrayList(); for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) { r.add(key.attachment()); } if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) { w.add(key.attachment()); } } List ret = new ArrayList(); ret.add(RubyArray.newArray(runtime, r)); ret.add(RubyArray.newArray(runtime, w)); ret.add(RubyArray.newArray(runtime, e)); // make all sockets blocking again List toReset = new ArrayList(); for (Iterator i = selector.keys().iterator(); i.hasNext(); ) { SelectionKey key = (SelectionKey) i.next(); toReset.add(key.channel()); } selector.close(); for (Iterator i = toReset.iterator(); i.hasNext(); ) { SelectableChannel channel = (SelectableChannel) i.next(); channel.configureBlocking(true); } return RubyArray.newArray(runtime, ret); } catch(IOException e) { throw runtime.newIOError(e.getMessage()); } }
| 3,229,871
|
public RubyObject m_compact_bang() { modify(); boolean changed = false; int length = length(); for (int i = 0; i < length; i++) { if (entry(i).isNil()) { list.remove(i); changed = true; } } return changed ? (RubyObject)this : (RubyObject)getRuby().getNil(); }
|
public RubyObject m_compact_bang() { modify(); boolean changed = false; int length = length(); for (int i = 0; i < length; i++) { if (entry(i).isNil()) { list.remove(i); changed = true; } } return changed ? (RubyObject)this : (RubyObject)getRuby().getNil(); }
| 3,229,872
|
public RubyObject m_compact_bang() { modify(); boolean changed = false; int length = length(); for (int i = 0; i < length; i++) { if (entry(i).isNil()) { list.remove(i); changed = true; } } return changed ? (RubyObject)this : (RubyObject)getRuby().getNil(); }
|
public RubyObject m_compact_bang() { modify(); boolean changed = false; int length = length(); for (int i = 0; i < length; i++) { if (entry(i).isNil()) { list.remove(i); changed = true; } } return changed ? (RubyObject)this : (RubyObject)getRuby().getNil(); }
| 3,229,873
|
public ClassData getOrCreateClassData(String name) { ClassData classData = (ClassData)this.classes.get(name); if (classData == null) { classData = new ClassData(name); addClassData(classData); } return classData; }
|
public ClassData getOrCreateClassData(String name) { ClassData classData = (ClassData)this.classes.get(name); if (classData == null) { classData = new ClassData(name); addClassData(classData); } return classData; }
| 3,229,876
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.