use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.
the class EditorContentSynchronizerImpl method onActivePartChanged.
@Override
public void onActivePartChanged(ActivePartChangedEvent event) {
PartPresenter activePart = event.getActivePart();
if (!(activePart instanceof EditorPartPresenter)) {
return;
}
EditorPartPresenter activeEditor = (EditorPartPresenter) activePart;
Path path = activeEditor.getEditorInput().getFile().getLocation();
if (editorGroups.containsKey(path)) {
editorGroups.get(path).onActiveEditorChanged(activeEditor);
}
}
use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.
the class EditorMultiPartStackPresenter method onActivePartChanged.
@Override
public void onActivePartChanged(ActivePartChangedEvent event) {
PartPresenter activePart = event.getActivePart();
if (activePart instanceof EditorPartPresenter) {
activeEditor = activePart;
activeEditorPartStack = getPartStackByPart(activePart);
}
}
use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.
the class RecipeEditorPanel method initializeEditor.
private void initializeEditor(@NotNull final VirtualFile file) {
FileType fileType = fileTypeRegistry.getFileTypeByFile(file);
editor = getEditor();
editor.activate();
editor.onOpen();
view.showEditor(editor);
// wait when editor is initialized
editor.addPropertyListener(new PropertyListener() {
@Override
public void propertyChanged(PartPresenter source, int propId) {
switch(propId) {
case PROP_INPUT:
view.showEditor(editor);
break;
case PROP_DIRTY:
if (validateUndoOperation()) {
setEnableSaveAndCancelButtons(true);
}
break;
default:
}
}
});
editor.init(new RecipeEditorInput(fileType, file), new OpenEditorCallbackImpl());
}
use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.
the class AbstractPerspective method loadState.
@Override
public void loadState(@NotNull JsonObject state) {
if (state.hasKey("PART_STACKS")) {
JsonObject part_stacks = state.getObject("PART_STACKS");
for (String partStackType : part_stacks.keys()) {
JsonObject partStack = part_stacks.getObject(partStackType);
switch(PartStackType.valueOf(partStackType)) {
case INFORMATION:
restorePartController(partStacks.get(INFORMATION), belowPartController, partStack);
break;
case NAVIGATION:
restorePartController(partStacks.get(NAVIGATION), leftPartController, partStack);
break;
case TOOLING:
restorePartController(partStacks.get(TOOLING), rightPartController, partStack);
break;
}
}
}
if (state.hasKey("ACTIVE_PART")) {
String activePart = state.getString("ACTIVE_PART");
Provider<PartPresenter> provider = dynaProvider.getProvider(activePart);
if (provider != null) {
setActivePart(provider.get());
}
}
}
use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.
the class FileWatcher method editorOpened.
public void editorOpened(final EditorPartPresenter editor) {
final PropertyListener propertyListener = new PropertyListener() {
@Override
public void propertyChanged(PartPresenter source, int propId) {
if (propId == EditorPartPresenter.PROP_DIRTY) {
if (!editor.isDirty()) {
reparseAllOpenedFiles();
//remove just saved editor
editor2reconcile.remove(editor);
}
}
}
};
editor.addPropertyListener(propertyListener);
}
Aggregations