Source:
public void showDialog(Project project) { this.project = project; service.getStatus(appContext.getDevMachine(), project.getLocation()).then(new Operation<Status>() { @Override public void apply(Status status) throws OperationException { if (status.isClean()) { dialogFactory.createMessageDialog(constant.messagesWarningTitle(), constant.indexIsEmpty(), null).show(); return; } indexedFiles = new IndexFile[0]; for (String path : status.getAdded()) { indexedFiles = add(indexedFiles, wrap(path)); } for (String path : status.getChanged()) { indexedFiles = add(indexedFiles, wrap(path)); } for (String path : status.getRemoved()) { indexedFiles = add(indexedFiles, wrap(path)); } if (indexedFiles.length == 0) { dialogFactory.createMessageDialog(constant.messagesWarningTitle(), constant.indexIsEmpty(), null).show(); return; } for (Resource selectedItem : appContext.getResources()) { String selectedItemPath = selectedItem.getLocation() .removeFirstSegments(appContext.getRootProject().getLocation().segmentCount()) .toString(); for (IndexFile file : indexedFiles) if (file.getPath().startsWith(selectedItemPath)) { file.setIndexed(false); } } view.setIndexedFiles(indexedFiles); view.showDialog(); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { String errorMassage = error.getMessage() != null ? error.getMessage() : constant.statusFailed(); GitOutputConsole console = gitOutputConsoleFactory.create(STATUS_COMMAND_NAME); console.printError(errorMassage); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(errorMassage); } }); }

Target:
public void showDialog(Project project) { this.project = project; service.getStatus(appContext.getDevMachine(), project.getLocation()).then(new Operation<Status>() { @Override public void apply(Status status) throws OperationException { if (status.isClean()) { dialogFactory.createMessageDialog(constant.messagesWarningTitle(), constant.indexIsEmpty(), null).show(); return; } indexedFiles = new IndexFile[0]; for (String path : status.getAdded()) { indexedFiles = add(indexedFiles, wrap(path)); } for (String path : status.getChanged()) { indexedFiles = add(indexedFiles, wrap(path)); } for (String path : status.getRemoved()) { indexedFiles = add(indexedFiles, wrap(path)); } if (indexedFiles.length == 0) { dialogFactory.createMessageDialog(constant.messagesWarningTitle(), constant.indexIsEmpty(), null).show(); return; } Resource[] resources = appContext.getResources(); if (resources != null) { for (Resource selectedItem : resources) { String selectedItemPath = selectedItem.getLocation().removeFirstSegments(1).toString(); for (IndexFile file : indexedFiles) if (file.getPath().startsWith(selectedItemPath)) { file.setIndexed(false); } } } view.setIndexedFiles(indexedFiles); view.showDialog(); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { String errorMassage = error.getMessage() != null ? error.getMessage() : constant.statusFailed(); GitOutputConsole console = gitOutputConsoleFactory.create(STATUS_COMMAND_NAME); console.printError(errorMassage); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(errorMassage); } }); }