Revision 1409

tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/TxmCommand.java (revision 1409)
4 4
import org.eclipse.core.commands.ExecutionEvent;
5 5
import org.eclipse.core.commands.ExecutionException;
6 6

  
7
/**
8
 * Use BaseAbstractHandler instead
9
 * @author mdecorde
10
 *
11
 */
7 12
@Deprecated
8 13
public class TxmCommand extends AbstractHandler {
9 14

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/AutoPersistenceDisabled.java (revision 1409)
21 21
	public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
22 22

  
23 23
		boolean enabled = RCPPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED);
24
		System.err.println("IS results persistence enabled: " + enabled);
24
		//System.err.println("IS results persistence enabled: " + enabled);
25 25
		return !enabled;
26 26
	}
27 27

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ShowHiddenParents.java (revision 1409)
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.rcp.handlers.results;
29

  
30
import org.eclipse.core.commands.ExecutionEvent;
31

  
32
import org.eclipse.core.commands.ExecutionException;
33
import org.txm.core.results.TXMResult;
34
import org.txm.objects.Project;
35
import org.txm.objects.Workspace;
36
import org.txm.rcp.handlers.BaseAbstractHandler;
37
import org.txm.rcp.views.corpora.CorporaView;
38
/**
39
 * show the hidden parent results of the result
40
 */
41
public class ShowHiddenParents extends BaseAbstractHandler {
42

  
43
	@Override
44
	public Object execute(ExecutionEvent event) throws ExecutionException {
45
		Object sel = this.getCorporaViewSelectedObject(event);
46
		if (sel instanceof TXMResult && !(sel instanceof Project) && !(sel instanceof Workspace)) {
47
			TXMResult result = (TXMResult)sel;
48
			TXMResult parent = result.getParent();
49

  
50
			int n = 0;
51
			while (parent != null && !parent.isVisible() && !(sel instanceof Project) && !(sel instanceof Workspace)) {
52
				parent.setVisible(true);
53
				n++;
54
				parent = parent.getParent();
55
			}
56

  
57
			if (n > 0) {
58
				CorporaView.refresh();
59
			}
60
		}
61

  
62
		return null;
63
	}
64
}
0 65

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/HideIntermediateParents.java (revision 1409)
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.rcp.handlers.results;
29

  
30
import org.eclipse.core.commands.ExecutionEvent;
31
import org.eclipse.core.commands.ExecutionException;
32
import org.txm.core.results.TXMResult;
33
import org.txm.objects.Project;
34
import org.txm.objects.Workspace;
35
import org.txm.rcp.handlers.BaseAbstractHandler;
36
import org.txm.rcp.views.corpora.CorporaView;
37

  
38
/**
39
 * hide the intermediate parent results of the result
40
 */
41
public class HideIntermediateParents extends BaseAbstractHandler {
42

  
43
	@Override
44
	public Object execute(ExecutionEvent event) throws ExecutionException {
45
		Object sel = this.getCorporaViewSelectedObject(event);
46
		if (sel instanceof TXMResult && !(sel instanceof Project) && !(sel instanceof Workspace)) {
47
			TXMResult result = (TXMResult)sel;
48
			TXMResult parent = result.getParent();
49

  
50
			int n = 0;
51
			while (parent != null && parent.isVisible() && !(sel instanceof Project) && !(sel instanceof Workspace)) {
52
				parent.setVisible(false);
53
				n++;
54
				parent = parent.getParent();
55
			}
56

  
57
			if (n > 0) {
58
				CorporaView.refresh();
59
			}
60
		}
61

  
62
		return null;
63
	}
64
}
0 65

  
tmp/org.txm.rcp/plugin.xml (revision 1409)
2019 2019
                  </reference>
2020 2020
               </visibleWhen>
2021 2021
            </command>
2022
            
2022 2023
            <command
2024
                  commandId="org.txm.rcp.handlers.results.DeleteObject"
2025
                  icon="icons/functions/Delete.png"
2026
                  style="push">
2027
               <visibleWhen
2028
                     checkEnabled="false">
2029
                  <or>
2030
                     <reference
2031
                           definitionId="OneTXMResultSelected">
2032
                     </reference>
2033
                  </or>
2034
               </visibleWhen>
2035
            </command>
2036
            <command
2023 2037
                  commandId="org.txm.rcp.handlers.results.CloneTXMResult"
2024
                  label="Cloner"
2038
                  label="Clone"
2025 2039
                  style="push">
2026 2040
               <visibleWhen
2027 2041
                     checkEnabled="false">
......
2039 2053
            </command>
2040 2054
            <command
2041 2055
                  commandId="org.txm.rcp.handlers.results.CloneTXMResultTree"
2042
                  label="Cloner tout"
2056
                  label="Clone all"
2043 2057
                  style="push">
2044 2058
               <visibleWhen
2045 2059
                     checkEnabled="false">
......
2055 2069
                  </and>
2056 2070
               </visibleWhen>
2057 2071
            </command>
2058
            
2059 2072
            <command
2060
                  commandId="org.txm.rcp.handlers.results.DeleteObject"
2061
                  icon="icons/functions/Delete.png"
2073
                  commandId="org.txm.rcp.handlers.results.ShowHiddenParents"
2074
                  label="Show hidden parents"
2062 2075
                  style="push">
2063 2076
               <visibleWhen
2064 2077
                     checkEnabled="false">
2065
                  <or>
2078
                  <and>
2066 2079
                     <reference
2067 2080
                           definitionId="OneTXMResultSelected">
2068 2081
                     </reference>
2069
                  </or>
2082
                  </and>
2070 2083
               </visibleWhen>
2071 2084
            </command>
2085
            <command
2086
                  commandId="org.txm.rcp.handlers.results.HideIntermediateParents"
2087
                  label="Hide intermediate parents"
2088
                  style="push">
2089
               <visibleWhen
2090
                     checkEnabled="false">
2091
                  <and>
2092
                     <reference
2093
                           definitionId="OneTXMResultSelected">
2094
                     </reference>
2095
                  </and>
2096
               </visibleWhen>
2097
            </command>
2072 2098
            <separator
2073 2099
                  name="org.txm.rcp.corporaview.preferences"
2074 2100
                  visible="true">
......
2614 2640
            id="org.txm.rcp.handlers.results.CloneTXMResultTree"
2615 2641
            name="Clone all">
2616 2642
      </command>
2643
            <command
2644
                  defaultHandler="org.txm.rcp.handlers.results.ShowHiddenParents"
2645
                  id="org.txm.rcp.handlers.results.ShowHiddenParents"
2646
                  name="ShowHiddenParents">
2647
            </command>
2648
            <command
2649
                  defaultHandler="org.txm.rcp.handlers.results.HideIntermediateParents"
2650
                  id="org.txm.rcp.handlers.results.HideIntermediateParents"
2651
                  name="Hide intermediate parents">
2652
            </command>
2617 2653
   </extension>
2618 2654
   <extension
2619 2655
         id="scripts"

Also available in: Unified diff