@Override public String getWorkspaceId() { if (workspace == null) { throw new IllegalArgumentException(getClass() + " Workspace can not be null."); } return workspace.getId(); }
/** {@inheritDoc} */ @Override public void actionPerformed(ActionEvent event) { checkNotNull(appContext.getWorkspace().getId(), "Workspace id should not be null"); appStateManager .persistState() .then( arg -> { workspaceManager.stopWorkspace(); }); } }
/** Allows to remove IDE state for current workspace from user preferences */ void removeAppState() { JsonObject allWsState = getAllWorkspacesState(); if (allWsState != null) { String wsId = appContext.getWorkspace().getId(); allWsState.remove(wsId); writeToPreferences(allWsState); } }
/** * Allows to get IDE state for current workspace from user preferences. * * @return IDE state of current workspace or {@code null} when this one is not found */ @Nullable JsonObject getAppState() { JsonObject allWsState = getAllWorkspacesState(); if (allWsState == null) { return null; } String wsId = appContext.getWorkspace().getId(); JsonObject workspaceSettings = allWsState.getObject(wsId); return workspaceSettings != null ? workspaceSettings.get(WORKSPACE) : null; }
@Override public void onCreateClicked() { final String factoryName = view.getFactoryName(); factoryService .getFactoryJson(appContext.getWorkspace().getId(), null) .then( new Operation<FactoryDto>() { @Override public void apply(final FactoryDto factory) throws OperationException { factoryService .findFactory( null, null, Collections.singletonList(Pair.of("name", factoryName))) .then(saveFactory(factory, factoryName)) .catchError(logError()); } }) .catchError(logError()); }
public WorkspaceImpl(WorkspaceImpl workspace) { this( workspace.getId(), workspace.getNamespace(), workspace.getConfig(), workspace.getRuntime(), workspace.getAttributes(), workspace.isTemporary(), workspace.getStatus(), workspace.getLinks(), workspace.getRuntime() != null ? workspace.getRuntime().getMachineToken() : null); }
/** Start the current workspace with a default environment. */ Promise<Void> startWorkspace() { WorkspaceImpl workspace = appContext.getWorkspace(); String defEnvName = workspace.getConfig().getDefaultEnv(); return workspaceServiceClient .startById(workspace.getId(), defEnvName) .then( ws -> { ((AppContextImpl) appContext).setWorkspace(ws); eventBus.fireEvent(new WorkspaceStartingEvent()); }) .then((Function<WorkspaceImpl, Void>) arg -> null) .catchError( error -> { dialogFactory .createMessageDialog(messages.startWsErrorTitle(), error.getMessage(), null) .show(); wsStatusNotification.setError(STARTING_WORKSPACE_RUNTIME); startWorkspaceNotification.show(); }); }