use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class ResetToCommitAction method actionPerformed.
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
final Project project = appContext.getRootProject();
checkState(project != null, "Null project occurred");
presenter.showDialog(project);
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class ShowBranchesAction method actionPerformed.
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
final Project project = appContext.getRootProject();
checkState(project != null, "Null project occurred");
presenter.showBranches(project);
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class PomInterceptor method intercept.
/** {@inheritDoc} */
@Override
public void intercept(Resource resource) {
if (resource.isFile() && POM_XML.equals(resource.getName())) {
final Optional<Project> project = resource.getRelatedProject();
if (!project.isPresent() || !project.get().isTypeOf(MAVEN_ID)) {
return;
}
final String artifact = project.get().getAttribute(ARTIFACT_ID);
if (!isNullOrEmpty(artifact)) {
resource.addMarker(new PresentableTextMarker(artifact));
}
}
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class OrganizeImportsPresenter method onFinishButtonClicked.
/** {@inheritDoc} */
@Override
public void onFinishButtonClicked() {
selected.put(page, view.getSelectedImport());
ConflictImportDTO result = dtoFactory.createDto(ConflictImportDTO.class).withTypeMatches(new ArrayList<>(selected.values()));
if (file instanceof Resource) {
final Optional<Project> project = ((Resource) file).getRelatedProject();
javaCodeAssistClient.applyChosenImports(project.get().getLocation().toString(), JavaUtil.resolveFQN(file), result).then(new Operation<List<Change>>() {
@Override
public void apply(List<Change> result) throws OperationException {
applyChanges(((TextEditor) editor).getDocument(), result);
view.hide();
((TextEditor) editor).setFocus();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
String title = locale.failedToProcessOrganizeImports();
String message = arg.getMessage();
notificationManager.notify(title, message, FAIL, FLOAT_MODE);
}
});
}
}
use of org.eclipse.che.ide.api.resources.Project in project che by eclipse.
the class ClasspathResolver method updateClasspath.
/** Concatenates classpath entries and update classpath file. */
public Promise<Void> updateClasspath() {
final Resource resource = appContext.getResource();
checkState(resource != null);
final Optional<Project> optProject = resource.getRelatedProject();
checkState(optProject.isPresent());
final List<ClasspathEntryDto> entries = new ArrayList<>();
for (String path : libs) {
entries.add(dtoFactory.createDto(ClasspathEntryDto.class).withPath(path).withEntryKind(LIBRARY));
}
for (ClasspathEntryDto container : containers) {
entries.add(container);
}
for (String path : sources) {
entries.add(dtoFactory.createDto(ClasspathEntryDto.class).withPath(path).withEntryKind(SOURCE));
}
for (String path : projects) {
entries.add(dtoFactory.createDto(ClasspathEntryDto.class).withPath(path).withEntryKind(PROJECT));
}
final Project project = optProject.get();
Promise<Void> promise = classpathUpdater.setRawClasspath(project.getLocation().toString(), entries);
promise.then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
project.synchronize().then(new Operation<Resource[]>() {
@Override
public void apply(Resource[] arg) throws OperationException {
eventBus.fireEvent(new ClasspathChangedEvent(project.getLocation().toString(), entries));
}
});
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
notificationManager.notify("Problems with updating classpath", arg.getMessage(), FAIL, EMERGE_MODE);
}
});
return promise;
}
Aggregations