### Setup and SetupClass Method Mapping Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/spring-integration-d5d954def737038a5982ca34ecc8f14610061090.txt Shows the mapping between the setup() and setupClass() methods, suggesting a change in how setup logic is organized. ```java public setup() : void ``` ```java public setupClass() : void ``` -------------------------------- ### Setup Start and End Destination Text Input Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Configures the start and end destination text fields, including requesting focus and showing the soft keyboard for the start destination. ```java currentLocationIcon.setVisibility(View.VISIBLE); startDestinationText.setFocusableInTouchMode(true); startDestinationText.requestFocus(); startDestinationText.post(() -> { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) imm.showSoftInput(startDestinationText, InputMethodManager.SHOW_IMPLICIT); }); ``` -------------------------------- ### Refactoring Miner Setup Method Mapping Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/hbase-587f5bc11f9d5d37557baf36c7df110af860a95c-inline.txt Maps the 'setUp()' method to 'setUpBeforeClass()' in Java for test setup. ```java public setUp() : void -> public setUpBeforeClass() : void ``` -------------------------------- ### Setup Method Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/spring-integration-0ead69529ea1fec992483c96f78c94e303eb6818.txt Standard setup method for test classes. It is annotated with @Before and should be called before each test method. ```Java public void setup() : void @Before==null ``` -------------------------------- ### Initialize and Setup RoutePickerController Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/MapsActivity-v2.txt Initializes the RoutePickerController with its dependencies and calls its setup method. ```java routePickerController = new RoutePickerController(this, routeManager, indoorNavController, bannerManager); routePickerController.setup(); ``` -------------------------------- ### Setup and Basic Polling Methods Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/spring-integration-d5d954def737038a5982ca34ecc8f14610061090.txt Illustrates the relationship between the setup() and basicPolling() methods, indicating potential refactoring or code evolution. ```java public setup() : void ``` ```java public basicPolling() : void ``` -------------------------------- ### Refactoring Miner Setup Method Overload Mapping Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/hbase-587f5bc11f9d5d37557baf36c7df110af860a95c-inline.txt Maps the 'setUp()' method to an overloaded 'setUp(tableNameAsString String)' in Java. ```java public setUp() : void -> public setUp(tableNameAsString String) : void ``` -------------------------------- ### Setup Destination Text Input Listeners Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Sets up click listeners for the start and end destination text inputs to update the text, set selection, and preview the route upon item selection. ```java startDestinationText.setOnItemClickListener((parent, view, position, id) -> { startDestinationText.setText((String) parent.getItemAtPosition(position)); startDestinationText.setSelection(startDestinationText.getText().length()); previewRoute(); }); endDestinationText.setOnItemClickListener((parent, view, position, id) -> { endDestinationText.setText((String) parent.getItemAtPosition(position)); endDestinationText.setSelection(endDestinationText.getText().length()); previewRoute(); }); ``` -------------------------------- ### Setup Method (Class Level) Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/spring-integration-0ead69529ea1fec992483c96f78c94e303eb6818.txt Setup method for test classes, executed once before all tests in the class. Annotated with @BeforeClass. ```Java public void setup() : void null==@BeforeClass ``` -------------------------------- ### setUp Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/druid-76cb06a8d8161d29d985ef048b89e6a82b489058.txt Sets up the environment. This method is used for initialization before tests. ```APIDOC ## setUp ### Description Sets up the environment. This method is used for initialization before tests. ### Method POST ### Endpoint /api/setup ### Parameters None ### Request Example ``` POST /api/setup ``` ### Response #### Success Response (200) - **void** - Indicates successful setup. #### Response Example ```json { "message": "Setup complete" } ``` ``` -------------------------------- ### Service Start Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/FifoScheduler-v1.txt Handles the starting of the service by calling the superclass's serviceStart. ```java @Override public void serviceStart() throws Exception { super.serviceStart(); } ``` -------------------------------- ### Setup Destination Text Listeners Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v1.txt Sets up listeners for start and end destination text fields to update the displayed text, set cursor position, and trigger a route preview upon item selection. ```Java private void setupSuggestionListeners() { startDestinationText.setOnItemClickListener((parent, view, position, id) -> { startDestinationText.setText((String) parent.getItemAtPosition(position)); startDestinationText.setSelection(startDestinationText.getText().length()); previewRoute(); }); endDestinationText.setOnItemClickListener((parent, view, position, id) -> { endDestinationText.setText((String) parent.getItemAtPosition(position)); endDestinationText.setSelection(endDestinationText.getText().length()); previewRoute(); }); } ``` -------------------------------- ### Apply Route and Start Navigation Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Applies a calculated route to the map, starts navigation updates, and updates the UI. It also displays a toast message indicating navigation has started. ```Java private void applyPoiRoute(Route route, String pendingPoiName) { if (pendingPoiName != null && !pendingPoiName.isEmpty()) { openWithStartAndDestination(CURRENT_LOCATION, pendingPoiName); } routeManager.drawRouteOnMap(route.getPoints(), route.getDuration(), route.getSteps()); routeManager.startNavigationUpdates(); toggleNavigationUI(true); if (txtNavInstruction != null && txtDuration != null) { CharSequence durationText = txtDuration.getText(); String instructionText = (durationText != null && durationText.length() > 0) ? durationText + " (" + routeManager.getSelectedMode().getValue() + ")" : "Follow the route (" + routeManager.getSelectedMode().getValue() + ")"; txtNavInstruction.setText(instructionText); } Toast.makeText(activity, "Navigation Started", Toast.LENGTH_SHORT).show(); } ``` -------------------------------- ### Start Navigation Sequence Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Manages the start of a navigation session, including UI updates, instruction text, and camera positioning. Assumes routeManager and mMap are initialized. ```java private void startNavigation(String startText, String destText) { routeManager.removeStartDot(); routeManager.startNavigationUpdates(); Toast.makeText(activity, "Navigation Started", Toast.LENGTH_SHORT).show(); toggleNavigationUI(true); String modeLabel = routeManager.getSelectedMode().getValue(); if (txtDuration != null && txtDuration.getText().length() > 0 && !txtDuration.getText().equals("-- MIN")) { txtNavInstruction.setText(txtDuration.getText() + " (" + modeLabel + ")"); } else { txtNavInstruction.setText("Follow the route (" + modeLabel + ")"); } LatLng cameraTarget = routeManager.getSelectedMode() == RouteTravelMode.SHUTTLE ? BuildingLookup.getLatLngFromBuildingName(startText, MapsActivity.buildingsMap) : routeManager.getFirstRoutePoint(); if (cameraTarget != null && mMap != null) { mMap.animateCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder().target(cameraTarget).zoom(19f).tilt(0).build())); } } ``` -------------------------------- ### Handle Outdoor Navigation Start Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/MapsActivity-v1.txt Displays a toast message indicating that outdoor navigation has started. This is typically called upon successful initiation of an outdoor route. ```java Toast.makeText(MapsActivity.this, "Outdoor navigation started", Toast.LENGTH_SHORT).show(); ``` -------------------------------- ### Test URL Starting with 'www.' Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/URLUtilTest-v1.txt Verifies that URLs starting with 'www.' are automatically prefixed with 'https://' during creation. This handles a common shorthand for URLs. ```java // URLs starting with www. should be prefixed with https:// URL result = URLUtil.create("www.example.com"); assertNotNull(result); assertEquals("https://www.example.com", result.toString()); ``` -------------------------------- ### Handle Rawtext Start Tag Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v2.txt Inserts a start tag and transitions the tokeniser to the Rawtext state, marking the insertion mode and transitioning the parser state to Text. ```Java private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } ``` -------------------------------- ### Open Route Picker with Start and Destination Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v1.txt Opens the route picker UI, pre-fills the start and destination fields, and initiates a route preview. This is typically called from notification or banner flows. ```Java /** * Opens the route picker pre-filled with start and destination, then * kicks off a route preview. Called from notification/banner directions flow. */ public void openWithStartAndDestination(String start, String destination) { View bannerView = activity.findViewById(R.id.included_banner); if (bannerView != null) bannerView.setVisibility(View.GONE); if (startDestinationText == null || endDestinationText == null) return; startDestinationText.setText(start); endDestinationText.setText(destination); View searchBar = activity.findViewById(R.id.search_bar_container); if (searchBar != null) searchBar.setVisibility(View.GONE); if (routePicker != null) routePicker.setVisibility(View.VISIBLE); bannerManager.setRoutePickerOpen(true); routeManager.initiateRoutePreview(start, destination); } ``` -------------------------------- ### ApplyCommand Constructor Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/ApplyCommand-v1.txt Initializes the ApplyCommand with a given repository instance. This is the starting point for using the apply functionality. ```java ApplyCommand(Repository repo) { super(repo); } ``` -------------------------------- ### Handle RCDATA Start Tag Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v2.txt Inserts a start tag and transitions the tokeniser to the Rcdata state, marking the insertion mode and transitioning the parser state to Text. ```Java private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } ``` -------------------------------- ### Setup BibEntry with Fields Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/CopyMoreActionTest-v2.txt Initializes a BibEntry with various fields including author, title, year, journal, date, keywords, abstract, DOI, subtitle, and citation key. This setup is used in tests to ensure all relevant data is available for copying. ```java String title = "A tale from the trenches"; String author = "Souti Chattopadhyay and Nicholas Nelson and Audrey Au and Natalia Morales and Christopher Sanchez and Rahul Pandita and Anita Sarma"; String journal = "Journal of the American College of Nutrition"; String date = "2001-10"; String keyword = "software engineering, cognitive bias, empirical study"; String abstractText = "This paper presents a study on cognitive biases in software development."; entry = new BibEntry(StandardEntryType.Misc) .withField(StandardField.AUTHOR, author) .withField(StandardField.TITLE, title) .withField(StandardField.YEAR, "2020") .withField(StandardField.JOURNAL, journal) .withField(StandardField.DATE, date) .withField(StandardField.KEYWORDS, keyword) .withField(StandardField.ABSTRACT, abstractText) .withField(StandardField.DOI, "10.1145/3377811.3380330") .withField(StandardField.SUBTITLE, "cognitive biases and software development") .withCitationKey("abc"); titles.add(title); keys.add("abc"); dois.add("10.1145/3377811.3380330"); authors.add(author); journals.add(journal); dates.add(date); keywords.add(keyword); abstracts.add(abstractText); ``` -------------------------------- ### Clone and Analyze Hibernate Commit Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/TestStatementMappings-v1.txt This example demonstrates cloning the hibernate-orm repository and analyzing a specific commit for refactorings. It follows a similar process to the Jetty example, including file diffing, content population, move source folder detection, and UML model comparison. It requires GitService and Refactoring Miner classes. ```java Repository repository = gitService.cloneIfNotExists( REPOS + "/hibernate-orm", "https://github.com/hibernate/hibernate-orm.git"); final List actual = new ArrayList<>(); String commitId = "5329bba1ea724eabf5783c71e5127b8f84ad0fcc"; List refactoringsAtRevision; try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(repository.resolve(commitId)); if (commit.getParentCount() > 0) { walk.parseCommit(commit.getParent(0)); Set filePathsBefore = new LinkedHashSet(); Set filePathsCurrent = new LinkedHashSet(); Map renamedFilesHint = new HashMap(); gitService.fileTreeDiff(repository, commit, filePathsBefore, filePathsCurrent, renamedFilesHint); Set repositoryDirectoriesBefore = new LinkedHashSet(); Set repositoryDirectoriesCurrent = new LinkedHashSet(); Map fileContentsBefore = new LinkedHashMap(); Map fileContentsCurrent = new LinkedHashMap(); if (!filePathsBefore.isEmpty() && !filePathsCurrent.isEmpty() && commit.getParentCount() > 0) { RevCommit parentCommit = commit.getParent(0); GitHistoryRefactoringMinerImpl.populateFileContents(repository, parentCommit, filePathsBefore, fileContentsBefore, repositoryDirectoriesBefore); GitHistoryRefactoringMinerImpl.populateFileContents(repository, commit, filePathsCurrent, fileContentsCurrent, repositoryDirectoriesCurrent); List moveSourceFolderRefactorings = GitHistoryRefactoringMinerImpl.processIdenticalFiles(fileContentsBefore, fileContentsCurrent, renamedFilesHint); UMLModel parentUMLModel = GitHistoryRefactoringMinerImpl.createModel(fileContentsBefore, repositoryDirectoriesBefore); UMLModel currentUMLModel = GitHistoryRefactoringMinerImpl.createModel(fileContentsCurrent, repositoryDirectoriesCurrent); UMLModelDiff modelDiff = parentUMLModel.diff(currentUMLModel); refactoringsAtRevision = modelDiff.getRefactorings(); ``` -------------------------------- ### Test Get Available Functionality Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/Strata-b2b9b629685ebc7e89e9a1667de88f2e878d5fc4-migration.txt Tests the functionality for retrieving available refactoring types. No specific setup is required beyond having the library imported. ```java public test_getAvailable() : void ``` -------------------------------- ### Initialize Repository and Prepare for Analysis Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/TestStatementMappings-v1.txt Clones a Git repository if it doesn't exist and initializes necessary data structures for refactoring analysis. This is a setup step before detailed commit analysis. ```java Repository repository = gitService.cloneIfNotExists( REPOS + "/commons-lang", "https://github.com/apache/commons-lang.git"); final List actual = new ArrayList<>(); String commitId = "4d46f014fb8ee44386feb5fec52509f35d0e36ea"; List refactoringsAtRevision; try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(repository.resolve(commitId)); if (commit.getParentCount() > 0) { walk.parseCommit(commit.getParent(0)); Set filePathsBefore = new LinkedHashSet(); Set filePathsCurrent = new LinkedHashSet(); Map renamedFilesHint = new HashMap(); gitService.fileTreeDiff(repository, commit, filePathsBefore, filePathsCurrent, renamedFilesHint); Set repositoryDirectoriesBefore = new LinkedHashSet(); Set repositoryDirectoriesCurrent = new LinkedHashSet(); Map fileContentsBefore = new LinkedHashMap(); Map fileContentsCurrent = new LinkedHashMap(); ``` -------------------------------- ### Initialize JabRefFrame Constructor Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v2.txt Sets up the main JabRef frame by initializing various services, creating UI components, and setting up event handlers and bindings. Requires several service dependencies. ```java GuiPreferences preferences, AiService aiService, StateManager stateManager, CountingUndoManager undoManager, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor) { this.mainStage = mainStage; this.dialogService = dialogService; this.fileUpdateMonitor = fileUpdateMonitor; this.preferences = preferences; this.aiService = aiService; this.stateManager = stateManager; this.undoManager = undoManager; this.entryTypesManager = entryTypesManager; this.clipBoardManager = clipBoardManager; this.taskExecutor = taskExecutor; setId("frame"); // Create components this.viewModel = new JabRefFrameViewModel( preferences, aiService, stateManager, dialogService, this, entryTypesManager, fileUpdateMonitor, undoManager, clipBoardManager, taskExecutor); Injector.setModelOrService(UiMessageHandler.class, viewModel); FrameDndHandler frameDndHandler = new FrameDndHandler( tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager); this.globalSearchBar = new GlobalSearchBar( this, stateManager, this.preferences, undoManager, dialogService, SearchType.NORMAL_SEARCH); this.sidePane = new SidePane( this, this.preferences, Injector.instantiateModelOrService(JournalAbbreviationRepository.class), taskExecutor, dialogService, aiService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, undoManager); this.entryEditor = new EntryEditor(this::getCurrentLibraryTab, // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. new UndoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager), new RedoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager)); Injector.setModelOrService(EntryEditor.class, entryEditor); this.pushToApplicationCommand = new PushToApplicationCommand( stateManager, dialogService, this.preferences, taskExecutor); this.fileHistory = new FileHistoryMenu( this.preferences.getLastFilesOpenedPreferences().getFileHistory(), dialogService, getOpenDatabaseAction()); fileHistory.disableProperty().bind(Bindings.isEmpty(fileHistory.getItems())); this.setOnKeyTyped(key -> { if (this.fileHistory.isShowing()) { if (this.fileHistory.openFileByKey(key)) { this.fileHistory.getParentMenu().hide(); } } }); initLayout(); initKeyBindings(); frameDndHandler.initDragAndDrop(); initBindings(); } ``` -------------------------------- ### Initialize Activity and Request Permissions Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/MapsActivity-v2.txt Sets up the activity, applies theme preferences, configures window insets for status bar, and requests necessary permissions (location and notifications) if not already granted. It also inflates the view binding and initializes UI components. ```java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextSizePreferences.apply(this); WindowCompat.setDecorFitsSystemWindows(getWindow(), false); getWindow().setStatusBarColor(Color.TRANSPARENT); // locationPermManager is initialized after fusedLocationClient — use direct launcher here List perms = new ArrayList<>(); if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { perms.add(Manifest.permission.ACCESS_FINE_LOCATION); perms.add(Manifest.permission.ACCESS_COARSE_LOCATION); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) { perms.add(Manifest.permission.POST_NOTIFICATIONS); } if (!perms.isEmpty()) requestMultiplePermissionsLauncher.launch(perms.toArray(new String[0])); // ViewBinding: inflate, then set content view ONCE binding = ActivityMapsBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); // Poi methods when user clicks on the button handleIncomingPoiIntent(); // Preload shuttle route data from bundled JSON ShuttleHelper.init(this); View bannerView = findViewById(R.id.included_banner); if (bannerView != null) { ViewCompat.setOnApplyWindowInsetsListener(bannerView, (v, windowInsets) -> { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); // Push the banner down by the height of the status bar + 16 pixels for a nice gap mlp.topMargin = insets.top + 16; v.setLayoutParams(mlp); return windowInsets; // Return the original insets untouched }); } buildingClassifier = new BuildingClassifier(); OnCampusApplication app = (OnCampusApplication) getApplication(); // If a mock hasn't been injected yet, set the default one if (app.getLocationProvider() == null) { app.setLocationProvider(new FusedLocationProvider(this)); } // Use the provider from the application fusedLocationClient = app.getLocationProvider(); // Initialize our custom Location Source myLocationSource = new FusedLocationSource(this, fusedLocationClient); // Initialize managers routeManager = new RouteManager(this); routeManager.setLocationClient(fusedLocationClient); routeManager.setBuildingsMap(buildingsMap); } ``` -------------------------------- ### Start Navigation Logic Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v1.txt Initiates navigation, updates UI elements, and sets up camera positioning for the map. Handles different travel modes like SHUTTLE. ```Java private void startNavigation(String startText, String destText) { routeManager.removeStartDot(); routeManager.startNavigationUpdates(); Toast.makeText(activity, "Navigation Started", Toast.LENGTH_SHORT).show(); toggleNavigationUI(true); String modeLabel = routeManager.getSelectedMode().getValue(); if (txtDuration != null && txtDuration.getText().length() > 0 && !txtDuration.getText().equals("-- MIN")) { txtNavInstruction.setText(txtDuration.getText() + " (" + modeLabel + ")"); } else { txtNavInstruction.setText("Follow the route (" + modeLabel + ")"); } LatLng cameraTarget = routeManager.getSelectedMode() == RouteTravelMode.SHUTTLE ? BuildingLookup.getLatLngFromBuildingName(startText, MapsActivity.buildingsMap) : routeManager.getFirstRoutePoint(); if (cameraTarget != null && mMap != null) { mMap.animateCamera(CameraUpdateFactory.newCameraPosition( new CameraCameraPosition.Builder().target(cameraTarget).zoom(19f).tilt(0).build())); } } ``` -------------------------------- ### Initialize Key Bindings Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v2.txt Sets up keyboard shortcuts for various actions within the application. It maps key events to specific UI actions like focusing elements or creating new entries. ```Java private void initKeyBindings() { addEventFilter(KeyEvent.KEY_PRESSED, event -> { Optional keyBinding = preferences.getKeyBindingRepository().mapToKeyBinding(event); if (keyBinding.isPresent()) { switch (keyBinding.get()) { case FOCUS_ENTRY_TABLE: getCurrentLibraryTab().getMainTable().requestFocus(); event.consume(); break; case FOCUS_GROUP_LIST: sidePane.getSidePaneComponent(SidePaneType.GROUPS).requestFocus(); event.consume(); break; case NEXT_LIBRARY: tabbedPane.getSelectionModel().selectNext(); event.consume(); break; case PREVIOUS_LIBRARY: tabbedPane.getSelectionModel().selectPrevious(); event.consume(); break; case SEARCH: globalSearchBar.requestFocus(); break; case OPEN_GLOBAL_SEARCH_DIALOG: globalSearchBar.openGlobalSearchDialog(); break; case NEW_ARTICLE: new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Article, dialogService, preferences, stateManager).execute(); break; case NEW_BOOK: new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Book, dialogService, preferences, stateManager).execute(); break; case NEW_INBOOK: new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.InBook, dialogService, preferences, stateManager).execute(); break; case NEW_MASTERSTHESIS: new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.MastersThesis, dialogService, preferences, stateManager).execute(); break; case NEW_PHDTHESIS: new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.PhdThesis, dialogService, preferences, stateManager).execute(); break; } } }); } ``` -------------------------------- ### Handle Incoming Permissions and UI Setup in onCreate Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/MapsActivity-v1.txt In the onCreate method, this code checks and requests necessary location and notification permissions. It also sets up view binding, handles incoming POI intents, initializes shuttle route data, and applies window insets to a banner view. ```java super.onCreate(savedInstanceState); TextSizePreferences.apply(this); WindowCompat.setDecorFitsSystemWindows(getWindow(), false); getWindow().setStatusBarColor(Color.TRANSPARENT); // locationPermManager is initialized after fusedLocationClient — use direct launcher here List perms = new ArrayList<>(); if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { perms.add(Manifest.permission.ACCESS_FINE_LOCATION); perms.add(Manifest.permission.ACCESS_COARSE_LOCATION); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) { perms.add(Manifest.permission.POST_NOTIFICATIONS); } if (!perms.isEmpty()) requestMultiplePermissionsLauncher.launch(perms.toArray(new String[0])); // ViewBinding: inflate, then set content view ONCE binding = ActivityMapsBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); // Poi methods when user clicks on the button handleIncomingPoiIntent(); // Preload shuttle route data from bundled JSON ShuttleHelper.init(this); View bannerView = findViewById(R.id.included_banner); if (bannerView != null) { ViewCompat.setOnApplyWindowInsetsListener(bannerView, (v, windowInsets) -> { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); // Push the banner down by the height of the status bar + 16 pixels for a nice gap mlp.topMargin = insets.top + 16; v.setLayoutParams(mlp); return windowInsets; // Return the original insets untouched }); } buildingClassifier = new BuildingClassifier(); OnCampusApplication app = (OnCampusApplication) getApplication(); // If a mock hasn't been injected yet, set the default one if (app.getLocationProvider() == null) { app.setLocationProvider(new FusedLocationProvider(this)); } // Use the provider from the application fusedLocationClient = app.getLocationProvider(); // Initialize our custom Location Source myLocationSource = new FusedLocationSource(this, fusedLocationClient); // Initialize managers routeManager = new RouteManager(this); routeManager.setLocationClient(fusedLocationClient); routeManager.setBuildingsMap(buildingsMap); buildingDialogManager = new BuildingDialogManager(this); ``` -------------------------------- ### Service Start Method Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/FifoScheduler-v2.txt Standard service start method for YARN components. It simply calls the superclass's serviceStart. ```java @Override public void serviceStart() throws Exception { super.serviceStart(); } ``` -------------------------------- ### Initialize UI Components Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v1.txt Initializes various UI components and handlers such as GlobalSearchBar, SidePane, and PushToApplicationCommand. Requires several service and manager instances. ```java Injector.setModelOrService(UiMessageHandler.class, viewModel); FrameDndHandler frameDndHandler = new FrameDndHandler( tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager); this.globalSearchBar = new GlobalSearchBar( this, stateManager, this.preferences, undoManager, dialogService, SearchType.NORMAL_SEARCH); this.sidePane = new SidePane( this, this.preferences, Injector.instantiateModelOrService(JournalAbbreviationRepository.class), taskExecutor, dialogService, aiService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, undoManager); this.pushToApplicationCommand = new PushToApplicationCommand( stateManager, dialogService, this.preferences, taskExecutor); this.fileHistory = new FileHistoryMenu( this.preferences.getLastFilesOpenedPreferences().getFileHistory(), dialogService, getOpenDatabaseAction()); fileHistory.disableProperty().bind(Bindings.isEmpty(fileHistory.getItems())); this.setOnKeyTyped(key -> { if (this.fileHistory.isShowing()) { if (this.fileHistory.openFileByKey(key)) { this.fileHistory.getParentMenu().hide(); } } }); initLayout(); initKeyBindings(); frameDndHandler.initDragAndDrop(); initBindings(); ``` -------------------------------- ### Handle HTML Start Tags in Body Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v1.txt Processes various start tags within the HTML 'in body' state, including options, ruby, math, and svg elements. It reconstructs formatting elements and inserts the start tag, with specific handling for self-closing flags for math and svg. ```Java tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in(name, Constants.InBodyStartRuby)) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, Constants.InBodyStartDrop)) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; ``` -------------------------------- ### Test Combining Immutable Holiday Calendars with Different Start Year 2 Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/Strata-b2b9b629685ebc7e89e9a1667de88f2e878d5fc4.txt Tests combining ImmutableHolidayCalendars with different start years, scenario 2. ```Java public test_combined_differentStartYear2() : void ``` -------------------------------- ### Test Combining Immutable Holiday Calendars with Different Start Year 1 Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/Strata-b2b9b629685ebc7e89e9a1667de88f2e878d5fc4.txt Tests combining ImmutableHolidayCalendars with different start years, scenario 1. ```Java public test_combined_differentStartYear1() : void ``` -------------------------------- ### Show Refactoring Miner Help Source: https://github.com/tsantalis/refactoringminer/blob/master/documentation/how-to.md Use the -h flag to display all available command-line options and their descriptions. ```bash ./RefactoringMiner -h ``` -------------------------------- ### Initialize Layout for JabRefFrame Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v2.txt Sets up the main layout of the JabRef frame, including the menu bar, tool bar, and split panes. This method is called after the main components are created. ```java private void initLayout() { MainToolBar mainToolBar = new MainToolBar( this, pushToApplicationCommand, globalSearchBar, dialogService, stateManager, preferences, aiService, fileUpdateMonitor, taskExecutor, entryTypesManager, clipBoardManager, undoManager); MainMenu mainMenu = new MainMenu( this, fileHistory, sidePane, pushToApplicationCommand, preferences, stateManager, fileUpdateMonitor, taskExecutor, dialogService, Injector.instantiateModelOrService(JournalAbbreviationRepository.class), entryTypesManager, undoManager, clipBoardManager, this::getOpenDatabaseAction, aiService, entryEditor); VBox head = new VBox(mainMenu, mainToolBar); head.setSpacing(0d); setTop(head); verticalSplit.getItems().addAll(tabbedPane); verticalSplit.setOrientation(Orientation.VERTICAL); updateEditorPane(); horizontalSplit.getItems().addAll(verticalSplit); horizontalSplit.setOrientation(Orientation.HORIZONTAL); } ``` -------------------------------- ### Initialize Application Layout Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v1.txt Sets up the main layout of the application by creating and arranging the MainMenu, MainToolBar, and SidePane. It also manages the split pane and side pane visibility. ```java private void initLayout() { MainToolBar mainToolBar = new MainToolBar( this, pushToApplicationCommand, globalSearchBar, dialogService, stateManager, preferences, aiService, fileUpdateMonitor, taskExecutor, entryTypesManager, clipBoardManager, undoManager); MainMenu mainMenu = new MainMenu( this, fileHistory, sidePane, pushToApplicationCommand, preferences, stateManager, fileUpdateMonitor, taskExecutor, dialogService, Injector.instantiateModelOrService(JournalAbbreviationRepository.class), entryTypesManager, undoManager, clipBoardManager, this::getOpenDatabaseAction, aiService); VBox head = new VBox(mainMenu, mainToolBar); head.setSpacing(0d); setTop(head); splitPane.getItems().add(tabbedPane); SplitPane.setResizableWithParent(sidePane, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); updateSidePane(); setCenter(splitPane); } ``` -------------------------------- ### Process Tokens in AfterAfterBody State (HTML Start Tag) Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v2.txt Handles HTML start tags by processing them in the InBody state within the AfterAfterBody parsing logic. ```Java else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } ``` -------------------------------- ### Initialize Navigation Components Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/MapsActivity-v1.txt Initializes controllers and managers for indoor navigation, event banners, and map loading. Ensures route picking functionality is set up. ```java indoorNavController = new IndoorNavigationController(this, indoorRoomMap); bannerManager = new EventBannerManager(this); geoJsonMapLoader = new GeoJsonMapLoader(this, buildingClassifier, buildingDialogManager); routePickerController = new RoutePickerController(this, routeManager, indoorNavController, bannerManager); routePickerController.setup(); ``` -------------------------------- ### Initialize GUI Bindings with EasyBind Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/JabRefFrame-v1.txt This section details the initialization of various GUI bindings using the EasyBind library. It includes filtering tabs, mapping database contexts, and subscribing to search query changes. Ensure the scene is created before binding focus owner properties. ```java // Bind global state FilteredList filteredTabs = new FilteredList<>(tabbedPane.getTabs()); filteredTabs.setPredicate(LibraryTab.class::isInstance); // This variable cannot be inlined, since otherwise the list created by EasyBind is being garbage collected openDatabaseList = EasyBind.map(filteredTabs, tab -> ((LibraryTab) tab).getBibDatabaseContext()); EasyBind.bindContent(stateManager.getOpenDatabases(), openDatabaseList); // the binding for stateManager.activeDatabaseProperty() is at org.jabref.gui.LibraryTab.onDatabaseLoadingSucceed // Subscribe to the search EasyBind.subscribe(stateManager.activeSearchQuery(SearchType.NORMAL_SEARCH), query -> { if (getCurrentLibraryTab() != null) { getCurrentLibraryTab().searchQueryProperty().set(query); } }); // Wait for the scene to be created, otherwise focusOwnerProperty is not provided Platform.runLater(() -> stateManager.focusOwnerProperty().bind( EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable))); EasyBind.subscribe(tabbedPane.getSelectionModel().selectedItemProperty(), selectedTab -> { if (selectedTab instanceof LibraryTab libraryTab) { stateManager.setActiveDatabase(libraryTab.getBibDatabaseContext()); stateManager.activeTabProperty().set(Optional.of(libraryTab)); } else if (selectedTab == null || selectedTab instanceof WelcomeTab) { if (stateManager.getActiveDatabase().isPresent()) { String activeUID = stateManager.getActiveDatabase().get().getUid(); // Check if the previously active database was closed boolean wasClosed = tabbedPane.getTabs().stream() .filter(tab -> tab instanceof LibraryTab) ``` -------------------------------- ### Setup for CopyMoreAction Tests Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/CopyMoreActionTest-v1.txt Initializes mock objects and test data, including BibEntry details and preferences, before each test execution. ```java private final DialogService dialogService = spy(DialogService.class); private final ClipBoardManager clipBoardManager = mock(ClipBoardManager.class); private final GuiPreferences preferences = mock(GuiPreferences.class); private final JournalAbbreviationRepository abbreviationRepository = mock(JournalAbbreviationRepository.class); private final StateManager stateManager = mock(StateManager.class); private final List titles = new ArrayList<>(); private final List keys = new ArrayList<>(); private final List dois = new ArrayList<>(); private CopyMoreAction copyMoreAction; private BibEntry entry; @BeforeEach void setUp() { String title = "A tale from the trenches"; entry = new BibEntry(StandardEntryType.Misc) .withField(StandardField.AUTHOR, "Souti Chattopadhyay and Nicholas Nelson and Audrey Au and Natalia Morales and Christopher Sanchez and Rahul Pandita and Anita Sarma") .withField(StandardField.TITLE, title) .withField(StandardField.YEAR, "2020") .withField(StandardField.DOI, "10.1145/3377811.3380330") .withField(StandardField.SUBTITLE, "cognitive biases and software development") .withCitationKey("abc"); titles.add(title); keys.add("abc"); dois.add("10.1145/3377811.3380330"); PushToApplicationPreferences pushToApplicationPreferences = mock(PushToApplicationPreferences.class); when(pushToApplicationPreferences.getCiteCommand()).thenReturn(new CitationCommandString("\\cite{", ",", "}")); when(preferences.getPushToApplicationPreferences()).thenReturn(pushToApplicationPreferences); } ``` -------------------------------- ### HTML Tokeniser Constants - InBody Start to Head Tags Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v1.txt Array of tag names that, when encountered as a start tag in the InBody state, should cause a transition to the Head state. ```Java private static final String[] InBodyStartToHead = new String[]{"base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title"}; ``` -------------------------------- ### Test URI Missing Scheme and Not Starting with 'www.' Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/URLUtilTest-v1.txt Confirms that URLs without a scheme and not starting with 'www.' (e.g., 'example.com') throw a MalformedURLException. This enforces the requirement for absolute URLs. ```java // URLs not starting with www. and without a scheme should still throw an exception MalformedURLException exception = assertThrows(MalformedURLException.class, () -> URLUtil.create("example.com")); assertTrue(exception.getMessage().contains("not absolute")); ``` -------------------------------- ### Initialize Repository and Analyze Commit Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/TestStatementMappings-v1.txt This snippet initializes a repository and analyzes a specific commit for refactorings. It populates file contents, creates UML models, and diffs them, similar to other examples but potentially for a different repository or commit. ```Java Repository repository = gitService.cloneIfNotExists( REPOS + "/jgit", ``` -------------------------------- ### Process Tokens in AfterAfterFrameset State (HTML Start Tag) Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v2.txt Handles specific HTML start tags like 'html' by processing them in the InBody state within the AfterAfterFrameset parsing logic. ```Java else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } ``` -------------------------------- ### Setup Route Picker UI Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v1.txt Initializes and wires all the views associated with the route picker. This method should be called once during the activity's creation. ```Java /** Inflates and wires all route-picker views. Call once from onCreate(). */ public void setup() { ``` -------------------------------- ### Start Indoor Navigation Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Initiates indoor navigation between two specified rooms. Returns true if navigation is launched, false otherwise. ```java indoorNavController.launchIndoorRoute(fromRoom, toRoom); return true; } ``` -------------------------------- ### Adjust Line Ranges for Refactoring Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/okhttp-084b06b48bae2b566bb1be3415b6c847d8ea3682.txt These examples show how to specify line ranges for refactoring operations. The first example adjusts a single line range, while the second adjusts a broader range. ```java line range:415-415==line range:400-400 ``` ```java line range:414-416==line range:399-401 ``` -------------------------------- ### Main Method Entry Point in Java Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/phishman-ab98bcacf6e5bf1c3a06f6bcca68f178f880ffc9.txt The main entry point for the application. It initializes and runs tests. ```Java public static void main(String[] args) { runTest(new Testable() { @Override public double test(Integer[] unsorted) { return 0.0; } }, new Integer[]{1, 2, 3}, new Integer[]{1, 2, 3}, new double[10], 0); } ``` -------------------------------- ### Process Tokens in AfterAfterFrameset State (Error Handling) Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v2.txt If a token is not a comment, doctype, whitespace, HTML start tag, 'noframes' start tag, or EOF, it's treated as an error, returning false. ```Java else { tb.error(this); return false; } ``` -------------------------------- ### Initialize Repository and Detect Refactorings in JFinal Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/TestStatementMappings-v2.txt Clones the JFinal repository if it doesn't exist and prepares for refactoring detection by initializing file paths and directory sets. This snippet focuses on the setup before detailed refactoring analysis. ```Java Repository repository = gitService.cloneIfNotExists( REPOS + "/jfinal", "https://github.com/jfinal/jfinal.git"); final List actual = new ArrayList<>(); String commitId = "881baed894540031bd55e402933bcad28b74ca88"; List refactoringsAtRevision; try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(repository.resolve(commitId)); if (commit.getParentCount() > 0) { walk.parseCommit(commit.getParent(0)); Set filePathsBefore = new LinkedHashSet(); Set filePathsCurrent = new LinkedHashSet(); Map renamedFilesHint = new HashMap(); gitService.fileTreeDiff(repository, commit, filePathsBefore, filePathsCurrent, renamedFilesHint); Set repositoryDirectoriesBefore = new LinkedHashSet(); Set repositoryDirectoriesCurrent = new LinkedHashSet(); ``` -------------------------------- ### Get First N Characters of First Author's Last Name Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/BracketedPattern-v1.txt A convenience method to get the first N characters of the first author's last name by calling authNofMth with M=1. ```java private static String authN(AuthorList authorList, int num) { return authNofMth(authorList, num, 1); } ``` -------------------------------- ### Open Route Picker Panel Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v1.txt Handles the logic for opening the route picker panel. This involves setting UI states, managing visibility of different views, starting animations, and requesting focus for the start destination input. ```Java private void openRoutePickerPanel() { bannerManager.setRoutePickerOpen(true); View bannerView = activity.findViewById(R.id.included_banner); if (bannerView != null) bannerView.setVisibility(View.GONE); searchBar.setVisibility(View.GONE); routePicker.setVisibility(View.VISIBLE); routePicker.startAnimation(slideDown); layoutInputs.setVisibility(View.VISIBLE); layoutTabs.setVisibility(View.VISIBLE); btnGo.setVisibility(View.VISIBLE); layoutNavActive.setVisibility(View.GONE); currentLocationIcon.setVisibility(View.VISIBLE); startDestinationText.setFocusableInTouchMode(true); startDestinationText.requestFocus(); startDestinationText.post(() -> { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); ``` -------------------------------- ### Setup Route Picker UI and Listeners Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/RoutePickerController-v2.txt Initializes route picker views, sets up animations, and configures click listeners for various UI elements like search bar, transport buttons, and navigation controls. Call this method once during the activity's onCreate(). ```java public void setup() { initViewReferences(); Animation slideUp = AnimationUtils.loadAnimation(activity, R.anim.slide_up); slideDown = AnimationUtils.loadAnimation(activity, R.anim.slide_down); setupWindowInsets(); Runnable closeRoutePicker = buildCloseRoutePickerRunnable(slideUp); searchBar.setOnClickListener(v -> openRoutePickerPanel()); setupSuggestionListeners(); Button btnShuttleTimetable = activity.findViewById(R.id.btn_shuttle_timetable); btnShuttleTimetable.setOnClickListener(v -> ShuttleHelper.openTimetable(activity)); routeManager.setTransportButtons( activity.findViewById(R.id.btn_mode_walking), btnShuttleTimetable, btnGo); setupTransportTabListeners(btnShuttleTimetable); ImageButton btnSwapAddress = activity.findViewById(R.id.btn_swap_address); btnSwapAddress.setOnClickListener(v -> { swapAddresses(); previewRoute(); }); currentLocationIcon.setOnClickListener(v -> setCurrentBuilding()); btnGo.setOnClickListener(v -> handleGoClick()); ImageButton prevDirBtn = activity.findViewById(R.id.prevDirBtn); ImageButton nextDirBtn = activity.findViewById(R.id.nextDirBtn); nextDirBtn.setOnClickListener(v -> routeManager.navigateToNextDirection()); prevDirBtn.setOnClickListener(v -> routeManager.navigateToPreviousDirection()); btnEndTrip.setOnClickListener(v -> handleEndTrip()); setupBackPressHandler(closeRoutePicker); } ``` -------------------------------- ### Process Start Tags for Pre/Listing Elements in InBody State Source: https://github.com/tsantalis/refactoringminer/blob/master/src/test/resources/mappings/HtmlTreeBuilderState-v1.txt Handles start tags for elements like 'pre' and 'listing' in the InBody state. It closes any open 'p' tag and then inserts the new tag, setting framesetOk to false. ```Java else if (StringUtil.in(name, Constants.InBodyStartPreListing)) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } ```