Automatic Construction Method and System for Programming Task Context Based on Eclipse Plug-in

Automatically constructing and recommending programming task contexts based on Eclipse plug-in, the problem of developers being inefficient when looking for programming task-related code is solved, and more efficient software development is achieved.

CN114356301BActive Publication Date: 2025-07-11ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210035659.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-13
Publication Date
2025-07-11
Estimated Expiration
2042-01-13

AI Technical Summary

Technical Problem

In existing software development tools, developers are inefficient in finding context code related to programming tasks, and lack the right carrier for explicit capture and construction.

Method used

Using an Eclipse plug-in-based approach, we automatically adapt the context pattern library, track the code elements accessed by developers, build a context model, use pattern matching to recommend relevant code elements, and provide visual analysis.

Benefits of technology

Improves the efficiency of developers in understanding the context of programming tasks. By intuitively recommending relevant code elements, it reduces the time for developers to find context code and improves the efficiency of software development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114356301B_ABST
    Figure CN114356301B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for automatically constructing a programming task context based on an Eclipse plug-in, which automatically adapts and selects a context pattern library by identifying programming task features; tracks code elements accessed by a developer within a sliding time window, forms a context model view of the code elements according to the declaration relationships between the code elements and uses the Eclipse SWT technology to display the view; extends the context model by using the AST technology, and then assigns abstract role types; extracts subgraphs of the extended model, performs pattern matching on the subgraphs by using the context pattern library, and records all successfully matched subgraphs; generates a list of recommended code elements by using the Eclipse SWT technology and displays the list. The developer can locate and analyze the recommended code elements by clicking on them. The present invention explicitly captures the programming task context model by a visual method, helps developers quickly understand the programming task context model, and effectively improves the efficiency of software development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer technology and software engineering, and particularly to a method and system for automatically constructing a programming task context based on an Eclipse plug-in. Background Art

[0002] The context of a programming task is of great significance in software development. When performing a programming task, developers spend a lot of time reading and browsing the parts of the software system related to the task, and at the same time, form a preliminary understanding of the context of the programming task. The programming task context refers to the code elements related to the programming task and the structural relationships between the code elements.

[0003] Research shows that explicitly capturing the programming task context in software development tools helps to improve the efficiency of software development. However, the existing technologies for constructing code context using development interaction history data all exist in the form of methods, and developers do not have a suitable carrier to use the above technologies in actual development scenarios, which results in developers spending a lot of time looking for context code related to development tasks during the development process. Summary of the Invention

[0004] Based on the above problems, the present invention provides a method and system for automatically constructing a programming task context based on an Eclipse plug-in.

[0005] The technical solution of the present invention to solve the above problems is as follows: A method for automatically constructing a programming task context based on an Eclipse plug-in, comprising the following steps:

[0006] Step 1: Automatically adapt and select a context pattern library;

[0007] Step 2: Track the code elements accessed by the developer within a sliding time window to form a context model view of the code elements;

[0008] Step 3: Expand the context model of the code elements, and then assign abstract role types to the code elements of the expanded model;

[0009] Step 4: Use the context pattern library to perform pattern matching on the expanded model, and record the successfully matched subgraphs;

[0010] Step 5: Generate a list of recommended code elements based on the successfully matched subgraphs and display them, and click on the recommended code elements to locate and analyze the recommended code elements.

[0011] Among them, the automatic adaptation and selection of the context pattern library in step 1 specifically includes: automatically identifying the project characteristics, task characteristics, code element characteristics, and developer characteristics of the programming task being executed. Among them, the task characteristics and code element characteristics are identified through the topic model of the text. Subsequently, the context pattern libraries corresponding to each characteristic are matched from different context pattern libraries to form the pattern library closest to the programming task characteristics. If the characteristics cannot be identified, a general context pattern library is selected.

[0012] Furthermore, the tracking of code elements in step 2 to form a context model view specifically includes: automatically tracking the code elements accessed by the developer within the sliding time window. Among them, the accessed code elements include the code elements accessed on the Package Explorer page and through the search function. The code elements within the current sliding time window are determined according to the access time of the code elements. Subsequently, the context model of the code elements is formed using the declaration relationships between the code elements. Finally, the context model of the code elements is displayed using the Tree component of Eclipse SWT.

[0013] Furthermore, the extension of the context model and the assignment of abstract role types in step 3 specifically includes: using AST technology to extend the four relationships of declaration, call, inheritance, and implementation for the code elements in the context model. Subsequently, abstract role types are assigned to the code elements of the extended model.

[0014] Furthermore, the pattern matching using the context pattern library in step 4 and recording the successfully matched subgraphs specifically includes: extracting the subgraphs of the extended model, and then performing pattern matching on all subgraphs with all context models of the currently selected context pattern library, and recording all successfully matched subgraphs.

[0015] Furthermore, the generation of the recommended code element list in step 5 and clicking on the recommended code element for positioning and analysis of the recommended code element specifically includes: screening out the code elements obtained by extension in the successfully matched subgraphs as the recommended code elements, calculating the confidence of the recommended code elements, forming and displaying a recommended list using the Table component of Eclipse SWT; when the developer clicks on the recommended code element e, it is located at the source code of e using JavaUI; at the same time, an analysis view is generated, and the analysis view includes the matching subgraph where e is located and its matching context model, and the reason for the recommended code element is analyzed through the analysis view.

[0016] Another technical solution for the present invention to solve the above technical problems is as follows: A programming task context automatic construction system based on an Eclipse plug-in, including a configuration module, a code element tracking module, a programming task context construction module, and an analysis module;

[0017] The configuration module is used to automatically adapt and select a context pattern library, automatically switch the size of the sliding time window, and select the number of extended steps for the programming task context;

[0018] The code element tracking module is used to automatically track the code elements accessed by the developer within the sliding time window;

[0019] The programming task context construction module is used to construct a context model of the code elements and then recommend code elements;

[0020] The analysis module is used to locate and analyze the recommended code elements when the developer clicks on the recommended code elements;

[0021] Furthermore, the configuration module is used to automatically adapt and select a context pattern library, automatically identify the context switch to change the size of the sliding time window, and the developer selects the number of extended steps for the programming task context through the Menu component of Eclipse SWT;

[0022] Furthermore, the code tracking module is used to automatically track the code elements accessed by the developer on the Package Explorer page and the code elements accessed using the search function within the sliding time window;

[0023] Furthermore, the programming task context construction module includes a context model display unit and a code element recommendation unit;

[0024] The context model display unit is used to construct a context model using the declaration relationships between the tracked code elements and display it using the Tree component of Eclipse SWT;

[0025] The code element recommendation unit is used to expand the context model, extract subgraphs, perform pattern matching using the context pattern library, screen out the extended code elements from the successfully matched subgraphs as recommended code elements, calculate the confidence of the recommended code elements, and construct and display a list of recommended code elements using the Table component of Eclipse SWT;

[0026] Furthermore, the analysis module is used to, when the developer clicks on the recommended code element e, use Java UI to locate to the source code of e and construct and display an analysis view, and the analysis view includes the matching subgraph where e is located and its matching context model.

[0027] Compared with the prior art, the present invention has the following advantages:

[0028] A method and system for automatically constructing a programming task context based on an Eclipse plug-in provided by the present invention uses the method of designing a plug-in on the Eclipse platform to intuitively recommend code elements related to programming tasks to developers, helping developers quickly understand the context of programming tasks, being convenient to operate, and improving the efficiency of software development.

[0029] (1) The context pattern library has strong characteristics: By identifying multiple characteristics of programming tasks, the context pattern library that is most similar to the characteristics of programming tasks can be matched and constructed to optimize the subsequent context prediction and construction effects.

[0030] (2) Explicitly construct and visually display the context model: Automatically tracking code elements related to programming tasks in a visual way can greatly improve the construction efficiency of the programming task context.

[0031] (3) The analysis view designed by the present invention effectively provides a basis for recommending code elements and helps developers understand the reasons for recommending code elements. Description of the Drawings

[0032] Figure 1 Shows a flowchart of the method for automatically constructing a programming task context based on an Eclipse plug-in of the present invention.

[0033] Figure 2 Shows a block diagram of the system for automatically constructing a programming task context based on an Eclipse plug-in of the present invention.

[0034] Figure 3 Shows a block diagram of the programming task context construction module of the present invention. Detailed Embodiments

[0035] To facilitate the understanding and implementation of the present invention by those of ordinary skill in the art, the present invention will be further described below with reference to the accompanying drawings, which is not intended to limit the scope of the present invention.

[0036] As Figure 1 shown, a method for automatically constructing a programming task context based on an Eclipse plug-in includes the following steps:

[0037] Step 1: Identify the project characteristics, task characteristics, code element characteristics, and developer characteristics of the executed programming task respectively. Among them, the task characteristics and code element characteristics are identified through the topic model of the text, and the topic with the highest belonging probability is used as its task or code element characteristic. For each identified characteristic, the corresponding context pattern library of the characteristic is matched and selected to form the context pattern library that is most similar to the programming task characteristics for subsequent automatic context construction. When the characteristic cannot be identified, a general context pattern library is selected.

[0038] Step 2: Automatically track the code elements accessed by the developer within the sliding time window. The accessed code elements include those accessed in the Package Explorer page and through the search function. Record the access time of the code elements, determine the code elements within the current sliding time window based on the access time of the code elements, then form a context model of the code elements using the declaration relationships between the code elements, and finally display the context model of the code elements using the Tree component of Eclipse SWT;

[0039] Step 3: Use AST technology to extend the four relationships of declaration, call, inheritance, and implementation for the code elements in the context model, and then assign abstract role types to the code elements of the extended model;

[0040] Step 4: Use the currently selected context pattern library to match the extended model: Extract the subgraphs of the extended model, perform pattern matching on all subgraphs using the currently selected context pattern library, and finally record the successfully matched subgraphs;

[0041] Step 5: Screen out the code elements obtained by extension in the successfully matched subgraphs as recommended code elements, calculate the confidence of the recommended code elements, form a recommended list using the Table component of Eclipse SWT and display it; When the developer clicks on the recommended code element e, use JavaUI to locate to the source code of e; At the same time, generate an analysis view, which includes the matching subgraph where e is located and its matching context model, and analyze the reasons for the recommended code element through the analysis view.

[0042] As Figure 2 shown, a programming task context automatic construction system based on an Eclipse plug-in includes a configuration module, a code element tracking module, a programming task context construction module, and an analysis module;

[0043] The configuration module is used to automatically adapt and select the context pattern library, automatically identify the context switch to change the size of the sliding time window, and the developer selects the extension step number of the programming task context through the Menu component of Eclipse SWT;

[0044] The code element tracking module is used to automatically track the code elements accessed by the developer in the Package Explorer page and those accessed through the search function within the sliding time window, and then determine the code elements within the current sliding time window based on the access time of the code elements;

[0045] The programming task context construction module is used to construct the context model of the code elements and then recommend code elements;

[0046] The analysis module is used to, when a developer clicks on the recommended code element e, use JavaUI to locate the source code of e, construct an analysis view and display it. The analysis view includes the matching subgraph where e is located and its matching context model;

[0047] As Figure 3 shown, the programming task context construction module includes a context model display unit and a code element recommendation unit;

[0048] The context model display unit is used to construct a context model by using the declared relationships between the traced code elements and display it by using the Tree component of EclipseSWT;

[0049] The code element recommendation unit is used to expand the context model, extract subgraphs, perform pattern matching by using a context pattern library, filter out the code elements obtained by expansion from the successfully matched subgraphs as recommended code elements, calculate the confidence of the recommended code elements, and construct and display a list of recommended code elements by using the Table component of EclipseSWT.

Claims

1. An automatic construction method for programming task context based on Eclipse plug-in, characterized in that It includes the following steps: Step 1: Automatically adapt and select the context pattern library, specifically including: Automatically identify the project features, task features, code element features, and developer features of the programming task being executed. Among them, the task features and code element features are identified through the topic model of the text; Subsequently, match the context pattern libraries corresponding to each feature from different context pattern libraries to form the pattern library closest to the programming task features. If the feature cannot be identified, a general context pattern library is selected; Step 2: Track the code elements accessed by the developer within the sliding time window to form a context model view of the code elements, specifically including: Automatically track the code elements accessed by the developer within the sliding time window. Among them, the accessed code elements include those accessed on the Package Explorer page and in the search function. Determine the code elements within the current sliding time window based on the access time of the code elements. Subsequently, use the declaration relationship between the code elements to form the context model of the code elements. Finally, use the Tree component of Eclipse SWT to display the context model of the code elements to form the context model view of the code elements; Step 3: Expand the context model of the code elements, and then assign abstract role types to the code elements of the expanded model, specifically including: Use AST technology to expand the four relationships of declaration, call, inheritance, and implementation of the code elements in the context model. Subsequently, assign abstract role types to the code elements of the expanded model; Step 4: Use the context pattern library to perform pattern matching on the expanded model, and record the successfully matched subgraphs, specifically including: Extract the subgraphs of the expanded model, and then perform pattern matching on all subgraphs with all context models of the currently selected context pattern library, and record all successfully matched subgraphs; Step 5: Generate a recommended code element list based on the matched subgraphs and display it. Click on the recommended code element to locate and analyze the recommended code element, specifically including: Filter out the code elements obtained by expansion in the matched subgraphs as recommended code elements, calculate the confidence of the recommended code elements, and use the Table component of Eclipse SWT to form and display the recommended list; When the developer clicks on the recommended code element e, use JavaUI to locate to the source code of e; at the same time, generate an analysis view, and the analysis view includes the matched subgraph where e is located and its matched context model.

2. A programming task context automatic construction system based on an Eclipse plug-in for implementing the method described in claim 1, characterized in that It includes a configuration module, a code element tracking module, a programming task context construction module, and an analysis module; The configuration module is used to automatically adapt and select the context pattern library, automatically switch the size of the sliding time window, and select the number of expansion steps for the programming task context; The code element tracking module is used to automatically track the code elements accessed by the developer within the sliding time window; The programming task context construction module is used to construct the context model of the code elements and then recommend code elements; The analysis module is used to locate and analyze the recommended code elements when the developer clicks on the recommended code element.

3. The automatic programming task context construction system based on the Eclipse plug-in according to claim 2, characterized in that The configuration module includes automatically adapting and selecting a context pattern library, automatically identifying context switches to change the size of the sliding time window, and developers can select the extended step number of the programming task context through the Menu component of Eclipse SWT.

4. The automatic programming task context construction system based on Eclipse plug-ins according to claim 2, characterized in that The code tracking module automatically tracks the code elements accessed by the developer on the Package Explorer page and the code elements accessed using the search function within the sliding time window, and determines the code elements within the current sliding time window based on the access time of the code elements.

5. The automatic construction system for programming task context based on the Eclipse plug-in according to claim 2, characterized in that The programming task context construction module includes a context model display unit and a code element recommendation unit; The context model display unit is used to construct a context model using the declaration relationships between the tracked code elements and display it using the Tree component of Eclipse SWT; The code element recommendation unit is used to expand the context model, extract subgraphs, perform pattern matching using the context pattern library, filter out the extended code elements from the successfully matched subgraphs as recommended code elements, calculate the confidence of the recommended code elements, and construct and display a list of recommended code elements using the Table component of Eclipse SWT.

6. The automatic programming task context construction system based on the Eclipse plug-in according to claim 2, characterized in that, The analysis module is used to, when the developer clicks on the recommended code element e, use JavaUI to locate to the source code of e, construct and display an analysis view, and the analysis view includes the matching subgraph where e is located and its matching context model.

Citation Information

Patent Citations

  • Subgraph search-based feature location method

    CN105930162A

  • Code fragment recommendation method considering code statement sequence information

    CN109634594A