Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » Code protection in Java editor
Code protection in Java editor [message #587431] Wed, 11 December 2002 03:06
Eclipse UserFriend
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
Previous Topic:Code protection in Java editor
Next Topic:JavaEditorPreferencePage
Goto Forum:
  


Current Time: Tue Apr 16 07:15:40 GMT 2024

Powered by FUDForum. Page generated in 0.23333 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top