1 /* 2 * CallFrame.java 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16 package org.rstudio.studio.client.workbench.views.environment.model; 17 18 import org.rstudio.core.client.DebugFilePosition; 19 20 import com.google.gwt.core.client.JavaScriptObject; 21 22 public class CallFrame extends JavaScriptObject 23 { CallFrame()24 protected CallFrame() 25 { 26 } 27 getFunctionName()28 public final native String getFunctionName() /*-{ 29 return this.function_name; 30 }-*/; 31 getContextDepth()32 public final native int getContextDepth() /*-{ 33 return this.context_depth; 34 }-*/; 35 getFileName()36 public final native String getFileName() /*-{ 37 return this.file_name; 38 }-*/; 39 getAliasedFileName()40 public final native String getAliasedFileName() /*-{ 41 return this.aliased_file_name; 42 }-*/; 43 getLineNumber()44 public final native int getLineNumber() /*-{ 45 return this.line_number; 46 }-*/; 47 getEndLineNumber()48 public final native int getEndLineNumber() /*-{ 49 return this.end_line_number; 50 }-*/; 51 getCharacterNumber()52 public final native int getCharacterNumber() /*-{ 53 return this.character_number; 54 }-*/; 55 getEndCharacterNumber()56 public final native int getEndCharacterNumber() /*-{ 57 return this.end_character_number; 58 }-*/; 59 getCallSummary()60 public final native String getCallSummary() /*-{ 61 return this.call_summary; 62 }-*/; 63 getFunctionLineNumber()64 public final native int getFunctionLineNumber() /*-{ 65 return this.function_line_number; 66 }-*/; 67 getFunctionCharacterNumber()68 public final native int getFunctionCharacterNumber() /*-{ 69 return this.function_character_number; 70 }-*/; 71 getShinyFunctionLabel()72 public final native String getShinyFunctionLabel() /*-{ 73 return this.shiny_function_label; 74 }-*/; 75 hasRealSrcref()76 public final native boolean hasRealSrcref() /*-{ 77 return this.real_sourceref; 78 }-*/; 79 isErrorHandler()80 public final native boolean isErrorHandler() /*-{ 81 return this.is_error_handler; 82 }-*/; 83 isHidden()84 public final native boolean isHidden() /*-{ 85 return this.is_hidden; 86 }-*/; 87 isSourceEquiv()88 public final native boolean isSourceEquiv() /*-{ 89 return this.is_source_equiv; 90 }-*/; 91 getRange()92 public final DebugFilePosition getRange() 93 { 94 return DebugFilePosition.create( 95 getLineNumber(), 96 getEndLineNumber(), 97 getCharacterNumber(), 98 getEndCharacterNumber()); 99 } 100 isNavigable()101 public final boolean isNavigable() 102 { 103 return hasRealSrcref(); 104 } 105 isNavigableFilename(String fileName)106 public final static boolean isNavigableFilename(String fileName) 107 { 108 if (fileName.length() > 0 && 109 !fileName.equalsIgnoreCase("NULL") && 110 !fileName.equalsIgnoreCase("<tmp>") && 111 !fileName.equalsIgnoreCase("<text>") && 112 !fileName.equalsIgnoreCase("~/.active-rstudio-document")) 113 { 114 return true; 115 } 116 return false; 117 } 118 } 119