});
inspectorMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
try {
SpreadInspector sp = new SpreadInspector(shell);
ConceptTO[] allConcepts = controller.getAllConcepts();
String []concepts = new String[allConcepts.length];
for(int i = 0; i<allConcepts.length;i++){
concepts[i] = allConcepts[i].getUri();
}
Arrays.sort(concepts);
sp.setInitialConceptsTOs(controller.getInitialConcepts());
sp.setRelationsWeight(controller.getOntoSpreadProcess().getRelationWeight());
sp.setActiveConcepts(createActiveConcepts());
PairRelationActiveTO result = (PairRelationActiveTO) sp.open();
if(result != null) updateInspector(result);
} catch (ConceptNotFoundException e) {
createErrorDialog(e);
}
}
private void updateInspector(PairRelationActiveTO result) throws ConceptNotFoundException {
controller.updateActiveConcepts(result.getActiveConceptsTOs());
controller.updateRelationsWeight(result.getRelationConceptsTOs());
}
private List<ScoredConceptTO> createActiveConcepts() throws ConceptNotFoundException {
List<ScoredConceptTO> actived = new LinkedList<ScoredConceptTO>();
Map<String, Double> concepts = controller.current().getConcepts();
for (UriDepthPair uriDepthPair : controller.current().getSortedList()) {
actived.add(new ScoredConceptTO(uriDepthPair.getUri(),concepts.get(uriDepthPair.getUri())));
}
return actived;
}
});
showConceptMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
ShowConcept showConcept = new ShowConcept(shell);
ConceptTO[] allConcepts = controller.getAllConcepts();
String []concepts = new String[allConcepts.length];
for(int i = 0; i<allConcepts.length;i++){
concepts[i] = allConcepts[i].getUri();
}
Arrays.sort(concepts);
showConcept.setConcepts(concepts);
String uri = (String) showConcept.open();
if(uri != null){
try {
viewer.setGraph(controller.createGraphFromConcept(uri));
updateGraph();
} catch (ConceptNotFoundException e) {
createErrorDialog(e);
}
}
}
});
conceptPathMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
try {
ShowConceptPath sp = new ShowConceptPath(shell);
String[] concepts;
concepts = controller.getAvailablePaths();
Arrays.sort(concepts);
sp.setConcepts(concepts);
String uri = (String) sp.open();
if(uri != null){
viewer.setGraph(controller.createGraphForSpreading(uri));
updateGraph();
}
} catch (ConceptNotFoundException e) {