Revision 2015

tmp/org.txm.rcp/plugin.xml (revision 2015)
2279 2279
      <menuContribution
2280 2280
            allPopups="true"
2281 2281
            locationURI="toolbar:TXMEditorTopToolBar">
2282
         <command
2283
               commandId="org.txm.rcp.handlers.ComputeTXMResult"
2284
               icon="icons/functions/run.png"
2285
               style="push"
2286
               tooltip="org.txm.rcp.handlers.ComputeTXMResult">
2287
         </command>
2282 2288
      </menuContribution>
2283 2289
      <menuContribution
2284 2290
            allPopups="false"
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java (revision 2015)
3 3
import org.eclipse.core.commands.AbstractHandler;
4 4
import org.eclipse.core.commands.ExecutionEvent;
5 5
import org.eclipse.core.commands.ExecutionException;
6
import org.eclipse.swt.widgets.Event;
7
import org.eclipse.swt.widgets.ToolBar;
8
import org.eclipse.swt.widgets.ToolItem;
6 9
import org.eclipse.ui.IEditorPart;
7 10
import org.eclipse.ui.IWorkbenchPart;
8 11
import org.eclipse.ui.handlers.HandlerUtil;
9 12
import org.txm.rcp.editors.TXMEditor;
10
import org.txm.rcp.editors.TXMMultiPageEditor;
13
import org.txm.rcp.editors.TXMEditorToolBar;
11 14

  
12 15
/**
13 16
 * Calls TXMEditor.ompute() on the current active editor.
......
24 27
		IEditorPart activeEditor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor();
25 28
		System.out.println("A part="+part);
26 29
		System.out.println("A editor="+activeEditor);
30
		compute(event);
27 31
		// gets the main editor if the active editor is a multipages editor
28
		if(part instanceof TXMMultiPageEditor)	{
29
			part = (IWorkbenchPart) ((TXMMultiPageEditor)part).getEditors().get(0);
30
		}
31
		
32
		if (!(part instanceof TXMEditor)) {
33
			System.out.println("Active editor is not a TXMEditor. Aborting.");
34
			return null;
35
		}
32
//		if(part instanceof TXMMultiPageEditor)	{
33
//			part = (IWorkbenchPart) ((TXMMultiPageEditor)part).getEditors().get(0);
34
//		}
35
//		
36
//		if (!(part instanceof TXMEditor)) {
37
//			System.out.println("Active editor is not a TXMEditor. Aborting.");
38
//			return null;
39
//		}
40
//
41
//		TXMEditor editor = (TXMEditor) part;
42
//		editor.compute(true);
36 43

  
37
		TXMEditor editor = (TXMEditor) part;
38
		editor.compute(true);
39

  
40 44
		return null;
41 45
	}
46
	
47
	public static Object compute(ExecutionEvent event) {
48
		Object trigger = event.getTrigger();
49
		System.out.println("TRIGGER="+trigger.getClass());
50
		if (trigger instanceof Event) {
51
			Event e = (Event) trigger;
52
			if (e.widget instanceof ToolItem) {
53
				ToolItem ti = (ToolItem) e.widget;
54
				ToolBar parent = ti.getParent();
55
				if (parent instanceof TXMEditorToolBar) {
56
					return ((TXMEditorToolBar)parent).getEditorPart().compute(true);
57
				}
58
			}
59
		}
60
		return null;
61
	}
42 62
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2015)
392 392
			this.topToolBar = new TXMEditorToolBar(this, this.firstLineComposite, this.extendedParametersComposite, SWT.FLAT | SWT.RIGHT, TOP_TOOLBAR_ID);
393 393

  
394 394
			// store the Compute button to access if later, especially from subclasses
395
			this.computeButton = new ToolItem(topToolBar, SWT.PUSH);//.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
396
			this.computeButton.setImage(IImageKeys.getImage(IImageKeys.START));
397
			this.computeButton.addSelectionListener(new ComputeSelectionListener(this, true));
395
			this.computeButton = topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
398 396
			
397
//			this.computeButton = new ToolItem(topToolBar, SWT.PUSH);//.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
398
//			this.computeButton.setImage(IImageKeys.getImage(IImageKeys.START));
399
//			this.computeButton.addSelectionListener(new ComputeSelectionListener(this, true));
400
			
399 401
			// computing parameters components
400 402
			boolean showExtendedParameters = false;
401 403
			// only show the area if the result can not compute and is dirty
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 2015)
394 394
	
395 395
	@Override
396 396
	public String getComputingDoneMessage() {
397
		return TXMCoreMessages.bind(TXMCoreMessages.P0BuiltParts, this.getChildrenCount());
397
		return TXMCoreMessages.bind(TXMCoreMessages.P0BuiltParts, this.getPartsCount());
398 398
	}
399 399
	
400 400
	/**

Also available in: Unified diff