Révision 2995
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java (revision 2995) | ||
---|---|---|
74 | 74 |
@Override |
75 | 75 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
76 | 76 |
|
77 |
if (!this.checkCorpusEngine()) { |
|
78 |
return false; |
|
79 |
} |
|
80 |
|
|
77 | 81 |
// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage sub-corpus creation and edition |
78 | 82 |
if (SubcorpusPreferences.getInstance().getBoolean(SubcorpusPreferences.EDITORMODE)) { |
79 | 83 |
return execute_editor(event); |
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java (revision 2995) | ||
---|---|---|
80 | 80 |
@Override |
81 | 81 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
82 | 82 |
|
83 |
if (!this.checkCorpusEngine()) { |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
83 | 87 |
// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage partitions creation and edition |
84 | 88 |
if (PartitionPreferences.getInstance().getBoolean(PartitionPreferences.EDITOR_MODE)) { |
85 | 89 |
return execute_editor(event); |
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/QueryIndexEditor.java (revision 2995) | ||
---|---|---|
304 | 304 |
title = "Computing QueryIndex..."; |
305 | 305 |
|
306 | 306 |
try { |
307 |
JobHandler jobhandler = new JobHandler(title, |
|
308 |
queryWidget.getParent()) { |
|
307 |
JobHandler jobhandler = new JobHandler(title) { |
|
309 | 308 |
|
310 | 309 |
@Override |
311 | 310 |
protected IStatus run(IProgressMonitor monitor) { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationActionBarAdvisor.java (revision 2995) | ||
---|---|---|
1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
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; |
|
29 |
|
|
30 |
import org.eclipse.jface.action.ICoolBarManager; |
|
31 |
import org.eclipse.jface.action.IMenuManager; |
|
32 |
import org.eclipse.ui.IWorkbenchWindow; |
|
33 |
import org.eclipse.ui.actions.ActionFactory; |
|
34 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
|
35 |
import org.eclipse.ui.application.ActionBarAdvisor; |
|
36 |
import org.eclipse.ui.application.IActionBarConfigurer; |
|
37 |
//import org.txm.rcp.actions.ComputeSpecificities; |
|
38 |
//import org.txm.rcp.actions.CreateFrequencyList; |
|
39 |
//import org.txm.rcp.actions.CreatePartition; |
|
40 |
//import org.txm.rcp.actions.CreateSubcorpus; |
|
41 |
//import org.txm.rcp.actions.GetConcordances; |
|
42 |
import org.txm.rcp.actions.RunGroovyScript; |
|
43 |
import org.txm.rcp.messages.TXMUIMessages; |
|
44 |
|
|
45 |
// TODO: Auto-generated Javadoc |
|
46 |
/** |
|
47 |
* Controls the available commands in toolbar |
|
48 |
*/ |
|
49 |
@Deprecated |
|
50 |
public class ApplicationActionBarAdvisor extends ActionBarAdvisor { |
|
51 |
|
|
52 |
/** |
|
53 |
* Instantiates a new application action bar advisor. |
|
54 |
* |
|
55 |
* @param configurer the configurer |
|
56 |
*/ |
|
57 |
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { |
|
58 |
super(configurer); |
|
59 |
} |
|
60 |
|
|
61 |
/** The exit action. */ |
|
62 |
private IWorkbenchAction exitAction; |
|
63 |
|
|
64 |
/** The about action. */ |
|
65 |
private IWorkbenchAction aboutAction; |
|
66 |
|
|
67 |
/** The preference action. */ |
|
68 |
private IWorkbenchAction preferenceAction; |
|
69 |
|
|
70 |
/** The delete action. */ |
|
71 |
private IWorkbenchAction deleteAction; |
|
72 |
|
|
73 |
/** The import action. */ |
|
74 |
private RunGroovyScript importAction; |
|
75 |
|
|
76 |
/** The help action. */ |
|
77 |
private IWorkbenchAction helpAction; |
|
78 |
|
|
79 |
/** The help search action. */ |
|
80 |
private IWorkbenchAction helpSearchAction; |
|
81 |
|
|
82 |
/** The dynamic help action. */ |
|
83 |
private IWorkbenchAction dynamicHelpAction; |
|
84 |
|
|
85 |
/** |
|
86 |
* build all the actions of the application, many are deprecated. |
|
87 |
* |
|
88 |
* @param window the window |
|
89 |
*/ |
|
90 |
@Override |
|
91 |
protected void makeActions(IWorkbenchWindow window) { |
|
92 |
|
|
93 |
preferenceAction = ActionFactory.PREFERENCES.create(window); |
|
94 |
preferenceAction.setText(TXMUIMessages.preferences); |
|
95 |
register(preferenceAction); |
|
96 |
exitAction = ActionFactory.QUIT.create(window); |
|
97 |
exitAction.setText(TXMUIMessages.exit); |
|
98 |
register(exitAction); |
|
99 |
aboutAction = ActionFactory.ABOUT.create(window); |
|
100 |
aboutAction.setText(TXMUIMessages.aboutTXM); |
|
101 |
register(aboutAction); |
|
102 |
deleteAction = ActionFactory.DELETE.create(window); |
|
103 |
// register(deleteAction); |
|
104 |
//computeSpecificities = new ComputeSpecificities(window); |
|
105 |
//register(computeSpecificities); |
|
106 |
//createPartition = new CreatePartition(window); |
|
107 |
//register(createPartition); |
|
108 |
//createSubcorpus = new CreateSubcorpus(window); |
|
109 |
//register(createSubcorpus); |
|
110 |
helpAction = ActionFactory.HELP_CONTENTS.create(window); |
|
111 |
register(helpAction); |
|
112 |
dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window); |
|
113 |
register(dynamicHelpAction); |
|
114 |
{ |
|
115 |
helpSearchAction = ActionFactory.HELP_SEARCH.create(window); |
|
116 |
register(helpSearchAction); |
|
117 |
} |
|
118 |
//createFrequencyList = new CreateFrequencyList(window); |
|
119 |
//register(createFrequencyList); |
|
120 |
|
|
121 |
// TODO remettre l'analyse par correspondance dans la toolbar principale |
|
122 |
// computeCorrespondanceAnalysis = new |
|
123 |
// ComputeCorrespondanceAnalysis(window); |
|
124 |
// register(computeCorrespondanceAnalysis); |
|
125 |
|
|
126 |
//getConcordances = new GetConcordances(window); |
|
127 |
//register(getConcordances); |
|
128 |
|
|
129 |
// System.out.println(Messages.ApplicationActionBarAdvisor_0); |
|
130 |
importAction = new RunGroovyScript(window); |
|
131 |
register(importAction); |
|
132 |
|
|
133 |
} |
|
134 |
|
|
135 |
/* (non-Javadoc) |
|
136 |
* @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager) |
|
137 |
*/ |
|
138 |
@Override |
|
139 |
protected void fillMenuBar(IMenuManager menuBar) { |
|
140 |
// MenuManager fileMenu = new MenuManager(Messages.File_Menu_Label1, |
|
141 |
// Messages.File_Menu_Label2); |
|
142 |
// fileMenu.add(openFileCommand.); |
|
143 |
// fileMenu.add(preferenceAction); |
|
144 |
// fileMenu.add(importAction); |
|
145 |
// fileMenu.add(new Separator()); |
|
146 |
// fileMenu.add(exitAction); |
|
147 |
|
|
148 |
// MenuManager corpusMenu = new MenuManager(Messages.Corpus_Menu_Label1, |
|
149 |
// Messages.Corpus_Menu_Label2); |
|
150 |
// corpusMenu.add(createSubcorpus); |
|
151 |
// corpusMenu.add(createPartition); |
|
152 |
// corpusMenu.add(new Separator()); |
|
153 |
// corpusMenu.add(createFrequencyList); |
|
154 |
// corpusMenu.add(getConcordances); |
|
155 |
// corpusMenu.add(computeSpecificities); |
|
156 |
// TODO remettre l'analyse par correspondance dans le menu corpus |
|
157 |
// corpusMenu.add(computeCorrespondanceAnalysis); |
|
158 |
|
|
159 |
// MenuManager helpMenu = new MenuManager(Messages.Help_Menu_Label1, |
|
160 |
// Messages.Help_Menu_Label2); |
|
161 |
// helpMenu.add(helpAction); |
|
162 |
// helpMenu.add(dynamicHelpAction); |
|
163 |
// helpMenu.add(helpSearchAction); |
|
164 |
// helpMenu.add(aboutAction); |
|
165 |
|
|
166 |
// menuBar.add(fileMenu); |
|
167 |
// menuBar.add(corpusMenu); |
|
168 |
// menuBar.add(helpMenu); |
|
169 |
} |
|
170 |
|
|
171 |
/* (non-Javadoc) |
|
172 |
* @see org.eclipse.ui.application.ActionBarAdvisor#fillCoolBar(org.eclipse.jface.action.ICoolBarManager) |
|
173 |
*/ |
|
174 |
@Override |
|
175 |
protected void fillCoolBar(ICoolBarManager coolBar) { |
|
176 |
// IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); |
|
177 |
// coolBar.add(toolbar); |
|
178 |
// toolbar.add(createSubcorpus); |
|
179 |
// toolbar.add(createPartition); |
|
180 |
// toolbar.add(new Separator()); |
|
181 |
// toolbar.add(createFrequencyList); |
|
182 |
// toolbar.add(getConcordances); |
|
183 |
// toolbar.add(computeSpecificities); |
|
184 |
// toolbar.add(computeCorrespondanceAnalysis); |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* Fill tray item. |
|
189 |
* |
|
190 |
* @param trayItem the tray item |
|
191 |
*/ |
|
192 |
protected void fillTrayItem(IMenuManager trayItem) { |
|
193 |
trayItem.add(aboutAction); |
|
194 |
trayItem.add(exitAction); |
|
195 |
} |
|
196 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchWindowAdvisor.java (revision 2995) | ||
---|---|---|
42 | 42 |
import org.eclipse.ui.IWorkbenchPage; |
43 | 43 |
import org.eclipse.ui.IWorkbenchWindow; |
44 | 44 |
import org.eclipse.ui.PlatformUI; |
45 |
import org.eclipse.ui.application.ActionBarAdvisor; |
|
46 |
import org.eclipse.ui.application.IActionBarConfigurer; |
|
47 | 45 |
import org.eclipse.ui.application.IWorkbenchWindowConfigurer; |
48 | 46 |
import org.eclipse.ui.application.WorkbenchWindowAdvisor; |
49 | 47 |
import org.eclipse.ui.internal.WorkbenchWindow; |
50 | 48 |
import org.txm.rcp.messages.TXMUIMessages; |
51 | 49 |
import org.txm.utils.logger.Log; |
52 | 50 |
|
53 |
// TODO: Auto-generated Javadoc |
|
54 | 51 |
/** |
55 | 52 |
* Configures TXM Windows |
56 | 53 |
*/ |
57 | 54 |
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { |
58 |
|
|
55 |
|
|
59 | 56 |
/** |
60 | 57 |
* Instantiates a new application workbench window advisor. |
61 | 58 |
* |
... | ... | |
64 | 61 |
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { |
65 | 62 |
super(configurer); |
66 | 63 |
} |
67 |
|
|
68 |
/* (non-Javadoc) |
|
69 |
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { |
|
73 |
return new ApplicationActionBarAdvisor(configurer); |
|
74 |
} |
|
75 |
|
|
76 |
/* (non-Javadoc) |
|
64 |
|
|
65 |
/* |
|
66 |
* (non-Javadoc) |
|
77 | 67 |
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen() |
78 | 68 |
*/ |
79 | 69 |
@Override |
80 | 70 |
public void preWindowOpen() { |
71 |
|
|
81 | 72 |
IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); |
82 | 73 |
configurer.setShowProgressIndicator(true); |
83 | 74 |
configurer.setInitialSize(new Point(1024, 768)); |
... | ... | |
89 | 80 |
configurer.setShowPerspectiveBar(true); |
90 | 81 |
configurer.setTitle(TXMUIMessages.tXM); |
91 | 82 |
|
92 |
|
|
93 | 83 |
// This is a patch to remove the Quick Search Field and spacers from the Main toolbar |
94 | 84 |
Log.fine(TXMUIMessages.removeUnnecessaryE4Elements); |
95 | 85 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
96 | 86 |
if (window instanceof WorkbenchWindow) { |
97 | 87 |
MWindow model = ((WorkbenchWindow) window).getModel(); |
98 |
EModelService modelService = model.getContext().get( |
|
99 |
EModelService.class); |
|
100 |
|
|
101 |
MTrimBar trimBar = modelService.getTrim((MTrimmedWindow) model, |
|
102 |
SideValue.TOP); |
|
88 |
EModelService modelService = model.getContext().get(EModelService.class); |
|
89 |
|
|
90 |
MTrimBar trimBar = modelService.getTrim((MTrimmedWindow) model, SideValue.TOP); |
|
103 | 91 |
Iterator<MTrimElement> it = trimBar.getChildren().iterator(); |
104 | 92 |
while (it.hasNext()) { |
105 | 93 |
MTrimElement next = it.next(); |
106 |
//System.out.println("Element: "+next.getElementId()); |
|
94 |
// System.out.println("Element: "+next.getElementId());
|
|
107 | 95 |
if ("com.none.playActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$ |
108 | 96 |
if ("org.eclipse.search.searchActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$ |
109 | 97 |
if ("org.eclipse.ui.edit.text.actionSet.annotationNavigation".equals(next.getElementId())) continue; //$NON-NLS-1$ |
... | ... | |
112 | 100 |
if ("org.eclipse.debug.ui.launchActionSet".equals(next.getElementId())) continue; //$NON-NLS-1$ |
113 | 101 |
if ("org.eclipse.ui.browser.editor".equals(next.getElementId())) continue; //$NON-NLS-1$ |
114 | 102 |
// Team |
115 |
//if ("org.eclipse.team.svn.ui.SVNTeamPreferences".equals(next.getElementId())) continue; |
|
103 |
// if ("org.eclipse.team.svn.ui.SVNTeamPreferences".equals(next.getElementId())) continue;
|
|
116 | 104 |
if ("group.editor".equals(next.getElementId())) continue; //$NON-NLS-1$ |
117 | 105 |
if ("SearchField".equals(next.getElementId())) continue; |
118 |
//if ("PerspectiveSpacer".equals(next.getElementId())) continue; |
|
119 |
//if ("Spacer Glue".equals(next.getElementId())) continue; |
|
120 |
//if ("Search-PS Glue".equals(next.getElementId())) continue; |
|
106 |
// if ("PerspectiveSpacer".equals(next.getElementId())) continue;
|
|
107 |
// if ("Spacer Glue".equals(next.getElementId())) continue;
|
|
108 |
// if ("Search-PS Glue".equals(next.getElementId())) continue;
|
|
121 | 109 |
if ("PerspectiveSwitcher".equals(next.getElementId())) continue; //$NON-NLS-1$ |
122 |
//System.out.println("DEL Element: "+next.getElementId()); |
|
123 |
if (next instanceof MToolControl) |
|
124 |
next.setToBeRendered(false); |
|
110 |
// System.out.println("DEL Element: "+next.getElementId()); |
|
111 |
if (next instanceof MToolControl) next.setToBeRendered(false); |
|
125 | 112 |
} |
126 | 113 |
} |
127 | 114 |
} |
128 |
|
|
129 |
/* (non-Javadoc) |
|
115 |
|
|
116 |
/* |
|
117 |
* (non-Javadoc) |
|
130 | 118 |
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowOpen() |
131 | 119 |
*/ |
132 | 120 |
@Override |
... | ... | |
137 | 125 |
page.hideActionSet("org.eclipse.ui.edit.text.actionSet.navigation"); //$NON-NLS-1$ |
138 | 126 |
page.hideActionSet("org.eclipse.ui.edit.text.actionSet.annotationNavigation"); //$NON-NLS-1$ |
139 | 127 |
page.hideActionSet("org.eclipse.ui.run"); //$NON-NLS-1$ |
140 |
//page.hideActionSet("org.eclipse.team.svn.ui.SVNTeamPreferences"); //$NON-NLS-1$ |
|
128 |
// page.hideActionSet("org.eclipse.team.svn.ui.SVNTeamPreferences"); //$NON-NLS-1$
|
|
141 | 129 |
// StatusLine.setMessage(Messages.ApplicationWorkbenchWindowAdvisor_statusready); |
142 |
|
|
130 |
|
|
143 | 131 |
IContributionItem[] mItems, mSubItems; |
144 |
IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer ().getMenuManager ();
|
|
132 |
IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
|
|
145 | 133 |
mm.remove("org.eclipse.ui.run"); |
146 |
// mItems = mm.getItems ();
|
|
147 |
// for (int i = 0; i < mItems.length; i++)
|
|
148 |
// {
|
|
149 |
// if (mItems[i] instanceof MenuManager)
|
|
150 |
// {
|
|
151 |
// mSubItems = ((MenuManager) mItems[i]).getItems ();
|
|
152 |
// for (int j = 0; j < mSubItems.length; j++)
|
|
153 |
// {
|
|
154 |
// System.out.println("menu : "+mItems[i].getId());
|
|
155 |
// if (mItems[i].getId ().equals ("file"))
|
|
156 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
|
|
157 |
// else if (mItems[i].getId ().equals ("help"))
|
|
158 |
// {
|
|
159 |
// ((MenuManager) mItems[i]).remove ("group.updates");
|
|
160 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.update.ui.updateMenu");
|
|
161 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.actions.showKeyAssistHandler");
|
|
162 |
// }
|
|
163 |
// }
|
|
164 |
// }
|
|
165 |
// }
|
|
134 |
// mItems = mm.getItems ();
|
|
135 |
// for (int i = 0; i < mItems.length; i++)
|
|
136 |
// {
|
|
137 |
// if (mItems[i] instanceof MenuManager)
|
|
138 |
// {
|
|
139 |
// mSubItems = ((MenuManager) mItems[i]).getItems ();
|
|
140 |
// for (int j = 0; j < mSubItems.length; j++)
|
|
141 |
// {
|
|
142 |
// System.out.println("menu : "+mItems[i].getId());
|
|
143 |
// if (mItems[i].getId ().equals ("file"))
|
|
144 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
|
|
145 |
// else if (mItems[i].getId ().equals ("help"))
|
|
146 |
// {
|
|
147 |
// ((MenuManager) mItems[i]).remove ("group.updates");
|
|
148 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.update.ui.updateMenu");
|
|
149 |
// ((MenuManager) mItems[i]).remove ("org.eclipse.ui.actions.showKeyAssistHandler");
|
|
150 |
// }
|
|
151 |
// }
|
|
152 |
// }
|
|
153 |
// }
|
|
166 | 154 |
} |
167 |
} |
|
155 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/RunGroovyScript.java (revision 2995) | ||
---|---|---|
1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
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.actions; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
import java.io.IOException; |
|
32 |
import java.util.ArrayList; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
36 |
import org.eclipse.core.runtime.IStatus; |
|
37 |
import org.eclipse.core.runtime.Status; |
|
38 |
import org.eclipse.jface.action.Action; |
|
39 |
import org.eclipse.osgi.util.NLS; |
|
40 |
import org.eclipse.swt.SWT; |
|
41 |
import org.eclipse.swt.widgets.FileDialog; |
|
42 |
import org.eclipse.ui.IWorkbenchWindow; |
|
43 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
|
44 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
|
45 |
import org.txm.Toolbox; |
|
46 |
import org.txm.importer.scripting.GroovyImportScriptRunner; |
|
47 |
import org.txm.rcp.Application; |
|
48 |
import org.txm.rcp.IImageKeys; |
|
49 |
import org.txm.rcp.messages.TXMUIMessages; |
|
50 |
import org.txm.rcp.swt.dialog.LastOpened; |
|
51 |
import org.txm.rcp.utils.JobHandler; |
|
52 |
import org.txm.utils.logger.Log; |
|
53 |
|
|
54 |
import groovy.lang.Binding; |
|
55 |
|
|
56 |
// TODO: Auto-generated Javadoc |
|
57 |
/** |
|
58 |
* The Class RunGroovyScript. |
|
59 |
*/ |
|
60 |
public class RunGroovyScript extends Action implements IWorkbenchAction { |
|
61 |
|
|
62 |
/** The ID. */ |
|
63 |
private static String ID = "org.txm.rcp.actions.RunGroovyScript"; //$NON-NLS-1$ |
|
64 |
|
|
65 |
/** The window. */ |
|
66 |
private IWorkbenchWindow window; |
|
67 |
|
|
68 |
/** The gse. */ |
|
69 |
private GroovyImportScriptRunner gse = null; |
|
70 |
|
|
71 |
/** |
|
72 |
* Instantiates a new run groovy script. |
|
73 |
* |
|
74 |
* @param window |
|
75 |
* the window |
|
76 |
*/ |
|
77 |
public RunGroovyScript(IWorkbenchWindow window) { |
|
78 |
this.window = window; |
|
79 |
setId(ID); |
|
80 |
setText(TXMUIMessages.ampRunScript); |
|
81 |
setToolTipText(TXMUIMessages.runScript); |
|
82 |
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( |
|
83 |
Application.PLUGIN_ID, IImageKeys.ACTION_RUN_SCRIPT)); |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
87 |
* (non-Javadoc) |
|
88 |
* |
|
89 |
* @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose() |
|
90 |
*/ |
|
91 |
@Override |
|
92 |
public void dispose() { |
|
93 |
} |
|
94 |
|
|
95 |
/* |
|
96 |
* (non-Javadoc) |
|
97 |
* |
|
98 |
* @see org.eclipse.jface.action.Action#run() |
|
99 |
*/ |
|
100 |
@Override |
|
101 |
public void run() { |
|
102 |
|
|
103 |
FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN); |
|
104 |
dialog.setFilterExtensions(new String[] { TXMUIMessages.groovy }); |
|
105 |
String scriptRootDir = Toolbox.getTxmHomePath() + "/scripts"; |
|
106 |
String scriptCurrentDir = Toolbox.getTxmHomePath() + "/scripts"; |
|
107 |
|
|
108 |
|
|
109 |
if (LastOpened.getFolder(ID) != null) { |
|
110 |
scriptCurrentDir = LastOpened.getFolder(ID); |
|
111 |
} |
|
112 |
dialog.setFilterPath(scriptCurrentDir); |
|
113 |
String result = dialog.open(); |
|
114 |
if (result == null) |
|
115 |
return; |
|
116 |
|
|
117 |
final File script = new File(result); |
|
118 |
LastOpened.set(ID, script.getParent(), script.getName()); |
|
119 |
try { |
|
120 |
List<File> classPath = new ArrayList<File>(); |
|
121 |
classPath.add(new File(scriptRootDir)); |
|
122 |
gse = new GroovyImportScriptRunner(script, classPath); |
|
123 |
} catch (IOException e) { |
|
124 |
System.err.println(NLS.bind(TXMUIMessages.errorWhileOpeningGroovyScriptColonP0, e)); |
|
125 |
System.err.println(e); |
|
126 |
} |
|
127 |
|
|
128 |
if (gse != null) { |
|
129 |
JobHandler jobhandler = new JobHandler(TXMUIMessages.scriptExecution, null) { |
|
130 |
@Override |
|
131 |
protected IStatus run(IProgressMonitor monitor) { |
|
132 |
this.runInit(monitor); |
|
133 |
try { |
|
134 |
monitor.beginTask(TXMUIMessages.executeScript, 100); |
|
135 |
new Binding(); |
|
136 |
// gse.run(binding); |
|
137 |
monitor.worked(100); |
|
138 |
|
|
139 |
} catch (ThreadDeath td) { |
|
140 |
return Status.CANCEL_STATUS; |
|
141 |
} catch (Exception e) { |
|
142 |
Log.severe(NLS.bind(TXMUIMessages.errorWhileRunningScriptColonP0, e)); |
|
143 |
} finally { |
|
144 |
monitor.done(); |
|
145 |
} |
|
146 |
return Status.OK_STATUS; |
|
147 |
} |
|
148 |
}; |
|
149 |
jobhandler.startJob(); |
|
150 |
} |
|
151 |
} |
|
152 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/JobHandler.java (revision 2995) | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.util.concurrent.Semaphore; |
31 | 31 |
|
32 |
import org.eclipse.core.resources.ResourcesPlugin; |
|
32 | 33 |
import org.eclipse.core.runtime.IProgressMonitor; |
34 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
|
33 | 35 |
import org.eclipse.core.runtime.jobs.Job; |
34 | 36 |
import org.eclipse.swt.widgets.Composite; |
35 | 37 |
import org.eclipse.swt.widgets.Display; |
36 | 38 |
import org.eclipse.ui.internal.progress.ProgressManagerUtil; |
39 |
import org.eclipse.ui.texteditor.ISchedulingRuleProvider; |
|
37 | 40 |
import org.txm.rcp.StatusLine; |
38 | 41 |
import org.txm.rcp.messages.TXMUIMessages; |
39 | 42 |
import org.txm.utils.logger.Log; |
... | ... | |
60 | 63 |
|
61 | 64 |
protected boolean success = false; |
62 | 65 |
|
63 |
|
|
64 | 66 |
/** |
65 |
* Instantiates a new job handler. |
|
66 |
* |
|
67 |
* @param title |
|
68 |
* the title |
|
69 |
* @param parent |
|
70 |
* the parent |
|
71 |
*/ |
|
72 |
// FIXME: SJ: parent is not used anymore, need to remove or modify this constructor |
|
73 |
public JobHandler(String title, Composite parent) { |
|
74 |
super(title); |
|
75 |
// this.parent = parent; |
|
76 |
this.setUser(true); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
/** |
|
81 | 67 |
* Create a job in RCP scheduler. |
82 | 68 |
* |
83 | 69 |
* @param title |
... | ... | |
87 | 73 |
this(title, true); |
88 | 74 |
} |
89 | 75 |
|
76 |
// static final ISchedulingRule RULE = new ISchedulingRule() { |
|
77 |
// |
|
78 |
// @Override |
|
79 |
// public String toString() { |
|
80 |
// return "MAIN RULE"; |
|
81 |
// } |
|
82 |
// |
|
83 |
// @Override |
|
84 |
// public boolean isConflicting(ISchedulingRule rule) { |
|
85 |
// return rule == this; |
|
86 |
// } |
|
87 |
// |
|
88 |
// @Override |
|
89 |
// public boolean contains(ISchedulingRule rule) { |
|
90 |
// return rule == this; |
|
91 |
// } |
|
92 |
// }; |
|
93 |
|
|
90 | 94 |
/** |
91 | 95 |
* Instantiates a new job handler. |
92 | 96 |
* |
... | ... | |
98 | 102 |
public JobHandler(String title, boolean show) { |
99 | 103 |
super(title); |
100 | 104 |
this.setUser(show); |
105 |
// this.setRule(RULE); |
|
101 | 106 |
} |
102 | 107 |
|
108 |
final static public String TXM_FAMILY = "TXM"; |
|
103 | 109 |
|
110 |
@Override |
|
111 |
public boolean belongsTo(Object family) { |
|
112 |
return TXM_FAMILY.equals(family); |
|
113 |
} |
|
114 |
|
|
104 | 115 |
/** |
105 | 116 |
* You must set the current monitor to be available to manage the process |
106 | 117 |
* progress |
... | ... | |
202 | 213 |
* Start job. |
203 | 214 |
*/ |
204 | 215 |
public void startJob(boolean modal) { |
205 |
if (modal) {
|
|
206 |
this.setRule(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());// set modal job
|
|
207 |
} |
|
216 |
// if (modal) { // this will deadlock the job if the jobs needs to work on the RCP workspace files
|
|
217 |
// this.setRule(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());// set modal job
|
|
218 |
// }
|
|
208 | 219 |
this.setUser(true);// show popup |
209 | 220 |
this.schedule();// start |
210 | 221 |
} |
... | ... | |
288 | 299 |
public void setTaskName(String name) { |
289 | 300 |
if (currentMonitor != null) currentMonitor.setTaskName(name); |
290 | 301 |
} |
302 |
|
|
303 |
/** |
|
304 |
* All TXM jobs are done if there is no more TXM_FAMILY jobs |
|
305 |
* |
|
306 |
* @return true if all TXM jobs are done |
|
307 |
*/ |
|
308 |
public static boolean areAllTXMJobsDone() { |
|
309 |
Job[] jobs = JobHandler.getJobManager().find(JobHandler.TXM_FAMILY); |
|
310 |
return jobs == null || jobs.length == 0; |
|
311 |
} |
|
291 | 312 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java (revision 2995) | ||
---|---|---|
33 | 33 |
import org.eclipse.core.runtime.IProgressMonitor; |
34 | 34 |
import org.eclipse.core.runtime.IStatus; |
35 | 35 |
import org.eclipse.core.runtime.Status; |
36 |
import org.eclipse.core.runtime.jobs.Job; |
|
36 | 37 |
import org.eclipse.osgi.util.NLS; |
37 | 38 |
import org.txm.Toolbox; |
38 | 39 |
import org.txm.rcp.JobsTimer; |
... | ... | |
44 | 45 |
|
45 | 46 |
// TODO: Auto-generated Javadoc |
46 | 47 |
/** |
47 |
* restart TXM: restart searchengine, statengine, workspace... |
|
48 |
* restart TXM: restart searchengine, statengine, workspace... |
|
49 |
* |
|
48 | 50 |
* @author mdecorde |
49 | 51 |
* |
50 | 52 |
*/ |
51 | 53 |
public class RestartTXM extends AbstractHandler { |
52 |
|
|
54 |
|
|
53 | 55 |
/** The ID. */ |
54 | 56 |
static public String ID = "org.txm.rcp.commands.RestartTXM"; //$NON-NLS-1$ |
55 |
|
|
56 |
/* (non-Javadoc) |
|
57 |
|
|
58 |
/* |
|
59 |
* (non-Javadoc) |
|
57 | 60 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
58 | 61 |
*/ |
59 | 62 |
@Override |
60 | 63 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
61 |
|
|
62 |
JobHandler jobhandler = new JobHandler("Restarting...") { |
|
64 |
|
|
65 |
if (!JobHandler.areAllTXMJobsDone()) { |
|
66 |
Log.warning("Wait for all jobs to end and retry"); |
|
67 |
return null; |
|
68 |
} |
|
69 |
|
|
70 |
JobHandler jobhandler = new JobHandler("Restarting...") { |
|
71 |
|
|
63 | 72 |
@Override |
64 | 73 |
protected IStatus run(IProgressMonitor monitor) { |
65 | 74 |
JobsTimer.start(); |
66 | 75 |
try { |
67 | 76 |
monitor.beginTask(TXMUIMessages.restartTXM, 100); |
68 |
//Toolbox.updateProperties(TxmPreferences.getProperties()); |
|
77 |
// Toolbox.updateProperties(TxmPreferences.getProperties());
|
|
69 | 78 |
if (Toolbox.restart()) { |
70 | 79 |
Log.info(TXMUIMessages.info_txmIsReady); |
71 |
} else { |
|
80 |
} |
|
81 |
else { |
|
72 | 82 |
Log.warning("TXM not restarted normally."); |
73 | 83 |
} |
74 |
|
|
84 |
|
|
75 | 85 |
monitor.worked(95); |
76 | 86 |
syncExec(new Runnable() { |
87 |
|
|
77 | 88 |
@Override |
78 | 89 |
public void run() { |
79 | 90 |
reloadViews(); |
80 | 91 |
} |
81 | 92 |
}); |
82 |
|
|
83 |
} catch (Exception e) { |
|
93 |
|
|
94 |
} |
|
95 |
catch (Exception e) { |
|
84 | 96 |
System.out.println(NLS.bind(TXMUIMessages.errorWhileRunningScriptColonP0, e)); |
85 | 97 |
org.txm.utils.logger.Log.printStackTrace(e); |
86 |
} finally { |
|
98 |
} |
|
99 |
finally { |
|
87 | 100 |
monitor.done(); |
88 | 101 |
} |
89 | 102 |
JobsTimer.stopAndPrint(); |
... | ... | |
93 | 106 |
jobhandler.startJob(); |
94 | 107 |
return event; |
95 | 108 |
} |
96 |
|
|
109 |
|
|
97 | 110 |
public static void reloadViews() { |
98 |
//System.out.println(Messages.RestartTXM_0); |
|
99 |
//TODO TXM views must have been registered to be reloaded |
|
111 |
// System.out.println(Messages.RestartTXM_0);
|
|
112 |
// TODO TXM views must have been registered to be reloaded
|
|
100 | 113 |
|
101 | 114 |
org.txm.rcp.views.corpora.CorporaView.reload(); |
102 | 115 |
org.txm.rcp.views.corpora.CorporaView.refresh(); |
... | ... | |
106 | 119 |
org.txm.rcp.views.QueriesView.reload(); |
107 | 120 |
org.txm.rcp.views.QueriesView.refresh(); |
108 | 121 |
SummaryView.reload(); |
109 |
//System.err.println(Messages.AddBase_10); |
|
110 |
//StatusLine.setMessage(Messages.AddBase_10); |
|
122 |
// System.err.println(Messages.AddBase_10);
|
|
123 |
// StatusLine.setMessage(Messages.AddBase_10);
|
|
111 | 124 |
} |
112 |
} |
|
125 |
} |
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TSIndexEditor.java (revision 2995) | ||
---|---|---|
321 | 321 |
title = NLS.bind(IndexUIMessages.indexOfInfP0SupWithPropertyColonP1InThePartitionColonP2, new Object[] { |
322 | 322 |
query.getQueryString(), properties, corpus.getName() }); |
323 | 323 |
|
324 |
JobHandler jobhandler = new JobHandler(title, go.getParent()) {
|
|
324 |
JobHandler jobhandler = new JobHandler(title) { |
|
325 | 325 |
|
326 | 326 |
@Override |
327 | 327 |
protected IStatus run(IProgressMonitor monitor) { |
... | ... | |
356 | 356 |
index.cut(); // Tmax |
357 | 357 |
Log.info("TSIndex done."); |
358 | 358 |
|
359 |
if (monitor.isCanceled()) |
|
359 |
if (monitor.isCanceled()) {
|
|
360 | 360 |
return Status.CANCEL_STATUS; |
361 |
} |
|
361 | 362 |
|
362 | 363 |
this.acquireSemaphore(); |
363 | 364 |
|
... | ... | |
369 | 370 |
this.releaseSemaphore(); |
370 | 371 |
|
371 | 372 |
final String message; |
372 |
if (index.getV() == 1) |
|
373 |
if (index.getV() == 1) {
|
|
373 | 374 |
message = ("one result"); |
374 |
else if (index.getV() > 0) |
|
375 |
} |
|
376 |
else if (index.getV() > 0) { |
|
375 | 377 |
message = (IndexUIMessages.bind(TXMUIMessages.doneColonP0Items, index.getV(), index.getT())); |
376 |
else |
|
378 |
} |
|
379 |
else { |
|
377 | 380 |
message = (IndexUIMessages.IndexEditor_17); |
381 |
} |
|
378 | 382 |
|
379 |
if (monitor.isCanceled()) |
|
383 |
if (monitor.isCanceled()) {
|
|
380 | 384 |
return Status.CANCEL_STATUS; |
385 |
} |
|
381 | 386 |
|
382 | 387 |
monitor.worked(95); |
383 | 388 |
// refresh ui |
... | ... | |
393 | 398 |
CorporaView.expand(index.getParent()); |
394 | 399 |
QueriesView.refresh(); |
395 | 400 |
RVariablesView.refresh(); |
396 |
if (partition != null) |
|
401 |
if (partition != null) {
|
|
397 | 402 |
setPartName(partition.getName() + ": " + index.getName()); //$NON-NLS-1$ |
398 |
else |
|
403 |
} |
|
404 |
else { |
|
399 | 405 |
setPartName(corpus.getName() + ": " + index.getName()); //$NON-NLS-1$ |
406 |
} |
|
400 | 407 |
|
401 | 408 |
// if (!queryWidget.isDisposed()) queryWidget.memorize(); |
402 | 409 |
nblinesperpage = NLignePPageSpinner.getSelection(); |
... | ... | |
446 | 453 |
*/ |
447 | 454 |
private boolean simpleQuery(CQLQuery query, List<Property> props) { |
448 | 455 |
for (Property p : props) { |
449 |
if (p instanceof StructuralUnitProperty) return false; |
|
456 |
if (p instanceof StructuralUnitProperty) { |
|
457 |
return false; |
|
458 |
} |
|
450 | 459 |
} |
451 | 460 |
String trimed = query.getQueryString().trim(); |
452 | 461 |
Property p = props.get(0); |
453 |
if (props.size() > 1) |
|
462 |
if (props.size() > 1) {
|
|
454 | 463 |
return false; |
455 |
else if (trimed.equals("[]")) //$NON-NLS-1$ |
|
464 |
} |
|
465 |
else if (trimed.equals("[]")) { //$NON-NLS-1$ |
|
456 | 466 |
return true; |
467 |
} |
|
457 | 468 |
else if (trimed.equals("[" + p.getName() + "=\".*\"]")) //$NON-NLS-1$ //$NON-NLS-2$ |
458 | 469 |
{ |
459 | 470 |
return true; |
... | ... | |
538 | 549 |
|
539 | 550 |
// select focus properties |
540 | 551 |
propsArea = new PropertiesSelector(queryArea, SWT.NONE); |
541 |
propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, |
|
542 |
false, false)); |
|
552 |
propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); |
|
543 | 553 |
propsArea.setLayout(new GridLayout(3, false)); |
544 | 554 |
propsArea.addValueChangeListener(new Listener() { |
545 | 555 |
|
... | ... | |
665 | 675 |
NLignePPageSpinner.setSelection(100); |
666 | 676 |
NLignePPageSpinner.setIncrement(1); |
667 | 677 |
NLignePPageSpinner.setPageIncrement(100); |
668 |
NLignePPageSpinner.setLayoutData(new GridData( |
|
669 |
GridData.VERTICAL_ALIGN_END)); |
|
678 |
NLignePPageSpinner.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END)); |
|
670 | 679 |
NLignePPageSpinner.addSelectionListener(new SelectionListener() { |
671 | 680 |
|
672 | 681 |
@Override |
... | ... | |
684 | 693 |
infosArea.setLayout(new GridLayout(6, false)); |
685 | 694 |
|
686 | 695 |
navigationArea = new NavigationWidget(infosArea, SWT.NONE); |
687 |
navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, |
|
688 |
false)); |
|
696 |
navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false)); |
|
689 | 697 |
|
690 | 698 |
navigationArea.addFirstListener(new SelectionListener() { |
691 | 699 |
|
... | ... | |
707 | 715 |
@Override |
708 | 716 |
public void widgetSelected(SelectionEvent e) { |
709 | 717 |
int i = (index.getV() / NLignePPageSpinner.getSelection()); |
710 |
int top = top = i * NLignePPageSpinner.getSelection();
|
|
718 |
int top = i * NLignePPageSpinner.getSelection(); |
|
711 | 719 |
|
712 | 720 |
int bottom = top + NLignePPageSpinner.getSelection(); |
713 | 721 |
fillDisplayArea(top, bottom); |
... | ... | |
737 | 745 |
@Override |
738 | 746 |
public void widgetSelected(SelectionEvent e) { |
739 | 747 |
int top = topLine - NLignePPageSpinner.getSelection(); |
740 |
if (top < 0) |
|
748 |
if (top < 0) {
|
|
741 | 749 |
top = 0; |
750 |
} |
|
742 | 751 |
int bottom = top + NLignePPageSpinner.getSelection(); |
743 | 752 |
fillDisplayArea(top, bottom); |
744 | 753 |
viewer.getTable().select(0); |
... | ... | |
812 | 821 |
FormLayout resultLayout = new FormLayout(); |
813 | 822 |
resultArea.setLayout(resultLayout); |
814 | 823 |
|
815 |
viewer = new TableViewer(resultArea, SWT.MULTI |
|
816 |
| SWT.FULL_SELECTION | SWT.BORDER); |
|
824 |
viewer = new TableViewer(resultArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); |
|
817 | 825 |
viewer.getTable().setLinesVisible(true); |
818 | 826 |
viewer.getTable().setHeaderVisible(true); |
819 | 827 |
viewer.getTable().addKeyListener(new TableKeyListener(viewer)); |
... | ... | |
852 | 860 |
} |
853 | 861 |
}); |
854 | 862 |
|
855 |
|
|
856 | 863 |
nColumn = new TableColumn(viewer.getTable(), SWT.LEFT); |
857 | 864 |
nColumn.setText(" "); //$NON-NLS-1$ |
858 | 865 |
nColumn.pack(); |
... | ... | |
936 | 943 |
if (this.partition != null) { |
937 | 944 |
List<String> partnames = this.partition.getPartNames(); |
938 | 945 |
if (partnames.size() > 1) |
939 |
if (viewer.getTable().getColumnCount() < partnames |
|
940 |
.size() + 3) { |
|
946 |
if (viewer.getTable().getColumnCount() < partnames.size() + 3) { |
|
941 | 947 |
for (int i = 0; i < partnames.size(); i++) { |
942 |
final TableColumn partColumn = new TableColumn( |
|
943 |
viewer.getTable(), SWT.RIGHT); |
|
948 |
final TableColumn partColumn = new TableColumn(viewer.getTable(), SWT.RIGHT); |
|
944 | 949 |
try { |
945 | 950 |
partColumn.setText(partnames.get(i) + " t=" + partition.getParts().get(i).getSize()); //$NON-NLS-1$ |
946 | 951 |
} |
... | ... | |
1054 | 1059 |
// props |
1055 | 1060 |
ArrayList<WordProperty> availables = new ArrayList<>(); |
1056 | 1061 |
try { |
1057 |
for (WordProperty p : index.getCorpus().getOrderedProperties()) |
|
1058 |
if (!index.getProperties().contains(p)) |
|
1062 |
for (WordProperty p : index.getCorpus().getOrderedProperties()) {
|
|
1063 |
if (!index.getProperties().contains(p)) {
|
|
1059 | 1064 |
availables.add(p); |
1065 |
} |
|
1066 |
} |
|
1060 | 1067 |
} |
1061 | 1068 |
catch (CqiClientException e) { |
1062 | 1069 |
Log.printStackTrace(e); |
... | ... | |
1090 | 1097 |
this.FminSpinner.setSelection(1); |
1091 | 1098 |
this.FmaxSpinner.setSelection(9999999); |
1092 | 1099 |
|
1093 |
if (partition != null) |
|
1100 |
if (partition != null) {
|
|
1094 | 1101 |
setPartName(partition.getName()); |
1095 |
else |
|
1102 |
} |
|
1103 |
else { |
|
1096 | 1104 |
setPartName(corpus.getName()); |
1105 |
} |
|
1097 | 1106 |
queryWidget.setFocus(); |
1098 | 1107 |
} |
1099 | 1108 |
else { |
... | ... | |
1117 | 1126 |
if (index.getV() > 0) { |
1118 | 1127 |
lines = index.getLines(from, to); |
1119 | 1128 |
} |
1120 |
else |
|
1129 |
else {
|
|
1121 | 1130 |
lines = new ArrayList<>(); |
1131 |
} |
|
1122 | 1132 |
|
1123 | 1133 |
navigationArea.setInfoLineText("" + (from + 1), //$NON-NLS-1$ |
1124 | 1134 |
"-" + (to) + " / " + index.getV()); //$NON-NLS-1$ //$NON-NLS-2$ |
... | ... | |
1135 | 1145 |
lVInfo.getParent().layout(); |
1136 | 1146 |
|
1137 | 1147 |
String unitColumnHeader = ""; //$NON-NLS-1$ |
1138 |
for (Property p : index.getProperties()) |
|
1148 |
for (Property p : index.getProperties()) {
|
|
1139 | 1149 |
unitColumnHeader += p.toString() + propSeparator; |
1140 |
if (unitColumnHeader.length() > 0) |
|
1141 |
unitColumnHeader = unitColumnHeader.substring(0, unitColumnHeader |
|
1142 |
.length() - 1); |
|
1150 |
} |
|
1151 |
if (unitColumnHeader.length() > 0) { |
|
1152 |
unitColumnHeader = unitColumnHeader.substring(0, unitColumnHeader.length() - 1); |
|
1153 |
} |
|
1143 | 1154 |
unitColumn.setText(unitColumnHeader); |
1144 | 1155 |
|
1145 | 1156 |
viewer.setInput(lines); |
... | ... | |
1161 | 1172 |
if (index != null) { |
1162 | 1173 |
String str; |
1163 | 1174 |
|
1164 |
if (partition != null) |
|
1175 |
if (partition != null) {
|
|
1165 | 1176 |
str = NLS.bind(IndexUIMessages.IndexEditor_17, |
1166 | 1177 |
new Object[] { partition.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax() }); |
1167 |
else |
|
1178 |
} |
|
1179 |
else { |
|
1168 | 1180 |
str = NLS.bind(IndexUIMessages.IndexEditor_17, |
1169 | 1181 |
new Object[] { corpus.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax() }); |
1170 |
|
|
1182 |
} |
|
1171 | 1183 |
return str; |
1172 | 1184 |
} |
1173 | 1185 |
return ""; //$NON-NLS-1$ |
... | ... | |
1180 | 1192 |
*/ |
1181 | 1193 |
@Override |
1182 | 1194 |
public void _setFocus() { |
1183 |
if (!this.queryWidget.isDisposed()) |
|
1195 |
if (!this.queryWidget.isDisposed()) {
|
|
1184 | 1196 |
this.queryWidget.setFocus(); |
1197 |
} |
|
1185 | 1198 |
StatusLine.setMessage(IndexUIMessages.openingTheIndexResults); |
1186 | 1199 |
} |
1187 | 1200 |
|
Formats disponibles : Unified diff