Skip to content

Commit aa89e47

Browse files
committed
Added Eclipse plugin resource
1 parent f5f1921 commit aa89e47

File tree

4 files changed

+69
-2
lines changed

4 files changed

+69
-2
lines changed

build/build.xml

+15-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<file name="outline_ui.js"/>
2626
<file name="controller.js"/>
2727
<file name="selection-notifier.js"/>
28+
<file name="clipboard.js"/>
2829
</filelist>
2930

3031
<target name="compile.js" depends="init">
@@ -85,7 +86,20 @@
8586
</copy>
8687
</target>
8788

88-
<target name="compile" depends="compile.css, compile.js, chrome.extension, browser.stylesheet, safari.extension">
89+
<target name="eclipse.extension" depends="compile.css, compile.js" description="Build Eclipse extension resource">
90+
<loadfile property="browser.compiled-css" srcFile="${dist.css.dir}/main.css"/>
91+
<loadfile property="browser.compiled-js" srcFile="${dist.js.dir}/xv.js"/>
92+
<copy file="${basedir}/eclipse.html" todir="${dist.dir}" overwrite="true">
93+
<filterchain>
94+
<replacetokens>
95+
<token key="CSS" value="${browser.compiled-css}"/>
96+
<token key="JS" value="${browser.compiled-js}"/>
97+
</replacetokens>
98+
</filterchain>
99+
</copy>
100+
</target>
101+
102+
<target name="compile" depends="compile.css, compile.js, chrome.extension, browser.stylesheet, safari.extension, eclipse.extension">
89103
<copy file="${basedir}/xml-pretty-print.xslt" tofile="${dist.dir}/xmlview.xsl"/>
90104
<echo>Build done</echo>
91105
</target>

eclipse.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<style type="text/css">
6+
@CSS@
7+
</style>
8+
</head>
9+
<body>
10+
<div class="xv-search-panel">
11+
<input type="search" class="xv-search-field" spellcheck="false" placeholder="Search by name or XPath" />
12+
<span class="xv-search-xpath-result"></span>
13+
</div>
14+
<div class="xv-source-pane">
15+
<div class="xv-source-pane-inner"></div>
16+
</div>
17+
18+
<div id="xv-source-data">@SOURCE@</div>
19+
20+
<script type="text/javascript">
21+
@JS@
22+
;xv_controller.process(document.getElementById('xv-source-data').textContent);
23+
</script>
24+
</body>
25+
</html>

extensions/chrome/controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var xv_dnd_feedback = {
6262
fn(response.image);
6363
});
6464
}
65-
}
65+
};
6666

6767
// intercept XML document while it is not replaced by Chrome's XML Tree
6868
if (!('_doc' in this)) {

src/clipboard.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Module for copying Quick XPath values to clipboard on click where available
3+
* (in IDE mostly)
4+
*/
5+
(function(GLOBAL) {
6+
var is_dnd_mode = false,
7+
copy_text = '';
8+
9+
xv_signals.dndModeEntered.add(function() {
10+
is_dnd_mode = true;
11+
});
12+
13+
xv_signals.dndModeQuit.add(function() {
14+
is_dnd_mode = false;
15+
});
16+
17+
xv_signals.dndMessageChanged.add(function(message) {
18+
copy_text = message;
19+
});
20+
21+
xv_dom.addEvent(document, 'click', function(evt) {
22+
if (is_dnd_mode && copy_text && 'copyToClipboard' in GLOBAL) {
23+
GLOBAL.copyToClipboard(copy_text);
24+
evt.preventDefault();
25+
evt.stopPropagation();
26+
}
27+
});
28+
})(this);

0 commit comments

Comments
 (0)