Révision 2638
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 2638) | ||
|---|---|---|
| 665 | 665 |
* |
| 666 | 666 |
* @param obj |
| 667 | 667 |
*/ |
| 668 |
public static void focus(TXMResult obj) {
|
|
| 668 |
public static void reveal(TXMResult obj) {
|
|
| 669 | 669 |
final CorporaView corporaView = getInstance(); |
| 670 | 670 |
if (obj != null && corporaView != null) {
|
| 671 | 671 |
corporaView.treeViewer.reveal(obj); |
| 672 | 672 |
} |
| 673 | 673 |
} |
| 674 | 674 |
|
| 675 |
public static boolean isFocused() {
|
|
| 675 |
/** |
|
| 676 |
* Checks if the Corpora view is active. |
|
| 677 |
* |
|
| 678 |
* @return |
|
| 679 |
*/ |
|
| 680 |
public static boolean isActive() {
|
|
| 676 | 681 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
| 677 |
if (window == null) return false; |
|
| 682 |
if (window == null) {
|
|
| 683 |
return false; |
|
| 684 |
} |
|
| 678 | 685 |
IWorkbenchPage page = window.getActivePage(); |
| 679 |
if (page == null) return false; |
|
| 680 |
|
|
| 686 |
if (page == null) {
|
|
| 687 |
return false; |
|
| 688 |
} |
|
| 681 | 689 |
IWorkbenchPart part = page.getActivePart(); |
| 682 | 690 |
return part.getSite().getId().equals(CorporaView.ID); |
| 683 | 691 |
} |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2638) | ||
|---|---|---|
| 764 | 764 |
// if (mainParametersComposite != null && !mainParametersComposite.isDisposed()) {
|
| 765 | 765 |
// mainParametersComposite.setFocus(); |
| 766 | 766 |
// } |
| 767 |
CorporaView.focus(this.getResult());
|
|
| 767 |
CorporaView.reveal(this.getResult());
|
|
| 768 | 768 |
} |
| 769 | 769 |
|
| 770 | 770 |
@SuppressWarnings("unchecked")
|
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesSelectionChart.java (revision 2638) | ||
|---|---|---|
| 26 | 26 |
* |
| 27 | 27 |
*/ |
| 28 | 28 |
public class ComputeSpecifictiesSelectionChart extends BaseAbstractHandler {
|
| 29 |
|
|
| 30 |
|
|
| 31 | 29 |
|
| 30 |
|
|
| 31 |
|
|
| 32 | 32 |
@Override |
| 33 | 33 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 34 | 34 |
|
| ... | ... | |
| 36 | 36 |
SpecificitiesSelection specificitiesSelection = null; |
| 37 | 37 |
|
| 38 | 38 |
// Reopening from existing result |
| 39 |
if(selection instanceof SpecificitiesSelection && CorporaView.isFocused()) {
|
|
| 39 |
if (selection instanceof SpecificitiesSelection && CorporaView.isActive()) { // test if the corpora view is active (otherwise, if a SpecificitiesSelection is selected, the creation from table
|
|
| 40 |
// lines bugs ) |
|
| 40 | 41 |
specificitiesSelection = (SpecificitiesSelection) selection; |
| 41 | 42 |
} |
| 42 | 43 |
// Creates from SpecificitiesEditor selected table lines |
| 43 |
else {
|
|
| 44 |
else {
|
|
| 44 | 45 |
try {
|
| 45 | 46 |
IWorkbenchWindow iww = HandlerUtil.getActiveWorkbenchWindow(event); |
| 46 | 47 |
IWorkbenchPage iwp = iww.getActivePage(); |
| ... | ... | |
| 49 | 50 |
System.out.println("Editor is not a SpecificitiesEditor: " + editor.getClass());
|
| 50 | 51 |
return null; |
| 51 | 52 |
} |
| 52 |
|
|
| 53 |
Specificities specificities = ((SpecificitiesEditor)editor).getResult(); |
|
| 54 | 53 |
|
| 55 |
IStructuredSelection tableSelection = (IStructuredSelection) ((SpecificitiesEditor)editor).getTableSelection(); |
|
| 54 |
Specificities specificities = ((SpecificitiesEditor) editor).getResult(); |
|
| 55 |
|
|
| 56 |
IStructuredSelection tableSelection = (IStructuredSelection) ((SpecificitiesEditor) editor).getTableSelection(); |
|
| 56 | 57 |
Object[] tableLines = tableSelection.toArray(); |
| 57 | 58 |
|
| 58 | 59 |
// no line selected |
| 59 | 60 |
if (tableSelection.isEmpty()) {
|
| 60 | 61 |
return null; |
| 61 | 62 |
} |
| 62 |
|
|
| 63 |
|
|
| 63 | 64 |
final String[] selectedTypeNames = new String[tableLines.length]; |
| 64 | 65 |
String[] partNames = specificities.getColumnsNames(); |
| 65 | 66 |
final double[][] selectedSpecificitiesIndices = new double[tableLines.length][partNames.length]; |
| ... | ... | |
| 73 | 74 |
// Set the data to focus on |
| 74 | 75 |
specificitiesSelection.setSelectedTypeNames(Arrays.asList(selectedTypeNames)); |
| 75 | 76 |
|
| 76 |
} catch (Exception e) {
|
|
| 77 |
} |
|
| 78 |
catch (Exception e) {
|
|
| 77 | 79 |
System.out.println("Error while computing specificities bar chart: " + e.getLocalizedMessage());
|
| 78 | 80 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 79 | 81 |
} |
Formats disponibles : Unified diff