CN102520947A - Method and device for automatically removing codes - Google Patents

Method and device for automatically removing codes Download PDF

Info

Publication number
CN102520947A
CN102520947A CN2011104091294A CN201110409129A CN102520947A CN 102520947 A CN102520947 A CN 102520947A CN 2011104091294 A CN2011104091294 A CN 2011104091294A CN 201110409129 A CN201110409129 A CN 201110409129A CN 102520947 A CN102520947 A CN 102520947A
Authority
CN
China
Prior art keywords
control
code
information
incident
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011104091294A
Other languages
Chinese (zh)
Inventor
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN2011104091294A priority Critical patent/CN102520947A/en
Priority to PCT/CN2012/075576 priority patent/WO2012155844A1/en
Publication of CN102520947A publication Critical patent/CN102520947A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and device for automatically removing codes. The method comprises the following steps: acquiring event code information of a created control from an index table according to the attribute information of the control when detecting the control is deleted, wherein the corresponding relationship between the attribute information and the event code information of the control is stored in the index table; and locating the position of a code corresponding to the control in a code file according to the event code information of the control, and deleting codes at the position. The method and device provided by the invention can automatically remove the codes corresponding to the control when the control is deleted according to the corresponding relationship between the attribute information and the event code information of the deleted control, thereby reducing code redundancy.

Description

Automatically remove the method and the device of code
Technical field
The present invention relates to field of computer technology, relate in particular to a kind of method and device that removes code automatically.
Background technology
But in the design tool (UI design tool) based on What You See Is What You Get, its code systematic function all is through this guide of incident guide block configuration at present, generates control event frame code.
What incident guide module was represented is the trigger action of management control and the administration module of its corresponding code, and this guide can allow the user to select all incidents of this control, disposes this incident corresponding processing function, generates this event frame code.
Through corresponding incident of configuration control and incident corresponding processing function thereof in incident guide, can generate the event handling function of control quickly and easily.
Yet most UI design tools can correctly generate the incident of control fast and handle function, but when control is deleted in window interface, can't from code file, delete in the original code of this control, code redundancy occurs.These redundant codes can only manually be removed by the programmer.When containing dissimilar in a large number controls in the visualization interface, delete these controls, its code redundancy amount is very big, has a strong impact on the user and uses.
Like the VC instrument of Microsoft, can accomplish that based on microsoft foundation class storehouse (MFC) thought configuration property and code that the interface is good generate fast, but the redundant code that in incident guide, generates does not have according to control by the interface remove-on-delete.The VC instrument can only use this development mode: instrument generates the interface code automatically, and the developer manually removes the redundant code of incident guide.Normal window widget tool box (SWT) plug-in unit of the code edit tool (Eclipse) of IBM equally can the The visual design interface, and the redundant code in the incident guide also is correctly to remove.Tall and erect (Android) mobile phone operating system of the peace of Google (Google) issue, attached abstract data type (ADT) instrument also is based on the thought of What You See Is What You Get, accomplishes that mobile phone interface disposes fast, functions such as code generation.And the redundant code of incident guide also is manually to be removed by the user.
Summary of the invention
The embodiment of the invention provides a kind of method and device that removes code automatically, to solve that control can't be deleted in the original code of this control by deletion from code file and the problem of the code redundancy that occurs.
The embodiment of the invention provides a kind of method that removes code automatically, and this method comprises:
After detecting the control of having created and being deleted; From concordance list, obtain the event code information of said control according to the attribute information of said control; Wherein, preserve the corresponding relation of event code information of attribute information and the said control of said control in the said concordance list;
Orient code the position in code file corresponding according to the event code information of said control, and delete said locational code with said control.
Preferably, said detecting before the control of having created deleted, said method also comprises:
The attribute information of the said control of having created and event code information and corresponding relation thereof are deposited in the said concordance list.
Preferably, the attribute information of said control comprises the identification information of said control, and said identification information has uniqueness;
The event code information of said control comprises title, the present code file of all incident functions and the positional information of all incident functions in corresponding code file of all incident functions of said control.
Preferably, the attribute information of said control also comprises the control type.
Preferably, said event code information according to said control is oriented code the position in code file corresponding with said control, and deletes said locational code, comprising:
The position of all incident functions of orienting said control according to the event code information of said control in code file separately, and the code of the corresponding incident function on the deletion correspondence position.
The embodiment of the invention also provides a kind of device that removes code automatically, and this device comprises:
Acquisition module; Be used for after detecting the control of having created and being deleted; From concordance list, obtain the event code information of said control according to the attribute information of said control, wherein, preserve the corresponding relation of event code information of attribute information and the said control of said control in the said concordance list;
Remove module, the event code information of the said control that is used for obtaining according to said acquisition module is oriented the code corresponding with said control in the position of code file, and deletes said locational code.
Preferably, said device also comprises:
Preserve module, be used to preserve attribute information and the event code information and the corresponding relation thereof of the control of having created.
Preferably, the attribute information of said control comprises the identification information of said control, and said identification information has uniqueness;
The event code information of said control comprises title, the present code file of all incident functions and the positional information of all incident functions in corresponding code file of all incident functions of said control.
Preferably, the attribute information of said control also comprises the control type.
Preferably, the said module that removes is all incident functions of being used for orienting said control according to the event code information of said control in the position of code file separately, and the code of the corresponding incident function on the deletion correspondence position.
Above-mentioned method and the device that removes code automatically according to by the attribute information of deletion control and the corresponding relation of event code information, can remove the code corresponding with this control automatically, thereby reduce the redundance of code when this control is deleted.
Description of drawings
Fig. 1 is the process flow diagram that the present invention removes the method embodiment of code automatically;
Fig. 2 is the structural representation of concordance list of the present invention;
Fig. 3 is the structural representation that the present invention removes the device embodiment of code automatically.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, hereinafter will combine accompanying drawing that embodiments of the invention are elaborated.Need to prove that under the situation of not conflicting, embodiment among the application and the characteristic among the embodiment be combination in any each other.
The embodiment of the invention is set up the corresponding relation of control property and control event code through a cover concordance list is provided; When increasing certain control; This concordance list is correspondingly stored control sign, control type, control incident and the event code information (title that comprises this incident function, the positional information in code file etc.) of increase, when this control is deleted; From concordance list, find the positional information of corresponding event code, it is removed from the code file of correspondence.
As shown in Figure 1, be the process flow diagram that the present invention removes the method embodiment of code automatically, this process comprises:
S101, set up control case index table and carry out initialization;
The corresponding relation global index that at first sets up the event code information of the attribute information be used to preserve control and control shows, and wherein, the attribute information of said control comprises the identification information of said control, can also comprise information such as control type; The structure of concordance list is as shown in Figure 2;
Because the sign (ID) of control has uniqueness, can be used as the major key of this concordance list.The event code information of control is at first filled all trigger events that control is supported, each incident corresponding processing code information is not temporarily filled, and the code information of incident corresponding processing waits until that this kind control recharges when being added.
S102, increase control, and trigger the event action of control at window interface;
The user is through the towing mode; From window interface, certain control of visual towing is to window interface, and through operations such as clicking, double-click, drag; Trigger the incident of this control; This moment, the user was through incident guide configuration interface, disposed the processing function of certain incident, the file location information that configuration code generates.
Increase the event code information of control in S103, the control case index table;
Add control at window interface, and after the incident title and event handling function thereof through incident guide configuration control, call the store operation of concordance list, deposit the code information of this control ID, control type, control incident, incident in concordance list; The user sets up a plurality of controls, triggers the multiple operation of this control, has generated many places event code information simultaneously.
Above-mentioned steps 101-103 is an optional step;
S104, after detecting the control of having created and being deleted, from concordance list, obtain the event code information of said control according to the attribute information of said control;
In window interface, through deletion action, behind the deletion control, information such as the coordinate information of this control of removing, child control quantity from the control model information of window itself;
The realization mechanism that the embodiment of the invention adopts the concordance list multilayer to search; According to control ID with the corresponding relation of setting up before; Can obtain the type (like control is type of button, or the edit box type) of control fast, also can get access to all trigger events of this control simultaneously; Like click event, double-click incident, drag events and these incident corresponding processing function of button control, the code file at function place, event code information such as the line number of function;
If there is not the corresponding event code information of control in concordance list, then directly from window, deletes control and get final product.This moment can triggering following yet operation.
S105, orient code the position in code file corresponding, and delete said locational code with said control according to the event code information of said control.
The position of all incident functions of orienting said control according to the event code information of said control in code file separately, and the code of the corresponding incident function on the deletion correspondence position.
Particularly, the event code information that from concordance list, finds comprises function name, parameter title, parameter type, and information such as capable number of the present code file of function and function according to these information, removes the redundant code of this control.
The above-mentioned method that removes code automatically; According to being deleted the attribute information of control and the corresponding relation of event code information; When this control is deleted, can remove the code corresponding automatically, thereby reduce the redundance of code, have good exploitativeness with this control.
As shown in Figure 3, be the structural representation that the present invention removes the device embodiment of code automatically, this device comprises acquisition module 31 and removes module 32, wherein:
Acquisition module; Be used for after detecting the control of having created and being deleted; From concordance list, obtain the event code information of said control according to the attribute information of said control, wherein, preserve the corresponding relation of event code information of attribute information and the said control of said control in the said concordance list;
Remove module, the event code information of the said control that is used for obtaining according to said acquisition module is oriented the code corresponding with said control in the position of code file, and deletes said locational code.
In addition, said device also comprises: preserve module, be used to preserve attribute information and the event code information and the corresponding relation thereof of the control of having created.
Wherein, the attribute information of said control can comprise the identification information of said control, and said identification information has uniqueness; The attribute information of said control can also comprise the control type.The event code information of said control comprises title, the present code file of all incident functions and the positional information of all incident functions in corresponding code file etc. of all incident functions of said control.
Particularly, the said module that removes is all incident functions of being used for orienting said control according to the event code information of said control in the position of code file separately, and the code of the corresponding incident function on the deletion correspondence position.
The above-mentioned device that removes code automatically according to by the attribute information of deletion control and the corresponding relation of event code information, can remove the code corresponding with this control automatically, thereby reduce the redundance of code when this control is deleted.
One of ordinary skill in the art will appreciate that all or part of step in the said method can instruct related hardware to accomplish through program, said procedure can be stored in the computer-readable recording medium, like ROM (read-only memory), disk or CD etc.Alternatively, all or part of step of the foregoing description also can use one or more integrated circuit to realize.Correspondingly, each the module/unit in the foregoing description can adopt the form of hardware to realize, also can adopt the form of software function module to realize.The present invention is not restricted to the combination of the hardware and software of any particular form.
Above embodiment is only unrestricted in order to technical scheme of the present invention to be described, only with reference to preferred embodiment the present invention is specified.Those of ordinary skill in the art should be appreciated that and can make amendment or be equal to replacement technical scheme of the present invention, and do not break away from the spirit and the scope of technical scheme of the present invention, all should be encompassed in the middle of the claim scope of the present invention.

Claims (10)

1. a method that removes code automatically is characterized in that, this method comprises:
After detecting the control of having created and being deleted; From concordance list, obtain the event code information of said control according to the attribute information of said control; Wherein, preserve the corresponding relation of event code information of attribute information and the said control of said control in the said concordance list;
Orient code the position in code file corresponding according to the event code information of said control, and delete said locational code with said control.
2. method according to claim 1 is characterized in that:
Said detecting before the control of having created deleted, said method also comprises:
The attribute information of the said control of having created and event code information and corresponding relation thereof are deposited in the said concordance list.
3. method according to claim 1 and 2 is characterized in that:
The attribute information of said control comprises the identification information of said control, and said identification information has uniqueness;
The event code information of said control comprises title, the present code file of all incident functions and the positional information of all incident functions in corresponding code file of all incident functions of said control.
4. method according to claim 3 is characterized in that:
The attribute information of said control also comprises the control type.
5. method according to claim 3 is characterized in that:
Said event code information according to said control is oriented code the position in code file corresponding with said control, and deletes said locational code, comprising:
The position of all incident functions of orienting said control according to the event code information of said control in code file separately, and the code of the corresponding incident function on the deletion correspondence position.
6. a device that removes code automatically is characterized in that, this device comprises:
Acquisition module; Be used for after detecting the control of having created and being deleted; From concordance list, obtain the event code information of said control according to the attribute information of said control, wherein, preserve the corresponding relation of event code information of attribute information and the said control of said control in the said concordance list;
Remove module, the event code information of the said control that is used for obtaining according to said acquisition module is oriented the code corresponding with said control in the position of code file, and deletes said locational code.
7. device according to claim 6 is characterized in that, said device also comprises:
Preserve module, be used to preserve attribute information and the event code information and the corresponding relation thereof of the control of having created.
8. according to claim 6 or 7 described devices, it is characterized in that:
The attribute information of said control comprises the identification information of said control, and said identification information has uniqueness;
The event code information of said control comprises title, the present code file of all incident functions and the positional information of all incident functions in corresponding code file of all incident functions of said control.
9. device according to claim 8 is characterized in that:
The attribute information of said control also comprises the control type.
10. device according to claim 8 is characterized in that:
The said module that removes is all incident functions of being used for orienting said control according to the event code information of said control in the position of code file separately, and the code of the corresponding incident function on the deletion correspondence position.
CN2011104091294A 2011-12-09 2011-12-09 Method and device for automatically removing codes Pending CN102520947A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2011104091294A CN102520947A (en) 2011-12-09 2011-12-09 Method and device for automatically removing codes
PCT/CN2012/075576 WO2012155844A1 (en) 2011-12-09 2012-05-16 Method and device for automatic removal of code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011104091294A CN102520947A (en) 2011-12-09 2011-12-09 Method and device for automatically removing codes

Publications (1)

Publication Number Publication Date
CN102520947A true CN102520947A (en) 2012-06-27

Family

ID=46291889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011104091294A Pending CN102520947A (en) 2011-12-09 2011-12-09 Method and device for automatically removing codes

Country Status (2)

Country Link
CN (1) CN102520947A (en)
WO (1) WO2012155844A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103353836A (en) * 2013-04-01 2013-10-16 深圳市东微智能科技有限公司 Method for realizing functions of programmable reusable control
CN105095107A (en) * 2014-05-04 2015-11-25 腾讯科技(深圳)有限公司 Buffer memory data cleaning method and apparatus
CN105511934A (en) * 2015-12-08 2016-04-20 贵阳朗玛信息技术股份有限公司 Resource processing method and device in application program development
CN105975260A (en) * 2016-04-28 2016-09-28 广州华多网络科技有限公司 File generation method and device
CN106569799A (en) * 2016-10-17 2017-04-19 搜游网络科技(北京)有限公司 Program processing method and equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050188365A1 (en) * 2004-02-25 2005-08-25 Samsung Electronics Co., Ltd. Flash memory and method of dynamically loading firmware operation module in optical drive
CN102043655A (en) * 2011-01-04 2011-05-04 奇智软件(北京)有限公司 Method and system for carrying out advanced uninstall on software

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100049373A1 (en) * 2008-08-25 2010-02-25 Gm Global Technology Operations, Inc. Method for modular software removal

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050188365A1 (en) * 2004-02-25 2005-08-25 Samsung Electronics Co., Ltd. Flash memory and method of dynamically loading firmware operation module in optical drive
CN102043655A (en) * 2011-01-04 2011-05-04 奇智软件(北京)有限公司 Method and system for carrying out advanced uninstall on software

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
管旭东 等: "Delphi中控件的动态生成及清除", 《微电脑世界》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103353836A (en) * 2013-04-01 2013-10-16 深圳市东微智能科技有限公司 Method for realizing functions of programmable reusable control
CN103353836B (en) * 2013-04-01 2016-12-28 深圳市东微智能科技股份有限公司 A kind of function realizing method of programmable reusable control
CN105095107A (en) * 2014-05-04 2015-11-25 腾讯科技(深圳)有限公司 Buffer memory data cleaning method and apparatus
CN105511934A (en) * 2015-12-08 2016-04-20 贵阳朗玛信息技术股份有限公司 Resource processing method and device in application program development
CN105511934B (en) * 2015-12-08 2018-11-13 贵阳朗玛信息技术股份有限公司 Method for processing resource in application development and device
CN105975260A (en) * 2016-04-28 2016-09-28 广州华多网络科技有限公司 File generation method and device
CN105975260B (en) * 2016-04-28 2019-05-03 广州华多网络科技有限公司 A kind of document generating method and device
CN106569799A (en) * 2016-10-17 2017-04-19 搜游网络科技(北京)有限公司 Program processing method and equipment

Also Published As

Publication number Publication date
WO2012155844A1 (en) 2012-11-22

Similar Documents

Publication Publication Date Title
US10147398B2 (en) Display control method and device
CN104915268A (en) Desktop layout storage and recovery method and device thereof, terminal equipment and system
US20100077328A1 (en) Automatically arranging widgets of a model within a canvas using iterative region based widget relative adjustments
CN109902255B (en) Page mixed browsing record generation method, device, equipment and storage medium
CN104360805A (en) Application icon management method and application icon management device
CN105068727A (en) Realization method and device for drawing tool
CN105302784A (en) Method and system for copying/ cutting and pasting data
CN102520947A (en) Method and device for automatically removing codes
CN103226442B (en) A kind of method of batch processing file and device
US20110131533A1 (en) Apparatus and method for user interface configuration in portable terminal
US8914428B2 (en) System and method for maintaining a file system at a computing device
CN105320578A (en) Method and apparatus for backing up and recovering APP
CN110032324A (en) A kind of text chooses method and terminal
US20080222576A1 (en) Design support apparatus, method for supporting design, and medium recording design support program
US20150033182A1 (en) Data Processing Method and Apparatus
CN107908340A (en) Method, mobile terminal and the device with store function of factory reset
CN102541561B (en) Method for developing configuration type software and device
CN106033301B (en) Application program desktop management method and touch screen terminal
CN103207918A (en) Method, system and device for managing animation effect of presentation files
CN109597707A (en) Clone volume data copying method, device and computer readable storage medium
CN106776908A (en) Data clearing method, device and terminal
CN110309100A (en) A kind of snapshot object generation method and device
CN110688145A (en) Android MVP code automatic generation method, device, medium and electronic equipment
EP3232304B1 (en) Device, method and graphical user interface for mobile application interface element
WO2022126039A1 (en) Process mining for multi-instance processes

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120627