else if (source == editButton){ // edit the chosen file in the rich text editor
if (chosenFile == null) {
showError(NLS_ERROR_CHOOSEFILEFIRST);
return;
}
VFSItem vfsItem = rootContainer.resolve(chosenFile);
if (vfsItem == null || !(vfsItem instanceof VFSLeaf)) {
showError(NLS_ERROR_FILEDOESNOTEXIST);
return;
}
String editFile;
VFSContainer editRoot;
if (allowRelativeLinks.booleanValue()) {
editRoot = rootContainer;
editFile = chosenFile;
} else {
ContainerAndFile caf = VFSUtil.calculateSubRoot(rootContainer, chosenFile);
editRoot = caf.getContainer();
editFile = caf.getFileName();
}
removeAsListenerAndDispose(wysiwygCtr);
wysiwygCtr = createWysiwygController(ureq, getWindowControl(), editRoot, editFile);
listenTo(wysiwygCtr);
removeAsListenerAndDispose(cmcWysiwygCtr);
cmcWysiwygCtr = new CloseableModalController(getWindowControl(), getTranslator().translate("close"), wysiwygCtr.getInitialComponent());
listenTo(cmcWysiwygCtr);
cmcWysiwygCtr.activate();
updateVelocityVariables(chosenFile);
fireEvent(ureq, FILE_CONTENT_CHANGED_EVENT);
}
// delete the chosen file
else if (source == deleteButton){
if (chosenFile == null) {
showError(NLS_ERROR_CHOOSEFILEFIRST);
return;
}
VFSItem vfsItem = rootContainer.resolve(chosenFile);
if (vfsItem == null || !(vfsItem instanceof LocalFileImpl)) {
showError(NLS_ERROR_FILEDOESNOTEXIST);
return;
}
File file = ((LocalFileImpl)vfsItem).getBasefile();