For IntelliJ IDEA and
Android Studio


/** * Creates new command of the specified type. * * <p><b>Note</b> that command's name will be generated by {@link CommandManager} and command line * will be provided by an appropriate {@link CommandType}. */ Promise<Void> createCommand(final CommandImpl command) { return workspaceServiceClient .addCommand(appContext.getWorkspaceId(), command) .then(updateWorkspace()); }
@Override public void execute(final WorkflowExecutor executor, Context context) { context .getVcsHostingService() .getUserInfo() .then(authSuccessOp(executor, context)) .catchError(getUserErrorOp(executor, context)); }
private void deleteKey(final SshPairDto key) { service .deletePair(key.getService(), key.getName()) .then( arg -> { refreshKeys(); }) .catchError( arg -> { notificationManager.notify(arg.getMessage(), FAIL, FLOAT_MODE); }); }
public void openFile(final String filePath, final TextRange selectionRange) { if (Strings.isNullOrEmpty(filePath)) { return; } EditorPartPresenter editorPartPresenter = editorAgent.getOpenedEditor(Path.valueOf(filePath)); if (editorPartPresenter != null) { editorAgent.activateEditor(editorPartPresenter); fileOpened(editorPartPresenter, selectionRange); return; } appContext.getWorkspaceRoot().getFile(filePath).then(openNode(selectionRange)); }
@Override public void actionPerformed(ActionEvent e) { final Resource[] resources = appContext.getResources(); Set<String> pathsToExclude = stream(resources).map(resource -> resource.getLocation().toString()).collect(toSet()); fileWatcherExcludesOperation .addToFileWatcherExcludes(pathsToExclude) .catchError( error -> { notificationManager.notify(error.getMessage(), FAIL, EMERGE_MODE); }); }
/** Updates the commands. */ Promise<List<CommandImpl>> fetchCommands() { return workspaceServiceClient .getWorkspace(appContext.getWorkspaceId()) .thenPromise( workspace -> { updateWorkspace().apply(workspace); return promiseProvider.resolve(getCommands()); }); }
/** {@inheritDoc} */ @NotNull @Override public final Promise<List<Node>> getChildren(boolean forceUpdate) { if (children == null || children.isEmpty() || forceUpdate) { return getChildrenImpl().then(setParentAndSaveState()); } return Promises.resolve(children); }
@Override public void valueChanged(String value) { opts.getModel(value) .then( new Operation<QuickOpenModel>() { @Override public void apply(QuickOpenModel model) throws OperationException { view.setModel(model); } }); }
@Override public Promise<Map<String, String>> loadPreferences() { return getPreferences() .then( (Function<Map<String, String>, Map<String, String>>) preferences -> { persistedPreferences.clear(); persistedPreferences.putAll(preferences); return preferences; }); }
private Promise<Boolean> checkVcsState(final Context context) { return context .getVcsService() .getBranchName(context.getProject()) .then( new Function<String, Boolean>() { @Override public Boolean apply(String branchName) throws FunctionException { return !branchName.equals(context.getWorkBranchName()); } }); }
@Override public Promise<String> getBranchName(ProjectConfig project) { return service .getStatus(Path.valueOf(project.getPath()), emptyList()) .then((Function<Status, String>) status -> status.getBranchName()); }
private void refreshKeys() { service .getPairs(SSH_SERVICE) .then(view::setPairs) .catchError( arg -> { notificationManager.notify(constant.failedToLoadSshKeys(), FAIL, FLOAT_MODE); }); }
/** {@inheritDoc} */ @Override public void onAcceptButtonClicked() { clientServerEventService .sendFileTrackingSuspendEvent() .then( success -> { applyRefactoring(); }); }
private void createNewFactory( final WorkflowExecutor executor, final Context context, final FactoryDto factory, Operation<FactoryDto> operation) { factoryService.saveFactory(factory).then(operation).catchError(handleError(executor, context)); }
public void registerHover(final JsArrayString contentTypes, final OrionHoverHandler handler) { editorModule .getInitializerPromise() .then( new Operation<Void>() { @Override public void apply(Void arg) throws OperationException { registerHover( codeEditWidgetProvider.get().getServiceRegistry(), contentTypes, handler); } }); }