Code protection in Java editor [message #37875] |
Wed, 11 December 2002 03:06 |
Eclipse User |
|
|
|
Originally posted by: benjamin.fayle.maketechnologies.com
Does anyone know if it is possible to make some lines of code in the
editor read only?
When you use the NetBeans GUI designer it generates code for the controls.
This code cannot be edited in the NetBeans Java editor.
If you open up the code in a text editor you see a pair of comments
//GEN-BEGIN: and //GEN-END:
The NetBeans java editor makes the code between these comments read only
and hides these strings.
We are writing a code generation plug-in and this is very useful as you
can prevent programmers from changing code they shouldn't be touching.
Is there a way to do something similar in Eclipse?
Thanks,
Benj
Here is a sample of code from the NetBeans GUI editor that shows the begin
and end comments.
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
jLabel1 = new javax.swing.JLabel();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jLabel1.setText("jLabel1");
getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
pack();
}//GEN-END:initComponents
|
|
|
Powered by
FUDForum. Page generated in 0.03562 seconds