use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class EditorAgentImpl method doOpen.
private void doOpen(final VirtualFile file, final OpenEditorCallback callback, final Constraints constraints) {
EditorPartStack activePartStack = editorMultiPartStack.getActivePartStack();
if (constraints == null && activePartStack != null) {
PartPresenter partPresenter = activePartStack.getPartByPath(file.getLocation());
if (partPresenter != null) {
workspaceAgent.setActivePart(partPresenter, EDITING);
callback.onEditorActivated((EditorPartPresenter) partPresenter);
return;
}
}
final FileType fileType = fileTypeRegistry.getFileTypeByFile(file);
final EditorProvider editorProvider = editorRegistry.getEditor(fileType);
if (editorProvider instanceof AsyncEditorProvider) {
AsyncEditorProvider provider = (AsyncEditorProvider) editorProvider;
Promise<EditorPartPresenter> promise = provider.createEditor(file);
if (promise != null) {
promise.then(new Operation<EditorPartPresenter>() {
@Override
public void apply(EditorPartPresenter arg) throws OperationException {
initEditor(file, callback, fileType, arg, constraints, editorProvider);
}
});
return;
}
}
final EditorPartPresenter editor = editorProvider.getEditor();
initEditor(file, callback, fileType, editor, constraints, editorProvider);
}
use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class EditorTabWidget method update.
/** {@inheritDoc} */
@Override
public void update(@NotNull PartPresenter part) {
title.setText(part.getTitle());
if (part instanceof EditorPartPresenter) {
file = ((EditorPartPresenter) part).getEditorInput().getFile();
FileType fileType = fileTypeRegistry.getFileTypeByFile(file);
icon = fileType.getImage();
iconPanel.setWidget(getIcon());
}
}
Aggregations