~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardScanPage.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2013 Ericsson
3
 
 *
4
 
 * All rights reserved. This program and the accompanying materials are
5
 
 * made available under the terms of the Eclipse Public License v1.0 which
6
 
 * accompanies this distribution, and is available at
7
 
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 *
9
 
 * Contributors:
10
 
 *   Matthew Khouzam - Initial API and implementation
11
 
 *******************************************************************************/
12
 
 
13
 
package org.eclipse.linuxtools.tmf.ui.project.wizards.importtrace;
14
 
 
15
 
import java.io.File;
16
 
import java.text.DecimalFormat;
17
 
import java.util.concurrent.ArrayBlockingQueue;
18
 
import java.util.concurrent.BlockingQueue;
19
 
 
20
 
import org.eclipse.core.runtime.IProgressMonitor;
21
 
import org.eclipse.core.runtime.IStatus;
22
 
import org.eclipse.core.runtime.Status;
23
 
import org.eclipse.core.runtime.SubMonitor;
24
 
import org.eclipse.core.runtime.jobs.Job;
25
 
import org.eclipse.jface.viewers.CellEditor;
26
 
import org.eclipse.jface.viewers.CheckStateChangedEvent;
27
 
import org.eclipse.jface.viewers.CheckboxTreeViewer;
28
 
import org.eclipse.jface.viewers.ColumnLabelProvider;
29
 
import org.eclipse.jface.viewers.ColumnViewer;
30
 
import org.eclipse.jface.viewers.ColumnViewerEditor;
31
 
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
32
 
import org.eclipse.jface.viewers.EditingSupport;
33
 
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter;
34
 
import org.eclipse.jface.viewers.ICheckStateListener;
35
 
import org.eclipse.jface.viewers.IStructuredSelection;
36
 
import org.eclipse.jface.viewers.TextCellEditor;
37
 
import org.eclipse.jface.viewers.TreeViewerColumn;
38
 
import org.eclipse.jface.viewers.TreeViewerEditor;
39
 
import org.eclipse.jface.viewers.TreeViewerFocusCellManager;
40
 
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
41
 
import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
42
 
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceType;
43
 
import org.eclipse.linuxtools.tmf.ui.project.model.TraceValidationHelper;
44
 
import org.eclipse.swt.SWT;
45
 
import org.eclipse.swt.events.SelectionEvent;
46
 
import org.eclipse.swt.events.SelectionListener;
47
 
import org.eclipse.swt.graphics.Image;
48
 
import org.eclipse.swt.layout.GridData;
49
 
import org.eclipse.swt.layout.GridLayout;
50
 
import org.eclipse.swt.widgets.Button;
51
 
import org.eclipse.swt.widgets.Composite;
52
 
import org.eclipse.swt.widgets.Control;
53
 
import org.eclipse.ui.IWorkbench;
54
 
 
55
 
/**
56
 
 * <b>Import page that scans files, can be cancelled</b> this page is the third
57
 
 * of three pages shown. This one selects the traces to be imported that are to
58
 
 * be scanned.
59
 
 *
60
 
 * @author Matthew Khouzam
61
 
 * @since 2.0
62
 
 */
63
 
public class ImportTraceWizardScanPage extends AbstractImportTraceWizardPage {
64
 
 
65
 
    private static final int COL_WIDTH = 200;
66
 
    private static final int MAX_TRACES = 65536;
67
 
    private CheckboxTreeViewer traceTypeViewer;
68
 
 
69
 
    final ScanRunnable fRunnable = new ScanRunnable("Scan job"); //$NON-NLS-1$
70
 
    final private BlockingQueue<TraceValidationHelper> fTracesToScan = new ArrayBlockingQueue<TraceValidationHelper>(MAX_TRACES);
71
 
    private volatile boolean fCanRun = true;
72
 
 
73
 
    // --------------------------------------------------------------------------------
74
 
    // Constructor and destructor
75
 
    // --------------------------------------------------------------------------------
76
 
 
77
 
    /**
78
 
     * Import page that scans files, can be cancelled.
79
 
     *
80
 
     * @param name
81
 
     *            The name of the page.
82
 
     * @param selection
83
 
     *            The current selection
84
 
     */
85
 
    protected ImportTraceWizardScanPage(String name, IStructuredSelection selection) {
86
 
        super(name, selection);
87
 
    }
88
 
 
89
 
    /**
90
 
     * Import page that scans files, can be cancelled
91
 
     *
92
 
     * @param workbench
93
 
     *            The workbench reference.
94
 
     * @param selection
95
 
     *            The current selection
96
 
     */
97
 
    public ImportTraceWizardScanPage(IWorkbench workbench, IStructuredSelection selection) {
98
 
        super(workbench, selection);
99
 
    }
100
 
 
101
 
    @Override
102
 
    public void dispose() {
103
 
        fCanRun = false;
104
 
        fRunnable.done(Status.OK_STATUS);
105
 
        super.dispose();
106
 
    }
107
 
 
108
 
    /*
109
 
     * Init
110
 
     */
111
 
 
112
 
    @Override
113
 
    public void createControl(Composite parent) {
114
 
        super.createControl(parent);
115
 
        final Composite control = (Composite) this.getControl();
116
 
        setTitle(Messages.ImportTraceWizardScanPageTitle);
117
 
        traceTypeViewer = new CheckboxTreeViewer(control, SWT.CHECK);
118
 
        traceTypeViewer.setContentProvider(getBatchWizard().getScannedTraces());
119
 
        traceTypeViewer.getTree().setHeaderVisible(true);
120
 
        traceTypeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
121
 
        traceTypeViewer.setInput(getBatchWizard().getScannedTraces());
122
 
        traceTypeViewer.addCheckStateListener(new ImportTraceCheckStateListener());
123
 
 
124
 
        TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(traceTypeViewer, new FocusCellOwnerDrawHighlighter(traceTypeViewer));
125
 
        ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(traceTypeViewer) {
126
 
        };
127
 
        TreeViewerEditor.create(traceTypeViewer, focusCellManager, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL
128
 
                | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
129
 
                | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);
130
 
 
131
 
        final TextCellEditor textCellEditor = new TextCellEditor(traceTypeViewer.getTree());
132
 
        // --------------------
133
 
        // Column 1
134
 
        // --------------------
135
 
        TreeViewerColumn column = new TreeViewerColumn(traceTypeViewer, SWT.NONE);
136
 
        column.getColumn().setWidth(COL_WIDTH);
137
 
        column.getColumn().setText(Messages.ImportTraceWizardTraceDisplayName);
138
 
        column.setLabelProvider(new FirstColumnLabelProvider());
139
 
        column.setEditingSupport(new ColumnEditorSupport(traceTypeViewer, textCellEditor));
140
 
 
141
 
        // --------------------
142
 
        // Column 2
143
 
        // --------------------
144
 
 
145
 
        column = new TreeViewerColumn(traceTypeViewer, SWT.NONE);
146
 
        column.getColumn().setWidth(500);
147
 
        column.getColumn().setText(Messages.ImportTraceWizardImportCaption);
148
 
        column.setLabelProvider(new ColumnLabelProvider() {
149
 
            @Override
150
 
            public String getText(Object element) {
151
 
                if (element instanceof FileAndName) {
152
 
                    FileAndName elem = (FileAndName) element;
153
 
                    return elem.getFile().getPath();
154
 
                }
155
 
                return null;
156
 
            }
157
 
        });
158
 
        // --------------------
159
 
        // Column 3
160
 
        // --------------------
161
 
 
162
 
        column = new TreeViewerColumn(traceTypeViewer, SWT.NONE);
163
 
 
164
 
        column.getColumn().setWidth(80);
165
 
        column.getColumn().setText(Messages.ImportTraceWizardScanPageSize);
166
 
        column.getColumn().setAlignment(SWT.RIGHT);
167
 
        column.setLabelProvider(new ColumnLabelProvider() {
168
 
 
169
 
            @Override
170
 
            public String getText(Object element) {
171
 
                if (element instanceof FileAndName) {
172
 
 
173
 
                    FileAndName elem = (FileAndName) element;
174
 
                    long len = recurseSize(elem.getFile());
175
 
                    if (len > 0) {
176
 
                        double sizeb10 = Math.log10(len);
177
 
                        DecimalFormat df = new DecimalFormat();
178
 
                        df.setMaximumFractionDigits(2);
179
 
                        df.setMinimumFractionDigits(0);
180
 
                        if (sizeb10 > 12) {
181
 
                            final double tbSize = len / 1024.0 / 1024 / 1024 / 1024;
182
 
                            return df.format(tbSize) + Messages.ImportTraceWizardScanPageTerabyte;
183
 
                        }
184
 
                        if (sizeb10 > 9) {
185
 
                            final double gbSize = len / 1024.0 / 1024 / 1024;
186
 
                            return df.format(gbSize) + Messages.ImportTraceWizardScanPageGigabyte;
187
 
                        }
188
 
                        if (sizeb10 > 6) {
189
 
                            final double mbSize = len / 1024.0 / 1024;
190
 
                            return df.format(mbSize) + Messages.ImportTraceWizardScanPageMegabyte;
191
 
                        }
192
 
                        if (sizeb10 > 3) {
193
 
                            final double kbSize = len / 1024.0;
194
 
                            return df.format(kbSize) + Messages.ImportTraceWizardScanPageKilobyte;
195
 
                        }
196
 
                    }
197
 
                    return Long.toString(len) + Messages.ImportTraceWizardScanPagebyte;
198
 
 
199
 
                }
200
 
                return null;
201
 
            }
202
 
 
203
 
            private long recurseSize(File file) {
204
 
                if (file.isFile() && file.canRead()) {
205
 
                    return file.length();
206
 
                }
207
 
                long size = 0;
208
 
                if (file.exists() && file.isDirectory() && file.canRead()) {
209
 
                    final File[] listFiles = file.listFiles();
210
 
                    if (listFiles != null) {
211
 
                        for (File child : listFiles) {
212
 
                            if (child.isFile() && child.canRead()) {
213
 
                                size += child.length();
214
 
                            } else if (child.isDirectory()) {
215
 
                                size += recurseSize(child);
216
 
                            } else {
217
 
                                Activator.getDefault().logError("Unknown \"file\" type for " + child + ' ' + child.toString()); //$NON-NLS-1$
218
 
                            }
219
 
                        }
220
 
                    }
221
 
                }
222
 
                return size;
223
 
            }
224
 
        });
225
 
 
226
 
        init();
227
 
        getBatchWizard().setTracesToScan(fTracesToScan);
228
 
        getBatchWizard().setTraceFolder(fTargetFolder);
229
 
 
230
 
        fRunnable.schedule();
231
 
        setErrorMessage(Messages.ImportTraceWizardScanPageSelectAtleastOne);
232
 
    }
233
 
 
234
 
    private void init() {
235
 
        Composite optionPane = (Composite) this.getControl();
236
 
 
237
 
        optionPane.setLayout(new GridLayout());
238
 
        optionPane.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
239
 
 
240
 
        final Button fLink = new Button(optionPane, SWT.RADIO);
241
 
        fLink.setText(Messages.ImportTraceWizardLinkTraces);
242
 
        fLink.setSelection(true);
243
 
        fLink.setLayoutData(new GridData());
244
 
 
245
 
        final Button fCopy = new Button(optionPane, SWT.RADIO);
246
 
        fCopy.setText(Messages.ImportTraceWizardCopyTraces);
247
 
        fCopy.setLayoutData(new GridData());
248
 
 
249
 
        final SelectionListener linkedListener = new RadioChooser(fLink);
250
 
 
251
 
        fLink.addSelectionListener(linkedListener);
252
 
        fCopy.addSelectionListener(linkedListener);
253
 
 
254
 
        Button fOverwrite = new Button(optionPane, SWT.CHECK);
255
 
        fOverwrite.setText(Messages.ImportTraceWizardOverwriteTraces);
256
 
        fOverwrite.setLayoutData(new GridData());
257
 
        fOverwrite.setSelection(true);
258
 
        fOverwrite.addSelectionListener(new SelectionListener() {
259
 
 
260
 
            @Override
261
 
            public void widgetSelected(SelectionEvent e) {
262
 
                getBatchWizard().setOverwrite(((Button) e.widget).getSelection());
263
 
            }
264
 
 
265
 
            @Override
266
 
            public void widgetDefaultSelected(SelectionEvent e) {
267
 
            }
268
 
        });
269
 
    }
270
 
 
271
 
    /*
272
 
     * Helper classes
273
 
     */
274
 
 
275
 
    private final class RadioChooser implements SelectionListener {
276
 
        final private Button isLinked;
277
 
 
278
 
        public RadioChooser(Button desiredButton) {
279
 
            isLinked = desiredButton;
280
 
        }
281
 
 
282
 
        @Override
283
 
        public void widgetSelected(SelectionEvent e) {
284
 
 
285
 
            final Button widget = (Button) e.widget;
286
 
            getBatchWizard().setLinked(widget.equals(isLinked));
287
 
        }
288
 
 
289
 
        @Override
290
 
        public void widgetDefaultSelected(SelectionEvent e) {
291
 
 
292
 
        }
293
 
    }
294
 
 
295
 
    private final class ColumnEditorSupport extends EditingSupport {
296
 
        private final TextCellEditor textCellEditor;
297
 
 
298
 
        private ColumnEditorSupport(ColumnViewer viewer, TextCellEditor textCellEditor) {
299
 
            super(viewer);
300
 
            this.textCellEditor = textCellEditor;
301
 
        }
302
 
 
303
 
        @Override
304
 
        protected boolean canEdit(Object element) {
305
 
            return element instanceof FileAndName;
306
 
        }
307
 
 
308
 
        @Override
309
 
        protected CellEditor getCellEditor(Object element) {
310
 
            return textCellEditor;
311
 
        }
312
 
 
313
 
        @Override
314
 
        protected Object getValue(Object element) {
315
 
            if (element instanceof FileAndName) {
316
 
                return ((FileAndName) element).getName();
317
 
            }
318
 
            return null;
319
 
        }
320
 
 
321
 
        @Override
322
 
        protected void setValue(Object element, Object value) {
323
 
            FileAndName fan = (FileAndName) element;
324
 
            fan.setName((String) value);
325
 
            getBatchWizard().updateConflicts();
326
 
            traceTypeViewer.update(element, null);
327
 
            traceTypeViewer.refresh();
328
 
        }
329
 
    }
330
 
 
331
 
    private final class FirstColumnLabelProvider extends ColumnLabelProvider {
332
 
        Image fConflict;
333
 
 
334
 
        @Override
335
 
        public Image getImage(Object element) {
336
 
            if (element instanceof FileAndName) {
337
 
                final FileAndName fan = (FileAndName) element;
338
 
                if (fan.isConflictingName()) {
339
 
                    if (fConflict == null) {
340
 
                        fConflict = Activator.getDefault().getImageFromImageRegistry(ITmfImageConstants.IMG_UI_CONFLICT);
341
 
                    }
342
 
                    return fConflict;
343
 
                }
344
 
            }
345
 
            return null;
346
 
        }
347
 
 
348
 
        @Override
349
 
        public String getText(Object element) {
350
 
            if (element instanceof FileAndName) {
351
 
                FileAndName elem = (FileAndName) element;
352
 
                return elem.getName();
353
 
            }
354
 
            if (element instanceof String) {
355
 
                return (String) element;
356
 
            }
357
 
            return null;
358
 
        }
359
 
    }
360
 
 
361
 
    private final class ImportTraceCheckStateListener implements ICheckStateListener {
362
 
        @Override
363
 
        public void checkStateChanged(CheckStateChangedEvent event) {
364
 
            final CheckboxTreeViewer tv = (CheckboxTreeViewer)
365
 
                    event.getSource();
366
 
            if (event.getElement() instanceof FileAndName) {
367
 
                final FileAndName element = (FileAndName) event.getElement();
368
 
                if (event.getChecked()) {
369
 
                    getBatchWizard().addFileToImport(element);
370
 
                    traceTypeViewer.update(element, null);
371
 
                }
372
 
                else {
373
 
                    getBatchWizard().removeFileToImport(element);
374
 
                    traceTypeViewer.update(element, null);
375
 
                }
376
 
                maintainCheckIntegrity(tv, element);
377
 
            }
378
 
            if (event.getElement() instanceof String) {
379
 
 
380
 
                tv.setSubtreeChecked(event.getElement(), event.getChecked());
381
 
                final Object[] children =
382
 
                        getBatchWizard().getScannedTraces().getChildren(event.getElement());
383
 
                if (event.getChecked()) {
384
 
                    for (int i = 0; i < children.length; i++) {
385
 
                        final FileAndName element = (FileAndName) children[i];
386
 
                        getBatchWizard().addFileToImport(element);
387
 
                        traceTypeViewer.update(children[i], null);
388
 
                    }
389
 
                }
390
 
                else {
391
 
                    for (int i = 0; i < children.length; i++) {
392
 
                        getBatchWizard().removeFileToImport((FileAndName) children[i]);
393
 
 
394
 
                    }
395
 
                }
396
 
 
397
 
            }
398
 
            getBatchWizard().updateConflicts();
399
 
            if (getBatchWizard().hasConflicts()) {
400
 
                setErrorMessage(Messages.ImportTraceWizardScanPageRenameError);
401
 
            } else if (!getBatchWizard().hasTracesToImport()) {
402
 
                setErrorMessage(Messages.ImportTraceWizardScanPageSelectAtleastOne);
403
 
            } else {
404
 
                setErrorMessage(null);
405
 
            }
406
 
            getWizard().getContainer().updateButtons();
407
 
            traceTypeViewer.update(event.getElement(), null);
408
 
        }
409
 
 
410
 
        private void maintainCheckIntegrity(final CheckboxTreeViewer viewer, final FileAndName element) {
411
 
            final ImportTraceContentProvider scannedTraces = getBatchWizard().getScannedTraces();
412
 
            String parentElement = (String) scannedTraces.getParent(element);
413
 
            boolean allChecked = true;
414
 
            final FileAndName[] siblings = scannedTraces.getSiblings(element);
415
 
            if (siblings != null) {
416
 
                for (FileAndName child : siblings) {
417
 
                    allChecked &= viewer.getChecked(child);
418
 
                }
419
 
            }
420
 
            viewer.setChecked(parentElement, allChecked);
421
 
        }
422
 
    }
423
 
 
424
 
    private final class ScanRunnable extends Job {
425
 
 
426
 
        // monitor is stored here, starts as the main monitor but becomes a
427
 
        // submonitor
428
 
        private IProgressMonitor fMonitor;
429
 
 
430
 
        public ScanRunnable(String name) {
431
 
            super(name);
432
 
            this.setSystem(true);
433
 
        }
434
 
 
435
 
        private synchronized IProgressMonitor getMonitor() {
436
 
            return fMonitor;
437
 
        }
438
 
 
439
 
        @Override
440
 
        public IStatus run(IProgressMonitor monitor) {
441
 
            /*
442
 
             * Set up phase, it is synchronous
443
 
             */
444
 
            fMonitor = monitor;
445
 
            final Control control = traceTypeViewer.getControl();
446
 
            // please note the sync exec here is to allow us to set
447
 
            control.getDisplay().syncExec(new Runnable() {
448
 
                @Override
449
 
                public void run() {
450
 
                    // monitor gets overwritten here so it's necessary to save
451
 
                    // it in a field.
452
 
                    fMonitor = SubMonitor.convert(getMonitor());
453
 
                    getMonitor().setTaskName(Messages.ImportTraceWizardPageScanScanning + ' ');
454
 
                    ((SubMonitor) getMonitor()).setWorkRemaining(IProgressMonitor.UNKNOWN);
455
 
                }
456
 
            });
457
 
            /*
458
 
             * At this point we start calling async execs and updating the view.
459
 
             * This is a good candidate to parallelise.
460
 
             */
461
 
            while (fCanRun == true) {
462
 
                boolean updated = false;
463
 
                boolean validCombo;
464
 
                if (fTracesToScan.isEmpty() && !control.isDisposed()) {
465
 
                    control.getDisplay().asyncExec(new Runnable() {
466
 
 
467
 
                        @Override
468
 
                        public void run() {
469
 
                            if (!control.isDisposed()) {
470
 
                                getMonitor().setTaskName(Messages.ImportTraceWizardPageScanScanning + ' ');
471
 
                                getMonitor().subTask(Messages.ImportTraceWizardPageScanDone);
472
 
                                ImportTraceWizardScanPage.this.setMessage(Messages.ImportTraceWizardPageScanScanning + ' ' + Messages.ImportTraceWizardPageScanDone);
473
 
                            }
474
 
                        }
475
 
                    });
476
 
                }
477
 
                try {
478
 
                    final TraceValidationHelper traceToScan = fTracesToScan.take();
479
 
 
480
 
                    if (!getBatchWizard().hasScanned(traceToScan)) {
481
 
                        getBatchWizard().addResult(traceToScan, TmfTraceType.getInstance().validate(traceToScan));
482
 
                    }
483
 
 
484
 
                    /*
485
 
                     * The following is to update the UI
486
 
                     */
487
 
                    validCombo = getBatchWizard().getResult(traceToScan);
488
 
                    if (validCombo) {
489
 
                        // Synched on it's parent
490
 
 
491
 
                        getBatchWizard().getScannedTraces().addCandidate(traceToScan.getTraceType(), new File(traceToScan.getTraceToScan()));
492
 
                        updated = true;
493
 
                    }
494
 
                    final int scanned = getBatchWizard().getNumberOfResults();
495
 
                    final int total = scanned + fTracesToScan.size();
496
 
                    final int prevVal = (int) ((scanned - 1) * 100.0 / total);
497
 
                    final int curVal = (int) ((scanned) * 100.0 / total);
498
 
                    if (curVal != prevVal) {
499
 
                        updated = true;
500
 
                    }
501
 
                    /*
502
 
                     * update the progress
503
 
                     */
504
 
                    if (updated) {
505
 
                        if (!control.isDisposed()) {
506
 
                            control.getDisplay().asyncExec(new Runnable() {
507
 
                                @Override
508
 
                                public void run() {
509
 
                                    if (!control.isDisposed()) {
510
 
                                        getMonitor().setTaskName(Messages.ImportTraceWizardPageScanScanning + ' ');
511
 
                                        getMonitor().subTask(traceToScan.getTraceToScan());
512
 
                                        getMonitor().worked(1);
513
 
                                        ImportTraceWizardScanPage.this.setMessage(Messages.ImportTraceWizardPageScanScanning + ' '
514
 
                                                + Integer.toString(curVal)
515
 
                                                + '%');
516
 
                                    }
517
 
                                }
518
 
                            }
519
 
                                    );
520
 
                        }
521
 
                    }
522
 
 
523
 
                    /*
524
 
                     * here we update the table
525
 
                     */
526
 
                    final boolean editing = traceTypeViewer.isCellEditorActive();
527
 
                    if (updated && !editing) {
528
 
                        if (!control.isDisposed()) {
529
 
                            control.getDisplay().asyncExec(new Runnable() {
530
 
 
531
 
                                @Override
532
 
                                public void run() {
533
 
                                    if (!control.isDisposed()) {
534
 
                                        if (!traceTypeViewer.isCellEditorActive()) {
535
 
                                            traceTypeViewer.refresh();
536
 
                                        }
537
 
                                    }
538
 
                                }
539
 
                            });
540
 
                        }
541
 
                    }
542
 
                } catch (InterruptedException e) {
543
 
                    return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, new String());
544
 
                }
545
 
            }
546
 
            return Status.OK_STATUS;
547
 
        }
548
 
    }
549
 
 
550
 
    /**
551
 
     * Refresh the view and the corresponding model.
552
 
     */
553
 
    public void refresh() {
554
 
        final Control control = traceTypeViewer.getControl();
555
 
        if (!control.isDisposed()) {
556
 
            control.getDisplay().asyncExec(new Runnable() {
557
 
                @Override
558
 
                public void run() {
559
 
                    if (!control.isDisposed()) {
560
 
                        traceTypeViewer.refresh();
561
 
                    }
562
 
                }
563
 
            });
564
 
        }
565
 
    }
566
 
}