Révision 1128

tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1128)
32 32
import java.io.IOException;
33 33
import java.lang.reflect.Constructor;
34 34
import java.util.ArrayList;
35
import java.util.Collection;
35 36
import java.util.Date;
36 37
import java.util.HashMap;
37 38
import java.util.List;
......
1048 1049
	public String getParametersNodeRootPath()	{
1049 1050
		return "project/" + this.rcpProject.getName() + "/";
1050 1051
	}
1051
	
1052

  
1053
	public Collection<? extends CorpusBuild> getCorpora() {
1054
		ArrayList<CorpusBuild> l = new ArrayList<>();
1055
		for (TXMResult r : getChildren()) {
1056
			if (r instanceof CorpusBuild) {
1057
				l.add((CorpusBuild)r);
1058
			}
1059
		}
1060
		return l;
1061
	}
1052 1062
}
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1128)
201 201
		// parts lexicons
202 202
		List<Lexicon> partsLexicons = new ArrayList<Lexicon>();
203 203
		for (int i = 0; i < partition.getNPart(); i++) {
204
			partsLexicons.add(Lexicon.getLexicon(partition.getParts().get(i), this.property, this.monitor));
204
			Lexicon l = Lexicon.getLexicon(partition.getParts().get(i), this.property, this.monitor);
205
			l.setVisible(false);
206
			partsLexicons.add(l);
205 207
		}
206 208

  
207 209
		// Corpus global lexicon
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/TXMResultContentProvider.java (revision 1128)
30 30
import java.util.ArrayList;
31 31
import java.util.Collections;
32 32
import java.util.Comparator;
33
import java.util.List;
33 34

  
34 35
import org.eclipse.core.runtime.IAdaptable;
35 36
import org.eclipse.core.runtime.Platform;
......
37 38
import org.eclipse.jface.viewers.Viewer;
38 39
import org.eclipse.ui.model.IWorkbenchAdapter;
39 40
import org.txm.core.results.TXMResult;
41
import org.txm.objects.CorpusBuild;
40 42
import org.txm.objects.Project;
41 43
import org.txm.objects.Workspace;
42 44
import org.txm.searchengine.cqp.corpus.MainCorpus;
......
101 103
	 */
102 104
	@Override
103 105
	public Object[] getElements(Object element) {
104
//		return element;
105
//		
106
//		if (element instanceof Workspace) {
107
//			ArrayList<MainCorpus> elements = new ArrayList<MainCorpus>();
108
//			Workspace p = (Workspace) element;
109
//
110
//			for (Project b : p.getProjects()) {
111
//				for (TXMResult o : b.getChildren(MainCorpus.class)) {
112
//					elements.add((MainCorpus)o);
113
//				}
114
//			}
115
//			//System.out.println("get elements: "+elements);
116
//			Collections.sort(elements, new Comparator<MainCorpus>() {
117
//
118
//				@Override
119
//				public int compare(MainCorpus o1, MainCorpus o2) {
120
//					if (o1 == null) return -1;
121
//					if (o2 == null) return 1;
122
//					return o1.getName().compareTo(o2.getName());
123
//				}
124
//			});
125
//			//System.out.println("corpora view content: "+elements);
126
//			return elements.toArray();
127
//		} else 
128
			if (element instanceof TXMResult) {
106
		//		return element;
107
		//		
108
		//		if (element instanceof Workspace) {
109
		//			ArrayList<MainCorpus> elements = new ArrayList<MainCorpus>();
110
		//			Workspace p = (Workspace) element;
111
		//
112
		//			for (Project b : p.getProjects()) {
113
		//				for (TXMResult o : b.getChildren(MainCorpus.class)) {
114
		//					elements.add((MainCorpus)o);
115
		//				}
116
		//			}
117
		//			//System.out.println("get elements: "+elements);
118
		//			Collections.sort(elements, new Comparator<MainCorpus>() {
119
		//
120
		//				@Override
121
		//				public int compare(MainCorpus o1, MainCorpus o2) {
122
		//					if (o1 == null) return -1;
123
		//					if (o2 == null) return 1;
124
		//					return o1.getName().compareTo(o2.getName());
125
		//				}
126
		//			});
127
		//			//System.out.println("corpora view content: "+elements);
128
		//			return elements.toArray();
129
		//		} else 
130
		if (element instanceof Workspace) {
131
			Workspace w = (Workspace)element;
132
			ArrayList<CorpusBuild> corpora = new ArrayList<CorpusBuild>();
133
			for (Project p : w.getProjects()) {
134
				corpora.addAll(p.getCorpora());
135
			}
136
			return corpora.toArray();
137
		} else if (element instanceof TXMResult) {
129 138
			return ((TXMResult)element).getChildren().toArray();
139
		} else if (element instanceof List) {
140
			List list = (List)element;
141
			return list.toArray();
130 142
		}
131 143
		return new Object[0];
132 144
	}
......
136 148
	 */
137 149
	@Override
138 150
	public Object getParent(Object element) {
139
//		IWorkbenchAdapter adapter = getAdapter(element);
140
//		if (adapter != null) {
141
//			return adapter.getParent(element);
142
//		}
143
//		else
144
			if (element instanceof TXMResult) {
151
		//		IWorkbenchAdapter adapter = getAdapter(element);
152
		//		if (adapter != null) {
153
		//			return adapter.getParent(element);
154
		//		}
155
		//		else
156
		if (element instanceof TXMResult) {
145 157
			return ((TXMResult)element).getParent();
146 158
		}
147 159
		return null;

Formats disponibles : Unified diff