¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡QUESTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

86 views
Skip to first unread message

WILSON RIVERA

unread,
Feb 8, 2012, 6:39:29 AM2/8/12
to Ace Internals Dev
Hi, I'm working on the design of an IDE for java, and I use the
library ace.js. I wonder if even possible that segment of the session
could lock and not allow editing, ie make a setReadyOnly (true) to a
segemento the document.

I appreciate the cooperation that can give me, and apologizing for my
bad English since I am a Latino

Harutyun Amirjanyan

unread,
Feb 8, 2012, 9:32:30 AM2/8/12
to ace-in...@googlegroups.com
>segment of the session could lock and not allow editing
why you need that?

there's no built in way for doing it, but you can override commandManager.exec

editor.commands.exec = function (command, editor, args) {
if (typeof command === "string")
command = this.commands[command];
if (!command)
return false;
if (editor && !command.readOnly && !editor.canModify())
return false;
if (typeof command == "function")
command(editor, args || {});
else
command.exec(editor, args || {});

return true;
}
editor.canModify = function(){
var c = this.getCursorPosition()
// some logic to determine if current position is editable
if (c.row>4||c.row<2)
return true
}

or

editor.__defineGetter__("$readOnly", function(){
return ...
})


you may also need to highlight not editable parts somehow

WILSON RIVERA

unread,
Feb 8, 2012, 4:24:43 PM2/8/12
to Ace Internals Dev
thank you very much for answering, but I do not understand.

My purpose is to block a method created in the editor ace, so that
once created can not be edited directly.

Our application manages to build GUIs and generates the source code,
but when viewed in the editor, you can not manipulate the method
"initComponents ()" which has the configuration of the graphical
components.

that's the reason I want to block the release of a certain segment of
the document, ie the folding block all "initComponents ()".

WILSON RIVERA

unread,
Feb 9, 2012, 7:59:27 AM2/9/12
to Ace Internals Dev
tank you very much, I did the test with the code you wrote and it
works, I have only to modify it a bit to make it more dynamic ways to
block segments.

thanks again.
Reply all
Reply to author
Forward
0 new messages