Browse files

Added an examples section to Bulk Rename command

  • Loading branch information...
1 parent 122b475 commit b39c596a14d44ee91e17d755005fded4b4fe929a @danlucraft committed Jun 16, 2010
View
71 plugins/application_swt/lib/application_swt/notebook/drag_and_drop_listener.rb
@@ -1,71 +0,0 @@
-module Redcar
- class ApplicationSWT
- class Notebook
- class DragAndDropListener
-
- def initialize(tab_folder)
- @tab_folder = tab_folder
- @drag, @exit_drag = false, false
- @drag_item = nil
- end
-
- def handleEvent(e)
- if e.type == Swt::SWT::DragDetect
- p = @tab_folder.toControl(Swt::Widgets::Display.getCurrent.getCursorLocation) # see bug 43251
- else
- p = Swt::Graphics::Point.new(e.x, e.y)
- end
- case e.type
- when Swt::SWT::DragDetect
- item = @tab_folder.getItem(p)
- return unless item
- @drag = true
- @exit_Drag = false
- @drag_item = item
- when Swt::SWT::MouseEnter
- if @exit_drag
- @exit_drag = false;
- @drag = (e.button != 0)
- end
- when Swt::SWT::MouseExit
- if @drag
- @tab_folder.setInsertMark(nil, false)
- @exit_drag = true
- @drag = false
- end
- when Swt::SWT::MouseUp
- return unless @drag
- @tab_folder.setInsertMark(nil, false)
- if item = @tab_folder.getItem(Swt::Graphics::Point.new(p.x, 1))
- rect = item.getBounds()
- after = (p.x > rect.x + rect.width/2)
- index = @tab_folder.indexOf(item)
- index = after ? index + 1 : index -1
- index = [0, index].max
- new_item = Swt::Custom::CTabItem.new(@tab_folder, Swt::SWT::NONE, index)
- new_item.setText("new tab item")
- c = @drag_item.getControl()
- @drag_item.setControl(nil)
- new_item.setControl(c)
- @drag_item.dispose()
- @tab_folder.setSelection(new_item)
- end
- @drag = false
- @exit_drag = false
- @drag_item = nil
- when Swt::SWT::MouseMove
- return unless @drag
- item = @tab_folder.getItem(Swt::Graphics::Point.new(p.x, 2))
- unless item
- @tab_folder.setInsertMark(nil, false)
- return
- end
- rect = item.getBounds
- after = (p.x > rect.x + rect.width/2)
- @tab_folder.setInsertMark(item, after)
- end
- end
- end
- end
- end
-end
View
39 plugins/project/views/bulk_rename.html.erb
@@ -13,8 +13,6 @@
</table>
</form>
-<br />
-
<table>
<tr>
<th>Old</th>
@@ -28,6 +26,24 @@
</tr>
<% end %>
</table>
+<br />
+<hr />
+<br />
+<small><a class="show-examples">Show examples</a></small>
+<div id="examples" style="display:none;" class="example-box">
+ <small><a class="hide-examples">Hide examples</a></small>
+ <br /><br />
+ <p>E.g.</p>
+ <table>
+ <tr>
+ <td>Match</td><td>Replace</td><td>From</td><td>To</td>
+ </tr>
+ <tr><td>E</td><td>XXXXX</td><td>README</td><td>RXXXXXADME</td></tr>
+ <tr><td>$</td><td>.md</td><td>README</td><td>README.md</td></tr>
+ </table>
+</div>
+<br />
+
<script language="javascript">
jQuery.fn.watch = function( id, fn ) {
@@ -45,19 +61,15 @@ jQuery.fn.watch = function( id, fn ) {
oldVal = self[id];
}
}, 100)
- );
-
- });
-
+ );
+ });
return self;
};
jQuery.fn.unwatch = function( id ) {
-
return this.each(function(){
clearInterval( $(this).data('watch_timer') );
- });
-
+ });
};
jQuery.fn.valuechange = function(fn) {
return this.bind('valuechange', fn);
@@ -130,6 +142,15 @@ BulkRename = {
alert(e.message);
};
});
+
+ $(".show-examples").click(function() {
+ $("#examples").slideDown();
+ $(".show-examples").slideUp();
+ });
+ $(".hide-examples").click(function() {
+ $("#examples").slideUp();
+ $(".show-examples").slideDown();
+ });
}
};

0 comments on commit b39c596

Please sign in to comment.