Promise
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.eclipse.che.api.promises.client.Promise(Showing top 15 results out of 315)

origin: eclipse/che

/**
 * 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());
}
origin: eclipse/che

@Override
public void execute(final WorkflowExecutor executor, Context context) {
 context
   .getVcsHostingService()
   .getUserInfo()
   .then(authSuccessOp(executor, context))
   .catchError(getUserErrorOp(executor, context));
}
origin: eclipse/che

private void deleteKey(final SshPairDto key) {
 service
   .deletePair(key.getService(), key.getName())
   .then(
     arg -> {
      refreshKeys();
     })
   .catchError(
     arg -> {
      notificationManager.notify(arg.getMessage(), FAIL, FLOAT_MODE);
     });
}
origin: eclipse/che

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));
}
origin: eclipse/che

@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);
     });
}
origin: eclipse/che

/** Updates the commands. */
Promise<List<CommandImpl>> fetchCommands() {
 return workspaceServiceClient
   .getWorkspace(appContext.getWorkspaceId())
   .thenPromise(
     workspace -> {
      updateWorkspace().apply(workspace);
      return promiseProvider.resolve(getCommands());
     });
}
origin: eclipse/che

/** {@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);
}
origin: eclipse/che

@Override
public void valueChanged(String value) {
 opts.getModel(value)
   .then(
     new Operation<QuickOpenModel>() {
      @Override
      public void apply(QuickOpenModel model) throws OperationException {
       view.setModel(model);
      }
     });
}
origin: eclipse/che

@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;
       });
}
origin: eclipse/che

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());
      }
     });
}
origin: eclipse/che

@Override
public Promise<String> getBranchName(ProjectConfig project) {
 return service
   .getStatus(Path.valueOf(project.getPath()), emptyList())
   .then((Function<Status, String>) status -> status.getBranchName());
}
origin: eclipse/che

private void refreshKeys() {
 service
   .getPairs(SSH_SERVICE)
   .then(view::setPairs)
   .catchError(
     arg -> {
      notificationManager.notify(constant.failedToLoadSshKeys(), FAIL, FLOAT_MODE);
     });
}
origin: eclipse/che

/** {@inheritDoc} */
@Override
public void onAcceptButtonClicked() {
 clientServerEventService
   .sendFileTrackingSuspendEvent()
   .then(
     success -> {
      applyRefactoring();
     });
}
origin: eclipse/che

private void createNewFactory(
  final WorkflowExecutor executor,
  final Context context,
  final FactoryDto factory,
  Operation<FactoryDto> operation) {
 factoryService.saveFactory(factory).then(operation).catchError(handleError(executor, context));
}
origin: eclipse/che

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);
      }
     });
}
org.eclipse.che.api.promises.clientPromise

Javadoc

A placeholder for a value that will be completed at a later time.

Most used methods

  • then
  • catchError
  • thenPromise
    Allows to add another promise as action when this promise is fulfilled.
  • catchErrorPromise
    Allows to add another promise as action when this promise is rejected.

Popular classes and methods

  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • GridBagLayout (java.awt)
  • Window (java.awt)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • ImageIO (javax.imageio)

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)