use of org.eclipse.che.ide.api.editor.texteditor.TextEditorPartView in project che by eclipse.
the class ClassFileSourcesDownloader method onEditorOpened.
@Override
public void onEditorOpened(EditorOpenedEvent event) {
EditorPartPresenter editor = event.getEditor();
VirtualFile file = editor.getEditorInput().getFile();
if (file instanceof JarFileNode) {
final JarFileNode jarFileNode = (JarFileNode) file;
if (jarFileNode.isContentGenerated()) {
if (editor instanceof TextEditor) {
final TextEditor presenter = (TextEditor) editor;
TextEditorPartView view = presenter.getView();
final DivElement divElement = Elements.createDivElement();
divElement.setClassName(resources.css().editorInfoPanel());
Text textNode = Elements.createTextNode(constant.mavenClassDecompiled());
DivElement decompiledElement = Elements.createDivElement();
decompiledElement.appendChild(textNode);
decompiledElement.setClassName(resources.css().editorMessage());
divElement.appendChild(decompiledElement);
AnchorElement anchorElement = Elements.createAnchorElement();
anchorElement.appendChild(Elements.createTextNode(constant.mavenDownloadSources()));
anchorElement.setHref("#");
anchorElement.setClassName(resources.css().downloadLink());
divElement.appendChild(anchorElement);
final HasNotificationPanel.NotificationRemover remover = view.addNotification((Element) divElement);
anchorElement.setOnclick(new EventListener() {
@Override
public void handleEvent(Event evt) {
downloadSources(jarFileNode, remover);
}
});
}
}
}
}
Aggregations