Révision 2451

tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreatePartition.java (revision 2451)
54 54
 * @author mdecorde
55 55
 */
56 56
public class CreatePartition extends AbstractHandler {
57

  
57
	
58 58
	/** The window. */
59 59
	private IWorkbenchWindow window;
60

  
60
	
61 61
	/** The selection. */
62 62
	private IStructuredSelection selection;
63

  
63
	
64 64
	/*
65 65
	 * (non-Javadoc)
66
	 * 
67 66
	 * @see
68 67
	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
69 68
	 * .ExecutionEvent)
......
71 70
	@Override
72 71
	public Object execute(ExecutionEvent event) throws ExecutionException {
73 72
		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
74

  
73
		
75 74
		final CQPCorpus corpus = (CQPCorpus) selection.getFirstElement();
76 75
		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
77 76
		final CreatePartitionDialog d = new CreatePartitionDialog(shell, corpus);
......
79 78
		if (code == Window.OK) {
80 79
			try {
81 80
				JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName())) {
81
					
82 82
					@Override
83 83
					protected IStatus run(IProgressMonitor monitor) {
84 84
						this.runInit(monitor);
......
86 86
							JobsTimer.start();
87 87
							monitor.beginTask(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()), 100);
88 88
							
89
							Log.info(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()));
90
							
91 89
							final Partition partition = d.getPartition();
92 90
							if (partition == null) {
93 91
								monitor.done();
......
96 94
							}
97 95
							try {
98 96
								partition.compute(monitor);
99
															
97
								
100 98
								if (partition.getPartsCount() == 0) {
101 99
									Log.severe(TXMUIMessages.errorColonThePartitionCreatedHasNoPart);
102 100
									return null;
103
								}		
104
							} catch (Exception e) {
101
								}
102
							}
103
							catch (Exception e) {
105 104
								Log.printStackTrace(e);
106 105
							}
107 106
							monitor.worked(95);
108

  
109
							Log.info(NLS.bind(TXMUIMessages.doneColonP0Parts, partition.getPartsCount()));
110 107
							
111 108
							monitor.subTask(TXMUIMessages.refreshingCorpora);
112 109
							syncExec(new Runnable() {
110
								
113 111
								@Override
114 112
								public void run() {
115 113
									CorporaView.refresh();
......
129 127
					}
130 128
				};
131 129
				jobhandler.startJob();
132

  
133
			} catch (Exception e) {
130
				
131
			}
132
			catch (Exception e) {
134 133
				Log.severe(NLS.bind(TXMUIMessages.errorWhileCreatingAPartitionColonP0, e));
135 134
			}
136 135
		}
137 136
		return null;
138 137
	}
139
}
138
}

Formats disponibles : Unified diff