use of org.eclipse.che.ide.resource.Path in project che by eclipse.
the class ClasspathMacroTest method defaultValueOfClasspathShouldBeBuilt.
@Test
public void defaultValueOfClasspathShouldBeBuilt() throws Exception {
List<ClasspathEntryDto> entries = new ArrayList<>();
Set<String> libs = new HashSet<>();
Path projectsRoot = Path.valueOf("/projects");
when(appContext.getProjectsRoot()).thenReturn(projectsRoot);
when(classpathContainer.getClasspathEntries(anyString())).thenReturn(classpathEntriesPromise);
when(classpathResolver.getLibs()).thenReturn(libs);
classpathMacro.expand();
verify(classpathEntriesPromise).then(classpathEntriesCapture.capture());
String classpath = classpathEntriesCapture.getValue().apply(entries);
verify(classpathResolver).resolveClasspathEntries(entries);
assertEquals("/projects/name:", classpath);
}
use of org.eclipse.che.ide.resource.Path 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.resource.Path in project che by eclipse.
the class EditorContentSynchronizerImpl method onResourceChanged.
@Override
public void onResourceChanged(ResourceChangedEvent event) {
final ResourceDelta delta = event.getDelta();
if (delta.getKind() != ADDED || (delta.getFlags() & (MOVED_FROM | MOVED_TO)) == 0) {
return;
}
final Path fromPath = delta.getFromPath();
final Path toPath = delta.getToPath();
if (delta.getResource().isFile()) {
onFileChanged(fromPath, toPath);
} else {
onFolderChanged(fromPath, toPath);
}
}
use of org.eclipse.che.ide.resource.Path in project che by eclipse.
the class JavaDebuggerFileHandler method openExternalResource.
private void openExternalResource(final Location location, final AsyncCallback<VirtualFile> callback) {
final String className = extractOuterClassFqn(location.getTarget());
final int libId = location.getExternalResourceId();
final Path projectPath = new Path(location.getResourceProjectPath());
service.getEntry(projectPath, libId, className).then(new Operation<JarEntry>() {
@Override
public void apply(final JarEntry jarEntry) throws OperationException {
final JarFileNode file = nodeFactory.newJarFileNode(jarEntry, libId, projectPath, null);
AsyncCallback<VirtualFile> downloadSourceCallback = new AsyncCallback<VirtualFile>() {
@Override
public void onSuccess(final VirtualFile result) {
if (file.isContentGenerated()) {
handleContentGeneratedResource(file, location, callback);
} else {
handleActivatedFile(file, callback, location.getLineNumber());
}
}
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
};
handleActivatedFile(file, downloadSourceCallback, location.getLineNumber());
eventBus.fireEvent(FileEvent.createOpenFileEvent(file));
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
callback.onFailure(arg.getCause());
}
});
}
use of org.eclipse.che.ide.resource.Path in project che by eclipse.
the class SwitchPresenter method showWindow.
public void showWindow() {
final Project project = appContext.getRootProject();
checkState(project != null);
switchView.showWindow();
switchView.setSwitchButtonEnabled(false);
invalidateLoadedData();
performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<InfoResponse>() {
@Override
public Promise<InfoResponse> perform(Credentials credentials) {
return service.info(appContext.getRootProject().getLocation(), ".", "HEAD", false, credentials);
}
}, null).then(new Operation<InfoResponse>() {
@Override
public void apply(InfoResponse response) throws OperationException {
if (!response.getItems().isEmpty()) {
SubversionItem subversionItem = response.getItems().get(0);
projectUri = subversionItem.getProjectUri();
}
defaultViewInitialization();
handleSwitchButton();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
projectUri = "^";
Path location = appContext.getRootProject().getLocation();
notificationManager.notify(constants.infoRequestError(location.toString()), error.getMessage(), FAIL, EMERGE_MODE);
defaultViewInitialization();
handleSwitchButton();
}
});
}
Aggregations