Revision 934

tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/messages/messages_ru.properties (revision 934)
1

  
2
CQPPreferencePage_0  = 
3
CQPPreferencePage_1  = Использовать сетевой протокол
4
CQPPreferencePage_10 = Удаленный &сервер CWB
5
CQPPreferencePage_11 = Удаленный сервер: &имя машины
6
CQPPreferencePage_12 = Удаленный сервер: &номер порта
7
CQPPreferencePage_13 = Удаленный сервер: &логин
8
CQPPreferencePage_14 = Удаленный сервер: &пароль
9
CQPPreferencePage_15 = Путь к исполняемому &файлу 'cqpserver'
10
CQPPreferencePage_17 = Путь к файлу инициализации сервера CWB
11
CQPPreferencePage_18 = Дополнительные опции сервера CWB: 
12

  
13
Max_Value_To_Display = Число отображаемых значений свойства
0 14

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/messages/messages_fr.properties (revision 934)
1
Max_Value_To_Display = Nombre de valeurs de propri?t? affich?
0 2

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/messages/PropertiesUIMessages.java (revision 934)
1
package org.txm.properties.rcp.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4
import org.txm.utils.messages.Utf8NLS;
5

  
6
/**
7
 * CAP UI messages.
8
 * 
9
 * @author mdecorde
10
 * @author sjacquot
11
 *
12
 */
13
public class PropertiesUIMessages extends NLS {
14
	
15
	public static String CQPPreferencePage_0;
16
	public static String CQPPreferencePage_1;
17
	public static String CQPPreferencePage_10;
18
	public static String CQPPreferencePage_11;
19
	public static String CQPPreferencePage_12;
20
	public static String CQPPreferencePage_13;
21
	public static String CQPPreferencePage_14;
22
	public static String CQPPreferencePage_15;
23
	public static String CQPPreferencePage_17;
24
	public static String CQPPreferencePage_18;
25
	
26
	
27
	public static String ComputeProperties_0;
28

  
29
	public static String Max_Value_To_Display;
30

  
31
	
32
	static {
33
		// initialize resource bundle
34
		Utf8NLS.initializeMessages(PropertiesUIMessages.class);
35
	}
36
}
0 37

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/messages/messages.properties (revision 934)
1
ComputeProperties_0 = Selection is not structured
2

  
3
Max_Value_To_Display = Maximum values to display
0 4

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/editors/PropertiesEditor.java (revision 934)
1
package org.txm.properties.rcp.editors;
2

  
3
import java.io.File;
4
import java.net.MalformedURLException;
5

  
6
import org.eclipse.jface.layout.GridDataFactory;
7
import org.eclipse.swt.SWT;
8
import org.eclipse.swt.browser.Browser;
9
import org.eclipse.swt.custom.StyledText;
10
import org.eclipse.swt.events.SelectionEvent;
11
import org.eclipse.swt.events.SelectionListener;
12
import org.eclipse.swt.layout.GridData;
13
import org.eclipse.swt.layout.GridLayout;
14
import org.eclipse.swt.layout.RowData;
15
import org.eclipse.swt.widgets.Button;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Group;
18
import org.eclipse.swt.widgets.Label;
19
import org.eclipse.swt.widgets.Spinner;
20
import org.eclipse.swt.widgets.Text;
21
import org.txm.core.results.Parameter;
22
import org.txm.properties.core.functions.Properties;
23
import org.txm.properties.core.preferences.PropertiesPreferences;
24
import org.txm.rcp.editors.TXMEditor;
25
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
26
import org.txm.rcp.swt.GLComposite;
27
import org.txm.rcp.views.corpora.CorporaView;
28
import org.txm.utils.logger.Log;
29

  
30
/**
31
 * Corpus, Subcorpus or Partition information editor.
32
 * 
33
 * @author mdecorde
34
 * @author sjacquot
35
 *
36
 */
37
public class PropertiesEditor extends TXMEditor<Properties> {
38

  
39

  
40
	/**
41
	 * The browser to display the HTML file.
42
	 */
43
	private Browser browser;
44

  
45

  
46
	/**
47
	 * The maximum number of word property values to display.
48
	 */
49
	@Parameter(key=PropertiesPreferences.MAX_PROPERTIES_TO_DISPLAY)
50
	protected Spinner maxPropertiesToDisplay;
51

  
52

  
53
	private Button nameSaveButton;
54

  
55

  
56
	private Text nameText;
57

  
58

  
59
	private StyledText descriptionText;
60

  
61

  
62
	private Button descriptionSaveButton;
63

  
64

  
65

  
66
	@Override
67
	public void _createPartControl() {
68

  
69
		Composite parametersArea = this.getExtendedParametersComposite();
70

  
71
		// label
72
		new Label(parametersArea, SWT.NONE).setText("V max");
73

  
74
		// spinner
75
		this.maxPropertiesToDisplay = new Spinner(parametersArea, SWT.BORDER);
76
		this.maxPropertiesToDisplay.setToolTipText("The maximum number of word property values to show");
77
		this.maxPropertiesToDisplay.setMinimum(0);
78
		RowData gdata = new RowData();
79
		gdata.width = 100;
80
		this.maxPropertiesToDisplay.setLayoutData(gdata);
81
		this.maxPropertiesToDisplay.addSelectionListener(new ComputeSelectionListener(this));
82

  
83
		Group editComposite = this.getTopToolbar().installGroup("edit properties", "edit properties", null, null, false);
84
		editComposite.setLayout(GLComposite.createDefaultLayout(3));
85
		
86
		Label nameLabel = new Label(editComposite, SWT.NONE);
87
		nameLabel.setText("Displayed name: ");
88

  
89
		nameText = new Text(editComposite, SWT.BORDER);
90
		nameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
91
		nameSaveButton = new Button(editComposite, SWT.PUSH);
92
		nameSaveButton.setText("Apply");
93
		nameSaveButton.addSelectionListener(new SelectionListener() {
94
			@Override
95
			public void widgetSelected(SelectionEvent e) {
96
				String newName = nameText.getText().trim();
97
				if (newName.length() > 0) {
98
					getResult().getCorpus().setUserName(newName);
99
					CorporaView.refreshObject(getResult().getCorpus());
100
				}
101
			}
102

  
103
			@Override
104
			public void widgetDefaultSelected(SelectionEvent e) { }
105
		});
106

  
107
		Label descLabel = new Label(editComposite, SWT.NONE);
108
		descLabel.setText("Description: ");
109

  
110
		descriptionText = new StyledText(editComposite, SWT.BORDER|SWT.V_SCROLL);
111
		descriptionText.setLayoutData(GridDataFactory.fillDefaults().hint(400, 100).minSize(400, 100).span(1, 2).create());
112
		descriptionSaveButton = new Button(editComposite, SWT.PUSH);
113
		descriptionSaveButton.setText("Apply");
114
		descriptionSaveButton.addSelectionListener(new SelectionListener() {
115
			@Override
116
			public void widgetSelected(SelectionEvent e) {
117
				String newDescription = descriptionText.getText().trim();
118
				if (newDescription.length() > 0) {
119
					getResult().getCorpus().setDescription(newDescription);
120
					getResult().setDirty();
121
					compute(true);
122
				}
123
			}
124

  
125
			@Override
126
			public void widgetDefaultSelected(SelectionEvent e) { }
127
		});
128

  
129
		// browser
130
		GLComposite displayArea = this.getResultArea();
131

  
132
		this.browser = new Browser(displayArea, SWT.NONE);
133
		this.browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
134
	}
135

  
136
	@Override
137
	public void updateEditorFromResult(boolean update) throws Exception {
138
		File file = this.getResult().getHTMLFile();
139
		if (file.exists()) {
140
			this.browser.setUrl(file.toURI().toURL().toString());
141
		}
142
		else	{
143
			Log.severe("Information HTML file doesn't exist."); //$NON-NLS-1$
144
		}
145
		String n = getResult().getCorpus().getUserName();
146
		if (n == null) n = getResult().getCorpus().getName();
147
		nameText.setText(n);
148

  
149
		String d = getResult().getCorpus().getDescription();
150
		if (d != null) {
151
			descriptionText.setText(getResult().getCorpus().getDescription());
152
		}
153
	}
154

  
155
	@Override
156
	public void updateResultFromEditor() {
157
		// nothing to do
158
	}
159

  
160
}
0 161

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/handlers/ComputeProperties.java (revision 934)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.properties.rcp.handlers;
29

  
30
import org.eclipse.core.commands.ExecutionEvent;
31
import org.eclipse.core.commands.ExecutionException;
32
import org.txm.properties.core.functions.Properties;
33
import org.txm.properties.rcp.editors.PropertiesEditor;
34
import org.txm.rcp.editors.TXMEditor;
35
import org.txm.rcp.handlers.BaseAbstractHandler;
36
import org.txm.rcp.views.corpora.CorporaView;
37
import org.txm.searchengine.cqp.corpus.Corpus;
38

  
39
/**
40
 * Calls the function Information on a MainCorpus or a SubCorpus.
41
 * Displays basic statistics and gives some properties values. 
42
 * 
43
 * @author mdecorde
44
 * @author sjacquot
45
 */
46
public class ComputeProperties extends BaseAbstractHandler {
47
	
48
	
49
	@Override
50
	public Object execute(ExecutionEvent event) throws ExecutionException {
51

  
52
		if (!this.checkCorpusEngine())	{
53
			return false;
54
		}
55
		
56
		Object selection = this.getCorporaViewSelectedObject(event);
57
		Properties information = null;
58
		
59
		// Creating from Corpus
60
		if (selection instanceof Corpus) {
61
			information = new Properties((Corpus) selection);
62
		}
63
		// Reopening from existing result
64
		else if(selection instanceof Properties)	{
65
			information = (Properties) selection;
66
		}
67
		// Error
68
		else	{
69
			return super.logCanNotCompute(selection);
70
		}
71
		
72
		TXMEditor.openEditor(information, PropertiesEditor.class.getName());
73
		return null;
74
	}
75
}
0 76

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/preferences/PropertiesPreferencePage.java (revision 934)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.properties.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.IntegerFieldEditor;
31
import org.eclipse.ui.IWorkbench;
32
import org.txm.core.messages.TXMCoreMessages;
33
import org.txm.properties.core.preferences.PropertiesPreferences;
34
import org.txm.properties.rcp.messages.PropertiesUIMessages;
35
import org.txm.rcp.preferences.TXMPreferencePage;
36
import org.txm.rcp.preferences.TXMPreferenceStore;
37
import org.txm.searchengine.cqp.CQPPreferences;
38

  
39
/**
40
 * Information preferences page.
41
 * 
42
 * @author mdecorde
43
 * @author sjacquot
44
 *
45
 */
46
public class PropertiesPreferencePage extends TXMPreferencePage {
47

  
48
		
49
	@Override
50
	public void init(IWorkbench workbench) {
51
		this.setPreferenceStore(new TXMPreferenceStore(PropertiesPreferences.PREFERENCES_NODE));
52
		this.setTitle(TXMCoreMessages.common_description);
53
	}
54
	
55

  
56
	@Override
57
	public void createFieldEditors() {
58
		
59
		// The maximum number of word property values to display
60
		IntegerFieldEditor maxValue = new IntegerFieldEditor(PropertiesPreferences.MAX_PROPERTIES_TO_DISPLAY, PropertiesUIMessages.Max_Value_To_Display, this.getFieldEditorParent());
61
		maxValue.setValidRange(1, 9999);
62
		this.addField(maxValue);
63
	}
64
}
0 65

  
tmp/org.txm.properties.rcp/src/org/txm/properties/rcp/adapters/PropertiesAdapterFactory.java (revision 934)
1
// Copyright © 2010-2013 ENS de Lyon.
2
package org.txm.properties.rcp.adapters;
3

  
4
import org.eclipse.jface.resource.ImageDescriptor;
5
import org.eclipse.ui.model.IWorkbenchAdapter;
6
import org.eclipse.ui.plugin.AbstractUIPlugin;
7
import org.osgi.framework.FrameworkUtil;
8
import org.txm.properties.core.functions.Properties;
9
import org.txm.rcp.adapters.TXMResultAdapter;
10
import org.txm.rcp.adapters.TXMResultAdapterFactory;
11

  
12

  
13
/**
14
 * 
15
 *  
16
 * @author mdecorde
17
 * @author sjacquot
18
 */
19
public class PropertiesAdapterFactory extends TXMResultAdapterFactory {
20

  
21
	public static final ImageDescriptor ICON =
22
			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(PropertiesAdapterFactory.class).getSymbolicName(),
23
					"platform:/plugin/"+ FrameworkUtil.getBundle(PropertiesAdapterFactory.class).getSymbolicName() + "/icons/functions/properties.png"); //$NON-NLS-1$ //$NON-NLS-2$
24

  
25
	
26
	@Override
27
	public Object getAdapter(Object adaptableObject, Class adapterType) {
28
		if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Properties)	{
29
			return new TXMResultAdapter() {
30
				@Override
31
				public ImageDescriptor getImageDescriptor(Object object) {
32
					return ICON;
33
				}
34
			};
35
		}
36
		return null;
37
	}
38
	
39
}
0 40

  
tmp/org.txm.properties.rcp/build.properties (revision 934)
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .,\
5
               plugin.xml,\
6
               icons/,\
7
               OSGI-INF/
0 8

  
tmp/org.txm.properties.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 934)
1

  
2
command.name = \u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435
0 3

  
tmp/org.txm.properties.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 934)
1

  
2
command.name = Propri\u00E9t\u00E9s
0 3

  
tmp/org.txm.properties.rcp/OSGI-INF/l10n/bundle.properties (revision 934)
1
command.name=Properties
0 2

  
tmp/org.txm.properties.rcp/plugin.xml (revision 934)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.ui.preferencePages">
6
      <page
7
            category="org.txm.rcp.preferences.UserPreferencePage"
8
            class="org.txm.properties.rcp.preferences.PropertiesPreferencePage"
9
            id="org.txm.properties.rcp.preferences.PropertiesPreferencePage"
10
            name="%command.name">
11
      </page>
12
   </extension>
13
   <extension
14
         point="org.eclipse.ui.commands">
15
      <command
16
            defaultHandler="org.txm.properties.rcp.handlers.ComputeProperties"
17
            id="org.txm.properties.rcp.handlers.ComputeProperties"
18
            name="%command.name"
19
            returnTypeId="org.txm.properties.core.functions.Properties">
20
      </command>
21
   </extension>
22
   <extension
23
         point="org.eclipse.ui.editors">
24
      <editor
25
            class="org.txm.properties.rcp.editors.PropertiesEditor"
26
            default="false"
27
            icon="icons/functions/properties.png"
28
            id="org.txm.properties.rcp.editors.PropertiesEditor"
29
            name="%command.name">
30
      </editor>
31
   </extension>
32
   <extension
33
         point="org.eclipse.core.runtime.adapters">
34
      <factory
35
            adaptableType="org.txm.properties.core.functions.Properties"
36
            class="org.txm.properties.rcp.adapters.PropertiesAdapterFactory">
37
         <adapter
38
               type="org.eclipse.ui.model.IWorkbenchAdapter">
39
         </adapter>
40
      </factory>
41
   </extension>
42
   <extension
43
         point="org.eclipse.ui.menus">
44
      <menuContribution
45
            locationURI="toolbar:org.txm.rcp.toolbarcorpus?after=org.txm.edition.rcp.handlers.OpenEdition">
46
         <command
47
               commandId="org.txm.properties.rcp.handlers.ComputeProperties"
48
               icon="icons/functions/properties.png"
49
               style="push"
50
               tooltip="%command.name">
51
            <visibleWhen
52
                  checkEnabled="false">
53
               <or>
54
                  <reference
55
                        definitionId="OneCorpusSelected">
56
                  </reference>
57
               </or>
58
            </visibleWhen>
59
         </command>
60
      </menuContribution>
61
      <menuContribution
62
            locationURI="menu:menu.corpus?after=menu.corpus.read">
63
         <command
64
               commandId="org.txm.properties.rcp.handlers.ComputeProperties"
65
               icon="icons/functions/properties.png"
66
               style="push">
67
            <visibleWhen
68
                  checkEnabled="false">
69
               <reference
70
                     definitionId="OneCorpusSelected">
71
               </reference>
72
            </visibleWhen>
73
         </command>
74
      </menuContribution>
75
      <menuContribution
76
            locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.rcp.corporaview.corpus.read">
77
         <command
78
               commandId="org.txm.properties.rcp.handlers.ComputeProperties"
79
               icon="icons/functions/properties.png"
80
               style="push">
81
            <visibleWhen
82
                  checkEnabled="false">
83
               <reference
84
                     definitionId="OneCorpusSelected">
85
               </reference>
86
            </visibleWhen>
87
         </command>
88
      </menuContribution>
89
   </extension>
90
</plugin>
0 91

  
tmp/org.txm.properties.rcp/.settings/org.eclipse.jdt.core.prefs (revision 934)
1
eclipse.preferences.version=1
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4
org.eclipse.jdt.core.compiler.compliance=1.6
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7
org.eclipse.jdt.core.compiler.source=1.6
0 8

  
tmp/org.txm.properties.rcp/.classpath (revision 934)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<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
		<accessrules>
6
			<accessrule kind="accessible" pattern="**"/>
7
		</accessrules>
8
	</classpathentry>
9
	<classpathentry kind="src" path="src"/>
10
	<classpathentry kind="output" path="bin"/>
11
</classpath>
0 12

  
tmp/org.txm.properties.rcp/META-INF/MANIFEST.MF (revision 934)
1
Manifest-Version: 1.0
2
Require-Bundle: org.txm.rcp;bundle-version="0.8.0";visibility:=reexport,
3
 org.txm.properties.core;bundle-version="1.0.0";visibility:=reexport
4
Bundle-Vendor: Textometrie.org
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Name: Corpus Properties RCP
7
Bundle-ManifestVersion: 2
8
Bundle-SymbolicName: org.txm.properties.rcp;singleton:=true
9
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
10
Export-Package: org.txm.properties.rcp.adapters,
11
 org.txm.properties.rcp.editors,
12
 org.txm.properties.rcp.handlers,
13
 org.txm.properties.rcp.messages,
14
 org.txm.properties.rcp.preferences
15

  
0 16

  
tmp/org.txm.properties.rcp/.project (revision 934)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.properties.rcp</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  

Also available in: Unified diff