• R/O
  • HTTP
  • SSH
  • HTTPS

moreemacs: 提交

中央リポジトリ


Commit MetaInfo

修訂9dcbc4fc5d762b6afed813ad8f6695e9987329c4 (tree)
時間2015-03-16 00:58:52
作者quiver2k <quiver2k@user...>
Commiterquiver2k

Log Message

change whitespace chars

Change Summary

差異

--- a/jp.sourceforge.moreemacs.exp/build.properties
+++ b/jp.sourceforge.moreemacs.exp/build.properties
@@ -1,5 +1,5 @@
1-source.. = src/
2-output.. = bin/
3-bin.includes = META-INF/,\
4- .,\
5- fragment.xml
1+source.. = src/
2+output.. = bin/
3+bin.includes = META-INF/,\
4+ .,\
5+ fragment.xml
--- a/jp.sourceforge.moreemacs.exp/fragment.xml
+++ b/jp.sourceforge.moreemacs.exp/fragment.xml
@@ -1,31 +1,31 @@
1-<?xml version="1.0" encoding="UTF-8"?>
2-<?eclipse version="3.4"?>
3-<fragment>
4- <extension
5- point="org.eclipse.ui.commands">
6- <command
7- categoryId="jp.sourceforge.moreemacs.category"
8- id="jp.sourceforge.moreemacs.NextError"
9- name="next-error">
10- </command>
11- </extension>
12- <extension
13- point="org.eclipse.ui.handlers">
14- <handler
15- commandId="jp.sourceforge.moreemacs.NextError">
16- <class
17- class="jp.sourceforge.moreemacs.exp.NextErrorHandler">
18- </class>
19- </handler>
20- </extension>
21- <extension
22- point="org.eclipse.ui.bindings">
23- <key
24- commandId="jp.sourceforge.moreemacs.NextError"
25- contextId="org.eclipse.ui.contexts.window"
26- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
27- sequence="M3+G M3+N">
28- </key>
29- </extension>
30-
31-</fragment>
1+<?xml version="1.0" encoding="UTF-8"?>
2+<?eclipse version="3.4"?>
3+<fragment>
4+ <extension
5+ point="org.eclipse.ui.commands">
6+ <command
7+ categoryId="jp.sourceforge.moreemacs.category"
8+ id="jp.sourceforge.moreemacs.NextError"
9+ name="next-error">
10+ </command>
11+ </extension>
12+ <extension
13+ point="org.eclipse.ui.handlers">
14+ <handler
15+ commandId="jp.sourceforge.moreemacs.NextError">
16+ <class
17+ class="jp.sourceforge.moreemacs.exp.NextErrorHandler">
18+ </class>
19+ </handler>
20+ </extension>
21+ <extension
22+ point="org.eclipse.ui.bindings">
23+ <key
24+ commandId="jp.sourceforge.moreemacs.NextError"
25+ contextId="org.eclipse.ui.contexts.window"
26+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
27+ sequence="M3+G M3+N">
28+ </key>
29+ </extension>
30+
31+</fragment>
--- a/jp.sourceforge.moreemacs.exp/src/jp/sourceforge/moreemacs/exp/NextErrorHandler.java
+++ b/jp.sourceforge.moreemacs.exp/src/jp/sourceforge/moreemacs/exp/NextErrorHandler.java
@@ -1,131 +1,131 @@
1-package jp.sourceforge.moreemacs.exp;
2-
3-import java.util.ArrayList;
4-import java.util.List;
5-
6-import org.eclipse.core.commands.AbstractHandler;
7-import org.eclipse.core.commands.ExecutionEvent;
8-import org.eclipse.core.commands.ExecutionException;
9-import org.eclipse.core.commands.NotEnabledException;
10-import org.eclipse.core.commands.NotHandledException;
11-import org.eclipse.core.commands.common.NotDefinedException;
12-import org.eclipse.core.resources.IMarker;
13-import org.eclipse.core.resources.IResource;
14-import org.eclipse.core.runtime.CoreException;
15-import org.eclipse.jface.util.OpenStrategy;
16-import org.eclipse.ui.IViewPart;
17-import org.eclipse.ui.IWorkbenchPage;
18-import org.eclipse.ui.IWorkbenchSite;
19-import org.eclipse.ui.PartInitException;
20-import org.eclipse.ui.handlers.HandlerUtil;
21-import org.eclipse.ui.handlers.IHandlerService;
22-import org.eclipse.ui.ide.IDE;
23-import org.eclipse.ui.views.markers.MarkerSupportView;
24-
25-public class NextErrorHandler extends AbstractHandler {
26-
27- @Override
28- public Object execute(ExecutionEvent event) throws ExecutionException {
29- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
30- IWorkbenchPage page = site.getPage();
31-
32- MarkerSupportView problemView = (MarkerSupportView) page.findView("org.eclipse.ui.views.ProblemView");
33- if(problemView == null) {
34- return null;
35- }
36- @SuppressWarnings("restriction")
37- IMarker[] currentMarkers = problemView.getSelectedMarkers();
38- IMarker startPoint = (currentMarkers.length != 0)?currentMarkers[currentMarkers.length-1]:null;
39-
40- selectAll(problemView);
41-
42- @SuppressWarnings("restriction")
43- IMarker[] allMarkers = problemView.getSelectedMarkers();
44- goNextError(allMarkers, startPoint, page);
45-
46- return null;
47- }
48-
49- void selectAll(IViewPart view) throws ExecutionException {
50- view.getSite().getPage().activate(view);
51- IHandlerService handlerService = (IHandlerService)view.getSite().getService(IHandlerService.class);
52- try {
53- handlerService.executeCommand("org.eclipse.ui.edit.selectAll", null);
54- } catch (NotDefinedException e) {
55- throw new ExecutionException(e.getMessage(), e);
56- } catch (NotEnabledException e) {
57- throw new ExecutionException(e.getMessage(), e);
58- } catch (NotHandledException e) {
59- throw new ExecutionException(e.getMessage(), e);
60- }
61- }
62-
63- void goNextError(IMarker[] allMarkers, IMarker startPoint, IWorkbenchPage page) throws ExecutionException {
64- boolean found = false;
65- List<IMarker> skipped = new ArrayList<IMarker>();
66- for(IMarker marker: allMarkers) {
67- if(!marker.exists()) {
68- continue;
69- }
70- if(startPoint != null && startPoint.exists()) {
71- if(startPoint.equals(marker)) {
72- found = true;
73- continue;
74- }
75-
76- if(hasSameLineNumber(startPoint, marker)) {
77- continue;
78- }
79-
80- if(!found) {
81- skipped.add(marker);
82- continue;
83- }
84- }
85-
86- if(marker.getResource().getType() != IResource.FILE) {
87- continue;
88- }
89-
90- try {
91- IDE.openEditor(page, marker, OpenStrategy.activateOnOpen());
92- } catch (PartInitException e) {
93- throw new ExecutionException(e.getMessage(), e);
94- }
95- return;
96- }
97- if(startPoint != null && startPoint.exists()) {
98- skipped.add(startPoint);
99- }
100-
101- for(IMarker marker: skipped) {
102- if(marker.getResource().getType() != IResource.FILE) {
103- continue;
104- }
105-
106- try {
107- IDE.openEditor(page, marker, OpenStrategy.activateOnOpen());
108- } catch (PartInitException e) {
109- throw new ExecutionException(e.getMessage(), e);
110- }
111- return;
112- }
113-
114- }
115-
116- boolean hasSameLineNumber(IMarker marker1, IMarker marker2) throws ExecutionException {
117- if(!marker1.getResource().equals(marker2.getResource())) {
118- return false;
119- }
120- try {
121- Integer line1 = (Integer)marker1.getAttribute(IMarker.LINE_NUMBER);
122- Integer line2 = (Integer)marker2.getAttribute(IMarker.LINE_NUMBER);
123- if(line1 == null) {
124- return (line2 == null);
125- }
126- return line1.equals(line2);
127- } catch (CoreException e) {
128- throw new ExecutionException(e.getMessage(), e);
129- }
130- }
131-}
1+package jp.sourceforge.moreemacs.exp;
2+
3+import java.util.ArrayList;
4+import java.util.List;
5+
6+import org.eclipse.core.commands.AbstractHandler;
7+import org.eclipse.core.commands.ExecutionEvent;
8+import org.eclipse.core.commands.ExecutionException;
9+import org.eclipse.core.commands.NotEnabledException;
10+import org.eclipse.core.commands.NotHandledException;
11+import org.eclipse.core.commands.common.NotDefinedException;
12+import org.eclipse.core.resources.IMarker;
13+import org.eclipse.core.resources.IResource;
14+import org.eclipse.core.runtime.CoreException;
15+import org.eclipse.jface.util.OpenStrategy;
16+import org.eclipse.ui.IViewPart;
17+import org.eclipse.ui.IWorkbenchPage;
18+import org.eclipse.ui.IWorkbenchSite;
19+import org.eclipse.ui.PartInitException;
20+import org.eclipse.ui.handlers.HandlerUtil;
21+import org.eclipse.ui.handlers.IHandlerService;
22+import org.eclipse.ui.ide.IDE;
23+import org.eclipse.ui.views.markers.MarkerSupportView;
24+
25+public class NextErrorHandler extends AbstractHandler {
26+
27+ @Override
28+ public Object execute(ExecutionEvent event) throws ExecutionException {
29+ IWorkbenchSite site = HandlerUtil.getActiveSite(event);
30+ IWorkbenchPage page = site.getPage();
31+
32+ MarkerSupportView problemView = (MarkerSupportView) page.findView("org.eclipse.ui.views.ProblemView");
33+ if(problemView == null) {
34+ return null;
35+ }
36+ @SuppressWarnings("restriction")
37+ IMarker[] currentMarkers = problemView.getSelectedMarkers();
38+ IMarker startPoint = (currentMarkers.length != 0)?currentMarkers[currentMarkers.length-1]:null;
39+
40+ selectAll(problemView);
41+
42+ @SuppressWarnings("restriction")
43+ IMarker[] allMarkers = problemView.getSelectedMarkers();
44+ goNextError(allMarkers, startPoint, page);
45+
46+ return null;
47+ }
48+
49+ void selectAll(IViewPart view) throws ExecutionException {
50+ view.getSite().getPage().activate(view);
51+ IHandlerService handlerService = (IHandlerService)view.getSite().getService(IHandlerService.class);
52+ try {
53+ handlerService.executeCommand("org.eclipse.ui.edit.selectAll", null);
54+ } catch (NotDefinedException e) {
55+ throw new ExecutionException(e.getMessage(), e);
56+ } catch (NotEnabledException e) {
57+ throw new ExecutionException(e.getMessage(), e);
58+ } catch (NotHandledException e) {
59+ throw new ExecutionException(e.getMessage(), e);
60+ }
61+ }
62+
63+ void goNextError(IMarker[] allMarkers, IMarker startPoint, IWorkbenchPage page) throws ExecutionException {
64+ boolean found = false;
65+ List<IMarker> skipped = new ArrayList<IMarker>();
66+ for(IMarker marker: allMarkers) {
67+ if(!marker.exists()) {
68+ continue;
69+ }
70+ if(startPoint != null && startPoint.exists()) {
71+ if(startPoint.equals(marker)) {
72+ found = true;
73+ continue;
74+ }
75+
76+ if(hasSameLineNumber(startPoint, marker)) {
77+ continue;
78+ }
79+
80+ if(!found) {
81+ skipped.add(marker);
82+ continue;
83+ }
84+ }
85+
86+ if(marker.getResource().getType() != IResource.FILE) {
87+ continue;
88+ }
89+
90+ try {
91+ IDE.openEditor(page, marker, OpenStrategy.activateOnOpen());
92+ } catch (PartInitException e) {
93+ throw new ExecutionException(e.getMessage(), e);
94+ }
95+ return;
96+ }
97+ if(startPoint != null && startPoint.exists()) {
98+ skipped.add(startPoint);
99+ }
100+
101+ for(IMarker marker: skipped) {
102+ if(marker.getResource().getType() != IResource.FILE) {
103+ continue;
104+ }
105+
106+ try {
107+ IDE.openEditor(page, marker, OpenStrategy.activateOnOpen());
108+ } catch (PartInitException e) {
109+ throw new ExecutionException(e.getMessage(), e);
110+ }
111+ return;
112+ }
113+
114+ }
115+
116+ boolean hasSameLineNumber(IMarker marker1, IMarker marker2) throws ExecutionException {
117+ if(!marker1.getResource().equals(marker2.getResource())) {
118+ return false;
119+ }
120+ try {
121+ Integer line1 = (Integer)marker1.getAttribute(IMarker.LINE_NUMBER);
122+ Integer line2 = (Integer)marker2.getAttribute(IMarker.LINE_NUMBER);
123+ if(line1 == null) {
124+ return (line2 == null);
125+ }
126+ return line1.equals(line2);
127+ } catch (CoreException e) {
128+ throw new ExecutionException(e.getMessage(), e);
129+ }
130+ }
131+}
--- a/jp.sourceforge.moreemacs.feature/build.properties
+++ b/jp.sourceforge.moreemacs.feature/build.properties
@@ -1 +1 @@
1-bin.includes = feature.xml
1+bin.includes = feature.xml
--- a/jp.sourceforge.moreemacs.feature/feature.xml
+++ b/jp.sourceforge.moreemacs.feature/feature.xml
@@ -1,21 +1,21 @@
1-<?xml version="1.0" encoding="UTF-8"?>
2-<feature
3- id="jp.sourceforge.moreemacs.feature"
4- label="More Emacs"
5- version="2.0.0.qualifier"
6- provider-name="quiver2k"
7- plugin="jp.sourceforge.moreemacs">
8-
9- <description url="http://moreemacs.sourceforge.jp/">
10- More Emacs Plugin
11- </description>
12-
13- <copyright>
1+<?xml version="1.0" encoding="UTF-8"?>
2+<feature
3+ id="jp.sourceforge.moreemacs.feature"
4+ label="More Emacs"
5+ version="2.0.0.qualifier"
6+ provider-name="quiver2k"
7+ plugin="jp.sourceforge.moreemacs">
8+
9+ <description url="http://moreemacs.sourceforge.jp/">
10+ More Emacs Plugin
11+ </description>
12+
13+ <copyright>
1414 Copyright (c) 2009, quiver2k
15-All rights reserved.
16- </copyright>
17-
18- <license>
15+All rights reserved.
16+ </copyright>
17+
18+ <license>
1919 Copyright (c) 2009, quiver2k
2020 All rights reserved.
2121
@@ -41,26 +41,26 @@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
4141 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
4242 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4343 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44-POSSIBILITY OF SUCH DAMAGE.
45- </license>
46-
47- <url>
48- <update label="More Emacs" url="http://moreemacs.sourceforge.jp/update-site"/>
49- </url>
50-
51- <requires>
52- <import plugin="org.eclipse.ui"/>
53- <import plugin="org.eclipse.core.runtime"/>
54- <import plugin="org.eclipse.ui.editors" version="3.4.0" match="greaterOrEqual"/>
55- <import plugin="com.ibm.icu" version="3.8.1" match="greaterOrEqual"/>
56- <import plugin="org.eclipse.jface.text" version="3.4.2" match="greaterOrEqual"/>
57- </requires>
58-
59- <plugin
60- id="jp.sourceforge.moreemacs"
61- download-size="0"
62- install-size="0"
63- version="0.0.0"
64- unpack="false"/>
65-
66-</feature>
44+POSSIBILITY OF SUCH DAMAGE.
45+ </license>
46+
47+ <url>
48+ <update label="More Emacs" url="http://moreemacs.sourceforge.jp/update-site"/>
49+ </url>
50+
51+ <requires>
52+ <import plugin="org.eclipse.ui"/>
53+ <import plugin="org.eclipse.core.runtime"/>
54+ <import plugin="org.eclipse.ui.editors" version="3.4.0" match="greaterOrEqual"/>
55+ <import plugin="com.ibm.icu" version="3.8.1" match="greaterOrEqual"/>
56+ <import plugin="org.eclipse.jface.text" version="3.4.2" match="greaterOrEqual"/>
57+ </requires>
58+
59+ <plugin
60+ id="jp.sourceforge.moreemacs"
61+ download-size="0"
62+ install-size="0"
63+ version="0.0.0"
64+ unpack="false"/>
65+
66+</feature>
--- a/jp.sourceforge.moreemacs.test/build.properties
+++ b/jp.sourceforge.moreemacs.test/build.properties
@@ -1,4 +1,4 @@
1-source.. = src/
2-output.. = bin/
3-bin.includes = META-INF/,\
4- .
1+source.. = src/
2+output.. = bin/
3+bin.includes = META-INF/,\
4+ .
--- a/jp.sourceforge.moreemacs.test/src/jp/sourceforge/moreemacs/utils/CharacterUtilsTest.java
+++ b/jp.sourceforge.moreemacs.test/src/jp/sourceforge/moreemacs/utils/CharacterUtilsTest.java
@@ -1,29 +1,29 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import java.util.Locale;
4-import static org.junit.Assert.*;
5-import org.junit.Test;
6-
7-public class CharacterUtilsTest {
8- @Test
9- public void testGetWidth() {
10- String ambiguousChars = "α■";
11-
12- for(int codePoint : CodePointIterator.each(ambiguousChars)) {
13- assertEquals(2, CharacterUtils.getWidth(codePoint, Locale.JAPANESE));
14- }
15- Locale defaultLocale = Locale.getDefault();
16- try {
17- Locale.setDefault(Locale.JAPANESE);
18- for(int codePoint : CodePointIterator.each(ambiguousChars)) {
19- assertEquals(2, CharacterUtils.getWidth(codePoint));
20- }
21- Locale.setDefault(Locale.ENGLISH);
22- for(int codePoint : CodePointIterator.each(ambiguousChars)) {
23- assertEquals(1, CharacterUtils.getWidth(codePoint));
24- }
25- } finally {
26- Locale.setDefault(defaultLocale);
27- }
28- }
29-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import java.util.Locale;
4+import static org.junit.Assert.*;
5+import org.junit.Test;
6+
7+public class CharacterUtilsTest {
8+ @Test
9+ public void testGetWidth() {
10+ String ambiguousChars = "α■";
11+
12+ for(int codePoint : CodePointIterator.each(ambiguousChars)) {
13+ assertEquals(2, CharacterUtils.getWidth(codePoint, Locale.JAPANESE));
14+ }
15+ Locale defaultLocale = Locale.getDefault();
16+ try {
17+ Locale.setDefault(Locale.JAPANESE);
18+ for(int codePoint : CodePointIterator.each(ambiguousChars)) {
19+ assertEquals(2, CharacterUtils.getWidth(codePoint));
20+ }
21+ Locale.setDefault(Locale.ENGLISH);
22+ for(int codePoint : CodePointIterator.each(ambiguousChars)) {
23+ assertEquals(1, CharacterUtils.getWidth(codePoint));
24+ }
25+ } finally {
26+ Locale.setDefault(defaultLocale);
27+ }
28+ }
29+}
--- a/jp.sourceforge.moreemacs.updatesite/site.xml
+++ b/jp.sourceforge.moreemacs.updatesite/site.xml
@@ -1,14 +1,14 @@
1-<?xml version="1.0" encoding="UTF-8"?>
2-<site>
3- <description name="More Emacs" url="http://moreemacs.sourceforge.jp/update-site">
4- More Emacs update site
5- </description>
6- <feature url="features/jp.sourceforge.moreemacs.feature_2.0.0.qualifier.jar" id="jp.sourceforge.moreemacs.feature" version="2.0.0.qualifier">
7- <category name="moreemacs"/>
8- </feature>
9- <category-def name="moreemacs" label="More Emacs">
10- <description>
11- provides more emacs like key bindings.
12- </description>
13- </category-def>
14-</site>
1+<?xml version="1.0" encoding="UTF-8"?>
2+<site>
3+ <description name="More Emacs" url="http://moreemacs.sourceforge.jp/update-site">
4+ More Emacs update site
5+ </description>
6+ <feature url="features/jp.sourceforge.moreemacs.feature_2.0.0.qualifier.jar" id="jp.sourceforge.moreemacs.feature" version="2.0.0.qualifier">
7+ <category name="moreemacs"/>
8+ </feature>
9+ <category-def name="moreemacs" label="More Emacs">
10+ <description>
11+ provides more emacs like key bindings.
12+ </description>
13+ </category-def>
14+</site>
--- a/jp.sourceforge.moreemacs.web/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/jp.sourceforge.moreemacs.web/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,5 +1,5 @@
1-<?xml version="1.0" encoding="UTF-8"?>
2-<faceted-project>
3- <fixed facet="wst.web"/>
4- <installed facet="wst.web" version="1.0"/>
5-</faceted-project>
1+<?xml version="1.0" encoding="UTF-8"?>
2+<faceted-project>
3+ <fixed facet="wst.web"/>
4+ <installed facet="wst.web" version="1.0"/>
5+</faceted-project>
--- a/jp.sourceforge.moreemacs.web/WebContent/index.html
+++ b/jp.sourceforge.moreemacs.web/WebContent/index.html
@@ -1,242 +1,242 @@
1-<!DOCTYPE html>
2-<html>
3-<head>
4-<link rel='stylesheet' type='text/css' href='style.css'/>
5-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6-<title>More Emacs Plugin</title>
7-</head>
8-<body>
9-<h1>More Emacs Plugin</h1>
10-<p>More Emacs Plugin is an eclipse plugin for emacs users.</p>
11-<p>Eclipse provides the emacs like key bindings. But emacs users require
12-more emacs like key bindings. More emacs plugin provides more emacs like key bindings.
13-The key bind scheme of more emacs is a child schema of Eclispe's emacs scheme.
14-It adds some key bindings or overrides some bindings to emacs scheme.
15-</p>
16-
17-<p>
18-Drag 'Install' button to your eclipse workspace.
19-<a href="http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=975" class="drag" title="Drag to your running Eclipse workspace to install More Emacs"><img src="https://marketplace.eclipse.org/sites/all/themes/solstice/_themes/solstice_marketplace/public/images/btn-install.png" alt="Drag to your running Eclipse workspace to install More Emacs" /></a>
20-</p>
21-
22-<h2>Install</h2>
23-<p>You can install the plugin from
24- <a href="http://moreemacs.sourceforge.jp/update-site">http://moreemacs.sourceforge.jp/update-site</a>.</p>
25-<p>Open the preferences dialog and General/Keys. Choose "More Emacs" from "Scheme" pull down.</p>
26-<div class="chart"><img src="settings.png" alt="settings" /></div>
27-
28-
29-
30-<h2>Key Bindings</h2>
31-<p>
32-The following list is key bindings of more emacs plugin.
33-</p>
34-
35-<table id="functions" class="flatTable">
36-<caption>Key bindings of More Emacs</caption>
37-<tr>
38-<th class="function">function</th>
39-<th>binding</th>
40-<th>description</th>
41-</tr>
42-<tr>
43-<td class="function">undo</td>
44-<td>C-/</td>
45-<td>rebind</td>
46-</tr>
47-<tr>
48-<td class="function">delete previous</td>
49-<td>C-h</td>
50-<td>rebind</td>
51-</tr>
52-<tr>
53-<td class="function">next editor</td>
54-<td>C-x o<br>Shift-Tab</td>
55-<td>rebind</td>
56-</tr>
57-<tr>
58-<td class="function">previous editor</td>
59-<td>C-Shift-Tab</td>
60-<td>rebind</td>
61-</tr>
62-<tr>
63-<td class="function">file close</td>
64-<td>C-x 0</td>
65-<td>rebind</td>
66-</tr>
67-<tr>
68-<td class="function">maximize part</td>
69-<td>C-x 1</td>
70-<td>rebind</td>
71-</tr>
72-<tr>
73-<td class="function">new editor</td>
74-<td>C-x 2</td>
75-<td>rebind</td>
76-</tr>
77-<tr>
78-<td class="function">find replace</td>
79-<td>M-S-5</td>
80-<td>rebind</td>
81-</tr>
82-<tr>
83-<td class="function">newline-and-indent</td>
84-<td>C-j</td>
85-<td>rebind</td>
86-</tr>
87-<tr>
88-<td class="function">back-to-indentation</td>
89-<td>M-m</td>
90-<td>rebind</td>
91-</tr>
92-<tr>
93-<td class="function">move-beginning-of-line</td>
94-<td>C-a</td>
95-<td>moves the cursor to 0th column, not to the first non-space char of the line.</td>
96-</tr>
97-<tr>
98-<td class="function">move-end-of-line</td>
99-<td>C-e</td>
100-<td></td>
101-</tr>
102-<tr>
103-<td class="function">forward-word</td>
104-<td>M-f</td>
105-<td>moves the cursor to the end of word, not to the first char of the next word.
106-Only Character.isLetterOrDigit() is used to word-break.
107-It is very simple but predictable.
108-</td>
109-</tr>
110-<tr>
111-<td class="function">backward-word</td>
112-<td>M-b</td>
113-<td></td>
114-</tr>
115-<tr>
116-<td class="function">kill-word</td>
117-<td>M-d</td>
118-<td></td>
119-</tr>
120-<tr>
121-<td class="function">backward-kill-word</td>
122-<td>M-BS</td>
123-<td></td>
124-</tr>
125-<tr>
126-<td class="function">delete-horizontal-space</td>
127-<td>M-\</td>
128-<td></td>
129-</tr>
130-<tr>
131-<td class="function">kill-line</td>
132-<td>C-k</td>
133-<td></td>
134-</tr>
135-<tr>
136-<td class="function">transpose-chars</td>
137-<td>C-t</td>
138-<td></td>
139-</tr>
140-<tr>
141-<td class="function">transpose-words</td>
142-<td>M-t</td>
143-<td></td>
144-</tr>
145-<tr>
146-<td class="function">kill-rectangle</td>
147-<td>C-x r k</td>
148-<td>East Asian Width supported</td>
149-</tr>
150-<tr>
151-<td class="function">yank-rectangle</td>
152-<td>C-x r y</td>
153-<td>East Asian Width supported</td>
154-</tr>
155-<tr>
156-<td class="function">newline</td>
157-<td>C-m</td>
158-<td></td>
159-</tr>
160-<tr>
161-<td class="function">open-line</td>
162-<td>C-o</td>
163-<td></td>
164-</tr>
165-<tr>
166-<td class="function">upcase-word</td>
167-<td>M-u</td>
168-<td></td>
169-</tr>
170-<tr>
171-<td class="function">downcase-word</td>
172-<td>M-l</td>
173-<td></td>
174-</tr>
175-<tr>
176-<td class="function">capitalize-word</td>
177-<td>M-c</td>
178-<td></td>
179-</tr>
180-<tr>
181-<td class="function">comment-region</td>
182-<td>C-c C-c<br/>C-u C-c C-c</td>
183-<td>forward to toggle comment</td>
184-</tr>
185-</table>
186-
187-<h2>Unicode</h2>
188-<ul>
189-<li>The supplementary characters are supported.
190-All characters are treated as code point.
191-
192-<li>East Asian Width is supported.
193-In the column calculation of rectangle operation, the width of ambiguous characters are 2 for CJK languages
194- and 1 for other languages.
195-
196-</ul>
197-
198-
199-<h2>Change Log</h2>
200-<h3>2015.3.15</h3>
201-<ul>
202-<li>Release 2.0.0
203-<li>Support Eclipse4.x
204-</ul>
205-<h3>2009.8.20</h3>
206-<ul>
207-<li>Release 1.2.0
208-</ul>
209-<h3>2009.8.4</h3>
210-<ul>
211-<li>Added newline, and assigned to C-m
212-<li>Added back-to-indentation
213-</ul>
214-<h3>2009.8.1</h3>
215-<ul>
216-<li>Added comment-region
217-<li>Rebinded C-j
218-</ul>
219-<h3>2009.7.28</h3>
220-<ul>
221-<li>Fix rectangle action.
222-<li>Add the followings.
223-<ul>
224-<li>upcase-word
225-<li>downcase-word
226-<li>capitalize-word
227-</ul>
228-
229-<li>Release 1.1.0
230-</ul>
231-<h3>2009.6.14</h3>
232-<ul>
233-<li>Release 1.0.0
234-</ul>
235-
236-<h2>Links</h2>
237-<ul>
238-<li><a href="https://sourceforge.jp/projects/moreemacs/simple">More Emacs Plugin SourceForge Project</a>
239-<li><a href="https://marketplace.eclipse.org/content/more-emacs">Eclipse Market</a>
240-</ul>
241-</body>
242-</html>
1+<!DOCTYPE html>
2+<html>
3+<head>
4+<link rel='stylesheet' type='text/css' href='style.css'/>
5+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6+<title>More Emacs Plugin</title>
7+</head>
8+<body>
9+<h1>More Emacs Plugin</h1>
10+<p>More Emacs Plugin is an eclipse plugin for emacs users.</p>
11+<p>Eclipse provides the emacs like key bindings. But emacs users require
12+more emacs like key bindings. More emacs plugin provides more emacs like key bindings.
13+The key bind scheme of more emacs is a child schema of Eclispe's emacs scheme.
14+It adds some key bindings or overrides some bindings to emacs scheme.
15+</p>
16+
17+<p>
18+Drag 'Install' button to your eclipse workspace.
19+<a href="http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=975" class="drag" title="Drag to your running Eclipse workspace to install More Emacs"><img src="https://marketplace.eclipse.org/sites/all/themes/solstice/_themes/solstice_marketplace/public/images/btn-install.png" alt="Drag to your running Eclipse workspace to install More Emacs" /></a>
20+</p>
21+
22+<h2>Install</h2>
23+<p>You can install the plugin from
24+ <a href="http://moreemacs.sourceforge.jp/update-site">http://moreemacs.sourceforge.jp/update-site</a>.</p>
25+<p>Open the preferences dialog and General/Keys. Choose "More Emacs" from "Scheme" pull down.</p>
26+<div class="chart"><img src="settings.png" alt="settings" /></div>
27+
28+
29+
30+<h2>Key Bindings</h2>
31+<p>
32+The following list is key bindings of more emacs plugin.
33+</p>
34+
35+<table id="functions" class="flatTable">
36+<caption>Key bindings of More Emacs</caption>
37+<tr>
38+<th class="function">function</th>
39+<th>binding</th>
40+<th>description</th>
41+</tr>
42+<tr>
43+<td class="function">undo</td>
44+<td>C-/</td>
45+<td>rebind</td>
46+</tr>
47+<tr>
48+<td class="function">delete previous</td>
49+<td>C-h</td>
50+<td>rebind</td>
51+</tr>
52+<tr>
53+<td class="function">next editor</td>
54+<td>C-x o<br>Shift-Tab</td>
55+<td>rebind</td>
56+</tr>
57+<tr>
58+<td class="function">previous editor</td>
59+<td>C-Shift-Tab</td>
60+<td>rebind</td>
61+</tr>
62+<tr>
63+<td class="function">file close</td>
64+<td>C-x 0</td>
65+<td>rebind</td>
66+</tr>
67+<tr>
68+<td class="function">maximize part</td>
69+<td>C-x 1</td>
70+<td>rebind</td>
71+</tr>
72+<tr>
73+<td class="function">new editor</td>
74+<td>C-x 2</td>
75+<td>rebind</td>
76+</tr>
77+<tr>
78+<td class="function">find replace</td>
79+<td>M-S-5</td>
80+<td>rebind</td>
81+</tr>
82+<tr>
83+<td class="function">newline-and-indent</td>
84+<td>C-j</td>
85+<td>rebind</td>
86+</tr>
87+<tr>
88+<td class="function">back-to-indentation</td>
89+<td>M-m</td>
90+<td>rebind</td>
91+</tr>
92+<tr>
93+<td class="function">move-beginning-of-line</td>
94+<td>C-a</td>
95+<td>moves the cursor to 0th column, not to the first non-space char of the line.</td>
96+</tr>
97+<tr>
98+<td class="function">move-end-of-line</td>
99+<td>C-e</td>
100+<td></td>
101+</tr>
102+<tr>
103+<td class="function">forward-word</td>
104+<td>M-f</td>
105+<td>moves the cursor to the end of word, not to the first char of the next word.
106+Only Character.isLetterOrDigit() is used to word-break.
107+It is very simple but predictable.
108+</td>
109+</tr>
110+<tr>
111+<td class="function">backward-word</td>
112+<td>M-b</td>
113+<td></td>
114+</tr>
115+<tr>
116+<td class="function">kill-word</td>
117+<td>M-d</td>
118+<td></td>
119+</tr>
120+<tr>
121+<td class="function">backward-kill-word</td>
122+<td>M-BS</td>
123+<td></td>
124+</tr>
125+<tr>
126+<td class="function">delete-horizontal-space</td>
127+<td>M-\</td>
128+<td></td>
129+</tr>
130+<tr>
131+<td class="function">kill-line</td>
132+<td>C-k</td>
133+<td></td>
134+</tr>
135+<tr>
136+<td class="function">transpose-chars</td>
137+<td>C-t</td>
138+<td></td>
139+</tr>
140+<tr>
141+<td class="function">transpose-words</td>
142+<td>M-t</td>
143+<td></td>
144+</tr>
145+<tr>
146+<td class="function">kill-rectangle</td>
147+<td>C-x r k</td>
148+<td>East Asian Width supported</td>
149+</tr>
150+<tr>
151+<td class="function">yank-rectangle</td>
152+<td>C-x r y</td>
153+<td>East Asian Width supported</td>
154+</tr>
155+<tr>
156+<td class="function">newline</td>
157+<td>C-m</td>
158+<td></td>
159+</tr>
160+<tr>
161+<td class="function">open-line</td>
162+<td>C-o</td>
163+<td></td>
164+</tr>
165+<tr>
166+<td class="function">upcase-word</td>
167+<td>M-u</td>
168+<td></td>
169+</tr>
170+<tr>
171+<td class="function">downcase-word</td>
172+<td>M-l</td>
173+<td></td>
174+</tr>
175+<tr>
176+<td class="function">capitalize-word</td>
177+<td>M-c</td>
178+<td></td>
179+</tr>
180+<tr>
181+<td class="function">comment-region</td>
182+<td>C-c C-c<br/>C-u C-c C-c</td>
183+<td>forward to toggle comment</td>
184+</tr>
185+</table>
186+
187+<h2>Unicode</h2>
188+<ul>
189+<li>The supplementary characters are supported.
190+All characters are treated as code point.
191+
192+<li>East Asian Width is supported.
193+In the column calculation of rectangle operation, the width of ambiguous characters are 2 for CJK languages
194+ and 1 for other languages.
195+
196+</ul>
197+
198+
199+<h2>Change Log</h2>
200+<h3>2015.3.15</h3>
201+<ul>
202+<li>Release 2.0.0
203+<li>Support Eclipse4.x
204+</ul>
205+<h3>2009.8.20</h3>
206+<ul>
207+<li>Release 1.2.0
208+</ul>
209+<h3>2009.8.4</h3>
210+<ul>
211+<li>Added newline, and assigned to C-m
212+<li>Added back-to-indentation
213+</ul>
214+<h3>2009.8.1</h3>
215+<ul>
216+<li>Added comment-region
217+<li>Rebinded C-j
218+</ul>
219+<h3>2009.7.28</h3>
220+<ul>
221+<li>Fix rectangle action.
222+<li>Add the followings.
223+<ul>
224+<li>upcase-word
225+<li>downcase-word
226+<li>capitalize-word
227+</ul>
228+
229+<li>Release 1.1.0
230+</ul>
231+<h3>2009.6.14</h3>
232+<ul>
233+<li>Release 1.0.0
234+</ul>
235+
236+<h2>Links</h2>
237+<ul>
238+<li><a href="https://sourceforge.jp/projects/moreemacs/simple">More Emacs Plugin SourceForge Project</a>
239+<li><a href="https://marketplace.eclipse.org/content/more-emacs">Eclipse Market</a>
240+</ul>
241+</body>
242+</html>
--- a/jp.sourceforge.moreemacs.web/WebContent/style.css
+++ b/jp.sourceforge.moreemacs.web/WebContent/style.css
@@ -1,45 +1,45 @@
1-@CHARSET "UTF-8";
2-
3-body {
4- background: #EEFFEE;
5- margin: 30px;
6-}
7-
8-h1 {
9- background: #8888FF;
10-}
11-
12-h2 {
13- background: #AAAAFF;
14-}
15-
16-table {
17- margin-left: auto;
18- margin-right: auto;
19-}
20-
21-th {
22- background: #AABBBB;
23-}
24-
25-.chart {
26- text-align: center;
27-}
28-
29-.function {
30- white-space: nowrap
31-}
32-
33-.flatTable {
34- border: 1px solid black;
35- border-collapse: collapse;
36-}
37-.flatTable td, .flatTable th {
38- border: 1px solid black;
39- padding: 5px;
40-}
41-#functions td:first-child,
42-#functions td:nth-child(2)
43-{
44- white-space: nowrap;
45-}
1+@CHARSET "UTF-8";
2+
3+body {
4+ background: #EEFFEE;
5+ margin: 30px;
6+}
7+
8+h1 {
9+ background: #8888FF;
10+}
11+
12+h2 {
13+ background: #AAAAFF;
14+}
15+
16+table {
17+ margin-left: auto;
18+ margin-right: auto;
19+}
20+
21+th {
22+ background: #AABBBB;
23+}
24+
25+.chart {
26+ text-align: center;
27+}
28+
29+.function {
30+ white-space: nowrap
31+}
32+
33+.flatTable {
34+ border: 1px solid black;
35+ border-collapse: collapse;
36+}
37+.flatTable td, .flatTable th {
38+ border: 1px solid black;
39+ padding: 5px;
40+}
41+#functions td:first-child,
42+#functions td:nth-child(2)
43+{
44+ white-space: nowrap;
45+}
--- a/jp.sourceforge.moreemacs/LICENCE.txt
+++ b/jp.sourceforge.moreemacs/LICENCE.txt
@@ -1,26 +1,26 @@
1-Copyright (c) 2009, quiver2k
2-All rights reserved.
3-
4-Redistribution and use in source and binary forms, with or without
5-modification, are permitted provided that the following conditions are met:
6-
7- * Redistributions of source code must retain the above copyright notice,
8- this list of conditions and the following disclaimer.
9- * Redistributions in binary form must reproduce the above copyright notice,
10- this list of conditions and the following disclaimer in the documentation
11- and/or other materials provided with the distribution.
12- * Neither the name of the authors nor the names of its contributors may be
13- used to endorse or promote products derived from this software without
14- specific prior written permission.
15-
16-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26-POSSIBILITY OF SUCH DAMAGE.
1+Copyright (c) 2009, quiver2k
2+All rights reserved.
3+
4+Redistribution and use in source and binary forms, with or without
5+modification, are permitted provided that the following conditions are met:
6+
7+ * Redistributions of source code must retain the above copyright notice,
8+ this list of conditions and the following disclaimer.
9+ * Redistributions in binary form must reproduce the above copyright notice,
10+ this list of conditions and the following disclaimer in the documentation
11+ and/or other materials provided with the distribution.
12+ * Neither the name of the authors nor the names of its contributors may be
13+ used to endorse or promote products derived from this software without
14+ specific prior written permission.
15+
16+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+POSSIBILITY OF SUCH DAMAGE.
--- a/jp.sourceforge.moreemacs/about.ini
+++ b/jp.sourceforge.moreemacs/about.ini
@@ -1 +1 @@
1-featureImage=icons/logo.png
1+featureImage=icons/logo.png
--- a/jp.sourceforge.moreemacs/build.properties
+++ b/jp.sourceforge.moreemacs/build.properties
@@ -1,8 +1,8 @@
1-source.. = src/
2-output.. = bin/
3-bin.includes = META-INF/,\
4- .,\
5- plugin.xml,\
6- LICENCE.txt,\
7- icons/logo.png,\
8- about.ini
1+source.. = src/
2+output.. = bin/
3+bin.includes = META-INF/,\
4+ .,\
5+ plugin.xml,\
6+ LICENCE.txt,\
7+ icons/logo.png,\
8+ about.ini
--- a/jp.sourceforge.moreemacs/plugin.xml
+++ b/jp.sourceforge.moreemacs/plugin.xml
@@ -1,747 +1,747 @@
1-<?xml version="1.0" encoding="UTF-8"?>
2-<?eclipse version="3.4"?>
3-<plugin>
4- <extension
5- point="org.eclipse.ui.commands">
6- <category
7- id="jp.sourceforge.moreemacs.category"
8- name="More Emacs">
9- </category>
10- <command
11- categoryId="jp.sourceforge.moreemacs.category"
12- id="jp.sourceforge.moreemacs.MoveBeginningOfLine"
13- name="move-beginning-of-line">
14- </command>
15- <command
16- categoryId="jp.sourceforge.moreemacs.category"
17- id="jp.sourceforge.moreemacs.MoveEndOfLine"
18- name="move-end-of-line">
19- </command>
20- <command
21- categoryId="jp.sourceforge.moreemacs.category"
22- id="jp.sourceforge.moreemacs.ForwardWord"
23- name="forward-word">
24- </command>
25- <command
26- categoryId="jp.sourceforge.moreemacs.category"
27- id="jp.sourceforge.moreemacs.BackwardWord"
28- name="backward-word">
29- </command>
30- <command
31- categoryId="jp.sourceforge.moreemacs.category"
32- id="jp.sourceforge.moreemacs.KillWord"
33- name="kill-word">
34- </command>
35- <command
36- categoryId="jp.sourceforge.moreemacs.category"
37- id="jp.sourceforge.moreemacs.BackwardKillWord"
38- name="backward-kill-word">
39- </command>
40- <command
41- categoryId="jp.sourceforge.moreemacs.category"
42- id="jp.sourceforge.moreemacs.DeleteHorizontalSpace"
43- name="delete-horizontal-space">
44- </command>
45- <command
46- categoryId="jp.sourceforge.moreemacs.category"
47- id="jp.sourceforge.moreemacs.KillLine"
48- name="kill-line">
49- </command>
50- <command
51- categoryId="jp.sourceforge.moreemacs.category"
52- id="jp.sourceforge.moreemacs.TransposeChars"
53- name="transpose-chars">
54- </command>
55- <command
56- categoryId="jp.sourceforge.moreemacs.category"
57- id="jp.sourceforge.moreemacs.TransposeWords"
58- name="transpose-words">
59- </command>
60- <command
61- categoryId="jp.sourceforge.moreemacs.category"
62- id="jp.sourceforge.moreemacs.KillRectangle"
63- name="kill-rectangle">
64- </command>
65- <command
66- categoryId="jp.sourceforge.moreemacs.category"
67- id="jp.sourceforge.moreemacs.YankRectangle"
68- name="yank-rectangle">
69- </command>
70- <command
71- categoryId="jp.sourceforge.moreemacs.category"
72- id="jp.sourceforge.moreemacs.OpenLine"
73- name="open-line">
74- </command>
75- <command
76- categoryId="jp.sourceforge.moreemacs.category"
77- id="jp.sourceforge.moreemacs.NewLine"
78- name="newline">
79- </command>
80- <command
81- categoryId="jp.sourceforge.moreemacs.category"
82- id="jp.sourceforge.moreemacs.UpcaseWord"
83- name="upcase-word">
84- </command>
85- <command
86- categoryId="jp.sourceforge.moreemacs.category"
87- id="jp.sourceforge.moreemacs.DowncaseWord"
88- name="downcase-word">
89- </command>
90- <command
91- categoryId="jp.sourceforge.moreemacs.category"
92- id="jp.sourceforge.moreemacs.CapitalizeWord"
93- name="capitalize-word">
94- </command>
95- <command
96- categoryId="jp.sourceforge.moreemacs.category"
97- id="jp.sourceforge.moreemacs.CommentRegion"
98- name="comment-region">
99- </command>
100- </extension>
101-
102- <extension
103- point="org.eclipse.ui.handlers">
104- <handler
105- commandId="jp.sourceforge.moreemacs.MoveBeginningOfLine">
106- <class
107- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
108- </class>
109- </handler>
110- <handler
111- commandId="jp.sourceforge.moreemacs.MoveEndOfLine">
112- <class
113- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
114- </class>
115- </handler>
116- <handler
117- commandId="jp.sourceforge.moreemacs.ForwardWord">
118- <class
119- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
120- </class>
121- </handler>
122- <handler
123- commandId="jp.sourceforge.moreemacs.BackwardWord">
124- <class
125- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
126- </class>
127- </handler>
128- <handler
129- commandId="jp.sourceforge.moreemacs.KillWord">
130- <class
131- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
132- </class>
133- </handler>
134- <handler
135- commandId="jp.sourceforge.moreemacs.BackwardKillWord">
136- <class
137- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
138- </class>
139- </handler>
140- <handler
141- commandId="jp.sourceforge.moreemacs.DeleteHorizontalSpace">
142- <class
143- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
144- </class>
145- </handler>
146- <handler
147- commandId="jp.sourceforge.moreemacs.KillLine">
148- <class
149- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
150- </class>
151- </handler>
152- <handler
153- commandId="jp.sourceforge.moreemacs.TransposeChars">
154- <class
155- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
156- </class>
157- </handler>
158- <handler
159- commandId="jp.sourceforge.moreemacs.TransposeWords">
160- <class
161- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
162- </class>
163- </handler>
164- <handler
165- commandId="jp.sourceforge.moreemacs.KillRectangle">
166- <class
167- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
168- </class>
169- </handler>
170- <handler
171- commandId="jp.sourceforge.moreemacs.YankRectangle">
172- <class
173- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
174- </class>
175- </handler>
176- <handler
177- commandId="jp.sourceforge.moreemacs.OpenLine">
178- <class
179- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
180- </class>
181- </handler>
182- <handler
183- commandId="jp.sourceforge.moreemacs.NewLine">
184- <class
185- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
186- </class>
187- </handler>
188- <handler
189- commandId="jp.sourceforge.moreemacs.UpcaseWord">
190- <class
191- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
192- </class>
193- </handler>
194- <handler
195- commandId="jp.sourceforge.moreemacs.DowncaseWord">
196- <class
197- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
198- </class>
199- </handler>
200- <handler
201- commandId="jp.sourceforge.moreemacs.CapitalizeWord">
202- <class
203- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
204- </class>
205- </handler>
206- <handler
207- commandId="jp.sourceforge.moreemacs.CommentRegion">
208- <class
209- class="jp.sourceforge.moreemacs.handlers.CommandHandler">
210- </class>
211- </handler>
212-
213- </extension>
214-
215- <extension
216- point="org.eclipse.ui.bindings">
217- <scheme
218- description="provides more emacs like key binding."
219- id="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
220- parentId="org.eclipse.ui.defaultAcceleratorConfiguration"
221- name="More Emacs">
222- </scheme>
223- <!-- M1=CTRL, M2=SHIFT, M3=ALT for windows platform -->
224-
225- <key
226- commandId="org.eclipse.ui.edit.undo"
227- contextId="org.eclipse.ui.contexts.window"
228- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
229- sequence="M1+/">
230- </key>
231- <key
232- commandId="org.eclipse.ui.edit.text.deletePrevious"
233- contextId="org.eclipse.ui.contexts.window"
234- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
235- sequence="M1+H">
236- </key>
237- <key
238- commandId="org.eclipse.ui.window.nextEditor"
239- contextId="org.eclipse.ui.contexts.window"
240- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
241- sequence="M1+TAB">
242- </key>
243- <key
244- commandId="org.eclipse.ui.window.nextEditor"
245- contextId="org.eclipse.ui.contexts.window"
246- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
247- sequence="M1+X O">
248- </key>
249- <key
250- commandId="org.eclipse.ui.window.previousEditor"
251- contextId="org.eclipse.ui.contexts.window"
252- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
253- sequence="M1+M2+TAB">
254- </key>
255- <key
256- commandId="org.eclipse.ui.file.close"
257- contextId="org.eclipse.ui.contexts.window"
258- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
259- sequence="M1+X 0">
260- </key>
261- <key
262- commandId="org.eclipse.ui.window.maximizePart"
263- contextId="org.eclipse.ui.contexts.window"
264- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
265- sequence="M1+X 1">
266- </key>
267- <key
268- commandId="org.eclipse.ui.window.newEditor"
269- contextId="org.eclipse.ui.contexts.window"
270- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
271- sequence="M1+X 2">
272- </key>
273- <key
274- commandId="org.eclipse.ui.edit.findReplace"
275- contextId="org.eclipse.ui.contexts.window"
276- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
277- sequence="M3+M2+5">
278- </key>
279- <key
280- commandId="org.eclipse.ui.edit.text.goto.lineStart"
281- contextId="org.eclipse.ui.textEditorScope"
282- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
283- sequence="M3+M">
284- </key>
285- <key
286- commandId="jp.sourceforge.moreemacs.NewLine"
287- contextId="org.eclipse.ui.textEditorScope"
288- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
289- sequence="M1+M">
290- </key>
291- <key
292- contextId="org.eclipse.ui.textEditorScope"
293- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
294- sequence="M1+J">
295- </key>
296- <key
297- commandId="jp.sourceforge.moreemacs.MoveBeginningOfLine"
298- contextId="org.eclipse.ui.textEditorScope"
299- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
300- sequence="M1+A">
301- </key>
302- <key
303- commandId="jp.sourceforge.moreemacs.MoveEndOfLine"
304- contextId="org.eclipse.ui.textEditorScope"
305- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
306- sequence="M1+E">
307- </key>
308- <key
309- commandId="jp.sourceforge.moreemacs.ForwardWord"
310- contextId="org.eclipse.ui.textEditorScope"
311- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
312- sequence="M3+F">
313- </key>
314- <key
315- commandId="jp.sourceforge.moreemacs.BackwardWord"
316- contextId="org.eclipse.ui.textEditorScope"
317- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
318- sequence="M3+B">
319- </key>
320- <key
321- commandId="jp.sourceforge.moreemacs.KillWord"
322- contextId="org.eclipse.ui.textEditorScope"
323- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
324- sequence="M3+D">
325- </key>
326- <key
327- commandId="jp.sourceforge.moreemacs.BackwardKillWord"
328- contextId="org.eclipse.ui.textEditorScope"
329- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
330- sequence="M3+Backspace">
331- </key>
332- <key
333- commandId="jp.sourceforge.moreemacs.DeleteHorizontalSpace"
334- contextId="org.eclipse.ui.textEditorScope"
335- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
336- sequence="M3+\">
337- </key>
338- <key
339- commandId="jp.sourceforge.moreemacs.KillLine"
340- contextId="org.eclipse.ui.textEditorScope"
341- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
342- sequence="M1+K">
343- </key>
344- <key
345- commandId="jp.sourceforge.moreemacs.OpenLine"
346- contextId="org.eclipse.ui.textEditorScope"
347- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
348- sequence="M1+O">
349- </key>
350- <key
351- commandId="jp.sourceforge.moreemacs.TransposeChars"
352- contextId="org.eclipse.ui.textEditorScope"
353- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
354- sequence="M1+T">
355- </key>
356- <key
357- commandId="jp.sourceforge.moreemacs.TransposeWords"
358- contextId="org.eclipse.ui.textEditorScope"
359- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
360- sequence="M3+T">
361- </key>
362- <key
363- commandId="jp.sourceforge.moreemacs.KillRectangle"
364- contextId="org.eclipse.ui.textEditorScope"
365- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
366- sequence="M1+X R K">
367- </key>
368- <key
369- commandId="jp.sourceforge.moreemacs.YankRectangle"
370- contextId="org.eclipse.ui.textEditorScope"
371- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
372- sequence="M1+X R Y">
373- </key>
374- <key
375- commandId="jp.sourceforge.moreemacs.UpcaseWord"
376- contextId="org.eclipse.ui.textEditorScope"
377- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
378- sequence="M3+U">
379- </key>
380- <key
381- commandId="jp.sourceforge.moreemacs.DowncaseWord"
382- contextId="org.eclipse.ui.textEditorScope"
383- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
384- sequence="M3+L">
385- </key>
386- <key
387- commandId="jp.sourceforge.moreemacs.CapitalizeWord"
388- contextId="org.eclipse.ui.textEditorScope"
389- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
390- sequence="M3+C">
391- </key>
392- <key
393- commandId="jp.sourceforge.moreemacs.CommentRegion"
394- contextId="org.eclipse.ui.textEditorScope"
395- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
396- sequence="M1+C M1+C">
397- </key>
398- <key
399- commandId="jp.sourceforge.moreemacs.CommentRegion"
400- contextId="org.eclipse.ui.textEditorScope"
401- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
402- sequence="M1+U M1+C M1+C">
403- </key>
404-
405-
406- <!-- emacs key bindings org.eclipse.ui.workbench.texteditor_3.8.100.v20120619-083720/plugin.xml -->
407- <key
408- commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
409- contextId="org.eclipse.ui.textEditorScope"
410- sequence="ALT+0 CTRL+K"
411- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
412- <key
413- commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
414- contextId="org.eclipse.ui.textEditorScope"
415- sequence="ESC 0 CTRL+K"
416- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
417- <!-- <key -->
418- <!-- commandId="org.eclipse.ui.edit.text.cut.line.to.end" -->
419- <!-- contextId="org.eclipse.ui.textEditorScope" -->
420- <!-- sequence="CTRL+K" -->
421- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
422- <key
423- commandId="org.eclipse.ui.edit.text.set.mark"
424- contextId="org.eclipse.ui.textEditorScope"
425- sequence="CTRL+SPACE"
426- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
427- <key
428- commandId="org.eclipse.ui.edit.text.set.mark"
429- contextId="org.eclipse.ui.textEditorScope"
430- sequence="CTRL+2"
431- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
432- <key
433- commandId="org.eclipse.ui.edit.text.clear.mark"
434- contextId="org.eclipse.ui.textEditorScope"
435- sequence="CTRL+G"
436- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
437- <key
438- commandId="org.eclipse.ui.edit.text.swap.mark"
439- contextId="org.eclipse.ui.textEditorScope"
440- sequence="CTRL+X CTRL+X"
441- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
442- <key
443- commandId="org.eclipse.ui.edit.findIncremental"
444- contextId="org.eclipse.ui.textEditorScope"
445- sequence="CTRL+S"
446- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
447- <key
448- commandId="org.eclipse.ui.edit.findIncrementalReverse"
449- contextId="org.eclipse.ui.textEditorScope"
450- sequence="CTRL+R"
451- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
452- <key
453- commandId="org.eclipse.ui.edit.text.goto.lineUp"
454- contextId="org.eclipse.ui.textEditorScope"
455- sequence="CTRL+P"
456- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
457- <key
458- commandId="org.eclipse.ui.edit.text.goto.lineDown"
459- contextId="org.eclipse.ui.textEditorScope"
460- sequence="CTRL+N"
461- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
462- <!-- <key -->
463- <!-- commandId="org.eclipse.ui.edit.text.goto.lineStart" -->
464- <!-- contextId="org.eclipse.ui.textEditorScope" -->
465- <!-- sequence="CTRL+A" -->
466- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
467- <!-- <key -->
468- <!-- commandId="org.eclipse.ui.edit.text.goto.lineEnd" -->
469- <!-- contextId="org.eclipse.ui.textEditorScope" -->
470- <!-- sequence="CTRL+E" -->
471- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
472- <key
473- commandId="org.eclipse.ui.edit.text.goto.line"
474- contextId="org.eclipse.ui.textEditorScope"
475- sequence="CTRL+X G"
476- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
477- <key
478- commandId="org.eclipse.ui.edit.text.goto.columnPrevious"
479- contextId="org.eclipse.ui.textEditorScope"
480- sequence="CTRL+B"
481- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
482- <key
483- commandId="org.eclipse.ui.edit.text.goto.columnNext"
484- contextId="org.eclipse.ui.textEditorScope"
485- sequence="CTRL+F"
486- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
487- <key
488- commandId="org.eclipse.ui.edit.text.goto.pageUp"
489- contextId="org.eclipse.ui.textEditorScope"
490- sequence="ALT+V"
491- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
492- <key
493- commandId="org.eclipse.ui.edit.text.goto.pageUp"
494- contextId="org.eclipse.ui.textEditorScope"
495- sequence="ESC V"
496- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
497- <key
498- commandId="org.eclipse.ui.edit.text.goto.pageDown"
499- contextId="org.eclipse.ui.textEditorScope"
500- sequence="CTRL+V"
501- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
502- <!-- <key -->
503- <!-- commandId="org.eclipse.ui.edit.text.goto.wordPrevious" -->
504- <!-- contextId="org.eclipse.ui.textEditorScope" -->
505- <!-- sequence="ALT+B" -->
506- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
507- <key
508- commandId="org.eclipse.ui.edit.text.goto.wordPrevious"
509- contextId="org.eclipse.ui.textEditorScope"
510- sequence="ESC B"
511- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
512- <!-- <key -->
513- <!-- commandId="org.eclipse.ui.edit.text.goto.wordNext" -->
514- <!-- contextId="org.eclipse.ui.textEditorScope" -->
515- <!-- sequence="ALT+F" -->
516- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
517- <!-- <key -->
518- <!-- commandId="org.eclipse.ui.edit.text.goto.wordNext" -->
519- <!-- contextId="org.eclipse.ui.textEditorScope" -->
520- <!-- sequence="ESC F" -->
521- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
522- <key
523- commandId="org.eclipse.ui.edit.text.goto.textStart"
524- contextId="org.eclipse.ui.textEditorScope"
525- sequence="ALT+&lt;"
526- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
527- <key
528- commandId="org.eclipse.ui.edit.text.goto.textStart"
529- contextId="org.eclipse.ui.textEditorScope"
530- sequence="ALT+SHIFT+&lt;"
531- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
532- <key
533- commandId="org.eclipse.ui.edit.text.goto.textStart"
534- contextId="org.eclipse.ui.textEditorScope"
535- sequence="ESC &lt;"
536- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
537- <key
538- commandId="org.eclipse.ui.edit.text.goto.textStart"
539- contextId="org.eclipse.ui.textEditorScope"
540- sequence="ESC SHIFT+&lt;"
541- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
542- <key
543- commandId="org.eclipse.ui.edit.text.goto.textStart"
544- contextId="org.eclipse.ui.textEditorScope"
545- sequence="CTRL+X ["
546- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
547- <key
548- commandId="org.eclipse.ui.edit.text.goto.textEnd"
549- contextId="org.eclipse.ui.textEditorScope"
550- sequence="ALT+&gt;"
551- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
552- <key
553- commandId="org.eclipse.ui.edit.text.goto.textEnd"
554- contextId="org.eclipse.ui.textEditorScope"
555- sequence="ALT+SHIFT+&gt;"
556- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
557- <key
558- commandId="org.eclipse.ui.edit.text.goto.textEnd"
559- contextId="org.eclipse.ui.textEditorScope"
560- sequence="ESC &gt;"
561- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
562- <key
563- commandId="org.eclipse.ui.edit.text.goto.textEnd"
564- contextId="org.eclipse.ui.textEditorScope"
565- sequence="ESC SHIFT+&gt;"
566- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
567- <key
568- commandId="org.eclipse.ui.edit.text.goto.textEnd"
569- contextId="org.eclipse.ui.textEditorScope"
570- sequence="CTRL+X ]"
571- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
572- <key
573- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
574- contextId="org.eclipse.ui.textEditorScope"
575- sequence="ALT+Z"
576- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
577- <key
578- commandId="org.eclipse.ui.edit.text.scroll.lineUp"
579- contextId="org.eclipse.ui.textEditorScope"
580- sequence="ESC Z"
581- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
582- <key
583- commandId="org.eclipse.ui.edit.text.scroll.lineDown"
584- contextId="org.eclipse.ui.textEditorScope"
585- sequence="CTRL+Z"
586- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
587- <key
588- commandId="org.eclipse.ui.edit.text.deleteNext"
589- contextId="org.eclipse.ui.textEditorScope"
590- sequence="CTRL+D"
591- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
592- <!-- <key -->
593- <!-- commandId="org.eclipse.ui.edit.text.deletePreviousWord" -->
594- <!-- contextId="org.eclipse.ui.textEditorScope" -->
595- <!-- sequence="M3+BS" -->
596- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
597- <key
598- platform="carbon"
599- commandId=""
600- contextId="org.eclipse.ui.textEditorScope"
601- sequence="M3+BS"
602- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
603- <!-- <key -->
604- <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
605- <!-- contextId="org.eclipse.ui.textEditorScope" -->
606- <!-- sequence="M3+DEL" -->
607- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
608- <key
609- platform="carbon"
610- commandId=""
611- contextId="org.eclipse.ui.textEditorScope"
612- sequence="M3+DEL"
613- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
614- <!-- <key -->
615- <!-- commandId="org.eclipse.ui.edit.text.deletePreviousWord" -->
616- <!-- contextId="org.eclipse.ui.textEditorScope" -->
617- <!-- sequence="ESC BS" -->
618- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
619- <!-- <key -->
620- <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
621- <!-- contextId="org.eclipse.ui.textEditorScope" -->
622- <!-- sequence="M3+D" -->
623- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
624- <!-- <key -->
625- <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
626- <!-- contextId="org.eclipse.ui.textEditorScope" -->
627- <!-- sequence="ESC D" -->
628- <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
629- <key
630- commandId="org.eclipse.ui.edit.text.recenter"
631- contextId="org.eclipse.ui.textEditorScope"
632- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
633- sequence="CTRL+L"/>
634-
635- <!-- org.eclipse.ui_3.103.0.v20120521-2329/plugin.xml -->
636- <key
637- commandId="org.eclipse.ui.file.close"
638- sequence="CTRL+X K"
639- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
640- <key
641- commandId="org.eclipse.ui.file.closeAll"
642- sequence="CTRL+X CTRL+C"
643- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
644- <key
645- commandId="org.eclipse.ui.file.save"
646- sequence="CTRL+X CTRL+S"
647- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
648- <key
649- commandId="org.eclipse.ui.file.saveAll"
650- sequence="CTRL+X S"
651- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
652- <key
653- commandId="org.eclipse.ui.file.print"
654- sequence="M3+F9"
655- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
656- <key
657- commandId="org.eclipse.ui.file.print"
658- sequence="ESC F9"
659- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
660- <key
661- commandId="org.eclipse.ui.edit.undo"
662- sequence="F9"
663- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
664- <key
665- commandId="org.eclipse.ui.edit.undo"
666- sequence="CTRL+X U"
667- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
668- <key
669- commandId="org.eclipse.ui.edit.undo"
670- sequence="CTRL+M2+-"
671- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
672- <key
673- commandId="org.eclipse.ui.edit.redo"
674- sequence="F10"
675- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
676- <key
677- commandId="org.eclipse.ui.edit.redo"
678- sequence="CTRL+X R"
679- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
680- <key
681- commandId="org.eclipse.ui.edit.redo"
682- sequence="CTRL+M2++"
683- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
684- <key
685- commandId="org.eclipse.ui.edit.cut"
686- contextId="org.eclipse.ui.contexts.dialogAndWindow"
687- sequence="CTRL+W"
688- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
689- <key
690- commandId="org.eclipse.ui.edit.copy"
691- contextId="org.eclipse.ui.contexts.dialogAndWindow"
692- sequence="M3+W"
693- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
694- <key
695- commandId="org.eclipse.ui.edit.copy"
696- contextId="org.eclipse.ui.contexts.dialogAndWindow"
697- sequence="ESC W"
698- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
699- <key
700- commandId="org.eclipse.ui.edit.paste"
701- contextId="org.eclipse.ui.contexts.dialogAndWindow"
702- sequence="CTRL+Y"
703- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
704- <key
705- commandId="org.eclipse.ui.edit.paste"
706- contextId="org.eclipse.ui.contexts.dialogAndWindow"
707- sequence="CTRL+Y"
708- platform="gtk"
709- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
710- <key
711- commandId="org.eclipse.ui.edit.selectAll"
712- contextId="org.eclipse.ui.contexts.dialogAndWindow"
713- sequence="CTRL+X H"
714- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
715- <key
716- commandId="org.eclipse.ui.edit.findReplace"
717- sequence="M3+R"
718- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
719- <key
720- commandId="org.eclipse.ui.edit.findReplace"
721- sequence="ESC R"
722- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
723- <key
724- commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
725- contextId="org.eclipse.ui.contexts.dialogAndWindow"
726- sequence="ALT+/"
727- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
728- <key
729- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
730- sequence="ALT+?"
731- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
732- <key
733- commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
734- sequence="ALT+SHIFT+?"
735- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
736- <key
737- commandId="org.eclipse.ui.window.openEditorDropDown"
738- sequence="CTRL+X B"
739- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
740- <key
741- commandId="org.eclipse.ui.window.switchToEditor"
742- sequence="CTRL+X CTRL+B"
743- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
744-
745- </extension>
746-
747-</plugin>
1+<?xml version="1.0" encoding="UTF-8"?>
2+<?eclipse version="3.4"?>
3+<plugin>
4+ <extension
5+ point="org.eclipse.ui.commands">
6+ <category
7+ id="jp.sourceforge.moreemacs.category"
8+ name="More Emacs">
9+ </category>
10+ <command
11+ categoryId="jp.sourceforge.moreemacs.category"
12+ id="jp.sourceforge.moreemacs.MoveBeginningOfLine"
13+ name="move-beginning-of-line">
14+ </command>
15+ <command
16+ categoryId="jp.sourceforge.moreemacs.category"
17+ id="jp.sourceforge.moreemacs.MoveEndOfLine"
18+ name="move-end-of-line">
19+ </command>
20+ <command
21+ categoryId="jp.sourceforge.moreemacs.category"
22+ id="jp.sourceforge.moreemacs.ForwardWord"
23+ name="forward-word">
24+ </command>
25+ <command
26+ categoryId="jp.sourceforge.moreemacs.category"
27+ id="jp.sourceforge.moreemacs.BackwardWord"
28+ name="backward-word">
29+ </command>
30+ <command
31+ categoryId="jp.sourceforge.moreemacs.category"
32+ id="jp.sourceforge.moreemacs.KillWord"
33+ name="kill-word">
34+ </command>
35+ <command
36+ categoryId="jp.sourceforge.moreemacs.category"
37+ id="jp.sourceforge.moreemacs.BackwardKillWord"
38+ name="backward-kill-word">
39+ </command>
40+ <command
41+ categoryId="jp.sourceforge.moreemacs.category"
42+ id="jp.sourceforge.moreemacs.DeleteHorizontalSpace"
43+ name="delete-horizontal-space">
44+ </command>
45+ <command
46+ categoryId="jp.sourceforge.moreemacs.category"
47+ id="jp.sourceforge.moreemacs.KillLine"
48+ name="kill-line">
49+ </command>
50+ <command
51+ categoryId="jp.sourceforge.moreemacs.category"
52+ id="jp.sourceforge.moreemacs.TransposeChars"
53+ name="transpose-chars">
54+ </command>
55+ <command
56+ categoryId="jp.sourceforge.moreemacs.category"
57+ id="jp.sourceforge.moreemacs.TransposeWords"
58+ name="transpose-words">
59+ </command>
60+ <command
61+ categoryId="jp.sourceforge.moreemacs.category"
62+ id="jp.sourceforge.moreemacs.KillRectangle"
63+ name="kill-rectangle">
64+ </command>
65+ <command
66+ categoryId="jp.sourceforge.moreemacs.category"
67+ id="jp.sourceforge.moreemacs.YankRectangle"
68+ name="yank-rectangle">
69+ </command>
70+ <command
71+ categoryId="jp.sourceforge.moreemacs.category"
72+ id="jp.sourceforge.moreemacs.OpenLine"
73+ name="open-line">
74+ </command>
75+ <command
76+ categoryId="jp.sourceforge.moreemacs.category"
77+ id="jp.sourceforge.moreemacs.NewLine"
78+ name="newline">
79+ </command>
80+ <command
81+ categoryId="jp.sourceforge.moreemacs.category"
82+ id="jp.sourceforge.moreemacs.UpcaseWord"
83+ name="upcase-word">
84+ </command>
85+ <command
86+ categoryId="jp.sourceforge.moreemacs.category"
87+ id="jp.sourceforge.moreemacs.DowncaseWord"
88+ name="downcase-word">
89+ </command>
90+ <command
91+ categoryId="jp.sourceforge.moreemacs.category"
92+ id="jp.sourceforge.moreemacs.CapitalizeWord"
93+ name="capitalize-word">
94+ </command>
95+ <command
96+ categoryId="jp.sourceforge.moreemacs.category"
97+ id="jp.sourceforge.moreemacs.CommentRegion"
98+ name="comment-region">
99+ </command>
100+ </extension>
101+
102+ <extension
103+ point="org.eclipse.ui.handlers">
104+ <handler
105+ commandId="jp.sourceforge.moreemacs.MoveBeginningOfLine">
106+ <class
107+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
108+ </class>
109+ </handler>
110+ <handler
111+ commandId="jp.sourceforge.moreemacs.MoveEndOfLine">
112+ <class
113+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
114+ </class>
115+ </handler>
116+ <handler
117+ commandId="jp.sourceforge.moreemacs.ForwardWord">
118+ <class
119+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
120+ </class>
121+ </handler>
122+ <handler
123+ commandId="jp.sourceforge.moreemacs.BackwardWord">
124+ <class
125+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
126+ </class>
127+ </handler>
128+ <handler
129+ commandId="jp.sourceforge.moreemacs.KillWord">
130+ <class
131+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
132+ </class>
133+ </handler>
134+ <handler
135+ commandId="jp.sourceforge.moreemacs.BackwardKillWord">
136+ <class
137+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
138+ </class>
139+ </handler>
140+ <handler
141+ commandId="jp.sourceforge.moreemacs.DeleteHorizontalSpace">
142+ <class
143+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
144+ </class>
145+ </handler>
146+ <handler
147+ commandId="jp.sourceforge.moreemacs.KillLine">
148+ <class
149+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
150+ </class>
151+ </handler>
152+ <handler
153+ commandId="jp.sourceforge.moreemacs.TransposeChars">
154+ <class
155+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
156+ </class>
157+ </handler>
158+ <handler
159+ commandId="jp.sourceforge.moreemacs.TransposeWords">
160+ <class
161+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
162+ </class>
163+ </handler>
164+ <handler
165+ commandId="jp.sourceforge.moreemacs.KillRectangle">
166+ <class
167+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
168+ </class>
169+ </handler>
170+ <handler
171+ commandId="jp.sourceforge.moreemacs.YankRectangle">
172+ <class
173+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
174+ </class>
175+ </handler>
176+ <handler
177+ commandId="jp.sourceforge.moreemacs.OpenLine">
178+ <class
179+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
180+ </class>
181+ </handler>
182+ <handler
183+ commandId="jp.sourceforge.moreemacs.NewLine">
184+ <class
185+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
186+ </class>
187+ </handler>
188+ <handler
189+ commandId="jp.sourceforge.moreemacs.UpcaseWord">
190+ <class
191+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
192+ </class>
193+ </handler>
194+ <handler
195+ commandId="jp.sourceforge.moreemacs.DowncaseWord">
196+ <class
197+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
198+ </class>
199+ </handler>
200+ <handler
201+ commandId="jp.sourceforge.moreemacs.CapitalizeWord">
202+ <class
203+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
204+ </class>
205+ </handler>
206+ <handler
207+ commandId="jp.sourceforge.moreemacs.CommentRegion">
208+ <class
209+ class="jp.sourceforge.moreemacs.handlers.CommandHandler">
210+ </class>
211+ </handler>
212+
213+ </extension>
214+
215+ <extension
216+ point="org.eclipse.ui.bindings">
217+ <scheme
218+ description="provides more emacs like key binding."
219+ id="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
220+ parentId="org.eclipse.ui.defaultAcceleratorConfiguration"
221+ name="More Emacs">
222+ </scheme>
223+ <!-- M1=CTRL, M2=SHIFT, M3=ALT for windows platform -->
224+
225+ <key
226+ commandId="org.eclipse.ui.edit.undo"
227+ contextId="org.eclipse.ui.contexts.window"
228+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
229+ sequence="M1+/">
230+ </key>
231+ <key
232+ commandId="org.eclipse.ui.edit.text.deletePrevious"
233+ contextId="org.eclipse.ui.contexts.window"
234+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
235+ sequence="M1+H">
236+ </key>
237+ <key
238+ commandId="org.eclipse.ui.window.nextEditor"
239+ contextId="org.eclipse.ui.contexts.window"
240+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
241+ sequence="M1+TAB">
242+ </key>
243+ <key
244+ commandId="org.eclipse.ui.window.nextEditor"
245+ contextId="org.eclipse.ui.contexts.window"
246+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
247+ sequence="M1+X O">
248+ </key>
249+ <key
250+ commandId="org.eclipse.ui.window.previousEditor"
251+ contextId="org.eclipse.ui.contexts.window"
252+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
253+ sequence="M1+M2+TAB">
254+ </key>
255+ <key
256+ commandId="org.eclipse.ui.file.close"
257+ contextId="org.eclipse.ui.contexts.window"
258+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
259+ sequence="M1+X 0">
260+ </key>
261+ <key
262+ commandId="org.eclipse.ui.window.maximizePart"
263+ contextId="org.eclipse.ui.contexts.window"
264+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
265+ sequence="M1+X 1">
266+ </key>
267+ <key
268+ commandId="org.eclipse.ui.window.newEditor"
269+ contextId="org.eclipse.ui.contexts.window"
270+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
271+ sequence="M1+X 2">
272+ </key>
273+ <key
274+ commandId="org.eclipse.ui.edit.findReplace"
275+ contextId="org.eclipse.ui.contexts.window"
276+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
277+ sequence="M3+M2+5">
278+ </key>
279+ <key
280+ commandId="org.eclipse.ui.edit.text.goto.lineStart"
281+ contextId="org.eclipse.ui.textEditorScope"
282+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
283+ sequence="M3+M">
284+ </key>
285+ <key
286+ commandId="jp.sourceforge.moreemacs.NewLine"
287+ contextId="org.eclipse.ui.textEditorScope"
288+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
289+ sequence="M1+M">
290+ </key>
291+ <key
292+ contextId="org.eclipse.ui.textEditorScope"
293+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
294+ sequence="M1+J">
295+ </key>
296+ <key
297+ commandId="jp.sourceforge.moreemacs.MoveBeginningOfLine"
298+ contextId="org.eclipse.ui.textEditorScope"
299+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
300+ sequence="M1+A">
301+ </key>
302+ <key
303+ commandId="jp.sourceforge.moreemacs.MoveEndOfLine"
304+ contextId="org.eclipse.ui.textEditorScope"
305+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
306+ sequence="M1+E">
307+ </key>
308+ <key
309+ commandId="jp.sourceforge.moreemacs.ForwardWord"
310+ contextId="org.eclipse.ui.textEditorScope"
311+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
312+ sequence="M3+F">
313+ </key>
314+ <key
315+ commandId="jp.sourceforge.moreemacs.BackwardWord"
316+ contextId="org.eclipse.ui.textEditorScope"
317+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
318+ sequence="M3+B">
319+ </key>
320+ <key
321+ commandId="jp.sourceforge.moreemacs.KillWord"
322+ contextId="org.eclipse.ui.textEditorScope"
323+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
324+ sequence="M3+D">
325+ </key>
326+ <key
327+ commandId="jp.sourceforge.moreemacs.BackwardKillWord"
328+ contextId="org.eclipse.ui.textEditorScope"
329+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
330+ sequence="M3+Backspace">
331+ </key>
332+ <key
333+ commandId="jp.sourceforge.moreemacs.DeleteHorizontalSpace"
334+ contextId="org.eclipse.ui.textEditorScope"
335+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
336+ sequence="M3+\">
337+ </key>
338+ <key
339+ commandId="jp.sourceforge.moreemacs.KillLine"
340+ contextId="org.eclipse.ui.textEditorScope"
341+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
342+ sequence="M1+K">
343+ </key>
344+ <key
345+ commandId="jp.sourceforge.moreemacs.OpenLine"
346+ contextId="org.eclipse.ui.textEditorScope"
347+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
348+ sequence="M1+O">
349+ </key>
350+ <key
351+ commandId="jp.sourceforge.moreemacs.TransposeChars"
352+ contextId="org.eclipse.ui.textEditorScope"
353+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
354+ sequence="M1+T">
355+ </key>
356+ <key
357+ commandId="jp.sourceforge.moreemacs.TransposeWords"
358+ contextId="org.eclipse.ui.textEditorScope"
359+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
360+ sequence="M3+T">
361+ </key>
362+ <key
363+ commandId="jp.sourceforge.moreemacs.KillRectangle"
364+ contextId="org.eclipse.ui.textEditorScope"
365+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
366+ sequence="M1+X R K">
367+ </key>
368+ <key
369+ commandId="jp.sourceforge.moreemacs.YankRectangle"
370+ contextId="org.eclipse.ui.textEditorScope"
371+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
372+ sequence="M1+X R Y">
373+ </key>
374+ <key
375+ commandId="jp.sourceforge.moreemacs.UpcaseWord"
376+ contextId="org.eclipse.ui.textEditorScope"
377+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
378+ sequence="M3+U">
379+ </key>
380+ <key
381+ commandId="jp.sourceforge.moreemacs.DowncaseWord"
382+ contextId="org.eclipse.ui.textEditorScope"
383+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
384+ sequence="M3+L">
385+ </key>
386+ <key
387+ commandId="jp.sourceforge.moreemacs.CapitalizeWord"
388+ contextId="org.eclipse.ui.textEditorScope"
389+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
390+ sequence="M3+C">
391+ </key>
392+ <key
393+ commandId="jp.sourceforge.moreemacs.CommentRegion"
394+ contextId="org.eclipse.ui.textEditorScope"
395+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
396+ sequence="M1+C M1+C">
397+ </key>
398+ <key
399+ commandId="jp.sourceforge.moreemacs.CommentRegion"
400+ contextId="org.eclipse.ui.textEditorScope"
401+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
402+ sequence="M1+U M1+C M1+C">
403+ </key>
404+
405+
406+ <!-- emacs key bindings org.eclipse.ui.workbench.texteditor_3.8.100.v20120619-083720/plugin.xml -->
407+ <key
408+ commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
409+ contextId="org.eclipse.ui.textEditorScope"
410+ sequence="ALT+0 CTRL+K"
411+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
412+ <key
413+ commandId="org.eclipse.ui.edit.text.cut.line.to.beginning"
414+ contextId="org.eclipse.ui.textEditorScope"
415+ sequence="ESC 0 CTRL+K"
416+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
417+ <!-- <key -->
418+ <!-- commandId="org.eclipse.ui.edit.text.cut.line.to.end" -->
419+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
420+ <!-- sequence="CTRL+K" -->
421+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
422+ <key
423+ commandId="org.eclipse.ui.edit.text.set.mark"
424+ contextId="org.eclipse.ui.textEditorScope"
425+ sequence="CTRL+SPACE"
426+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
427+ <key
428+ commandId="org.eclipse.ui.edit.text.set.mark"
429+ contextId="org.eclipse.ui.textEditorScope"
430+ sequence="CTRL+2"
431+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
432+ <key
433+ commandId="org.eclipse.ui.edit.text.clear.mark"
434+ contextId="org.eclipse.ui.textEditorScope"
435+ sequence="CTRL+G"
436+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
437+ <key
438+ commandId="org.eclipse.ui.edit.text.swap.mark"
439+ contextId="org.eclipse.ui.textEditorScope"
440+ sequence="CTRL+X CTRL+X"
441+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
442+ <key
443+ commandId="org.eclipse.ui.edit.findIncremental"
444+ contextId="org.eclipse.ui.textEditorScope"
445+ sequence="CTRL+S"
446+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
447+ <key
448+ commandId="org.eclipse.ui.edit.findIncrementalReverse"
449+ contextId="org.eclipse.ui.textEditorScope"
450+ sequence="CTRL+R"
451+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
452+ <key
453+ commandId="org.eclipse.ui.edit.text.goto.lineUp"
454+ contextId="org.eclipse.ui.textEditorScope"
455+ sequence="CTRL+P"
456+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
457+ <key
458+ commandId="org.eclipse.ui.edit.text.goto.lineDown"
459+ contextId="org.eclipse.ui.textEditorScope"
460+ sequence="CTRL+N"
461+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
462+ <!-- <key -->
463+ <!-- commandId="org.eclipse.ui.edit.text.goto.lineStart" -->
464+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
465+ <!-- sequence="CTRL+A" -->
466+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
467+ <!-- <key -->
468+ <!-- commandId="org.eclipse.ui.edit.text.goto.lineEnd" -->
469+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
470+ <!-- sequence="CTRL+E" -->
471+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
472+ <key
473+ commandId="org.eclipse.ui.edit.text.goto.line"
474+ contextId="org.eclipse.ui.textEditorScope"
475+ sequence="CTRL+X G"
476+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
477+ <key
478+ commandId="org.eclipse.ui.edit.text.goto.columnPrevious"
479+ contextId="org.eclipse.ui.textEditorScope"
480+ sequence="CTRL+B"
481+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
482+ <key
483+ commandId="org.eclipse.ui.edit.text.goto.columnNext"
484+ contextId="org.eclipse.ui.textEditorScope"
485+ sequence="CTRL+F"
486+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
487+ <key
488+ commandId="org.eclipse.ui.edit.text.goto.pageUp"
489+ contextId="org.eclipse.ui.textEditorScope"
490+ sequence="ALT+V"
491+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
492+ <key
493+ commandId="org.eclipse.ui.edit.text.goto.pageUp"
494+ contextId="org.eclipse.ui.textEditorScope"
495+ sequence="ESC V"
496+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
497+ <key
498+ commandId="org.eclipse.ui.edit.text.goto.pageDown"
499+ contextId="org.eclipse.ui.textEditorScope"
500+ sequence="CTRL+V"
501+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
502+ <!-- <key -->
503+ <!-- commandId="org.eclipse.ui.edit.text.goto.wordPrevious" -->
504+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
505+ <!-- sequence="ALT+B" -->
506+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
507+ <key
508+ commandId="org.eclipse.ui.edit.text.goto.wordPrevious"
509+ contextId="org.eclipse.ui.textEditorScope"
510+ sequence="ESC B"
511+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
512+ <!-- <key -->
513+ <!-- commandId="org.eclipse.ui.edit.text.goto.wordNext" -->
514+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
515+ <!-- sequence="ALT+F" -->
516+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
517+ <!-- <key -->
518+ <!-- commandId="org.eclipse.ui.edit.text.goto.wordNext" -->
519+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
520+ <!-- sequence="ESC F" -->
521+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
522+ <key
523+ commandId="org.eclipse.ui.edit.text.goto.textStart"
524+ contextId="org.eclipse.ui.textEditorScope"
525+ sequence="ALT+&lt;"
526+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
527+ <key
528+ commandId="org.eclipse.ui.edit.text.goto.textStart"
529+ contextId="org.eclipse.ui.textEditorScope"
530+ sequence="ALT+SHIFT+&lt;"
531+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
532+ <key
533+ commandId="org.eclipse.ui.edit.text.goto.textStart"
534+ contextId="org.eclipse.ui.textEditorScope"
535+ sequence="ESC &lt;"
536+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
537+ <key
538+ commandId="org.eclipse.ui.edit.text.goto.textStart"
539+ contextId="org.eclipse.ui.textEditorScope"
540+ sequence="ESC SHIFT+&lt;"
541+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
542+ <key
543+ commandId="org.eclipse.ui.edit.text.goto.textStart"
544+ contextId="org.eclipse.ui.textEditorScope"
545+ sequence="CTRL+X ["
546+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
547+ <key
548+ commandId="org.eclipse.ui.edit.text.goto.textEnd"
549+ contextId="org.eclipse.ui.textEditorScope"
550+ sequence="ALT+&gt;"
551+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
552+ <key
553+ commandId="org.eclipse.ui.edit.text.goto.textEnd"
554+ contextId="org.eclipse.ui.textEditorScope"
555+ sequence="ALT+SHIFT+&gt;"
556+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
557+ <key
558+ commandId="org.eclipse.ui.edit.text.goto.textEnd"
559+ contextId="org.eclipse.ui.textEditorScope"
560+ sequence="ESC &gt;"
561+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
562+ <key
563+ commandId="org.eclipse.ui.edit.text.goto.textEnd"
564+ contextId="org.eclipse.ui.textEditorScope"
565+ sequence="ESC SHIFT+&gt;"
566+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
567+ <key
568+ commandId="org.eclipse.ui.edit.text.goto.textEnd"
569+ contextId="org.eclipse.ui.textEditorScope"
570+ sequence="CTRL+X ]"
571+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
572+ <key
573+ commandId="org.eclipse.ui.edit.text.scroll.lineUp"
574+ contextId="org.eclipse.ui.textEditorScope"
575+ sequence="ALT+Z"
576+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
577+ <key
578+ commandId="org.eclipse.ui.edit.text.scroll.lineUp"
579+ contextId="org.eclipse.ui.textEditorScope"
580+ sequence="ESC Z"
581+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
582+ <key
583+ commandId="org.eclipse.ui.edit.text.scroll.lineDown"
584+ contextId="org.eclipse.ui.textEditorScope"
585+ sequence="CTRL+Z"
586+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
587+ <key
588+ commandId="org.eclipse.ui.edit.text.deleteNext"
589+ contextId="org.eclipse.ui.textEditorScope"
590+ sequence="CTRL+D"
591+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
592+ <!-- <key -->
593+ <!-- commandId="org.eclipse.ui.edit.text.deletePreviousWord" -->
594+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
595+ <!-- sequence="M3+BS" -->
596+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
597+ <key
598+ platform="carbon"
599+ commandId=""
600+ contextId="org.eclipse.ui.textEditorScope"
601+ sequence="M3+BS"
602+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
603+ <!-- <key -->
604+ <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
605+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
606+ <!-- sequence="M3+DEL" -->
607+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
608+ <key
609+ platform="carbon"
610+ commandId=""
611+ contextId="org.eclipse.ui.textEditorScope"
612+ sequence="M3+DEL"
613+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
614+ <!-- <key -->
615+ <!-- commandId="org.eclipse.ui.edit.text.deletePreviousWord" -->
616+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
617+ <!-- sequence="ESC BS" -->
618+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
619+ <!-- <key -->
620+ <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
621+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
622+ <!-- sequence="M3+D" -->
623+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
624+ <!-- <key -->
625+ <!-- commandId="org.eclipse.ui.edit.text.deleteNextWord" -->
626+ <!-- contextId="org.eclipse.ui.textEditorScope" -->
627+ <!-- sequence="ESC D" -->
628+ <!-- schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/> -->
629+ <key
630+ commandId="org.eclipse.ui.edit.text.recenter"
631+ contextId="org.eclipse.ui.textEditorScope"
632+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"
633+ sequence="CTRL+L"/>
634+
635+ <!-- org.eclipse.ui_3.103.0.v20120521-2329/plugin.xml -->
636+ <key
637+ commandId="org.eclipse.ui.file.close"
638+ sequence="CTRL+X K"
639+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
640+ <key
641+ commandId="org.eclipse.ui.file.closeAll"
642+ sequence="CTRL+X CTRL+C"
643+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
644+ <key
645+ commandId="org.eclipse.ui.file.save"
646+ sequence="CTRL+X CTRL+S"
647+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
648+ <key
649+ commandId="org.eclipse.ui.file.saveAll"
650+ sequence="CTRL+X S"
651+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
652+ <key
653+ commandId="org.eclipse.ui.file.print"
654+ sequence="M3+F9"
655+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
656+ <key
657+ commandId="org.eclipse.ui.file.print"
658+ sequence="ESC F9"
659+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
660+ <key
661+ commandId="org.eclipse.ui.edit.undo"
662+ sequence="F9"
663+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
664+ <key
665+ commandId="org.eclipse.ui.edit.undo"
666+ sequence="CTRL+X U"
667+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
668+ <key
669+ commandId="org.eclipse.ui.edit.undo"
670+ sequence="CTRL+M2+-"
671+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
672+ <key
673+ commandId="org.eclipse.ui.edit.redo"
674+ sequence="F10"
675+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
676+ <key
677+ commandId="org.eclipse.ui.edit.redo"
678+ sequence="CTRL+X R"
679+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
680+ <key
681+ commandId="org.eclipse.ui.edit.redo"
682+ sequence="CTRL+M2++"
683+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
684+ <key
685+ commandId="org.eclipse.ui.edit.cut"
686+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
687+ sequence="CTRL+W"
688+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
689+ <key
690+ commandId="org.eclipse.ui.edit.copy"
691+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
692+ sequence="M3+W"
693+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
694+ <key
695+ commandId="org.eclipse.ui.edit.copy"
696+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
697+ sequence="ESC W"
698+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
699+ <key
700+ commandId="org.eclipse.ui.edit.paste"
701+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
702+ sequence="CTRL+Y"
703+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
704+ <key
705+ commandId="org.eclipse.ui.edit.paste"
706+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
707+ sequence="CTRL+Y"
708+ platform="gtk"
709+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
710+ <key
711+ commandId="org.eclipse.ui.edit.selectAll"
712+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
713+ sequence="CTRL+X H"
714+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
715+ <key
716+ commandId="org.eclipse.ui.edit.findReplace"
717+ sequence="M3+R"
718+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
719+ <key
720+ commandId="org.eclipse.ui.edit.findReplace"
721+ sequence="ESC R"
722+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
723+ <key
724+ commandId="org.eclipse.ui.edit.text.contentAssist.proposals"
725+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
726+ sequence="ALT+/"
727+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
728+ <key
729+ commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
730+ sequence="ALT+?"
731+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
732+ <key
733+ commandId="org.eclipse.ui.edit.text.contentAssist.contextInformation"
734+ sequence="ALT+SHIFT+?"
735+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration"/>
736+ <key
737+ commandId="org.eclipse.ui.window.openEditorDropDown"
738+ sequence="CTRL+X B"
739+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
740+ <key
741+ commandId="org.eclipse.ui.window.switchToEditor"
742+ sequence="CTRL+X CTRL+B"
743+ schemeId="jp.sourceforge.moreemacs.moreEmacsAcceleratorConfiguration" />
744+
745+ </extension>
746+
747+</plugin>
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/MoreEmacs.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/MoreEmacs.java
@@ -1,50 +1,50 @@
1-package jp.sourceforge.moreemacs;
2-
3-import org.eclipse.ui.plugin.AbstractUIPlugin;
4-import org.osgi.framework.BundleContext;
5-
6-/**
7- * The activator class controls the plug-in life cycle
8- */
9-public class MoreEmacs extends AbstractUIPlugin {
10-
11- // The plug-in ID
12- public static final String PLUGIN_ID = "jp.sourceforge.moreemacs";
13-
14- // The shared instance
15- private static MoreEmacs plugin;
16-
17- /**
18- * The constructor
19- */
20- public MoreEmacs() {
21- }
22-
23- /*
24- * (non-Javadoc)
25- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
26- */
27- public void start(BundleContext context) throws Exception {
28- super.start(context);
29- plugin = this;
30- }
31-
32- /*
33- * (non-Javadoc)
34- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
35- */
36- public void stop(BundleContext context) throws Exception {
37- plugin = null;
38- super.stop(context);
39- }
40-
41- /**
42- * Returns the shared instance
43- *
44- * @return the shared instance
45- */
46- public static MoreEmacs getDefault() {
47- return plugin;
48- }
49-
50-}
1+package jp.sourceforge.moreemacs;
2+
3+import org.eclipse.ui.plugin.AbstractUIPlugin;
4+import org.osgi.framework.BundleContext;
5+
6+/**
7+ * The activator class controls the plug-in life cycle
8+ */
9+public class MoreEmacs extends AbstractUIPlugin {
10+
11+ // The plug-in ID
12+ public static final String PLUGIN_ID = "jp.sourceforge.moreemacs";
13+
14+ // The shared instance
15+ private static MoreEmacs plugin;
16+
17+ /**
18+ * The constructor
19+ */
20+ public MoreEmacs() {
21+ }
22+
23+ /*
24+ * (non-Javadoc)
25+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
26+ */
27+ public void start(BundleContext context) throws Exception {
28+ super.start(context);
29+ plugin = this;
30+ }
31+
32+ /*
33+ * (non-Javadoc)
34+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
35+ */
36+ public void stop(BundleContext context) throws Exception {
37+ plugin = null;
38+ super.stop(context);
39+ }
40+
41+ /**
42+ * Returns the shared instance
43+ *
44+ * @return the shared instance
45+ */
46+ public static MoreEmacs getDefault() {
47+ return plugin;
48+ }
49+
50+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/BackwardKillWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/BackwardKillWordExecution.java
@@ -1,25 +1,25 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.swt.dnd.Clipboard;
5-import org.eclipse.swt.dnd.TextTransfer;
6-import org.eclipse.swt.dnd.Transfer;
7-
8-public final class BackwardKillWordExecution extends TextEditorExecution {
9-
10- @Override
11- public void execute()throws BadLocationException {
12- if(!textEditor.isEditable()) {
13- return;
14- }
15-
16- int current = cursor.offset();
17- int previous = BackwardWordExecution.getPreviousWordPosition(doc, current);
18- String word = doc.get(previous, current - previous);
19- Clipboard c = new Clipboard(window.getShell().getDisplay());
20- c.setContents(new String[] { word },
21- new Transfer[] { TextTransfer.getInstance() });
22- doc.replace(previous, current - previous, "");
23-
24- }
25-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.swt.dnd.Clipboard;
5+import org.eclipse.swt.dnd.TextTransfer;
6+import org.eclipse.swt.dnd.Transfer;
7+
8+public final class BackwardKillWordExecution extends TextEditorExecution {
9+
10+ @Override
11+ public void execute()throws BadLocationException {
12+ if(!textEditor.isEditable()) {
13+ return;
14+ }
15+
16+ int current = cursor.offset();
17+ int previous = BackwardWordExecution.getPreviousWordPosition(doc, current);
18+ String word = doc.get(previous, current - previous);
19+ Clipboard c = new Clipboard(window.getShell().getDisplay());
20+ c.setContents(new String[] { word },
21+ new Transfer[] { TextTransfer.getInstance() });
22+ doc.replace(previous, current - previous, "");
23+
24+ }
25+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/BackwardWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/BackwardWordExecution.java
@@ -1,34 +1,34 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.CodePointIterator;
4-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5-
6-import org.eclipse.jface.text.BadLocationException;
7-import org.eclipse.jface.text.IDocument;
8-
9-public final class BackwardWordExecution extends TextEditorExecution {
10- @Override
11- public void execute() throws BadLocationException {
12- int current = cursor.offset();
13- cursor.move(getPreviousWordPosition(doc, current));
14- }
15-
16- public static int getPreviousWordPosition(IDocument doc, int offset) throws BadLocationException {
17- CharSequence seq = new DocumentCharSequence(doc, 0, offset);
18- CodePointIterator itr = new CodePointIterator(seq, seq.length());
19-
20- for(; itr.hasPrevious(); ) {
21- if (Character.isLetterOrDigit(itr.previous())) {
22- itr.next();
23- break;
24- }
25- }
26- for(; itr.hasPrevious(); ) {
27- if (!Character.isLetterOrDigit(itr.previous())) {
28- itr.next();
29- break;
30- }
31- }
32- return itr.index();
33- }
34-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.CodePointIterator;
4+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5+
6+import org.eclipse.jface.text.BadLocationException;
7+import org.eclipse.jface.text.IDocument;
8+
9+public final class BackwardWordExecution extends TextEditorExecution {
10+ @Override
11+ public void execute() throws BadLocationException {
12+ int current = cursor.offset();
13+ cursor.move(getPreviousWordPosition(doc, current));
14+ }
15+
16+ public static int getPreviousWordPosition(IDocument doc, int offset) throws BadLocationException {
17+ CharSequence seq = new DocumentCharSequence(doc, 0, offset);
18+ CodePointIterator itr = new CodePointIterator(seq, seq.length());
19+
20+ for(; itr.hasPrevious(); ) {
21+ if (Character.isLetterOrDigit(itr.previous())) {
22+ itr.next();
23+ break;
24+ }
25+ }
26+ for(; itr.hasPrevious(); ) {
27+ if (!Character.isLetterOrDigit(itr.previous())) {
28+ itr.next();
29+ break;
30+ }
31+ }
32+ return itr.index();
33+ }
34+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CapitalizeWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CapitalizeWordExecution.java
@@ -1,27 +1,27 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.CodePointIterator;
4-
5-
6-public final class CapitalizeWordExecution extends ConvertWordExecution {
7- @Override
8- protected String convert(String word) {
9- StringBuilder builder = new StringBuilder();
10- for(CodePointIterator itr = new CodePointIterator(word); itr.hasNext(); ) {
11- int cp = itr.next();
12-
13- if(!Character.isLetter(cp)) {
14- builder.appendCodePoint(cp);
15- continue;
16- }
17-
18- builder.appendCodePoint(Character.toUpperCase(cp));
19- if(itr.hasNext()) {
20- builder.append(word.substring(itr.index()).toLowerCase());
21- }
22- break;
23- }
24- return builder.toString();
25- }
26-}
27-
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.CodePointIterator;
4+
5+
6+public final class CapitalizeWordExecution extends ConvertWordExecution {
7+ @Override
8+ protected String convert(String word) {
9+ StringBuilder builder = new StringBuilder();
10+ for(CodePointIterator itr = new CodePointIterator(word); itr.hasNext(); ) {
11+ int cp = itr.next();
12+
13+ if(!Character.isLetter(cp)) {
14+ builder.appendCodePoint(cp);
15+ continue;
16+ }
17+
18+ builder.appendCodePoint(Character.toUpperCase(cp));
19+ if(itr.hasNext()) {
20+ builder.append(word.substring(itr.index()).toLowerCase());
21+ }
22+ break;
23+ }
24+ return builder.toString();
25+ }
26+}
27+
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CommandHandler.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CommandHandler.java
@@ -1,68 +1,68 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import java.util.regex.Pattern;
4-
5-import jp.sourceforge.moreemacs.MoreEmacs;
6-
7-import org.eclipse.core.commands.AbstractHandler;
8-import org.eclipse.core.commands.Command;
9-import org.eclipse.core.commands.ExecutionEvent;
10-import org.eclipse.core.commands.ExecutionException;
11-import org.eclipse.ui.IWorkbenchWindow;
12-import org.eclipse.ui.handlers.HandlerUtil;
13-
14-public final class CommandHandler extends AbstractHandler {
15-
16- @Override
17- public Object execute(ExecutionEvent event) throws ExecutionException {
18- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
19-
20- Execution exe = newExecution(event);
21- if(!exe.init(window)) {
22- return null;
23- }
24- try {
25- exe.execute();
26- } catch (Exception e) {
27- throw new ExecutionException(e.getMessage(), e);
28- }
29-
30- return null;
31- }
32-
33- private Execution newExecution(ExecutionEvent event) throws ExecutionException {
34- try {
35- String className = getExecutionClassName(event);
36- Class<?> clazz = Class.forName(className);
37- Object obj = clazz.newInstance();
38- if(!(obj instanceof Execution)) {
39- throw new ExecutionException("the class "+clazz.getName()+
40- " does not implements Execution.");
41- }
42- return (Execution)obj;
43- } catch (ClassNotFoundException e) {
44- throw new ExecutionException(e.getMessage(), e);
45- } catch (InstantiationException e) {
46- throw new ExecutionException(e.getMessage(), e);
47- } catch (IllegalAccessException e) {
48- throw new ExecutionException(e.getMessage(), e);
49- }
50-
51- }
52-
53- // naming strategy will be separated to another class.
54- private static final String COMMAND_PREFIX_QUOTED = Pattern.quote(
55- MoreEmacs.class.getPackage().getName());
56- private static final String HANDLER_PREFIX = CommandHandler.class.getPackage().getName();
57- private static final String HANDLER_SUFFIX = "Execution";
58- private static String getExecutionClassName(ExecutionEvent event) {
59- Command command = event.getCommand();
60- String className = command.getId()
61- .replaceFirst(COMMAND_PREFIX_QUOTED, HANDLER_PREFIX)
62- +HANDLER_SUFFIX;
63-
64-
65- return className;
66- }
67-
68-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import java.util.regex.Pattern;
4+
5+import jp.sourceforge.moreemacs.MoreEmacs;
6+
7+import org.eclipse.core.commands.AbstractHandler;
8+import org.eclipse.core.commands.Command;
9+import org.eclipse.core.commands.ExecutionEvent;
10+import org.eclipse.core.commands.ExecutionException;
11+import org.eclipse.ui.IWorkbenchWindow;
12+import org.eclipse.ui.handlers.HandlerUtil;
13+
14+public final class CommandHandler extends AbstractHandler {
15+
16+ @Override
17+ public Object execute(ExecutionEvent event) throws ExecutionException {
18+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
19+
20+ Execution exe = newExecution(event);
21+ if(!exe.init(window)) {
22+ return null;
23+ }
24+ try {
25+ exe.execute();
26+ } catch (Exception e) {
27+ throw new ExecutionException(e.getMessage(), e);
28+ }
29+
30+ return null;
31+ }
32+
33+ private Execution newExecution(ExecutionEvent event) throws ExecutionException {
34+ try {
35+ String className = getExecutionClassName(event);
36+ Class<?> clazz = Class.forName(className);
37+ Object obj = clazz.newInstance();
38+ if(!(obj instanceof Execution)) {
39+ throw new ExecutionException("the class "+clazz.getName()+
40+ " does not implements Execution.");
41+ }
42+ return (Execution)obj;
43+ } catch (ClassNotFoundException e) {
44+ throw new ExecutionException(e.getMessage(), e);
45+ } catch (InstantiationException e) {
46+ throw new ExecutionException(e.getMessage(), e);
47+ } catch (IllegalAccessException e) {
48+ throw new ExecutionException(e.getMessage(), e);
49+ }
50+
51+ }
52+
53+ // naming strategy will be separated to another class.
54+ private static final String COMMAND_PREFIX_QUOTED = Pattern.quote(
55+ MoreEmacs.class.getPackage().getName());
56+ private static final String HANDLER_PREFIX = CommandHandler.class.getPackage().getName();
57+ private static final String HANDLER_SUFFIX = "Execution";
58+ private static String getExecutionClassName(ExecutionEvent event) {
59+ Command command = event.getCommand();
60+ String className = command.getId()
61+ .replaceFirst(COMMAND_PREFIX_QUOTED, HANDLER_PREFIX)
62+ +HANDLER_SUFFIX;
63+
64+
65+ return className;
66+ }
67+
68+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CommentRegionExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/CommentRegionExecution.java
@@ -1,41 +1,41 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.core.commands.Command;
4-import org.eclipse.jface.text.ITextSelection;
5-import org.eclipse.ui.commands.ICommandService;
6-import org.eclipse.ui.handlers.IHandlerService;
7-
8-
9-public final class CommentRegionExecution extends TextEditorExecution {
10- @Override
11- public void execute() throws Exception {
12- Command command = getEnabledToggleCommentCommand();
13- if(command == null) {
14- return;
15- }
16- // if the selection is empty, the marked region will be new selection.
17- getSelection(true);
18-
19- IHandlerService handlerService =
20- (IHandlerService)textEditor.getSite().getService(IHandlerService.class);
21- handlerService.executeCommand(command.getId(), null);
22-
23- ITextSelection selection = getSelection(false);
24- textViewer.setSelectedRange(selection.getOffset()+selection.getLength(), 0);
25- }
26-
27- private Command getEnabledToggleCommentCommand() {
28- ICommandService commandService =
29- (ICommandService)textEditor.getSite().getService(ICommandService.class);
30- for(Command command: commandService.getDefinedCommands()) {
31- if(isEnabledToggleCommentCommand(command)) {
32- return command;
33- }
34- }
35- return null;
36- }
37-
38- private boolean isEnabledToggleCommentCommand(Command command) {
39- return command.isEnabled() && command.getId().endsWith(".toggle.comment");
40- }
41-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.core.commands.Command;
4+import org.eclipse.jface.text.ITextSelection;
5+import org.eclipse.ui.commands.ICommandService;
6+import org.eclipse.ui.handlers.IHandlerService;
7+
8+
9+public final class CommentRegionExecution extends TextEditorExecution {
10+ @Override
11+ public void execute() throws Exception {
12+ Command command = getEnabledToggleCommentCommand();
13+ if(command == null) {
14+ return;
15+ }
16+ // if the selection is empty, the marked region will be new selection.
17+ getSelection(true);
18+
19+ IHandlerService handlerService =
20+ (IHandlerService)textEditor.getSite().getService(IHandlerService.class);
21+ handlerService.executeCommand(command.getId(), null);
22+
23+ ITextSelection selection = getSelection(false);
24+ textViewer.setSelectedRange(selection.getOffset()+selection.getLength(), 0);
25+ }
26+
27+ private Command getEnabledToggleCommentCommand() {
28+ ICommandService commandService =
29+ (ICommandService)textEditor.getSite().getService(ICommandService.class);
30+ for(Command command: commandService.getDefinedCommands()) {
31+ if(isEnabledToggleCommentCommand(command)) {
32+ return command;
33+ }
34+ }
35+ return null;
36+ }
37+
38+ private boolean isEnabledToggleCommentCommand(Command command) {
39+ return command.isEnabled() && command.getId().endsWith(".toggle.comment");
40+ }
41+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/ConvertWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/ConvertWordExecution.java
@@ -1,22 +1,22 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-
5-public abstract class ConvertWordExecution extends TextEditorExecution {
6-
7- @Override
8- public void execute() throws BadLocationException {
9- if(!textEditor.isEditable()) {
10- return;
11- }
12-
13- int current = cursor.offset();
14- int next = ForwardWordExecution.getNextWordPosition(doc, current);
15- String word = doc.get(current, next-current);
16- String convertedWord = convert(word);
17- doc.replace(current, next-current, convertedWord);
18- cursor.move(current + convertedWord.length());
19- }
20-
21- protected abstract String convert(String word);
22-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+
5+public abstract class ConvertWordExecution extends TextEditorExecution {
6+
7+ @Override
8+ public void execute() throws BadLocationException {
9+ if(!textEditor.isEditable()) {
10+ return;
11+ }
12+
13+ int current = cursor.offset();
14+ int next = ForwardWordExecution.getNextWordPosition(doc, current);
15+ String word = doc.get(current, next-current);
16+ String convertedWord = convert(word);
17+ doc.replace(current, next-current, convertedWord);
18+ cursor.move(current + convertedWord.length());
19+ }
20+
21+ protected abstract String convert(String word);
22+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/Cursor.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/Cursor.java
@@ -1,53 +1,53 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.ITextSelection;
4-import org.eclipse.jface.text.ITextViewer;
5-import org.eclipse.jface.text.ITextViewerExtension5;
6-import org.eclipse.swt.custom.StyledText;
7-import org.eclipse.ui.texteditor.ITextEditor;
8-
9-final class Cursor {
10- private final ITextEditor textEditor;
11- private final ITextViewerExtension5 textViewerEx5;
12- private final StyledText styledText;
13- private final ITextViewer textViewer;
14-
15- Cursor(ITextEditor textEditor, ITextViewer textViewer) {
16- this.textEditor = textEditor;
17- this.textViewer = textViewer;
18- this.styledText = textViewer.getTextWidget();
19- this.textViewerEx5 = (textViewer instanceof ITextViewerExtension5)
20- ? (ITextViewerExtension5) textViewer: null;
21- }
22-
23- int offset() {
24- if(textViewerEx5 != null) {
25- return textViewerEx5.widgetOffset2ModelOffset(
26- styledText.getCaretOffset());
27- }
28-
29- ITextSelection selectoin =
30- (ITextSelection) textEditor.getSelectionProvider().getSelection();
31- int selectionBegin = selectoin.getOffset();
32- return selectionBegin;
33- }
34-
35- void move(int offset) {
36- textViewer.setSelectedRange(offset, 0);
37- textViewer.revealRange(offset, 0);
38-
39-// workaround for ISourceViewer
40-// sourceViewer.setRangeIndication(offset, 0, true);
41-
42-// workaround for ITextViewerExtension5
43-// if(textViewerEx5 != null) {
44-// styledText.setCaretOffset(textViewerEx5.modelOffset2WidgetOffset(offset));
45-//
46-// return;
47-// }
48-
49-// workaround for ITextEditor
50-// textEditor.resetHighlightRange();
51-// textEditor.setHighlightRange(offset, 0, true);
52- }
53-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.ITextSelection;
4+import org.eclipse.jface.text.ITextViewer;
5+import org.eclipse.jface.text.ITextViewerExtension5;
6+import org.eclipse.swt.custom.StyledText;
7+import org.eclipse.ui.texteditor.ITextEditor;
8+
9+final class Cursor {
10+ private final ITextEditor textEditor;
11+ private final ITextViewerExtension5 textViewerEx5;
12+ private final StyledText styledText;
13+ private final ITextViewer textViewer;
14+
15+ Cursor(ITextEditor textEditor, ITextViewer textViewer) {
16+ this.textEditor = textEditor;
17+ this.textViewer = textViewer;
18+ this.styledText = textViewer.getTextWidget();
19+ this.textViewerEx5 = (textViewer instanceof ITextViewerExtension5)
20+ ? (ITextViewerExtension5) textViewer: null;
21+ }
22+
23+ int offset() {
24+ if(textViewerEx5 != null) {
25+ return textViewerEx5.widgetOffset2ModelOffset(
26+ styledText.getCaretOffset());
27+ }
28+
29+ ITextSelection selectoin =
30+ (ITextSelection) textEditor.getSelectionProvider().getSelection();
31+ int selectionBegin = selectoin.getOffset();
32+ return selectionBegin;
33+ }
34+
35+ void move(int offset) {
36+ textViewer.setSelectedRange(offset, 0);
37+ textViewer.revealRange(offset, 0);
38+
39+// workaround for ISourceViewer
40+// sourceViewer.setRangeIndication(offset, 0, true);
41+
42+// workaround for ITextViewerExtension5
43+// if(textViewerEx5 != null) {
44+// styledText.setCaretOffset(textViewerEx5.modelOffset2WidgetOffset(offset));
45+//
46+// return;
47+// }
48+
49+// workaround for ITextEditor
50+// textEditor.resetHighlightRange();
51+// textEditor.setHighlightRange(offset, 0, true);
52+ }
53+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/DeleteHorizontalSpaceExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/DeleteHorizontalSpaceExecution.java
@@ -1,55 +1,55 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.CodePointIterator;
4-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5-
6-import org.eclipse.jface.text.BadLocationException;
7-import org.eclipse.jface.text.IDocument;
8-import org.eclipse.jface.text.IRegion;
9-
10-public final class DeleteHorizontalSpaceExecution extends TextEditorExecution {
11-
12- @Override
13- public void execute() throws BadLocationException {
14- if(!textEditor.isEditable()) {
15- return;
16- }
17-
18- int current = cursor.offset();
19- int start = skipBackwardSpaces(doc, current);
20- int end = skipForwardSpaces(doc, current);
21- doc.replace(start, end - start, "");
22- }
23-
24- int skipBackwardSpaces(IDocument doc, int offset) throws BadLocationException {
25- IRegion line = doc.getLineInformationOfOffset(offset);
26-
27- CharSequence seq = new DocumentCharSequence(doc,
28- line.getOffset(), offset-line.getOffset());
29-
30- int result = offset;
31- for(CodePointIterator itr = new CodePointIterator(seq, seq.length()); itr.hasPrevious(); ) {
32- int codePoint = itr.previous();
33- if (!Character.isWhitespace(codePoint)) {
34- break;
35- }
36- result = line.getOffset() + itr.index();
37- }
38- return result;
39- }
40-
41- int skipForwardSpaces(IDocument doc, int offset) throws BadLocationException {
42- IRegion line = doc.getLineInformationOfOffset(offset);
43- CharSequence seq = new DocumentCharSequence(doc,
44- offset,line.getOffset()+line.getLength()-offset);
45- int result = offset;
46- for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
47- int codePoint = itr.next();
48- if (!Character.isWhitespace(codePoint)) {
49- break;
50- }
51- result = offset + itr.index();
52- }
53- return result;
54- }
55-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.CodePointIterator;
4+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5+
6+import org.eclipse.jface.text.BadLocationException;
7+import org.eclipse.jface.text.IDocument;
8+import org.eclipse.jface.text.IRegion;
9+
10+public final class DeleteHorizontalSpaceExecution extends TextEditorExecution {
11+
12+ @Override
13+ public void execute() throws BadLocationException {
14+ if(!textEditor.isEditable()) {
15+ return;
16+ }
17+
18+ int current = cursor.offset();
19+ int start = skipBackwardSpaces(doc, current);
20+ int end = skipForwardSpaces(doc, current);
21+ doc.replace(start, end - start, "");
22+ }
23+
24+ int skipBackwardSpaces(IDocument doc, int offset) throws BadLocationException {
25+ IRegion line = doc.getLineInformationOfOffset(offset);
26+
27+ CharSequence seq = new DocumentCharSequence(doc,
28+ line.getOffset(), offset-line.getOffset());
29+
30+ int result = offset;
31+ for(CodePointIterator itr = new CodePointIterator(seq, seq.length()); itr.hasPrevious(); ) {
32+ int codePoint = itr.previous();
33+ if (!Character.isWhitespace(codePoint)) {
34+ break;
35+ }
36+ result = line.getOffset() + itr.index();
37+ }
38+ return result;
39+ }
40+
41+ int skipForwardSpaces(IDocument doc, int offset) throws BadLocationException {
42+ IRegion line = doc.getLineInformationOfOffset(offset);
43+ CharSequence seq = new DocumentCharSequence(doc,
44+ offset,line.getOffset()+line.getLength()-offset);
45+ int result = offset;
46+ for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
47+ int codePoint = itr.next();
48+ if (!Character.isWhitespace(codePoint)) {
49+ break;
50+ }
51+ result = offset + itr.index();
52+ }
53+ return result;
54+ }
55+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/DowncaseWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/DowncaseWordExecution.java
@@ -1,10 +1,10 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-
4-public final class DowncaseWordExecution extends ConvertWordExecution {
5- @Override
6- protected String convert(String word) {
7- return word.toLowerCase();
8- }
9-}
10-
1+package jp.sourceforge.moreemacs.handlers;
2+
3+
4+public final class DowncaseWordExecution extends ConvertWordExecution {
5+ @Override
6+ protected String convert(String word) {
7+ return word.toLowerCase();
8+ }
9+}
10+
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/Execution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/Execution.java
@@ -1,8 +1,8 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.ui.IWorkbenchWindow;
4-
5-public interface Execution {
6- boolean init(IWorkbenchWindow window);
7- void execute() throws Exception;
8-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.ui.IWorkbenchWindow;
4+
5+public interface Execution {
6+ boolean init(IWorkbenchWindow window);
7+ void execute() throws Exception;
8+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/ForwardWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/ForwardWordExecution.java
@@ -1,38 +1,38 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.CodePointIterator;
4-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5-
6-import org.eclipse.jface.text.BadLocationException;
7-import org.eclipse.jface.text.IDocument;
8-
9-public final class ForwardWordExecution extends TextEditorExecution {
10-
11- @Override
12- public void execute() throws BadLocationException {
13- int current = cursor.offset();
14- cursor.move(getNextWordPosition(doc, current));
15- }
16-
17- public static int getNextWordPosition(IDocument doc, int offset) throws BadLocationException {
18- CharSequence seq = new DocumentCharSequence(doc, offset, doc.getLength()-offset);
19- CodePointIterator itr = new CodePointIterator(seq);
20-
21-
22- for(; itr.hasNext(); ) {
23- int codePoint = itr.next();
24- if (Character.isLetterOrDigit(codePoint)) {
25- itr.previous();
26- break;
27- }
28- }
29- for(; itr.hasNext(); ) {
30- if (!Character.isLetterOrDigit(itr.next())) {
31- itr.previous();
32- break;
33- }
34- }
35-
36- return offset + itr.index();
37- }
38-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.CodePointIterator;
4+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5+
6+import org.eclipse.jface.text.BadLocationException;
7+import org.eclipse.jface.text.IDocument;
8+
9+public final class ForwardWordExecution extends TextEditorExecution {
10+
11+ @Override
12+ public void execute() throws BadLocationException {
13+ int current = cursor.offset();
14+ cursor.move(getNextWordPosition(doc, current));
15+ }
16+
17+ public static int getNextWordPosition(IDocument doc, int offset) throws BadLocationException {
18+ CharSequence seq = new DocumentCharSequence(doc, offset, doc.getLength()-offset);
19+ CodePointIterator itr = new CodePointIterator(seq);
20+
21+
22+ for(; itr.hasNext(); ) {
23+ int codePoint = itr.next();
24+ if (Character.isLetterOrDigit(codePoint)) {
25+ itr.previous();
26+ break;
27+ }
28+ }
29+ for(; itr.hasNext(); ) {
30+ if (!Character.isLetterOrDigit(itr.next())) {
31+ itr.previous();
32+ break;
33+ }
34+ }
35+
36+ return offset + itr.index();
37+ }
38+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillLineExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillLineExecution.java
@@ -1,50 +1,50 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.CodePointIterator;
4-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5-
6-import org.eclipse.jface.text.BadLocationException;
7-import org.eclipse.jface.text.IDocument;
8-import org.eclipse.jface.text.IRegion;
9-import org.eclipse.swt.dnd.Clipboard;
10-import org.eclipse.swt.dnd.TextTransfer;
11-import org.eclipse.swt.dnd.Transfer;
12-
13-public final class KillLineExecution extends TextEditorExecution {
14- @Override
15- public void execute() throws BadLocationException {
16- if(!textEditor.isEditable()) {
17- return;
18- }
19-
20- int current = cursor.offset();
21- int linePos = doc.getLineOfOffset(current);
22- IRegion line = doc.getLineInformation(linePos);
23- String delim = doc.getLineDelimiter(linePos);
24-
25- int length = line.getOffset() + line.getLength() - current;
26- boolean allSpaces = isAllSpaces(doc, current, length);
27-
28- int cutLength = length;
29- if (allSpaces && delim != null) {
30- cutLength += delim.length();
31- }
32-
33- String cut = doc.get(current, cutLength);
34- Clipboard c = new Clipboard(window.getShell().getDisplay());
35- c.setContents(
36- new String[] { cut },
37- new Transfer[] { TextTransfer.getInstance() });
38- doc.replace(current, cutLength, "");
39- }
40-
41- private boolean isAllSpaces(IDocument doc, int offset, int length) throws BadLocationException {
42- CharSequence seq = new DocumentCharSequence(doc, offset, length);
43- for(int codePoint : CodePointIterator.each(seq)) {
44- if (!Character.isWhitespace(codePoint)) {
45- return false;
46- }
47- }
48- return true;
49- }
50-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.CodePointIterator;
4+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
5+
6+import org.eclipse.jface.text.BadLocationException;
7+import org.eclipse.jface.text.IDocument;
8+import org.eclipse.jface.text.IRegion;
9+import org.eclipse.swt.dnd.Clipboard;
10+import org.eclipse.swt.dnd.TextTransfer;
11+import org.eclipse.swt.dnd.Transfer;
12+
13+public final class KillLineExecution extends TextEditorExecution {
14+ @Override
15+ public void execute() throws BadLocationException {
16+ if(!textEditor.isEditable()) {
17+ return;
18+ }
19+
20+ int current = cursor.offset();
21+ int linePos = doc.getLineOfOffset(current);
22+ IRegion line = doc.getLineInformation(linePos);
23+ String delim = doc.getLineDelimiter(linePos);
24+
25+ int length = line.getOffset() + line.getLength() - current;
26+ boolean allSpaces = isAllSpaces(doc, current, length);
27+
28+ int cutLength = length;
29+ if (allSpaces && delim != null) {
30+ cutLength += delim.length();
31+ }
32+
33+ String cut = doc.get(current, cutLength);
34+ Clipboard c = new Clipboard(window.getShell().getDisplay());
35+ c.setContents(
36+ new String[] { cut },
37+ new Transfer[] { TextTransfer.getInstance() });
38+ doc.replace(current, cutLength, "");
39+ }
40+
41+ private boolean isAllSpaces(IDocument doc, int offset, int length) throws BadLocationException {
42+ CharSequence seq = new DocumentCharSequence(doc, offset, length);
43+ for(int codePoint : CodePointIterator.each(seq)) {
44+ if (!Character.isWhitespace(codePoint)) {
45+ return false;
46+ }
47+ }
48+ return true;
49+ }
50+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillRectangleExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillRectangleExecution.java
@@ -1,108 +1,108 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import java.util.ArrayList;
4-import java.util.List;
5-
6-import jp.sourceforge.moreemacs.utils.CodePointIterator;
7-import jp.sourceforge.moreemacs.utils.ColumnUtils;
8-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
9-import jp.sourceforge.moreemacs.utils.DocumentTransaction;
10-
11-import org.eclipse.jface.text.BadLocationException;
12-import org.eclipse.jface.text.IDocument;
13-import org.eclipse.jface.text.IRegion;
14-import org.eclipse.jface.text.ITextSelection;
15-
16-public final class KillRectangleExecution extends TextEditorExecution {
17-
18- @Override
19- public void execute() throws BadLocationException {
20-
21- if(!textEditor.isEditable()) {
22- return;
23- }
24-
25- ITextSelection selection = getSelection(true);
26-
27- int start = selection.getOffset();
28- int startRow = doc.getLineOfOffset(start);
29- int startColumn = ColumnUtils.getColumn(doc, start, getTabStop());
30-
31- int end = start + selection.getLength();
32- int endRow = doc.getLineOfOffset(end);
33- int endColumn = ColumnUtils.getColumn(doc, end, getTabStop());
34-
35- if(startColumn > endColumn) {
36- int work = startColumn;
37- startColumn = endColumn;
38- endColumn = work;
39- }
40-
41- int offset = cursor.offset();
42- DocumentTransaction transaction = new DocumentTransaction(doc);
43- transaction.begin();
44- try {
45- List<String> rectangle = new ArrayList<String>();
46- offset = killRectangle(doc, startRow, startColumn, endRow, endColumn, rectangle);
47- RectangleStorage.setRectangle(rectangle);
48- } finally {
49- transaction.end();
50- }
51- cursor.move(offset);
52- }
53- private int killRectangle(IDocument doc,
54- int startRow, int startColumn,
55- int endRow, int endColumn, List<String> rectangle)
56- throws BadLocationException {
57-
58-
59- int result = cursor.offset();
60- for(int i = startRow; i <= endRow; i++) {
61- result = killString(doc, i, startColumn, endColumn, rectangle);
62- }
63- return result;
64- }
65- private int killString(IDocument doc, int row,
66- int startColumn, int endColumn, List<String> rectangle) throws BadLocationException {
67- IRegion line = doc.getLineInformation(row);
68-
69- StringBuilder builder = new StringBuilder();
70- int column = 0;
71- int cutOffset = 0;
72- int cutLength = 0;
73-
74- CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), line.getLength());
75-
76- for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
77- if(column >= endColumn) {
78- break;
79- }
80- int offset = line.getOffset() + itr.index();
81- int codePoint = itr.next();
82-
83- int nextColumn = ColumnUtils.getNextColumn(column, codePoint, getTabStop());
84-
85- if(nextColumn < startColumn+1) {
86- column = nextColumn;
87- continue;
88- }
89- if(cutLength == 0) {
90- cutOffset = offset;
91- }
92- builder.appendCodePoint(codePoint);
93- cutLength += Character.charCount(codePoint);
94- column = nextColumn;
95- }
96-
97- doc.replace(cutOffset, cutLength, "");
98-
99-
100- for(int i = 0; i < endColumn-column; i++) {
101- builder.append(' ');
102- }
103-
104- rectangle.add(builder.toString());
105- return cutOffset;
106- }
107-
108-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import java.util.ArrayList;
4+import java.util.List;
5+
6+import jp.sourceforge.moreemacs.utils.CodePointIterator;
7+import jp.sourceforge.moreemacs.utils.ColumnUtils;
8+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
9+import jp.sourceforge.moreemacs.utils.DocumentTransaction;
10+
11+import org.eclipse.jface.text.BadLocationException;
12+import org.eclipse.jface.text.IDocument;
13+import org.eclipse.jface.text.IRegion;
14+import org.eclipse.jface.text.ITextSelection;
15+
16+public final class KillRectangleExecution extends TextEditorExecution {
17+
18+ @Override
19+ public void execute() throws BadLocationException {
20+
21+ if(!textEditor.isEditable()) {
22+ return;
23+ }
24+
25+ ITextSelection selection = getSelection(true);
26+
27+ int start = selection.getOffset();
28+ int startRow = doc.getLineOfOffset(start);
29+ int startColumn = ColumnUtils.getColumn(doc, start, getTabStop());
30+
31+ int end = start + selection.getLength();
32+ int endRow = doc.getLineOfOffset(end);
33+ int endColumn = ColumnUtils.getColumn(doc, end, getTabStop());
34+
35+ if(startColumn > endColumn) {
36+ int work = startColumn;
37+ startColumn = endColumn;
38+ endColumn = work;
39+ }
40+
41+ int offset = cursor.offset();
42+ DocumentTransaction transaction = new DocumentTransaction(doc);
43+ transaction.begin();
44+ try {
45+ List<String> rectangle = new ArrayList<String>();
46+ offset = killRectangle(doc, startRow, startColumn, endRow, endColumn, rectangle);
47+ RectangleStorage.setRectangle(rectangle);
48+ } finally {
49+ transaction.end();
50+ }
51+ cursor.move(offset);
52+ }
53+ private int killRectangle(IDocument doc,
54+ int startRow, int startColumn,
55+ int endRow, int endColumn, List<String> rectangle)
56+ throws BadLocationException {
57+
58+
59+ int result = cursor.offset();
60+ for(int i = startRow; i <= endRow; i++) {
61+ result = killString(doc, i, startColumn, endColumn, rectangle);
62+ }
63+ return result;
64+ }
65+ private int killString(IDocument doc, int row,
66+ int startColumn, int endColumn, List<String> rectangle) throws BadLocationException {
67+ IRegion line = doc.getLineInformation(row);
68+
69+ StringBuilder builder = new StringBuilder();
70+ int column = 0;
71+ int cutOffset = 0;
72+ int cutLength = 0;
73+
74+ CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), line.getLength());
75+
76+ for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
77+ if(column >= endColumn) {
78+ break;
79+ }
80+ int offset = line.getOffset() + itr.index();
81+ int codePoint = itr.next();
82+
83+ int nextColumn = ColumnUtils.getNextColumn(column, codePoint, getTabStop());
84+
85+ if(nextColumn < startColumn+1) {
86+ column = nextColumn;
87+ continue;
88+ }
89+ if(cutLength == 0) {
90+ cutOffset = offset;
91+ }
92+ builder.appendCodePoint(codePoint);
93+ cutLength += Character.charCount(codePoint);
94+ column = nextColumn;
95+ }
96+
97+ doc.replace(cutOffset, cutLength, "");
98+
99+
100+ for(int i = 0; i < endColumn-column; i++) {
101+ builder.append(' ');
102+ }
103+
104+ rectangle.add(builder.toString());
105+ return cutOffset;
106+ }
107+
108+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/KillWordExecution.java
@@ -1,24 +1,24 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.swt.dnd.Clipboard;
5-import org.eclipse.swt.dnd.TextTransfer;
6-import org.eclipse.swt.dnd.Transfer;
7-
8-public final class KillWordExecution extends TextEditorExecution {
9-
10- @Override
11- public void execute() throws BadLocationException {
12- if (!textEditor.isEditable()) {
13- return;
14- }
15-
16- int current = cursor.offset();
17- int next = ForwardWordExecution.getNextWordPosition(doc, current);
18- String word = doc.get(current, next - current);
19- Clipboard c = new Clipboard(window.getShell().getDisplay());
20- c.setContents(new String[] { word },
21- new Transfer[] { TextTransfer.getInstance() });
22- doc.replace(current, next - current, "");
23- }
24-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.swt.dnd.Clipboard;
5+import org.eclipse.swt.dnd.TextTransfer;
6+import org.eclipse.swt.dnd.Transfer;
7+
8+public final class KillWordExecution extends TextEditorExecution {
9+
10+ @Override
11+ public void execute() throws BadLocationException {
12+ if (!textEditor.isEditable()) {
13+ return;
14+ }
15+
16+ int current = cursor.offset();
17+ int next = ForwardWordExecution.getNextWordPosition(doc, current);
18+ String word = doc.get(current, next - current);
19+ Clipboard c = new Clipboard(window.getShell().getDisplay());
20+ c.setContents(new String[] { word },
21+ new Transfer[] { TextTransfer.getInstance() });
22+ doc.replace(current, next - current, "");
23+ }
24+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/MoveBeginningOfLineExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/MoveBeginningOfLineExecution.java
@@ -1,13 +1,13 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.jface.text.IRegion;
5-
6-public final class MoveBeginningOfLineExecution extends TextEditorExecution {
7- @Override
8- public void execute() throws BadLocationException {
9- IRegion line = doc.getLineInformationOfOffset(cursor.offset());
10- cursor.move(line.getOffset());
11- }
12-}
13-
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.jface.text.IRegion;
5+
6+public final class MoveBeginningOfLineExecution extends TextEditorExecution {
7+ @Override
8+ public void execute() throws BadLocationException {
9+ IRegion line = doc.getLineInformationOfOffset(cursor.offset());
10+ cursor.move(line.getOffset());
11+ }
12+}
13+
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/MoveEndOfLineExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/MoveEndOfLineExecution.java
@@ -1,14 +1,14 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.jface.text.IRegion;
5-
6-public final class MoveEndOfLineExecution extends TextEditorExecution {
7-
8- @Override
9- public void execute() throws BadLocationException {
10- IRegion line = doc.getLineInformationOfOffset(cursor.offset());
11- cursor.move(line.getOffset()+line.getLength());
12- }
13-
14-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.jface.text.IRegion;
5+
6+public final class MoveEndOfLineExecution extends TextEditorExecution {
7+
8+ @Override
9+ public void execute() throws BadLocationException {
10+ IRegion line = doc.getLineInformationOfOffset(cursor.offset());
11+ cursor.move(line.getOffset()+line.getLength());
12+ }
13+
14+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/NewLineExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/NewLineExecution.java
@@ -1,19 +1,19 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.jface.text.TextUtilities;
5-
6-public final class NewLineExecution extends TextEditorExecution {
7- @Override
8- public void execute() throws BadLocationException {
9- if(!textEditor.isEditable()) {
10- return;
11- }
12-
13- int offset = cursor.offset();
14- String delim = TextUtilities.getDefaultLineDelimiter(doc);
15- doc.replace(offset, 0, delim);
16- cursor.move(offset+delim.length());
17- }
18-}
19-
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.jface.text.TextUtilities;
5+
6+public final class NewLineExecution extends TextEditorExecution {
7+ @Override
8+ public void execute() throws BadLocationException {
9+ if(!textEditor.isEditable()) {
10+ return;
11+ }
12+
13+ int offset = cursor.offset();
14+ String delim = TextUtilities.getDefaultLineDelimiter(doc);
15+ doc.replace(offset, 0, delim);
16+ cursor.move(offset+delim.length());
17+ }
18+}
19+
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/OpenLineExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/OpenLineExecution.java
@@ -1,16 +1,16 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.TextUtilities;
4-
5-public final class OpenLineExecution extends TextEditorExecution {
6-
7- @Override
8- public void execute() throws Exception {
9- if(!textEditor.isEditable()) {
10- return;
11- }
12- String delim = TextUtilities.getDefaultLineDelimiter(doc);
13- doc.replace(cursor.offset(), 0, delim);
14- }
15-
16-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.TextUtilities;
4+
5+public final class OpenLineExecution extends TextEditorExecution {
6+
7+ @Override
8+ public void execute() throws Exception {
9+ if(!textEditor.isEditable()) {
10+ return;
11+ }
12+ String delim = TextUtilities.getDefaultLineDelimiter(doc);
13+ doc.replace(cursor.offset(), 0, delim);
14+ }
15+
16+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/RectangleStorage.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/RectangleStorage.java
@@ -1,17 +1,17 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import java.util.List;
4-
5-final class RectangleStorage {
6- private static List<String> rectangle ;
7-
8- private RectangleStorage() {}
9-
10- static void setRectangle(List<String> rect) {
11- rectangle = rect;
12- }
13-
14- static List<String> getRectangle() {
15- return rectangle;
16- }
17-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import java.util.List;
4+
5+final class RectangleStorage {
6+ private static List<String> rectangle ;
7+
8+ private RectangleStorage() {}
9+
10+ static void setRectangle(List<String> rect) {
11+ rectangle = rect;
12+ }
13+
14+ static List<String> getRectangle() {
15+ return rectangle;
16+ }
17+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TextEditorExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TextEditorExecution.java
@@ -1,83 +1,83 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.IDocument;
4-import org.eclipse.jface.text.ITextOperationTarget;
5-import org.eclipse.jface.text.ITextSelection;
6-import org.eclipse.jface.text.ITextViewer;
7-import org.eclipse.jface.text.ITextViewerExtension;
8-import org.eclipse.ui.IEditorPart;
9-import org.eclipse.ui.IWorkbenchWindow;
10-import org.eclipse.ui.texteditor.ITextEditor;
11-
12-abstract class TextEditorExecution implements Execution {
13- protected IWorkbenchWindow window;
14- protected ITextEditor textEditor;
15- protected ITextViewer textViewer;
16- protected Cursor cursor;
17- protected IDocument doc;
18-
19- @Override
20- public boolean init(IWorkbenchWindow window) {
21- this.window = window;
22-
23- IEditorPart editor = window.getActivePage().getActiveEditor();
24- if (editor instanceof ITextEditor) {
25- textEditor = (ITextEditor) editor;
26- } else {
27- textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
28- }
29- if(textEditor == null) {
30- return false;
31- }
32-
33- doc = textEditor.getDocumentProvider().getDocument(
34- textEditor.getEditorInput());
35-
36- ITextOperationTarget target =
37- (ITextOperationTarget)editor.getAdapter(ITextOperationTarget.class);
38- if(!(target instanceof ITextViewer)) {
39- return false;
40- }
41- textViewer = (ITextViewer) target;
42-
43- cursor = new Cursor(textEditor, textViewer);
44-
45- return true;
46- }
47-
48- protected ITextSelection getSelection(boolean fallbackToMark) {
49- ITextSelection selection =
50- (ITextSelection) textEditor.getSelectionProvider().getSelection();
51-
52- if(!fallbackToMark && selection.getLength() != 0) {
53- return selection;
54- }
55-
56- IEditorPart editor = window.getActivePage().getActiveEditor();
57- ITextOperationTarget target =
58- (ITextOperationTarget)editor.getAdapter(ITextOperationTarget.class);
59-
60- if(!(target instanceof ITextViewerExtension)) {
61- return selection;
62- }
63-
64- ITextViewerExtension viewerEx = (ITextViewerExtension) target;
65-
66- int mark = viewerEx.getMark();
67-
68- if(mark == -1) {
69- return selection;
70- }
71-
72- int current = selection.getOffset();
73-
74- int start = (mark < current) ? mark : current;
75- textViewer.setSelectedRange(start, Math.abs(mark - current));
76-
77- return (ITextSelection) textEditor.getSelectionProvider().getSelection();
78- }
79-
80- protected final int getTabStop() {
81- return textViewer.getTextWidget().getTabs();
82- }
83-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.IDocument;
4+import org.eclipse.jface.text.ITextOperationTarget;
5+import org.eclipse.jface.text.ITextSelection;
6+import org.eclipse.jface.text.ITextViewer;
7+import org.eclipse.jface.text.ITextViewerExtension;
8+import org.eclipse.ui.IEditorPart;
9+import org.eclipse.ui.IWorkbenchWindow;
10+import org.eclipse.ui.texteditor.ITextEditor;
11+
12+abstract class TextEditorExecution implements Execution {
13+ protected IWorkbenchWindow window;
14+ protected ITextEditor textEditor;
15+ protected ITextViewer textViewer;
16+ protected Cursor cursor;
17+ protected IDocument doc;
18+
19+ @Override
20+ public boolean init(IWorkbenchWindow window) {
21+ this.window = window;
22+
23+ IEditorPart editor = window.getActivePage().getActiveEditor();
24+ if (editor instanceof ITextEditor) {
25+ textEditor = (ITextEditor) editor;
26+ } else {
27+ textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
28+ }
29+ if(textEditor == null) {
30+ return false;
31+ }
32+
33+ doc = textEditor.getDocumentProvider().getDocument(
34+ textEditor.getEditorInput());
35+
36+ ITextOperationTarget target =
37+ (ITextOperationTarget)editor.getAdapter(ITextOperationTarget.class);
38+ if(!(target instanceof ITextViewer)) {
39+ return false;
40+ }
41+ textViewer = (ITextViewer) target;
42+
43+ cursor = new Cursor(textEditor, textViewer);
44+
45+ return true;
46+ }
47+
48+ protected ITextSelection getSelection(boolean fallbackToMark) {
49+ ITextSelection selection =
50+ (ITextSelection) textEditor.getSelectionProvider().getSelection();
51+
52+ if(!fallbackToMark && selection.getLength() != 0) {
53+ return selection;
54+ }
55+
56+ IEditorPart editor = window.getActivePage().getActiveEditor();
57+ ITextOperationTarget target =
58+ (ITextOperationTarget)editor.getAdapter(ITextOperationTarget.class);
59+
60+ if(!(target instanceof ITextViewerExtension)) {
61+ return selection;
62+ }
63+
64+ ITextViewerExtension viewerEx = (ITextViewerExtension) target;
65+
66+ int mark = viewerEx.getMark();
67+
68+ if(mark == -1) {
69+ return selection;
70+ }
71+
72+ int current = selection.getOffset();
73+
74+ int start = (mark < current) ? mark : current;
75+ textViewer.setSelectedRange(start, Math.abs(mark - current));
76+
77+ return (ITextSelection) textEditor.getSelectionProvider().getSelection();
78+ }
79+
80+ protected final int getTabStop() {
81+ return textViewer.getTextWidget().getTabs();
82+ }
83+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TransposeCharsExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TransposeCharsExecution.java
@@ -1,52 +1,52 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
4-
5-import org.eclipse.jface.text.BadLocationException;
6-import org.eclipse.jface.text.IRegion;
7-
8-public final class TransposeCharsExecution extends TextEditorExecution {
9- @Override
10- public void execute() throws BadLocationException {
11- if(!textEditor.isEditable()) {
12- return;
13- }
14-
15- int current = cursor.offset();
16- if(current == 0) {
17- // beginning of document
18- return;
19- }
20-
21- int linePos = doc.getLineOfOffset(current);
22- IRegion line = doc.getLineInformation(linePos);
23-
24- DocumentCharSequence seq = new DocumentCharSequence(doc);
25-
26- if(line.getOffset() + line.getLength() == current) {
27- // if end of line, adjust current position
28- current = (line.getOffset() == current)
29- ? current - doc.getLineDelimiter(linePos-1).length()
30- : seq.previousCodePointIndex(current);
31- linePos = doc.getLineOfOffset(current);
32- line = doc.getLineInformation(linePos);
33- }
34- if(current == 0) {
35- // beginning of document again
36- return;
37- }
38-
39- int nextIndex = seq.nextCodePointIndex(current);
40- String forwardChars = (line.getOffset() + line.getLength() == current)
41- ? doc.getLineDelimiter(linePos) : doc.get(current, nextIndex - current);
42-
43- int prevIndex = seq.previousCodePointIndex(current);
44- String backwardChars = (line.getOffset() == current)
45- ? doc.getLineDelimiter(linePos-1) : doc.get(prevIndex, current-prevIndex);
46-
47- doc.replace(current-backwardChars.length(),
48- backwardChars.length() + forwardChars.length(),
49- forwardChars+backwardChars);
50- }
51-
52-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
4+
5+import org.eclipse.jface.text.BadLocationException;
6+import org.eclipse.jface.text.IRegion;
7+
8+public final class TransposeCharsExecution extends TextEditorExecution {
9+ @Override
10+ public void execute() throws BadLocationException {
11+ if(!textEditor.isEditable()) {
12+ return;
13+ }
14+
15+ int current = cursor.offset();
16+ if(current == 0) {
17+ // beginning of document
18+ return;
19+ }
20+
21+ int linePos = doc.getLineOfOffset(current);
22+ IRegion line = doc.getLineInformation(linePos);
23+
24+ DocumentCharSequence seq = new DocumentCharSequence(doc);
25+
26+ if(line.getOffset() + line.getLength() == current) {
27+ // if end of line, adjust current position
28+ current = (line.getOffset() == current)
29+ ? current - doc.getLineDelimiter(linePos-1).length()
30+ : seq.previousCodePointIndex(current);
31+ linePos = doc.getLineOfOffset(current);
32+ line = doc.getLineInformation(linePos);
33+ }
34+ if(current == 0) {
35+ // beginning of document again
36+ return;
37+ }
38+
39+ int nextIndex = seq.nextCodePointIndex(current);
40+ String forwardChars = (line.getOffset() + line.getLength() == current)
41+ ? doc.getLineDelimiter(linePos) : doc.get(current, nextIndex - current);
42+
43+ int prevIndex = seq.previousCodePointIndex(current);
44+ String backwardChars = (line.getOffset() == current)
45+ ? doc.getLineDelimiter(linePos-1) : doc.get(prevIndex, current-prevIndex);
46+
47+ doc.replace(current-backwardChars.length(),
48+ backwardChars.length() + forwardChars.length(),
49+ forwardChars+backwardChars);
50+ }
51+
52+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TransposeWordsExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/TransposeWordsExecution.java
@@ -1,31 +1,31 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-
5-public final class TransposeWordsExecution extends TextEditorExecution {
6- @Override
7- public void execute() throws BadLocationException {
8- if(!textEditor.isEditable()) {
9- return;
10- }
11-
12- int current = cursor.offset();
13- int previousBegin = BackwardWordExecution.getPreviousWordPosition(doc, current);
14- int previousEnd = ForwardWordExecution.getNextWordPosition(doc, previousBegin);
15- int nextEnd = ForwardWordExecution.getNextWordPosition(doc, current);
16- int nextBegin = BackwardWordExecution.getPreviousWordPosition(doc, nextEnd);
17-
18- if(nextBegin <= previousEnd) {
19- return;
20- }
21-
22- String previous = doc.get(previousBegin, previousEnd-previousBegin);
23- String simbols = doc.get(previousEnd, nextBegin-previousEnd);
24- String next = doc.get(nextBegin, nextEnd-nextBegin);
25-
26- doc.replace(previousBegin,
27- nextEnd-previousBegin,
28- next+simbols+previous);
29-
30- }
31-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+
5+public final class TransposeWordsExecution extends TextEditorExecution {
6+ @Override
7+ public void execute() throws BadLocationException {
8+ if(!textEditor.isEditable()) {
9+ return;
10+ }
11+
12+ int current = cursor.offset();
13+ int previousBegin = BackwardWordExecution.getPreviousWordPosition(doc, current);
14+ int previousEnd = ForwardWordExecution.getNextWordPosition(doc, previousBegin);
15+ int nextEnd = ForwardWordExecution.getNextWordPosition(doc, current);
16+ int nextBegin = BackwardWordExecution.getPreviousWordPosition(doc, nextEnd);
17+
18+ if(nextBegin <= previousEnd) {
19+ return;
20+ }
21+
22+ String previous = doc.get(previousBegin, previousEnd-previousBegin);
23+ String simbols = doc.get(previousEnd, nextBegin-previousEnd);
24+ String next = doc.get(nextBegin, nextEnd-nextBegin);
25+
26+ doc.replace(previousBegin,
27+ nextEnd-previousBegin,
28+ next+simbols+previous);
29+
30+ }
31+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/UpcaseWordExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/UpcaseWordExecution.java
@@ -1,10 +1,10 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-
4-public final class UpcaseWordExecution extends ConvertWordExecution {
5- @Override
6- protected String convert(String word) {
7- return word.toUpperCase();
8- }
9-}
10-
1+package jp.sourceforge.moreemacs.handlers;
2+
3+
4+public final class UpcaseWordExecution extends ConvertWordExecution {
5+ @Override
6+ protected String convert(String word) {
7+ return word.toUpperCase();
8+ }
9+}
10+
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/YankRectangleExecution.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/handlers/YankRectangleExecution.java
@@ -1,96 +1,96 @@
1-package jp.sourceforge.moreemacs.handlers;
2-
3-import java.util.List;
4-
5-import jp.sourceforge.moreemacs.utils.CodePointIterator;
6-import jp.sourceforge.moreemacs.utils.ColumnUtils;
7-import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
8-import jp.sourceforge.moreemacs.utils.DocumentTransaction;
9-
10-import org.eclipse.jface.text.BadLocationException;
11-import org.eclipse.jface.text.IDocument;
12-import org.eclipse.jface.text.IRegion;
13-import org.eclipse.jface.text.TextUtilities;
14-
15-public final class YankRectangleExecution extends TextEditorExecution {
16- @Override
17- public void execute() throws BadLocationException {
18- if(!textEditor.isEditable()) {
19- return;
20- }
21-
22- List<String> rectangle = RectangleStorage.getRectangle();
23- if(rectangle == null) {
24- return;
25- }
26-
27- int current = cursor.offset();
28- int row = doc.getLineOfOffset(current);
29- int column = ColumnUtils.getColumn(doc, current, getTabStop());
30-
31-
32- int offset = cursor.offset();
33- DocumentTransaction transaction = new DocumentTransaction(doc);
34- transaction.begin();
35- try {
36- ensureLines(doc, row + rectangle.size());
37- offset = yankRectangle(doc, row, column, rectangle);
38- } finally {
39- transaction.end();
40- }
41- cursor.move(offset);
42- }
43-
44- private void ensureLines(IDocument doc, int lines) throws BadLocationException {
45- int n = lines - doc.getNumberOfLines();
46- if(n <= 0) {
47- return;
48- }
49-
50- StringBuilder builder = new StringBuilder();
51- String delim = TextUtilities.getDefaultLineDelimiter(doc);
52- for(int i = 0; i < n; i++) {
53- builder.append(delim);
54- }
55- doc.replace(doc.getLength(), 0, builder.toString());
56-
57- }
58-
59- private int yankRectangle(IDocument doc,
60- int row, int column, List<String> rectangle)
61- throws BadLocationException {
62- int offset = cursor.offset();
63- for(int i = 0; i < rectangle.size(); i++) {
64- offset = yankString(doc, row+i, column, rectangle.get(i));
65- }
66- return offset;
67- }
68-
69- private int yankString(IDocument doc, int row, int column, String str)
70- throws BadLocationException
71- {
72- IRegion line = doc.getLineInformation(row);
73- int col = 0;
74-
75- CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), line.getLength());
76-
77- for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
78- int offset = line.getOffset() + itr.index();
79- int codePoint = itr.next();
80- if(col >= column) {
81- doc.replace(offset, 0, str);
82- return offset+str.length();
83- }
84- col = ColumnUtils.getNextColumn(col, codePoint, getTabStop());
85- }
86-
87-
88- StringBuilder builder = new StringBuilder();
89- for(int i = 0; i < column-col; i++) {
90- builder.append(" ");
91- }
92- builder.append(str);
93- doc.replace(line.getOffset()+line.getLength(), 0, builder.toString());
94- return line.getOffset()+line.getLength()+builder.length();
95- }
96-}
1+package jp.sourceforge.moreemacs.handlers;
2+
3+import java.util.List;
4+
5+import jp.sourceforge.moreemacs.utils.CodePointIterator;
6+import jp.sourceforge.moreemacs.utils.ColumnUtils;
7+import jp.sourceforge.moreemacs.utils.DocumentCharSequence;
8+import jp.sourceforge.moreemacs.utils.DocumentTransaction;
9+
10+import org.eclipse.jface.text.BadLocationException;
11+import org.eclipse.jface.text.IDocument;
12+import org.eclipse.jface.text.IRegion;
13+import org.eclipse.jface.text.TextUtilities;
14+
15+public final class YankRectangleExecution extends TextEditorExecution {
16+ @Override
17+ public void execute() throws BadLocationException {
18+ if(!textEditor.isEditable()) {
19+ return;
20+ }
21+
22+ List<String> rectangle = RectangleStorage.getRectangle();
23+ if(rectangle == null) {
24+ return;
25+ }
26+
27+ int current = cursor.offset();
28+ int row = doc.getLineOfOffset(current);
29+ int column = ColumnUtils.getColumn(doc, current, getTabStop());
30+
31+
32+ int offset = cursor.offset();
33+ DocumentTransaction transaction = new DocumentTransaction(doc);
34+ transaction.begin();
35+ try {
36+ ensureLines(doc, row + rectangle.size());
37+ offset = yankRectangle(doc, row, column, rectangle);
38+ } finally {
39+ transaction.end();
40+ }
41+ cursor.move(offset);
42+ }
43+
44+ private void ensureLines(IDocument doc, int lines) throws BadLocationException {
45+ int n = lines - doc.getNumberOfLines();
46+ if(n <= 0) {
47+ return;
48+ }
49+
50+ StringBuilder builder = new StringBuilder();
51+ String delim = TextUtilities.getDefaultLineDelimiter(doc);
52+ for(int i = 0; i < n; i++) {
53+ builder.append(delim);
54+ }
55+ doc.replace(doc.getLength(), 0, builder.toString());
56+
57+ }
58+
59+ private int yankRectangle(IDocument doc,
60+ int row, int column, List<String> rectangle)
61+ throws BadLocationException {
62+ int offset = cursor.offset();
63+ for(int i = 0; i < rectangle.size(); i++) {
64+ offset = yankString(doc, row+i, column, rectangle.get(i));
65+ }
66+ return offset;
67+ }
68+
69+ private int yankString(IDocument doc, int row, int column, String str)
70+ throws BadLocationException
71+ {
72+ IRegion line = doc.getLineInformation(row);
73+ int col = 0;
74+
75+ CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), line.getLength());
76+
77+ for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
78+ int offset = line.getOffset() + itr.index();
79+ int codePoint = itr.next();
80+ if(col >= column) {
81+ doc.replace(offset, 0, str);
82+ return offset+str.length();
83+ }
84+ col = ColumnUtils.getNextColumn(col, codePoint, getTabStop());
85+ }
86+
87+
88+ StringBuilder builder = new StringBuilder();
89+ for(int i = 0; i < column-col; i++) {
90+ builder.append(" ");
91+ }
92+ builder.append(str);
93+ doc.replace(line.getOffset()+line.getLength(), 0, builder.toString());
94+ return line.getOffset()+line.getLength()+builder.length();
95+ }
96+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/CharacterUtils.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/CharacterUtils.java
@@ -1,44 +1,44 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import java.util.Arrays;
4-import java.util.List;
5-import java.util.Locale;
6-
7-import com.ibm.icu.lang.UCharacter;
8-import com.ibm.icu.lang.UProperty;
9-
10-public final class CharacterUtils {
11- private CharacterUtils() {}
12-
13- private static List<String> EAST_ASIAN_LANGS =
14- Arrays.asList("ja", "vi", "kr", "zh");
15-
16- public static int getWidth(int codePoint) {
17- return getWidth(codePoint, Locale.getDefault());
18- }
19-
20- public static int getWidth(int codePoint, Locale locale) {
21- if(locale == null) {
22- throw new NullPointerException("locale is null");
23- }
24- int value = UCharacter.getIntPropertyValue(codePoint,
25- UProperty.EAST_ASIAN_WIDTH);
26- switch(value) {
27- case UCharacter.EastAsianWidth.NARROW:
28- case UCharacter.EastAsianWidth.NEUTRAL:
29- case UCharacter.EastAsianWidth.HALFWIDTH:
30- return 1;
31- case UCharacter.EastAsianWidth.FULLWIDTH:
32- case UCharacter.EastAsianWidth.WIDE:
33- return 2;
34- case UCharacter.EastAsianWidth.AMBIGUOUS:
35- if(EAST_ASIAN_LANGS.contains(locale.getLanguage())) {
36- return 2;
37- } else {
38- return 1;
39- }
40- default:
41- return 1;
42- }
43- }
44-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import java.util.Arrays;
4+import java.util.List;
5+import java.util.Locale;
6+
7+import com.ibm.icu.lang.UCharacter;
8+import com.ibm.icu.lang.UProperty;
9+
10+public final class CharacterUtils {
11+ private CharacterUtils() {}
12+
13+ private static List<String> EAST_ASIAN_LANGS =
14+ Arrays.asList("ja", "vi", "kr", "zh");
15+
16+ public static int getWidth(int codePoint) {
17+ return getWidth(codePoint, Locale.getDefault());
18+ }
19+
20+ public static int getWidth(int codePoint, Locale locale) {
21+ if(locale == null) {
22+ throw new NullPointerException("locale is null");
23+ }
24+ int value = UCharacter.getIntPropertyValue(codePoint,
25+ UProperty.EAST_ASIAN_WIDTH);
26+ switch(value) {
27+ case UCharacter.EastAsianWidth.NARROW:
28+ case UCharacter.EastAsianWidth.NEUTRAL:
29+ case UCharacter.EastAsianWidth.HALFWIDTH:
30+ return 1;
31+ case UCharacter.EastAsianWidth.FULLWIDTH:
32+ case UCharacter.EastAsianWidth.WIDE:
33+ return 2;
34+ case UCharacter.EastAsianWidth.AMBIGUOUS:
35+ if(EAST_ASIAN_LANGS.contains(locale.getLanguage())) {
36+ return 2;
37+ } else {
38+ return 1;
39+ }
40+ default:
41+ return 1;
42+ }
43+ }
44+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/CodePointIterator.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/CodePointIterator.java
@@ -1,69 +1,69 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import java.util.Iterator;
4-
5-public final class CodePointIterator implements Iterator<Integer> {
6- private final CharSequence seq;
7- private int index;
8-
9- public CodePointIterator(CharSequence seq) {
10- this(seq, 0);
11- }
12-
13- public CodePointIterator(CharSequence seq, int index) {
14- if(seq == null) {
15- throw new NullPointerException("seq is null");
16- }
17-
18- this.seq = seq;
19- setIndex(index);
20- }
21-
22- public void setIndex(int index) {
23- if(index < 0 || index > seq.length()) {
24- throw new IndexOutOfBoundsException();
25- }
26- this.index = index;
27- }
28-
29- @Override
30- public boolean hasNext() {
31- return index < seq.length();
32- }
33-
34- public boolean hasPrevious() {
35- return index > 0;
36- }
37-
38- public int index() {
39- return index;
40- }
41-
42- @Override
43- public Integer next() {
44- int codePoint = Character.codePointAt(seq, index);
45- index += Character.charCount(codePoint);
46- return codePoint;
47- }
48-
49- public Integer previous() {
50- int codePoint = Character.codePointBefore(seq, index);
51- index -= Character.charCount(codePoint);
52- return codePoint;
53- }
54-
55- @Override
56- public void remove() {
57- throw new UnsupportedOperationException("unsupported");
58- }
59-
60- public static Iterable<Integer> each(final CharSequence seq) {
61- return new Iterable<Integer>() {
62- @Override
63- public Iterator<Integer> iterator() {
64- return new CodePointIterator(seq);
65- }
66-
67- };
68- }
69-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import java.util.Iterator;
4+
5+public final class CodePointIterator implements Iterator<Integer> {
6+ private final CharSequence seq;
7+ private int index;
8+
9+ public CodePointIterator(CharSequence seq) {
10+ this(seq, 0);
11+ }
12+
13+ public CodePointIterator(CharSequence seq, int index) {
14+ if(seq == null) {
15+ throw new NullPointerException("seq is null");
16+ }
17+
18+ this.seq = seq;
19+ setIndex(index);
20+ }
21+
22+ public void setIndex(int index) {
23+ if(index < 0 || index > seq.length()) {
24+ throw new IndexOutOfBoundsException();
25+ }
26+ this.index = index;
27+ }
28+
29+ @Override
30+ public boolean hasNext() {
31+ return index < seq.length();
32+ }
33+
34+ public boolean hasPrevious() {
35+ return index > 0;
36+ }
37+
38+ public int index() {
39+ return index;
40+ }
41+
42+ @Override
43+ public Integer next() {
44+ int codePoint = Character.codePointAt(seq, index);
45+ index += Character.charCount(codePoint);
46+ return codePoint;
47+ }
48+
49+ public Integer previous() {
50+ int codePoint = Character.codePointBefore(seq, index);
51+ index -= Character.charCount(codePoint);
52+ return codePoint;
53+ }
54+
55+ @Override
56+ public void remove() {
57+ throw new UnsupportedOperationException("unsupported");
58+ }
59+
60+ public static Iterable<Integer> each(final CharSequence seq) {
61+ return new Iterable<Integer>() {
62+ @Override
63+ public Iterator<Integer> iterator() {
64+ return new CodePointIterator(seq);
65+ }
66+
67+ };
68+ }
69+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/ColumnUtils.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/ColumnUtils.java
@@ -1,31 +1,31 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.jface.text.IDocument;
5-import org.eclipse.jface.text.IRegion;
6-
7-public final class ColumnUtils {
8- private ColumnUtils() {}
9-
10- public static int getColumn(IDocument doc, int offset, int tabStop)
11- throws BadLocationException {
12- IRegion line = doc.getLineInformationOfOffset(offset);
13- int column = 0;
14-
15- CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), offset - line.getOffset());
16- for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
17- int codePoint = itr.next();
18- column = getNextColumn(column, codePoint, tabStop);
19- }
20-
21- return column;
22- }
23-
24- public static int getNextColumn(int column, int codePoint, int tabStop) {
25- if(codePoint == '\t') {
26- return column - (column%tabStop) + tabStop;
27- } else {
28- return column + CharacterUtils.getWidth(codePoint);
29- }
30- }
31-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.jface.text.IDocument;
5+import org.eclipse.jface.text.IRegion;
6+
7+public final class ColumnUtils {
8+ private ColumnUtils() {}
9+
10+ public static int getColumn(IDocument doc, int offset, int tabStop)
11+ throws BadLocationException {
12+ IRegion line = doc.getLineInformationOfOffset(offset);
13+ int column = 0;
14+
15+ CharSequence seq = new DocumentCharSequence(doc, line.getOffset(), offset - line.getOffset());
16+ for(CodePointIterator itr = new CodePointIterator(seq); itr.hasNext(); ) {
17+ int codePoint = itr.next();
18+ column = getNextColumn(column, codePoint, tabStop);
19+ }
20+
21+ return column;
22+ }
23+
24+ public static int getNextColumn(int column, int codePoint, int tabStop) {
25+ if(codePoint == '\t') {
26+ return column - (column%tabStop) + tabStop;
27+ } else {
28+ return column + CharacterUtils.getWidth(codePoint);
29+ }
30+ }
31+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/DocumentCharSequence.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/DocumentCharSequence.java
@@ -1,64 +1,64 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import org.eclipse.jface.text.BadLocationException;
4-import org.eclipse.jface.text.IDocument;
5-
6-public final class DocumentCharSequence implements CharSequence {
7- private final IDocument doc;
8- private final int offset;
9- private final int length;
10-
11- public DocumentCharSequence(IDocument doc) {
12- this(doc, 0, doc.getLength());
13- }
14-
15- public DocumentCharSequence(IDocument doc, int offset, int length) {
16- if(doc == null) {
17- throw new NullPointerException("doc is null");
18- }
19-
20- this.doc = doc;
21- this.offset = offset;
22- this.length = length;
23-
24- validate(offset, length, doc.getLength());
25- }
26-
27- private static void validate(int offset, int length, int capacity) {
28- if(offset < 0 || length < 0 || offset+length > capacity) {
29- throw new IndexOutOfBoundsException();
30- }
31- }
32-
33- @Override
34- public char charAt(int index) {
35- if(index < 0 || index >= length) {
36- throw new IndexOutOfBoundsException();
37- }
38- try {
39- return doc.getChar(offset + index);
40- } catch (BadLocationException e) {
41- throw new IndexOutOfBoundsException(e.getMessage());
42- }
43- }
44-
45- @Override
46- public int length() {
47- return length;
48- }
49-
50- @Override
51- public CharSequence subSequence(int start, int end) {
52- validate(start, end-start, length);
53- return new DocumentCharSequence(doc, offset+start, end - start);
54- }
55-
56- public int nextCodePointIndex(int index) {
57- int codePoint = Character.codePointAt(this, index);
58- return index + Character.charCount(codePoint);
59- }
60- public int previousCodePointIndex(int index) {
61- int codePoint = Character.codePointBefore(this, index);
62- return index - Character.charCount(codePoint);
63- }
64-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import org.eclipse.jface.text.BadLocationException;
4+import org.eclipse.jface.text.IDocument;
5+
6+public final class DocumentCharSequence implements CharSequence {
7+ private final IDocument doc;
8+ private final int offset;
9+ private final int length;
10+
11+ public DocumentCharSequence(IDocument doc) {
12+ this(doc, 0, doc.getLength());
13+ }
14+
15+ public DocumentCharSequence(IDocument doc, int offset, int length) {
16+ if(doc == null) {
17+ throw new NullPointerException("doc is null");
18+ }
19+
20+ this.doc = doc;
21+ this.offset = offset;
22+ this.length = length;
23+
24+ validate(offset, length, doc.getLength());
25+ }
26+
27+ private static void validate(int offset, int length, int capacity) {
28+ if(offset < 0 || length < 0 || offset+length > capacity) {
29+ throw new IndexOutOfBoundsException();
30+ }
31+ }
32+
33+ @Override
34+ public char charAt(int index) {
35+ if(index < 0 || index >= length) {
36+ throw new IndexOutOfBoundsException();
37+ }
38+ try {
39+ return doc.getChar(offset + index);
40+ } catch (BadLocationException e) {
41+ throw new IndexOutOfBoundsException(e.getMessage());
42+ }
43+ }
44+
45+ @Override
46+ public int length() {
47+ return length;
48+ }
49+
50+ @Override
51+ public CharSequence subSequence(int start, int end) {
52+ validate(start, end-start, length);
53+ return new DocumentCharSequence(doc, offset+start, end - start);
54+ }
55+
56+ public int nextCodePointIndex(int index) {
57+ int codePoint = Character.codePointAt(this, index);
58+ return index + Character.charCount(codePoint);
59+ }
60+ public int previousCodePointIndex(int index) {
61+ int codePoint = Character.codePointBefore(this, index);
62+ return index - Character.charCount(codePoint);
63+ }
64+}
--- a/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/DocumentTransaction.java
+++ b/jp.sourceforge.moreemacs/src/jp/sourceforge/moreemacs/utils/DocumentTransaction.java
@@ -1,47 +1,47 @@
1-package jp.sourceforge.moreemacs.utils;
2-
3-import org.eclipse.jface.text.DocumentRewriteSession;
4-import org.eclipse.jface.text.DocumentRewriteSessionType;
5-import org.eclipse.jface.text.IDocument;
6-import org.eclipse.jface.text.IDocumentExtension4;
7-
8-public final class DocumentTransaction {
9- private IDocumentExtension4 sessionManager;
10- private DocumentRewriteSession session;
11-
12- public DocumentTransaction(IDocument doc) {
13- if(doc instanceof IDocumentExtension4) {
14- sessionManager = (IDocumentExtension4)doc;
15- }
16- }
17-
18- public boolean isAvailable() {
19- return sessionManager != null;
20- }
21-
22- public void begin() {
23- begin(DocumentRewriteSessionType.UNRESTRICTED_SMALL);
24- }
25-
26- public void begin(DocumentRewriteSessionType type) {
27- if(!isAvailable()) {
28- return;
29- }
30- if(session != null) {
31- throw new IllegalStateException("session already started");
32- }
33- session = sessionManager.startRewriteSession(type);
34- }
35-
36- public void end() {
37- if(!isAvailable()) {
38- return;
39- }
40- if(session == null) {
41- throw new IllegalStateException("session is not started");
42- }
43- sessionManager.stopRewriteSession(session);
44- session = null;
45- }
46-
47-}
1+package jp.sourceforge.moreemacs.utils;
2+
3+import org.eclipse.jface.text.DocumentRewriteSession;
4+import org.eclipse.jface.text.DocumentRewriteSessionType;
5+import org.eclipse.jface.text.IDocument;
6+import org.eclipse.jface.text.IDocumentExtension4;
7+
8+public final class DocumentTransaction {
9+ private IDocumentExtension4 sessionManager;
10+ private DocumentRewriteSession session;
11+
12+ public DocumentTransaction(IDocument doc) {
13+ if(doc instanceof IDocumentExtension4) {
14+ sessionManager = (IDocumentExtension4)doc;
15+ }
16+ }
17+
18+ public boolean isAvailable() {
19+ return sessionManager != null;
20+ }
21+
22+ public void begin() {
23+ begin(DocumentRewriteSessionType.UNRESTRICTED_SMALL);
24+ }
25+
26+ public void begin(DocumentRewriteSessionType type) {
27+ if(!isAvailable()) {
28+ return;
29+ }
30+ if(session != null) {
31+ throw new IllegalStateException("session already started");
32+ }
33+ session = sessionManager.startRewriteSession(type);
34+ }
35+
36+ public void end() {
37+ if(!isAvailable()) {
38+ return;
39+ }
40+ if(session == null) {
41+ throw new IllegalStateException("session is not started");
42+ }
43+ sessionManager.stopRewriteSession(session);
44+ session = null;
45+ }
46+
47+}
Show on old repository browser