Révision 39

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

  
tmp/org.txm.partition.rcp/plugin.xml (revision 39)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4

  
5
   <extension
6
         point="org.eclipse.ui.commands">
7
      <command
8
            categoryId="org.txm.rcpapplication.category.txm"
9
            defaultHandler="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
10
            id="org.txm.rcp.partition.handlers.ComputePartitionDimensionsBarChart"
11
            name="Dimensions2">
12
      </command>
13
   </extension>
14
   <extension
15
         point="org.eclipse.ui.handlers">
16
      <handler
17
            commandId="org.txm.rcp.partition.handlers.ComputePartitionDimensionsBarChart"
18
            class="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart">
19
      </handler>
20
   </extension>
21
   <extension
22
         point="org.eclipse.ui.menus">
23
      <menuContribution
24
            allPopups="false"
25
            locationURI="toolbar:org.txm.rcpapplication.toolbartools">
26
         <command
27
               commandId="org.txm.rcp.partition.handlers.ComputePartitionDimensionsBarChart"
28
               icon="icons/dimensions.png"
29
               label="Dimensions2"
30
               style="push"
31
               tooltip="Dimensions2">
32
            <visibleWhen
33
                  checkEnabled="false">
34
               <or>
35
                  <reference
36
                        definitionId="OnePartitionSelected">
37
                  </reference>
38
               </or>
39
            </visibleWhen>
40
         </command>
41
      </menuContribution>
42
      <menuContribution
43
            locationURI="menu:menu.tools">
44
         <command
45
               commandId="org.txm.rcp.partition.handlers.ComputePartitionDimensionsBarChart"
46
               icon="icons/dimensions.png"
47
               label="Dimensions2"
48
               style="push"
49
               tooltip="Dimensions2">
50
            <visibleWhen
51
                  checkEnabled="false">
52
               <or>
53
                  <reference
54
                        definitionId="OnePartitionSelected">
55
                  </reference>
56
               </or>
57
            </visibleWhen>
58
         </command>
59
      </menuContribution>
60
      <menuContribution
61
            allPopups="false"
62
            locationURI="popup:org.txm.rcpapplication.views.CorporaView">
63
         <command
64
               commandId="org.txm.rcp.partition.handlers.ComputePartitionDimensionsBarChart"
65
               icon="icons/dimensions.png"
66
               label="Dimensions2"
67
               style="push"
68
               tooltip="Dimensions2">
69
            <visibleWhen
70
                  checkEnabled="false">
71
               <or>
72
                  <reference
73
                        definitionId="OnePartitionSelected">
74
                  </reference>
75
               </or>
76
            </visibleWhen>
77
         </command>
78
      </menuContribution>
79
   </extension>
80
   <extension
81
         point="org.eclipse.ui.preferencePages">
82
      <page
83
            category="org.txm.rcpapplication.preferences.UserPreferencePage"
84
            class="org.txm.partition.rcp.preferences.PartitionPreferencePage"
85
            id="org.txm.rcp.partition.preferences.PartitionPreferencePage"
86
            name="Partition">
87
      </page>
88
   </extension>
89
   <extension
90
         point="org.eclipse.ui.editors">
91
      <editor
92
            class="org.txm.chartsengine.rcp.editors.ChartEditorPart"
93
            default="false"
94
            icon="icons/dimensions.png"
95
            id="org.txm.searchengine.cqp.corpus.Partition"
96
            name="Dimensions">
97
      </editor>
98
   </extension>
99

  
100
</plugin>
0 101

  
tmp/org.txm.partition.rcp/.settings/org.eclipse.jdt.core.prefs (revision 39)
1
eclipse.preferences.version=1
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4
org.eclipse.jdt.core.compiler.compliance=1.7
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.7
0 8

  
tmp/org.txm.partition.rcp/.classpath (revision 39)
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.7"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
0 8

  
tmp/org.txm.partition.rcp/META-INF/MANIFEST.MF (revision 39)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Partition RCP
4
Bundle-SymbolicName: org.txm.partition.rcp;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Require-Bundle: org.txm.chartsengine.rcp,
7
 org.eclipse.ui,
8
 org.eclipse.core.runtime,
9
 org.txm.toolbox;bundle-version="0.7.0",
10
 org.txm.rcpapplication;bundle-version="0.7.8",
11
 org.txm.partition.core;bundle-version="1.0.0",
12
 org.txm.chartsengine.core
13
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
14
Bundle-ActivationPolicy: lazy
15
Bundle-Vendor: TXM
0 16

  
tmp/org.txm.partition.rcp/.project (revision 39)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.partition.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
		<buildCommand>
24
			<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
25
			<arguments>
26
			</arguments>
27
		</buildCommand>
28
	</buildSpec>
29
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
31
		<nature>org.eclipse.jdt.core.javanature</nature>
32
		<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
33
	</natures>
34
</projectDescription>
0 35

  
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java (revision 39)
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.partition.rcp.handlers;
29

  
30
import java.util.List;
31

  
32
import org.eclipse.core.commands.AbstractHandler;
33
import org.eclipse.core.commands.ExecutionEvent;
34
import org.eclipse.core.commands.ExecutionException;
35
import org.eclipse.jface.viewers.IStructuredSelection;
36
import org.eclipse.ui.handlers.HandlerUtil;
37
import org.txm.Toolbox;
38
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
39
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
40
import org.txm.partition.core.preferences.PartitionDimensionsPreferences;
41
import org.txm.rcpapplication.Application;
42
import org.txm.rcpapplication.JobsTimer;
43
import org.txm.rcpapplication.Messages;
44
import org.txm.searchengine.cqp.corpus.Part;
45
import org.txm.searchengine.cqp.corpus.Partition;
46

  
47
/**
48
 * Creates and opens a bar chart editor with the dimensions of the selected partition.
49
 * 
50
 * @author mdecorde
51
 * @author sjacquot
52
 * 
53
 */
54
public class ComputePartitionDimensionsBarChart extends AbstractHandler {
55

  
56

  
57
	/* (non-Javadoc)
58
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
59
	 */
60
	@Override
61
	public Object execute(ExecutionEvent event) throws ExecutionException {
62
		if (!Toolbox.isSearchEngineInitialized()) return false;
63
		
64
		if (!Toolbox.isStatEngineInitialized()) {
65
			System.out.println(Messages.PartsSize_0);
66
			return null;
67
		}
68
		
69
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
70

  
71
		if (selection.getFirstElement() instanceof Partition) {
72
			final Partition partition = (Partition) selection.getFirstElement();
73
			try {
74

  
75
				JobsTimer.start();
76

  
77
				List<Part> parts = partition.getParts();
78
				if(parts.size() == 0)	{
79
					return false;
80
				}
81

  
82
				// Creates and opens the chart editor
83
				SWTChartsComponentsProvider.getCurrent().openEditor(Messages.bind(Messages.PartsSize_18, partition.getName()), partition, PartitionDimensionsPreferences.PREFERENCES_NODE,
84
						"Partition Dimensions Bar Chart");
85

  
86
				// FIXME: Pie chart tests
87
				SWTChartsComponentsProvider.getCurrent().openEditor(Messages.bind(Messages.PartsSize_18, partition.getName()), partition, PartitionDimensionsPreferences.PREFERENCES_NODE,
88
						"Partition Dimensions Pie Chart");
89
				
90
				
91
				JobsTimer.stopAndPrint();
92
			} catch (Exception e) {
93
				org.txm.rcpapplication.utils.Logger.printStackTrace(e);
94
			}
95
		}
96

  
97
		return null;
98
	}
99
	
100
}
0 101

  
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/preferences/PartitionPreferencePage.java (revision 39)
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.partition.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.BooleanFieldEditor;
31
import org.eclipse.swt.widgets.Group;
32
import org.eclipse.ui.IWorkbench;
33
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
34
import org.txm.partition.core.preferences.PartitionDimensionsPreferences;
35
import org.txm.partition.rcp.messages.RCPPartitionMessages;
36
import org.txm.rcp.preferences.TXMPreferencePage;
37
import org.txm.rcp.preferences.TXMPreferenceStore;
38
import org.txm.rcpapplication.Messages;
39

  
40
/**
41
 * 
42
 * @author mdecorde
43
 * @author sjacquot
44
 *
45
 */
46
public class PartitionPreferencePage extends TXMPreferencePage {
47

  
48

  
49
	/**
50
	 * The Constant ID.
51
	 */
52
	public static final String ID = "org.txm.rcp.partition.preferences.PartitionPreferencePage"; //$NON-NLS-1$
53
	
54
	/**
55
	 * Instantiates a new partition preference page.
56
	 */
57
	public PartitionPreferencePage() {
58
		super();
59
	}
60

  
61
	/**
62
	 * Creates the field editors. Field editors are abstractions of the common
63
	 * GUI blocks needed to manipulate various types of preferences. Each field
64
	 * editor knows how to save and restore itself.
65
	 */
66
	@Override
67
	public void createFieldEditors() {
68
		// Charts rendering
69
		Group chartsGroup = SWTChartsComponentsProvider.createChartsRenderingPreferencesGroup(this.getFieldEditorParent());
70
		this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.DIMENSIONS_SORTED_BY_SIZE, RCPPartitionMessages.PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE, chartsGroup));
71
		this.addField(new BooleanFieldEditor(PartitionDimensionsPreferences.DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, RCPPartitionMessages.PreferencesPage_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, chartsGroup));
72
	}
73

  
74
	
75
	/**
76
	 * 
77
	 * @return
78
	 */
79
	public static TXMPreferenceStore getNewPreferenceStore()	{
80
		return new TXMPreferenceStore(PartitionDimensionsPreferences.PREFERENCES_NODE);
81
	}
82

  
83
	
84
	/*
85
	 * (non-Javadoc)
86
	 * 
87
	 * @see
88
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
89
	 */
90
	@Override
91
	public void init(IWorkbench workbench) {
92
		setPreferenceStore(getNewPreferenceStore());
93
		//setDescription(Messages.DiagnosticPreferencePage_1);
94
		setTitle(Messages.DiagnosticPreferencePage_1);
95
	}
96

  
97

  
98
}
0 99

  
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/messages/messages.properties (revision 39)
1
PreferencesPage_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE=Display parts count in chart title
2
PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE=Sort by part size
0 3

  
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/messages/RCPPartitionMessages.java (revision 39)
1
package org.txm.partition.rcp.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4

  
5

  
6

  
7
public class RCPPartitionMessages extends NLS {
8

  
9
	private static final String BUNDLE_NAME = "org.txm.partition.rcp.messages.messages"; //$NON-NLS-1$
10

  
11
	public static String PreferencesPage_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE;
12
	public static String PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE;
13
	
14

  
15
	static {
16
		// initialize resource bundle
17
		NLS.initializeMessages(BUNDLE_NAME, RCPPartitionMessages.class);
18
	}
19

  
20
	private RCPPartitionMessages() {
21
	}
22
}
0 23

  
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/messages/messages_fr.properties (revision 39)
1
PreferencesPage_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE=Afficher le nombre de parties dans le titre du graphique
2
PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE=Trier par taille de partie
0 3

  

Formats disponibles : Unified diff