Eclipse插件可精确监控编辑器更改(Eclipse Plugin to granularly monitor editor changes)
因此,我希望为Eclipse 4.2开发一个插件,用于监视用户对其文件所做的编辑。
这是我的第一个Eclipse插件,为了准备,我浏览了Eclipse插件开发备忘单(HelloWorld),并花了很多时间在help.eclipse.org上查看文档和API。 我想我对我需要什么工具有所了解,但我不确定如何把这些工具放在一起做我想要的。
期望的结果 :有一个插件可以随时了解添加到(Java)编辑器的所有新字母以及任何和所有删除。 这包括Eclipse所做的事情(自动完成变量,大括号)以及用户键入的内容。
可能 有用的 工具 :我认为IResourceChangeListener会帮助我,因为它给了我一个IResourceChangeEvent ,它有一个可访问的IResourceDelta ,它表示工作区的变化。 此外,由于编辑器扩展了EditorPart,我认为将IPropertyChangeListener添加到相关编辑器也可能很有用。
我想我有合适的工具,但我不知道如何按照自己的意愿组装它们。
问题 :
上面列出的工具是否适用于该工作?
如何获取已打开或将要打开的所有编辑器的列表并向其添加侦听器?
有关学习如何编程Eclipse插件的资源的任何其他提示?So, I'm looking to develop a plugin for Eclipse 4.2 that monitors edits that a user makes to their files.
This is my first Eclipse plugin, and to prepare, I walked through the Eclipse plugin development cheat sheet (HelloWorld) and spent many hours on help.eclipse.org looking through the documentation and the API. I think I have some idea of what tools I need, but I'm not sure how to put those tools together to do what I want.
Desired Results: Have a plugin that's kept apprised of every new letter added to a (Java) editor and any and all deletes. This includes things that Eclipse does (auto-completing variables, curly braces) as well as what the user types.
Tools that might help: I'm thinking that a IResourceChangeListener will assist, as it gives me a IResourceChangeEvent, with an accessible IResourceDelta which represents workspace changes. Also, since editors extend EditorPart, I'm thinking that adding a IPropertyChangeListener to the relevant editor may be useful as well.
I think I've got the right tools, but I've got no idea how to go about assembling them to do as I wish.
Questions:
Are the tools listed above the proper ones for the job?
How can I get a list of all editors opened or that will be opened and add listeners to them?
Any additional tips for resources on learning how to program Eclipse plugins?
原文:https://stackoverflow.com/questions/11485082
最满意答案
如果您的下拉列表在您的表单中,您需要任何特殊处理,只需提交您的表单及其中的所有字段,将发送给您的控制器。
在JS中:
$('#formId').submit();
在你的HTML中:
<button type="submit">Send</button>
这2个选项中的任何一个都适合您的问题,如果我理解您的问题,请告诉我。
你也应该删除这段代码“onSubmit =”return selectAll()“并保持表单提交工作正常,将所有数据发送到表单中
If your dropdown lists are inside your form, you dotn need any special treatment, just submit your form and all fields inside it, will be send to your controller.
In JS:
$('#formId').submit();
In your html:
<button type="submit">Send</button>
Any of this 2 options would suit your problem, if i understand workgly your problem, please let me know.
Also you should remove this code "onSubmit="return selectAll()" and leave form submit work normally, will send all your data into the form
相关问答
更多-
jQuery - 将项目追加到Internet Explorer中的列表框(jQuery - Append items to listbox in Internet Explorer)[2023-06-02]
对于任何后来的人来说:这里是一种解决IE问题的方法,使用不同的工具: $('#lstDistricts').append(""); 我有一个评论(他删除了),这表明这对他有效: var newOpt = document.createElement("option"); newOpt.textContent = thisrowDistrict; newOpt.value = this ... -
在您的示例中,您为列表框指定了“lstbox”的ID。 您可以使用它来使用jQuery查找“列表框”: var box = $('#lstbox'); // or $('select[multiple]:first') for just the first one 从那里,您可以修改代码以过滤掉所选的选项: var selected = $('#lstbox option:selected'); 最后,为了获得索引,我们再次改变它并添加几行代码: var selectedIndices = []; // ...
-
喜欢这个, str = ""; $.each(selectedOpts, function (index, value) { str += value+" "; }); alert(str); Like this, str = ""; $.each(selectedOpts, function (index, value) { str += value+" "; }); alert(str);
-
使用jquery动态选择多选列表框中的所有项目(Dynamically select all items in a Multi-Select listbox using jquery)[2023-08-23]
我手头没有IE来检查你所指的滚动效果,但它应该很容易让你测试。 你可以保留你的selectDeselect函数,但它可能会改变成这样(假设jQuery〜1.7.2+): function selectDeselect(listbox, checkbox) { var select_all = $(checkbox).prop('checked') ? true : false; var select = $(listbox); $('option', select).prop('se ... -
我没有代码,但在使用jQuery的移动div的网页上有几个例子。 我的建议是将列表框放在偏向某些可移动的div或其他东西上。 像这样的东西可能会帮助你 。 它使用我认为的列表并允许您对它们重新排序。 然后,您可以jQuery新订单并将其存储在数据库中。 I don't have the code but there are several examples on the web of moving div's using jQuery. My suggestion would be to ditch the ...
-
你可以这样做 你的更新小提琴 HTML: JavaScript的: $('#btnRightAll').click(function(e) { var selectedOpts = $('#lstBox1 option'); if (selectedOpts.length == 0) { alert("Nothing to move."); e.p ...
-
更改DocThumbnail的值后,需要调用Validator.element方法。 这告诉jQuery Validate重新检查DocThumbnail ,这将使错误消息消失。 您更新的代码如下所示: var validator = $("#AddDocumentForm").validate({ ignore: [], rules: { DocThumbnail : { required : true} }, messages: { Do ...
-
使用已使用jQuery移动的列表框项目提交隐藏字段(Submit hidden fields with listbox items that have been moved using jQuery)[2021-09-21]
如果您的下拉列表在您的表单中,您需要任何特殊处理,只需提交您的表单及其中的所有字段,将发送给您的控制器。 在JS中: $('#formId').submit(); 在你的HTML中: 这2个选项中的任何一个都适合您的问题,如果我理解您的问题,请告诉我。 你也应该删除这段代码“onSubmit =”return selectAll()“并保持表单提交工作正常,将所有数据发送到表单中 If your dropdown lists are ... -
当您尝试向下移动多个项目时,从上到下依次循环显示。 不幸的是,这意味着您要在第二个选定项目后移动第一个选定项目,然后在第一个选定项目之后移动第二个选定项目,导致不变。 我使用这里的技巧解决了问题,在向下移动时向后循环选择。 更新:添加一个测试,看看你是否已经将选择移到顶部或底部以避免使用选择: http : //jsfiddle.net/FBTVk/1/ function moveUp() { $('#selected-items select :selected').each(function(i ...
-
阻止列表框滚动到选中的项目(使用jquery)(Prevent listbox from scrolling to the item getting selected (with jquery))[2021-12-07]
你可以试试这个: $('#lb').change(function() { var x = $(this).scrollTop(); $('#lb option:selected').each(function() { var groupName = $(this).attr('group'); if (groupName !== undefined) { $('#lb option[group=' + groupName ...