Revision 674

tmp/org.txm.annotation.rcp/plugin.xml (revision 674)
65 65
      <view
66 66
            category="org.txm.rcp"
67 67
            class="org.txm.annotation.rcp.views.knowledgerepositories.KRView"
68
            id="org.txm.rcp.views.knowledgerepositories.KRView"
68
            id="org.txm.annotation.rcp.views.knowledgerepositories.KRView"
69 69
            name="KR"
70 70
            restorable="true">
71 71
      </view>
......
115 115
               </command>
116 116
     </menuContribution>
117 117
     <menuContribution
118
            locationURI="popup:org.txm.rcp.views.knowledgerepositories.KRView">
118
            locationURI="popup:org.txm.annotation.rcp.views.knowledgerepositories.KRView">
119 119
         <command
120 120
               commandId="org.txm.rcp.commands.krview.Copy"
121 121
               style="push"
tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 674)
16 16
command.name.12 = Export XML Glozz...
17 17
command.name.13 = Export XML-TEI URS...
18 18
command.name.14 = XML-TEI URS
19
view.name = Propri?t?s
19
view.name = Propri?t?s
20
Bundle-Vendor = Textometrie.org
21
Bundle-Name = Analec
22
command.name.15 = Aligner les annotations Glozz avec les mots TXM
23
view.name.0 = chercher
24
menu.mnemonic = A
25
menu.label.0 = Analec
26
menu.mnemonic.0 = A
27
command.label.2 = XML-TEI Analec
28
command.name.10 = Installer
29
command.name.11 = Importer des annotations XML-TEI URS...
tmp/org.txm.analec.rcp/plugin.xml (revision 674)
56 56
         </menu>
57 57
      </menuContribution>
58 58
      <menuContribution
59
            locationURI="popup:org.txm.rcp.views.CorporaView">
59
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
60 60
         <menu
61 61
               id="corpora.menu.analec"
62 62
               label="%menu.label.0"
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 674)
29 29

  
30 30
import org.eclipse.core.commands.ExecutionEvent;
31 31
import org.eclipse.core.commands.ExecutionException;
32
import org.txm.core.preferences.TXMPreferences;
33 32
import org.txm.lexicaltable.core.functions.LexicalTable;
34
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences;
35
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor;
36 33
import org.txm.rcp.RCPMessages;
37 34
import org.txm.rcp.editors.TXMEditor;
38 35
import org.txm.rcp.handlers.BaseAbstractHandler;
......
40 37
import org.txm.searchengine.cqp.corpus.Partition;
41 38
import org.txm.searchengine.cqp.corpus.Subcorpus;
42 39
import org.txm.specificities.core.functions.Specificities;
43
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
44 40
import org.txm.specificities.rcp.editors.SpecificitiesEditor;
45 41
import org.txm.utils.logger.Log;
46 42

  
tmp/org.txm.specificities.rcp/plugin.xml (revision 674)
35 35
   <extension
36 36
         point="org.eclipse.ui.menus">
37 37
      <menuContribution
38
            locationURI="popup:org.txm.rcp.views.CorporaView">
38
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
39 39
         <command
40 40
               commandId="org.txm.specificities.rcp.handlers.ComputeSpecifities"
41 41
               icon="icons/functions/specificities.png"
......
54 54
                  </reference>
55 55
               </or>
56 56
            </visibleWhen>
57
            <parameter
58
                  name="org.txm.specificities.rcp.parameter1"
59
                  value="org.txm.specificities.rcp.parameter1">
60
            </parameter>
61 57
         </command>
62 58
      </menuContribution>
63 59
      <menuContribution
tmp/org.txm.utils/src/org/txm/utils/io/IOUtils.java (revision 674)
39 39
		ArrayList<String> matches = new ArrayList<String>();
40 40
		String text = IOUtils.getText(file, encoding);
41 41
		if (normalizeSeparators) text = text.replaceAll("\\s", " ");
42
		if (normalizeSeparators) text = text.replaceAll("\\t", " ");
43
		if (normalizeSeparators) text = text.replaceAll("\\n", " ");
44
		if (normalizeSeparators) text = text.replaceAll("[ ]+", " ");
42 45
		
43 46
		Pattern test = Pattern.compile(pattern);
44 47
		Matcher m = test.matcher(text);
tmp/org.txm.links.rcp/plugin.xml (revision 674)
60 60
   <extension
61 61
         point="org.eclipse.ui.menus">
62 62
               <menuContribution
63
            locationURI="popup:org.txm.synopticedition.rcp.editors.TXMBrowser">
63
            locationURI="popup:org.txm.rcp.editors.TXMBrowser">
64 64
         <command
65 65
               commandId="org.txm.synopticedition.rcp.commands.link.TextToConcordance"
66 66
               label="%command.label.73"
......
72 72
         </command>
73 73
      </menuContribution>
74 74
      <menuContribution
75
            locationURI="popup:org.txm.synopticedition.rcp.editors.TableEditor">
75
            locationURI="popup:org.txm.synopticedition.rcp.editors.SynopticEditionEditor">
76 76
         <command
77 77
               commandId="org.txm.synopticedition.rcp.commands.link.TextToConcordance"
78 78
               label="%command.label.74"
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PluginMenuContributions.java (revision 674)
1
package org.txm.core.tests.junit;
2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.ArrayList;
6
import java.util.Collections;
7
import java.util.HashSet;
8

  
9
import org.txm.utils.io.IOUtils;
10

  
11
/**
12
 * check that all menu contributions point to an existing menu
13
 * @author mdecorde
14
 *
15
 */
16
public class PluginMenuContributions extends TXMPluginTest {
17

  
18
	HashSet<String> allMenus = new HashSet<String>();
19
	HashSet<String> allSeparators = new HashSet<String>();
20

  
21
	@Override
22
	public void TBXPluginTest(File projectDirectory, String name, String packagePath) throws IOException {
23
		File javaSrcDirectory = getJavaSrcDirectory(projectDirectory);
24

  
25
		testDeclaredExtPoints(projectDirectory);
26
	}
27

  
28
	@Override
29
	public void RCPPluginTest(File projectDirectory, String name, String packagePath) throws IOException {
30
		File pluginXML = new File(projectDirectory, "plugin.xml");
31
		if (!pluginXML.exists()) {
32
			error("missing file "+pluginXML);
33
		}
34
		File javaSrcDirectory = getJavaSrcDirectory(projectDirectory);
35

  
36
		testDeclaredExtPoints(projectDirectory);
37
	}
38

  
39
	private void testDeclaredExtPoints(File projectDirectory) throws IOException {
40
		File pluginXML = new File(projectDirectory, "plugin.xml");
41
		if (pluginXML.exists()) {
42
			ArrayList<String> locations = IOUtils.findWithGroup(pluginXML, "<menuContribution locationURI=\"([^\"]+)\"", true);
43
			//System.out.println("Test locations: "+locations);
44
			for (String location : locations) {
45
				String type = "";
46
				String target = "";
47
				if (location.startsWith("toolbar:")) {
48
					type= "toolbar";
49
					target = location.substring(8);
50
				} else if (location.startsWith("menu:")) {
51
					type= "menu";
52
					target = location.substring(5);
53
				} else if (location.startsWith("popup:")) {
54
					type= "popup";
55
					target = location.substring(6);
56
				} else {
57
					error("wrong contribution type: "+location);
58
				}
59
				
60
				String position = "";
61
				if (target.contains("?")) {
62
					position = target.substring(target.indexOf("?")+1);
63
					target = target.substring(0, target.indexOf("?"));
64
				}
65
				//System.out.println(type+" -> "+target+" : "+position);
66
				if (!allMenus.contains(target)) {
67
					error("wrong contribution target: "+location);
68
				}
69
			}
70
			
71
		}
72
	}
73

  
74
	@Override
75
	public void gatherData() {
76
		try {
77
			allMenus.add("org.eclipse.ui.main.menu"); // eclipse main menu
78
			allMenus.add("#TextEditorContext"); // text editor context
79
			for (File projectDirectory : projects) {
80
				
81
				File pluginXML = new File(projectDirectory, "plugin.xml");
82
				if (pluginXML.exists()) {
83
					ArrayList<String> ids = IOUtils.findWithGroup(pluginXML, "menu id=\"([^\"]+)\"", true);
84
					allMenus.addAll(ids);
85
					
86
					ids = IOUtils.findWithGroup(pluginXML, "menu icon=\"[^\"]+\" id=\"([^\"]+)\"", true);
87
					allMenus.addAll(ids);
88
					//allowMultiple="false"
89
					ArrayList<String> views = IOUtils.findWithGroup(pluginXML, "<view category=\"[^\"]+\" class=\"([^\"]+)\"", true);
90
					for (String view : views) {
91
						allMenus.add(view);
92
					}
93
					
94
					views = IOUtils.findWithGroup(pluginXML, "<view allowMultiple=\"[^\"]+\" category=\"[^\"]+\" class=\"([^\"]+)\"", true);
95
					for (String view : views) {
96
						allMenus.add(view);
97
					}
98
					
99
					views = IOUtils.findWithGroup(pluginXML, "<view class=\"([^\"]+)\"", true);
100
					for (String view : views) {
101
						allMenus.add(view);
102
					}
103
					
104
					ArrayList<String> editors = IOUtils.findWithGroup(pluginXML, "<editor class=\"([^\"]+)\"", true);
105
					for (String editor : editors) {
106
						allMenus.add(editor);
107
					}
108
					
109
					ArrayList<String> toolbars = IOUtils.findWithGroup(pluginXML, "<toolbar id=\"([^\"]+)\"", true);
110
					for (String toolbar : toolbars) {
111
						allMenus.add(toolbar);
112
					}
113
					
114
					ArrayList<String> separators = IOUtils.findWithGroup(pluginXML, "<separator id=\"([^\"]+)\"", true);
115
					for (String separator : separators) {
116
						allSeparators.add(separator);
117
					}
118
					
119
				}
120
			}
121
			System.out.println("all menus: "+allMenus);
122
		} catch (IOException e) {
123
			// TODO Auto-generated catch block
124
			e.printStackTrace();
125
		}
126
	}
127
}
0 128

  
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/TXMPluginTest.java (revision 674)
6 6
import java.io.FileFilter;
7 7
import java.util.ArrayList;
8 8
import java.util.Arrays;
9
import java.util.Collections;
9 10

  
10 11
import org.junit.Test;
11 12

  
......
47 48
			}
48 49
		})));
49 50

  
51
		Collections.sort(ret);
50 52
		return ret;
51 53
	}
52 54
	
tmp/org.txm.concordance.rcp/plugin.xml (revision 674)
84 84
         </command>
85 85
      </menuContribution>
86 86
      <menuContribution
87
            locationURI="popup:org.txm.rcp.editors.ConcordancesEditor">
87
            locationURI="popup:org.txm.concordance.rcp.editors.ConcordanceEditor">
88 88
         <command
89 89
               commandId="org.txm.concordance.rcp.handlers.DeleteLines"
90 90
               icon="platform:/plugin/org.txm.rcp/icons/cross.png"
tmp/org.txm.statsengine.r.rcp/plugin.xml (revision 674)
66 66
         </command>
67 67
      </menuContribution>
68 68
      <menuContribution
69
            locationURI="popup:org.txm.rcp.views.RVariablesView">
69
            locationURI="popup:org.txm.statsengine.r.rcp.views.RVariablesView">
70 70
         <command
71 71
               commandId="org.txm.rcp.commands.R.CopySelection"
72 72
               label="%command.label.129"
......
243 243
            category="org.txm.rcp"
244 244
            class="org.txm.statsengine.r.rcp.views.RConsole"
245 245
            icon="icons/R.png"
246
            id="RConsoleView"
246
            id="org.txm.statsengine.r.rcp.views.RConsole"
247 247
            name="%view.name.6"
248 248
            restorable="true">
249 249
      </view>
......
251 251
                     category="org.txm.rcp"
252 252
                     class="org.txm.statsengine.r.rcp.views.RVariablesView"
253 253
                     icon="icons/R.png"
254
                     id="RVariablesView"
254
                     id="org.txm.statsengine.r.rcp.views.RVariablesView"
255 255
                     name="%view.name.5"
256 256
                     restorable="true">
257 257
               </view>
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 674)
851 851
		return initContextMenu(composite, menuId, null, null);
852 852
	}
853 853

  
854
	/**
855
	 * Creates and populates a popup menu and attaches it to the specified composite.
856
	 * The menu will be accessible through the RCP extension in plugin.xml by its id, eg. "popup:" + menuId.
857
	 * 
858
	 *  The menu ID will be the composite class fullpath
859
	 *  
860
	 * @param composite
861
	 * @param partSite not null
862
	 * @param selectionProvider
863
	 * @return
864
	 */
865
	public static Menu initContextMenu(Composite composite, IWorkbenchPartSite partSite, ISelectionProvider selectionProvider)	{
866
		return initContextMenu(composite, partSite.getId(), partSite, selectionProvider);
867
	}
854 868

  
855 869
	/**
856 870
	 * Creates and populates a popup menu with the specified id and attaches it to the specified composite.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/Explorer.java (revision 674)
65 65
import org.txm.rcp.handlers.files.EditFile;
66 66
import org.txm.rcp.handlers.files.PasteFile;
67 67
import org.txm.rcp.handlers.files.RenameFile;
68
// TODO: Auto-generated Javadoc
68

  
69 69
/**
70
 * Simple file explorer @ author mdecorde.
70
 * Simple file explorer
71
 *  
72
 * @author mdecorde.
71 73
 */
72 74
public class Explorer extends ViewPart {
73 75

  
tmp/org.txm.rcp/plugin.xml (revision 674)
1903 1903
      <menuContribution
1904 1904
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
1905 1905
         <separator
1906
               id="org.txm.rcp.corporaview.corpus"
1906
               id="org.txm.rcp.corporaview.begin"
1907 1907
               name="org.txm.rcp.corporaview.begin"
1908 1908
               visible="true"/>
1909 1909
               <separator
1910
               id="org.txm.rcp.corporaview.corpus"
1910
               id="org.txm.rcp.corporaview.export"
1911 1911
               name="org.txm.rcp.corporaview.export"
1912 1912
               visible="true"/>
1913 1913
            <command
......
1980 1980
            </command>
1981 1981
            <separator
1982 1982
                  name="org.txm.rcp.corporaview.corpus"
1983
                  id="org.txm.rcp.corporaview.corpus"
1983 1984
                  visible="true">
1984 1985
            </separator>
1985 1986
            
......
2019 2020
            </command>
2020 2021
            <separator
2021 2022
                  name="org.txm.rcp.corporaview.annotation"
2023
                  id="org.txm.rcp.corporaview.annotation"
2022 2024
                  visible="true">
2023 2025
            </separator>
2024 2026
            <separator
2025 2027
                  name="org.txm.rcp.corporaview.tools"
2028
                  id="org.txm.rcp.corporaview.tools"
2026 2029
                  visible="true">
2027 2030
            </separator>
2028 2031
            <command
......
2034 2037
            </command>
2035 2038
         <separator
2036 2039
               name="org.txm.rcp.corporaview.text"
2040
               id="org.txm.rcp.corporaview.text"
2037 2041
               visible="true">
2038 2042
         </separator>
2039 2043
         <separator
2040 2044
               name="org.txm.rcp.corporaview.file"
2045
               id="org.txm.rcp.corporaview.file"
2041 2046
               visible="true">
2042 2047
         </separator>
2043 2048

  
......
3094 3099
         point="org.eclipse.ui.contexts">
3095 3100
      <context
3096 3101
            description="Corpora view"
3097
            id="org.txm.rcp.views.corpora.CorporaView"
3102
            id="org.txm.rcp.views.corpora.CorporaViewContext"
3098 3103
            name="Corpora view">
3099 3104
      </context>
3100 3105
   </extension>
tmp/org.txm.backtomedia.rcp/plugin.xml (revision 674)
21 21
         </command>
22 22
      </menuContribution>
23 23
      <menuContribution
24
            locationURI="popup:org.txm.rcp.editors.ConcordancesEditor">
24
            locationURI="popup:org.txm.concordance.rcp.editors.ConcordanceEditor">
25 25
         <command
26 26
               commandId="org.txm.backtomedia.commands.function.BackToMedia"
27 27
               style="push">
tmp/org.txm.searchengine.cqp.rcp/plugin.xml (revision 674)
128 128
         </command>
129 129
      </menuContribution>
130 130
      <menuContribution
131
            locationURI="popup:corporaview.menu.file.export">
131
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.rcp.corporaview.export">
132 132
         <command
133 133
               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
134 134
               icon="icons/functions/compress.png"
tmp/org.txm.synopticeditor.rcp/plugin.xml (revision 674)
5 5
   <extension
6 6
         point="org.eclipse.ui.menus">
7 7
      <menuContribution
8
            locationURI="popup:ConcordanceEditor">
8
            locationURI="popup:org.txm.concordance.rcp.editors.ConcordanceEditor">
9 9
         <command
10 10
               commandId="org.txm.synopticedition.rcp.handlers.BackToText"
11 11
               icon="icons/objects/edition.png"
......
78 78
         </command>
79 79
      </menuContribution>
80 80
      <menuContribution
81
            locationURI="popup:org.txm.rcp.synoptic.editor.SynopticEditionEditor">
81
            locationURI="popup:org.txm.synopticedition.rcp.editors.SynopticEditionEditor">
82 82
         <command
83 83
               commandId="org.txm.rcp.commands.link.TextToConcordance"
84 84
               label="Send to concordances..."
tmp/org.txm.tigersearch.rcp/build.properties (revision 674)
3 3
bin.includes = plugin.xml,\
4 4
               META-INF/,\
5 5
               .,\
6
               icons/
6
               icons/,\
7
               lib/
tmp/org.txm.tigersearch.rcp/plugin.xml (revision 674)
188 188
            </visibleWhen>
189 189
         </command>
190 190
      </menuContribution>
191
      <menuContribution
192
            locationURI="menu:menu.file.import">
193
         <command
194
               commandId="org.txm.rcp.commands.ExecuteScriptImport"
195
               icon="icons/functions/TS.png"
196
               label="XML-TS"
197
               style="push">
198
            <parameter
199
                  name="org.txm.rcp.commands.importscript"
200
                  value="tigersearchLoader.groovy">
201
            </parameter>
202
         </command>
203
      </menuContribution>
191 204
   </extension>
192 205
   <extension
193 206
         point="org.eclipse.ui.editors">
tmp/org.txm.tigersearch.rcp/.classpath (revision 674)
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3
	<classpathentry exported="true" kind="lib" path="lib/"/>
3 4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
5
	<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins">
5 6
		<accessrules>
6 7
			<accessrule kind="accessible" pattern="**"/>
7 8
		</accessrules>
8 9
	</classpathentry>
9 10
	<classpathentry kind="src" path="src"/>
10
	<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
11
	<classpathentry kind="lib" path="lib/log4j-1.2.12.jar"/>
12
	<classpathentry kind="lib" path="lib/TigerSearch.jar"/>
11
	<classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
12
	<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.12.jar"/>
13
	<classpathentry exported="true" kind="lib" path="lib/TigerSearch.jar">
14
		<accessrules>
15
			<accessrule kind="accessible" pattern="**"/>
16
		</accessrules>
17
	</classpathentry>
13 18
	<classpathentry kind="output" path="bin"/>
14 19
</classpath>
tmp/org.txm.tigersearch.rcp/META-INF/MANIFEST.MF (revision 674)
341 341
 tigerAPI.tools,
342 342
 tigersearch4txm,
343 343
 tigersearch4txm.handlers
344
Import-Package: ims.tiger.gui.tigergraphviewer.forest
345 344
Bundle-Vendor: Textometrie.org
345
Bundle-ClassPath: lib/,
346
 .
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/commands/ComputeTIGERSearch.java (revision 674)
69 69
	}
70 70

  
71 71
	public static void openEditor(Object obj) {
72
		
73
		TIGERSearch ts = null;
74
		
72 75
		if (obj instanceof Corpus) {
73
			IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
74
			TIGERSearchEditorInput editorInput = new TIGERSearchEditorInput(obj, null);
75
			try {
76
				TIGERSearchEditor wceditor = (TIGERSearchEditor) page
77
						.openEditor(editorInput,TIGERSearchEditor.ID); //$NON-NLS-1$
78
				//voceditor.initializeFields();
79
			} catch (Exception e) {
80
				Log.printStackTrace(e);
81
			}
76
			ts = new TIGERSearch((Corpus)obj);
82 77
		} else if (obj instanceof TIGERSearch) {
83
			TIGERSearch ts = (TIGERSearch)obj;
84
			IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
85
			TIGERSearchEditorInput editorInput = new TIGERSearchEditorInput(ts.getParent(), ts);
86
			try {
87
				TIGERSearchEditor wceditor = (TIGERSearchEditor) page
88
						.openEditor(editorInput,TIGERSearchEditor.ID); //$NON-NLS-1$
89
				//voceditor.initializeFields();
90
			} catch (Exception e) {
91
				Log.printStackTrace(e);
92
			}
78
			ts = (TIGERSearch)obj;
93 79
		} else {
94 80
			System.out.println("Selection is not a corpus: "+obj);
81
			return;
95 82
		}
83
		
84
		try {
85
			TIGERSearchEditor.openEditor(ts,TIGERSearchEditor.ID); //$NON-NLS-1$
86
		} catch (Exception e) {
87
			Log.printStackTrace(e);
88
		}
96 89
	}
97 90
}

Also available in: Unified diff