224 |
224 |
gl_composite_3.marginWidth = 0;
|
225 |
225 |
composite_3.setLayout(gl_composite_3);
|
226 |
226 |
|
227 |
|
Button btnAddCharacter = new Button(composite_3, SWT.NONE);
|
|
227 |
Composite composite_4 = new Composite(composite_3, SWT.NONE);
|
|
228 |
formToolkit.adapt(composite_4);
|
|
229 |
formToolkit.paintBordersFor(composite_4);
|
|
230 |
GridLayout gl_composite_4 = new GridLayout(1, false);
|
|
231 |
gl_composite_4.marginWidth = 0;
|
|
232 |
composite_4.setLayout(gl_composite_4);
|
|
233 |
|
|
234 |
Button btnAddCharacter = new Button(composite_4, SWT.NONE);
|
228 |
235 |
btnAddCharacter.setText(">>"); //$NON-NLS-1$
|
229 |
236 |
formToolkit.adapt(btnAddCharacter, true, true);
|
230 |
237 |
btnAddCharacter.addSelectionListener(new SelectionAdapter() {
|
... | ... | |
260 |
267 |
}
|
261 |
268 |
});
|
262 |
269 |
|
|
270 |
Button btnAddRatioTo = new Button(composite_4, SWT.NONE);
|
|
271 |
btnAddRatioTo.setText("ratio to"); //$NON-NLS-1$
|
|
272 |
|
|
273 |
btnAddRatioTo.setSize(btnAddCharacter.getSize());
|
|
274 |
|
|
275 |
formToolkit.adapt(btnAddRatioTo, true, true);
|
|
276 |
btnAddRatioTo.addSelectionListener(new SelectionAdapter() {
|
|
277 |
@Override
|
|
278 |
public void widgetSelected(SelectionEvent e) {
|
|
279 |
if(!isVocabularySet()){
|
|
280 |
return;
|
|
281 |
}
|
|
282 |
if (confirmSaveDirty()){
|
|
283 |
return;
|
|
284 |
}
|
|
285 |
ISelection structureTreeSelection = structureViewer.getSelection();
|
|
286 |
ISelection characterSelection = characterTreeEditorComposite.getViewer().getSelection();
|
|
287 |
if(structureTreeSelection==null || characterSelection ==null){
|
|
288 |
MessagingUtils.warningDialog(Messages.CharacterEditor_CANNOT_PERFORM_TITLE, CharacterEditor.this,
|
|
289 |
Messages.CharacterEditor_CANNOT_PERFORM_MESSAGE);
|
|
290 |
return;
|
|
291 |
}
|
|
292 |
|
|
293 |
CharacterNodeDto character = (CharacterNodeDto)((TreeSelection)characterSelection).getFirstElement();
|
|
294 |
TermNode ratioToNode = (TermNode)((TreeSelection)structureTreeSelection).getFirstElement();
|
|
295 |
if (character == null){
|
|
296 |
return;
|
|
297 |
}
|
|
298 |
TermDto termDto = character.getTerm();
|
|
299 |
if (termDto instanceof CharacterDto){
|
|
300 |
CharacterDto dto = (CharacterDto)termDto;
|
|
301 |
dto.setRatioTo(TermNodeDto.fromNode(ratioToNode, null));
|
|
302 |
}
|
|
303 |
|
|
304 |
// Collection<Character> characters = createCharacters((TreeSelection)structureTreeSelection, (TreeSelection)propertyTreeSelection);
|
|
305 |
TermNodeDto parent = characterTreeEditorComposite.getFeatureTree().getRoot();
|
|
306 |
|
|
307 |
// for (Character character : characters) {
|
|
308 |
// //add new Character to feature tree
|
|
309 |
// CharacterNodeDto nodeDto = new CharacterNodeDto(CharacterDto.fromCharacter(character), parent, 0, parent.getTree(), null, null, null);
|
|
310 |
// nodesToSave.put(character, nodeDto);
|
|
311 |
// setDirty();
|
|
312 |
// // result = CdmStore.getService(IFeatureNodeService.class).createChildFeatureNode(parent.getUuid(), character, vocabulary.getUuid());
|
|
313 |
//
|
|
314 |
// }
|
|
315 |
setDirty();
|
|
316 |
nodesToUpdate.add(character);
|
|
317 |
|
|
318 |
refresh();
|
|
319 |
characterTreeEditorComposite.getViewer().setSelection(new StructuredSelection(character));
|
|
320 |
}
|
|
321 |
});
|
|
322 |
|
263 |
323 |
characterTreeEditorComposite = addFeatureTreeEditor(composite_3);
|
264 |
324 |
initFeatureTreeComposite(TermType.Character, characterTreeEditorComposite, new TermNodeDtoDragListener(characterTreeEditorComposite.getViewer()),
|
265 |
325 |
new TermTreeDtoDropAdapter(this, characterTreeEditorComposite.getViewer(), sync),
|
ref #9537: adapt editor to ratioTo in Character