public Promise<List<SourceEstimation>> resolve(Project project) { return ps.resolveSources(project.getLocation()); }
protected final Path[] getPaths(Project project, String srcType) { final List<String> srcFolders = project.getAttributes().get(srcType); if (srcFolders == null || srcFolders.isEmpty()) { return new Path[0]; } Path[] paths = new Path[0]; for (String srcFolder : srcFolders) { final int index = paths.length; paths = Arrays.copyOf(paths, index + 1); paths[index] = project.getLocation().append(srcFolder); } return paths; } }
@Override public Promise<PushResponse> perform(Credentials credentials) { return service.push( project.getLocation(), getRefs(), repository, view.isForcePushSelected(), credentials); } })
private List<String> getPathsToSelectedMavenProject() { final Resource[] resources = appContext.getResources(); if (resources == null) { return Collections.emptyList(); } Set<String> paths = new HashSet<>(); for (Resource resource : resources) { final Project project = resource.getProject(); if (project != null && project.isTypeOf(MavenAttributes.MAVEN_ID)) { paths.add(project.getLocation().toString()); } } return new ArrayList<>(paths); } }
/** Open dialog and shows branches to compare. */ public void showBranches(Project project, Resource selectedItem) { checkState( project.getLocation().isPrefixOf(selectedItem.getLocation()), "Given selected item is not descendant of given project"); this.project = project; this.selectedItem = selectedItem; getBranches(); }
@Override public Promise<PullResponse> perform(Credentials credentials) { return service.pull( project.getLocation(), getRefs(), view.getRepositoryName(), view.getRebase(), credentials); } })
@Override public Promise<Void> perform(Credentials credentials) { return service.fetch( project.getLocation(), view.getRepositoryName(), getRefs(), view.isRemoveDeletedRefs(), credentials); } })
/** Open dialog and shows revisions to compare. */ public void showRevisions(Project project, File selectedFile) { this.project = project; checkState( project.getLocation().isPrefixOf(selectedFile.getLocation()), "Given selected file is not descendant of given project"); selectedFilePath = selectedFile .getLocation() .removeFirstSegments(project.getLocation().segmentCount()) .removeTrailingSeparator(); getRevisions(); }
protected Path[] toRelativePaths(Resource[] resources) { final Path[] paths = new Path[resources.length]; for (int i = 0; i < resources.length; i++) { checkState(project.getLocation().isPrefixOf(resources[i].getLocation())); final Path tmpPath = resources[i].getLocation().removeFirstSegments(project.getLocation().segmentCount()); paths[i] = tmpPath.isEmpty() ? tmpPath.append(".") : tmpPath; } return paths; }
@NotNull @Override public Promise<String> expand() { String value = ""; Resource[] resources = appContext.getResources(); if (resources != null && resources.length == 1) { Optional<Project> project = appContext.getResource().getRelatedProject(); if (project.isPresent()) { value = appContext.getProjectsRoot().append(project.get().getLocation()).toString(); } } return promises.resolve(value); } }
/** {@inheritDoc} */ @Override public void intercept(Resource resource) { if (resource.isFile() && POM_XML.equals(resource.getName())) { Project project = resource.getProject(); if (project != null && project.isTypeOf(MAVEN_ID) && resource.getParent().getLocation().equals(project.getLocation())) { String artifact = project.getAttribute(ARTIFACT_ID); if (!isNullOrEmpty(artifact) && !UNKNOWN_VALUE.equals(artifact)) { resource.addMarker(new PresentableTextMarker(artifact)); } } } } }
/** * Get the list of branches. * * @param remoteMode is a remote mode */ void getBranchesForCurrentProject( @NotNull final BranchListMode remoteMode, final AsyncCallback<List<Branch>> asyncResult) { service .branchList(project.getLocation(), remoteMode) .then( branches -> { asyncResult.onSuccess(branches); }) .catchError( error -> { asyncResult.onFailure(error.getCause()); }); }
/** Open dialog and shows revisions to compare. */ public void show() { this.skip = 0; this.revisions = new ArrayList<>(); this.project = appContext.getRootProject(); this.selectedPath = appContext .getResource() .getLocation() .removeFirstSegments(project.getLocation().segmentCount()) .removeTrailingSeparator(); fetchRevisions(); }
@Override public Promise<List<Node>> intercept(Node parent, List<Node> children) { if (parent instanceof ResourceNode) { final Resource resource = ((ResourceNode) parent).getData(); if (resource.getResourceType() != PROJECT) { return promises.resolve(children); } final Project project = (Project) resource; if (isJavaProject(project) && isDisplayLibraries(project)) { final List<Node> intercepted = newArrayList(children); intercepted.add( nodeFactory.newLibrariesNode(project.getLocation(), settingsProvider.getSettings())); return promises.resolve(intercepted); } } return promises.resolve(children); }
/** Show status. */ public void showStatus(Project project) { service .statusText(project.getLocation()) .then( status -> { printGitStatus(status); }) .catchError( error -> { notificationManager.notify(constant.statusFailed(), FAIL, FLOAT_MODE); }); }
public void setMainClass(Resource resource, String fqn) { if (editedCommandModel.getMainClass().equals(resource.getLocation().toString())) { return; } final Optional<Project> project = resource.getRelatedProject(); if (!project.isPresent()) { return; } final Path relPath = resource.getLocation().removeFirstSegments(project.get().getLocation().segmentCount()); view.setMainClass(relPath.toString()); String commandLine = editedCommandModel.getCommandLine(); commandLine = commandLine.replace(editedCommandModel.getMainClass(), relPath.toString()); commandLine = commandLine.replace(' ' + editedCommandModel.getMainClassFQN(), ' ' + fqn); editedCommandModel.setMainClass(view.getMainClass()); editedCommandModel.setCommandLine(commandLine); editedCommand.setCommandLine(editedCommandModel.toCommandLine()); listener.onDirtyStateChanged(); }
private void reloadRepositoryData(Project project) { service .diff(project.getLocation(), null, NAME_STATUS, false, 0, REVISION, false) .then( diff -> { MutableAlteredFiles alteredFiles = new MutableAlteredFiles(project, diff); changes.put(project.getName(), alteredFiles); view.updateRepositoryChanges(project.getName(), alteredFiles.getFilesQuantity()); // update changed files list if this repository is selected if (project.getName().equals(view.getSelectedRepository())) { updateChangedFiles(alteredFiles); } }) .catchError( arg -> { notificationManager.notify(locale.diffFailed(), FAIL, NOT_EMERGE_MODE); }); }
/** {@inheritDoc} */ @Override public void onOkClicked() { final String name = view.getName(); final String url = view.getUrl().trim(); final Project project = appContext.getRootProject(); service .remoteAdd(project.getLocation(), name, url) .then( arg -> { callback.onSuccess(null); view.close(); }) .catchError( error -> { callback.onFailure(error.getCause()); }); }
public void showDialog(Project project) { this.project = project; view.setEnablePullButton(false); service .remoteList(project.getLocation(), null, true) .then( remotes -> { updateBranches(LIST_REMOTE); view.setRepositories(remotes); view.setEnablePullButton(!remotes.isEmpty()); view.showDialog(); }) .catchError( error -> { handleError(error.getCause(), REMOTE_REPO_COMMAND_NAME); view.setEnablePullButton(false); }); }
private void renameBranch(String newName) { service .branchRename(project.getLocation(), selectedBranch.getDisplayName(), newName) .then( ignored -> { getBranches(); view.setFocus(); }) .catchError( error -> { handleError(error.getCause(), BRANCH_RENAME_COMMAND_NAME); getBranches(); // rename of remote branch occurs in three stages, so needs update list // of branches on view }); }