Révision 1958

tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/handlers/SendToRCommand.java (revision 1958)
27 27
//
28 28
package org.txm.statsengine.r.rcp.handlers;
29 29

  
30
import java.util.HashMap;
30 31
import java.util.List;
31 32

  
32 33
import org.eclipse.core.commands.ExecutionEvent;
......
44 45
import org.txm.rcp.views.corpora.CorporaView;
45 46
import org.txm.statsengine.core.StatsEnginesManager;
46 47
import org.txm.statsengine.r.core.RStatsEngine;
48
import org.txm.statsengine.r.core.RTransformer;
47 49
import org.txm.statsengine.r.rcp.messages.RUIMessages;
48 50
import org.txm.statsengine.r.rcp.views.RVariablesView;
49 51
import org.txm.utils.logger.Log;
......
55 57
 * 
56 58
 * @author mdecorde.
57 59
 */
58
public abstract class SendToRCommand extends BaseAbstractHandler {
60
public class SendToRCommand extends BaseAbstractHandler {
59 61

  
60 62
	/* (non-Javadoc)
61 63
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
......
86 88
								this.acquireSemaphore();
87 89
								String symbol = send((TXMResult)o);
88 90
								if (symbol == null) {
89
									Log.info("** {0} was not transfered to the R workspace.");
91
									Log.info(NLS.bind("** {0} was not transfered to the R workspace.", ((TXMResult) o).getSimpleName()));
90 92
									this.releaseSemaphore();
91 93
									return Status.CANCEL_STATUS;
92 94
								} else {
......
135 137
	public String send(TXMResult o) throws Exception {
136 138
	
137 139
		RStatsEngine rengine = (RStatsEngine)StatsEnginesManager.getREngine();
138
		if (rengine.getTransformers().containsKey(o.getClass().getName())) {
139
			return rengine.getTransformers().get(o.getClass().getName()).fromTXMtoR(o);
140
		HashMap<String, RTransformer<? extends TXMResult>> transformers = rengine.getTransformers();
141
		if (transformers.containsKey(o.getClass().getName())) {
142
			RTransformer<? extends TXMResult> transformer = rengine.getTransformers().get(o.getClass().getName());
143
			return transformer.fromTXMtoR(o);
140 144
		} else {
141 145
			Log.info(NLS.bind("{0} cannot be copied in thr R workspace", o.getSimpleName()));
142 146
			return null;
tmp/org.txm.statsengine.r.core/plugin.xml (revision 1958)
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<?eclipse version="3.4"?>
3 3
<plugin>
4
   <extension-point id="org.txm.statengine.r.core.RTransformer" name="org.txm.statengine.r.core.RTransformer" schema="schema/org.txm.statengine.r.core.RTransformer.exsd"/>
4
   <extension-point id="org.txm.statsengine.r.core.RTransformer" name="org.txm.statsengine.r.core.RTransformer" schema="schema/org.txm.statsengine.r.core.RTransformer.exsd"/>
5 5
   <extension
6 6
         point="org.eclipse.core.runtime.preferences">
7 7
      <initializer
tmp/org.txm.statsengine.r.core/schema/org.txm.statengine.r.core.RTransformer.exsd (revision 1958)
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.txm.statsengine.r.core" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.txm.statsengine.r.core" id="org.txm.statengine.r.core.RTransformer" name="org.txm.statengine.r.core.RTransformer"/>
7
      </appinfo>
8
      <documentation>
9
         A transformer allow to import data in the RWorkspace or to export a R data to a TXM object
10
      </documentation>
11
   </annotation>
12

  
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <choice minOccurs="1" maxOccurs="unbounded">
21
            <element ref="transformer"/>
22
         </choice>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appinfo>
43
                  <meta.attribute translatable="true"/>
44
               </appinfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49

  
50
   <element name="transformer">
51
      <complexType>
52
         <attribute name="class" type="string" use="required">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="java" basedOn="org.txm.statsengine.r.core.RTransformer"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
62
         <attribute name="type" type="string" use="required">
63
            <annotation>
64
               <documentation>
65
                  The TXMResult managed by the transformer
66
               </documentation>
67
               <appinfo>
68
                  <meta.attribute kind="java" basedOn="org.txm.core.results.TXMResult:"/>
69
               </appinfo>
70
            </annotation>
71
         </attribute>
72
      </complexType>
73
   </element>
74

  
75
   <annotation>
76
      <appinfo>
77
         <meta.section type="since"/>
78
      </appinfo>
79
      <documentation>
80
         [Enter the first release in which this extension point appears.]
81
      </documentation>
82
   </annotation>
83

  
84
   <annotation>
85
      <appinfo>
86
         <meta.section type="examples"/>
87
      </appinfo>
88
      <documentation>
89
         [Enter extension point usage example here.]
90
      </documentation>
91
   </annotation>
92

  
93
   <annotation>
94
      <appinfo>
95
         <meta.section type="apiinfo"/>
96
      </appinfo>
97
      <documentation>
98
         [Enter API information here.]
99
      </documentation>
100
   </annotation>
101

  
102
   <annotation>
103
      <appinfo>
104
         <meta.section type="implementation"/>
105
      </appinfo>
106
      <documentation>
107
         [Enter information about supplied implementation of this extension point.]
108
      </documentation>
109
   </annotation>
110

  
111

  
112
</schema>
tmp/org.txm.statsengine.r.core/schema/org.txm.statsengine.r.core.RTransformer.exsd (revision 1958)
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.txm.statsengine.r.core" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.txm.statsengine.r.core" id="org.txm.statsengine.r.core.RTransformer" name="org.txm.statsengine.r.core.RTransformer"/>
7
      </appinfo>
8
      <documentation>
9
         A transformer allow to import data in the RWorkspace or to export a R data to a TXM object
10
      </documentation>
11
   </annotation>
12

  
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <choice minOccurs="1" maxOccurs="unbounded">
21
            <element ref="transformer"/>
22
         </choice>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appinfo>
43
                  <meta.attribute translatable="true"/>
44
               </appinfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49

  
50
   <element name="transformer">
51
      <complexType>
52
         <attribute name="class" type="string">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="java" basedOn="org.txm.statsengine.r.core.RTransformer:"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
62
         <attribute name="type" type="string">
63
            <annotation>
64
               <documentation>
65
                  The TXMResult managed by the transformer
66
               </documentation>
67
               <appinfo>
68
                  <meta.attribute kind="java" basedOn="org.txm.core.results.TXMResult:"/>
69
               </appinfo>
70
            </annotation>
71
         </attribute>
72
      </complexType>
73
   </element>
74

  
75
   <annotation>
76
      <appinfo>
77
         <meta.section type="since"/>
78
      </appinfo>
79
      <documentation>
80
         [Enter the first release in which this extension point appears.]
81
      </documentation>
82
   </annotation>
83

  
84
   <annotation>
85
      <appinfo>
86
         <meta.section type="examples"/>
87
      </appinfo>
88
      <documentation>
89
         [Enter extension point usage example here.]
90
      </documentation>
91
   </annotation>
92

  
93
   <annotation>
94
      <appinfo>
95
         <meta.section type="apiinfo"/>
96
      </appinfo>
97
      <documentation>
98
         [Enter API information here.]
99
      </documentation>
100
   </annotation>
101

  
102
   <annotation>
103
      <appinfo>
104
         <meta.section type="implementation"/>
105
      </appinfo>
106
      <documentation>
107
         [Enter information about supplied implementation of this extension point.]
108
      </documentation>
109
   </annotation>
110

  
111

  
112
</schema>
0 113

  
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java (revision 1958)
3 3
import java.util.HashMap;
4 4

  
5 5
import org.eclipse.core.runtime.IConfigurationElement;
6
import org.eclipse.core.runtime.IExtensionPoint;
6 7
import org.eclipse.core.runtime.IProgressMonitor;
7 8
import org.eclipse.core.runtime.RegistryFactory;
8 9
import org.txm.core.messages.TXMCoreMessages;
......
102 103
	private void loadRTransformers() {
103 104
		
104 105
		transformers.clear();
106

  
105 107
		IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(RTransformer.class.getName());
106 108

  
107
		Log.finest(TXMCoreMessages.bind("Looking for R transformers contributions with extension point id {1}...", RTransformer.class.getName())); //$NON-NLS-1$
108
		Log.finest(TXMCoreMessages.bind("{0} transformers(s) found.", contributions.length)); //$NON-NLS-1$
109
		Log.fine(TXMCoreMessages.bind("Looking for R transformers contributions with extension point id ''{0}''...", RTransformer.class.getName())); //$NON-NLS-1$
110
		Log.fine(TXMCoreMessages.bind("{0} transformers(s) found.", contributions.length)); //$NON-NLS-1$
109 111

  
110 112
		for (int i = 0; i < contributions.length; i++) {
111 113
			try {
112 114
				@SuppressWarnings("unchecked")
113 115
				RTransformer<? extends TXMResult> transformer = (RTransformer<? extends TXMResult>) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
114 116

  
115
				Log.fine(TXMCoreMessages.bind("Registering R transformer: {0}...", transformer));
117
				Log.finer(TXMCoreMessages.bind("Registering R transformer: {0}...", transformer));
116 118

  
117 119
				transformers.put(contributions[i].getAttribute("type"), transformer);
118 120
			} catch (Exception e) {
tmp/org.txm.statsengine.r.core/build.properties (revision 1958)
4 4
               plugin.xml,\
5 5
               .,\
6 6
               R/,\
7
               OSGI-INF/
7
               OSGI-INF/,\
8
               schema/
8 9
source..=src/
9 10
qualifier=svn
tmp/org.txm.rcp/src/main/java/org/txm/rcp/Application.java (revision 1958)
135 135
					+ System.getProperty("file.separator"));
136 136

  
137 137
			String[] fontFiles = javaFontsPath.list();
138
			for (int i = 0; i < fontFiles.length; i++) {
139
				if(fontFiles[i].endsWith(".ttf"))    { //$NON-NLS-1$
140
					File fontFile = new File(javaFontsPath, fontFiles[i]);
141
					Log.finest("Loading Java font to SWT Device from file " + fontFile + "...");
142
					// Load the font in SWT
143
					Display.getDefault().loadFont(fontFile.getAbsolutePath());
138
			if (fontFiles != null) {
139
				for (int i = 0; i < fontFiles.length; i++) {
140
					if(fontFiles[i].endsWith(".ttf"))    { //$NON-NLS-1$
141
						File fontFile = new File(javaFontsPath, fontFiles[i]);
142
						Log.finest("Loading Java font to SWT Device from file " + fontFile + "...");
143
						// Load the font in SWT
144
						Display.getDefault().loadFont(fontFile.getAbsolutePath());
145
					}
144 146
				}
145 147
			}
146 148
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java (revision 1958)
40 40
import org.txm.rcp.utils.JobHandler;
41 41
import org.txm.rcp.views.SummaryView;
42 42
import org.txm.rcp.views.fileexplorer.MacroExplorer;
43
import org.txm.utils.logger.Log;
43 44

  
44 45
// TODO: Auto-generated Javadoc
45 46
/**
......
65 66
				try {
66 67
					monitor.beginTask(TXMUIMessages.restartTXM, 100);
67 68
					//Toolbox.updateProperties(TxmPreferences.getProperties());
68
					Toolbox.restart();
69
					if (Toolbox.restart()) {
70
						Log.info(TXMUIMessages.info_txmIsReady);
71
					} else {
72
						Log.warning("TXM not restarted normally.");
73
					}
69 74

  
70 75
					monitor.worked(95);
71 76
					syncExec(new Runnable() {
tmp/org.txm.index.core/src/org/txm/index/core/r/IndexRTransformer.java (revision 1958)
37 37
	 */
38 38
	@Override
39 39
	public String fromTXMtoR(TXMResult o) throws RWorkspaceException {
40
		if ((o instanceof Index)) return null;
40
		if (!(o instanceof Index)) return null;
41 41
		
42 42
		Index index = (Index)o;
43 43
		
......
53 53

  
54 54
		int[] freq = new int[lines.size()];
55 55

  
56
		for (int i = 0 ; i < lines.size() ; i++) 
57
		{
58
			Line ligne = lines.get(i);
59
			freq[i] = ligne.getFrequency(); 
60
			keywords[i] = ligne.toString();
56
		for (int i = 0 ; i < lines.size() ; i++) {
57
			Line line = lines.get(i);
58
			freq[i] = line.getFrequency(); 
59
			keywords[i] = line.toString();
61 60
		}
62 61

  
63 62
		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
tmp/org.txm.index.core/plugin.xml (revision 1958)
7 7
            class="org.txm.index.core.preferences.IndexPreferences">
8 8
      </initializer>
9 9
   </extension>
10
   <extension
11
         point="org.txm.statengine.r.core.RTransformer">
12
      <transformer
10
   
11
      <extension
12
         point="org.txm.statsengine.r.core.RTransformer">
13
      <transfert
13 14
            class="org.txm.index.core.r.IndexRTransformer"
14 15
            type="org.txm.index.core.functions.Index">
15
      </transformer>
16
      </transfert>
16 17
   </extension>
17 18

  
18 19
</plugin>
tmp/org.txm.index.core/META-INF/MANIFEST.MF (revision 1958)
1 1
Manifest-Version: 1.0
2 2
Require-Bundle: org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport,
3 3
 org.txm.statsengine.r.core;bundle-version="1.0.0";visibility:=reexport
4
Export-Package: org.txm.index.core.functions,org.txm.index.core.messag
5
 es,org.txm.index.core.preferences,org.txm.macro.r,org.txm.test
4
Export-Package: org.txm.index.core.functions,
5
 org.txm.index.core.messages,
6
 org.txm.index.core.preferences,
7
 org.txm.index.core.r,
8
 org.txm.macro.r,
9
 org.txm.test
6 10
Bundle-Vendor: Textometrie.org
7 11
Bundle-ActivationPolicy: lazy
8 12
Bundle-Version: 1.0.0.qualifier

Formats disponibles : Unified diff