protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = breakpointManager.getAll().stream().map(this::toDto).collect(Collectors.toList()); StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }
@Override public void accept(org.eclipse.che.ide.dto.DtoFactory dtoFactory) { dtoFactory.registerProvider(org.eclipse.che.plugin.yaml.shared.YamlDTO.class, new org.eclipse.che.ide.dto.DtoProvider<org.eclipse.che.plugin.yaml.shared.YamlDTO>() { public Class<? extends org.eclipse.che.plugin.yaml.shared.YamlDTO> getImplClass() { return YamlDTOImpl.class; } public org.eclipse.che.plugin.yaml.shared.YamlDTO newInstance() { return YamlDTOImpl.make(); } public org.eclipse.che.plugin.yaml.shared.YamlDTO fromJson(String json) { return YamlDTOImpl.fromJsonString(json); } }); }
/** Loads debugger information from the local storage. */ protected void restoreDebuggerState() { invalidateDebugSession(); LocalStorage localStorage = localStorageProvider.get(); if (localStorage == null) { return; } String data = localStorage.getItem(LOCAL_STORAGE_DEBUGGER_SESSION_KEY); if (!Strings.isNullOrEmpty(data)) { DebugSessionDto debugSessionDto = dtoFactory.createDtoFromJson(data, DebugSessionDto.class); if (!debugSessionDto.getType().equals(getDebuggerType())) { return; } setDebugSession(debugSessionDto); } data = localStorage.getItem(LOCAL_STORAGE_DEBUGGER_STATE_KEY); if (!Strings.isNullOrEmpty(data)) { suspendEventDto = dtoFactory.createDtoFromJson(data, SuspendEventDto.class); } data = localStorage.getItem(LOCAL_STORAGE_DEBUGGER_DISPOSABLE_BREAKPOINT_KEY); if (!Strings.isNullOrEmpty(data)) { disposableBreakpoint = dtoFactory.createDtoFromJson(data, BreakpointDto.class); } }
private void saveConfigurations() { if (localStorageOptional.isPresent()) { List<DebugConfigurationDto> configurationDtos = new ArrayList<>(); for (DebugConfiguration configuration : configurations) { configurationDtos.add( dtoFactory .createDto(DebugConfigurationDto.class) .withType(configuration.getType().getId()) .withName(configuration.getName()) .withHost(configuration.getHost()) .withPort(configuration.getPort()) .withConnectionProperties(configuration.getConnectionProperties())); } localStorageOptional .get() .setItem(LOCAL_STORAGE_DEBUG_CONF_KEY, dtoFactory.toJson(configurationDtos)); } }
private void preserve() { if (storage == null) { return; } List<BreakpointDto> breakpoints2save = new LinkedList<>(); for (Breakpoint breakpoint : breakpoints) { breakpoints2save.add(toDto(breakpoint)); } storage.setItem(storageKey, dtoFactory.toJson(breakpoints2save)); }
private List<? extends Breakpoint> readAll() { if (storage == null) { return emptyList(); } String json = storage.getItem(storageKey); if (json == null) { return emptyList(); } return dtoFactory .createListDtoFromJson(json, BreakpointDto.class) .stream() .map(BreakpointImpl::new) .collect(Collectors.toList()); }
/** Updates the specified {@code project} with the given {@code commands}. */ private Promise<Void> updateProject(Project project, List<CommandImpl> commands) { MutableProjectConfig config = new MutableProjectConfig(project); Map<String, List<String>> attributes = config.getAttributes(); List<String> attrValue = new ArrayList<>(attributes.size()); for (CommandImpl command : commands) { CommandDto commandDto = dtoFactory .createDto(CommandDto.class) .withName(command.getName()) .withType(command.getType()) .withCommandLine(command.getCommandLine()) .withAttributes(command.getAttributes()); attrValue.add(dtoFactory.toJson(commandDto)); } attributes.put(COMMANDS_ATTRIBUTE_NAME, attrValue); return project.update().withBody(config).send().then((Function<Project, Void>) arg -> null); }
/** Preserves debugger information into the local storage. */ protected void preserveDebuggerState() { LocalStorage localStorage = localStorageProvider.get(); if (localStorage == null) { return; } if (!isConnected()) { localStorage.setItem(LOCAL_STORAGE_DEBUGGER_SESSION_KEY, ""); localStorage.setItem(LOCAL_STORAGE_DEBUGGER_STATE_KEY, ""); localStorage.setItem(LOCAL_STORAGE_DEBUGGER_DISPOSABLE_BREAKPOINT_KEY, ""); } else { localStorage.setItem(LOCAL_STORAGE_DEBUGGER_SESSION_KEY, dtoFactory.toJson(debugSessionDto)); if (suspendEventDto == null) { localStorage.setItem(LOCAL_STORAGE_DEBUGGER_STATE_KEY, ""); } else { localStorage.setItem(LOCAL_STORAGE_DEBUGGER_STATE_KEY, dtoFactory.toJson(suspendEventDto)); } if (disposableBreakpoint == null) { localStorage.setItem(LOCAL_STORAGE_DEBUGGER_DISPOSABLE_BREAKPOINT_KEY, ""); } else { localStorage.setItem( LOCAL_STORAGE_DEBUGGER_DISPOSABLE_BREAKPOINT_KEY, dtoFactory.toJson(disposableBreakpoint)); } } }
private List<DebugConfigurationDto> retrieveConfigurations() { List<DebugConfigurationDto> configurationsList; if (localStorageOptional.isPresent()) { final LocalStorage localStorage = localStorageOptional.get(); final Optional<String> data = Optional.fromNullable(localStorage.getItem(LOCAL_STORAGE_DEBUG_CONF_KEY)); if (data.isPresent() && !data.get().isEmpty()) { configurationsList = dtoFactory.createListDtoFromJson(data.get(), DebugConfigurationDto.class); } else { configurationsList = emptyList(); } } else { configurationsList = emptyList(); } return configurationsList; }
protected IndexFile wrap(String path) { return dtoFactory.createDto(IndexFile.class).withPath(path).withIndexed(true); }
@Override public void accept(org.eclipse.che.ide.dto.DtoFactory dtoFactory) { dtoFactory.registerProvider(org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto.class, new org.eclipse.che.ide.dto.DtoProvider<org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto>() { public Class<? extends org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto> getImplClass() { return DebugConfigurationDtoImpl.class; } public org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto newInstance() { return DebugConfigurationDtoImpl.make(); } public org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto fromJson(String json) { return DebugConfigurationDtoImpl.fromJsonString(json); } }); }
/** Returns commands for the specified {@code project}. */ List<CommandImpl> getCommands(Project project) { List<String> attrValues = project.getAttributes(COMMANDS_ATTRIBUTE_NAME); if (attrValues == null) { return new ArrayList<>(); } Map<String, CommandImpl> commands = new HashMap<>(attrValues.size()); for (String commandJson : attrValues) { try { CommandDto commandDto = dtoFactory.createDtoFromJson(commandJson, CommandDto.class); commands.put(commandDto.getName(), new CommandImpl(commandDto)); } catch (JSONException e) { Log.error( ProjectCommandManagerDelegate.class, "Unable to parse command of project '" + project.getPath() + "': " + commandJson + ". " + e.getMessage()); } } return new ArrayList<>(commands.values()); }
@Override public void addNode(String path, int kind) { if (categories.containsKey(path)) { return; } dirty = true; delegate.onDirtyChanged(); categories.put(path, dtoFactory.createDto(ClasspathEntry.class).withEntryKind(kind)); view.setData(categories); view.renderLibraries(); }
@Override public void accept(org.eclipse.che.ide.dto.DtoFactory dtoFactory) { dtoFactory.registerProvider(org.eclipse.che.plugin.maven.shared.dto.ArchetypeOutput.class, new org.eclipse.che.ide.dto.DtoProvider<org.eclipse.che.plugin.maven.shared.dto.ArchetypeOutput>() { public Class<? extends org.eclipse.che.plugin.maven.shared.dto.ArchetypeOutput> getImplClass() { return ArchetypeOutputImpl.class; } public org.eclipse.che.plugin.maven.shared.dto.ArchetypeOutput newInstance() { return ArchetypeOutputImpl.make(); } public org.eclipse.che.plugin.maven.shared.dto.ArchetypeOutput fromJson(String json) { return ArchetypeOutputImpl.fromJsonString(json); } }); dtoFactory.registerProvider(org.eclipse.che.plugin.maven.shared.dto.MavenArchetypeDto.class, new org.eclipse.che.ide.dto.DtoProvider<org.eclipse.che.plugin.maven.shared.dto.MavenArchetypeDto>() { public Class<? extends org.eclipse.che.plugin.maven.shared.dto.MavenArchetypeDto> getImplClass() { return MavenArchetypeDtoImpl.class; } public org.eclipse.che.plugin.maven.shared.dto.MavenArchetypeDto newInstance() { return MavenArchetypeDtoImpl.make(); } public org.eclipse.che.plugin.maven.shared.dto.MavenArchetypeDto fromJson(String json) { return MavenArchetypeDtoImpl.fromJsonString(json); } }); }
errorMessage = dtoFactory.createDtoFromJson(errorMessage, ServiceError.class).getMessage(); if (errorMessage.equals("Unable get private ssh key")) { console.printError(locale.messagesUnableGetSshKey());
@Override public void addNode(String path, int kind) { if (categories.containsKey(path)) { return; } dirty = true; delegate.onDirtyChanged(); categories.put(path, dtoFactory.createDto(ClasspathEntry.class).withEntryKind(kind)); view.setData(categories); view.renderNodes(); }
public void accept(DtoFactory dtoFactory) { dtoFactory.registerProvider(ExternalLibrariesParameters.class, new ExternalLibrariesParametersDtoProvider()); dtoFactory.registerProvider(TestFindParameters.class, new TestFindParametersDtoProvider()); dtoFactory.registerProvider(JarEntry.class, new JarEntryDtoProvider()); dtoFactory.registerProvider(TestPosition.class, new TestPositionDtoProvider()); dtoFactory.registerProvider(PackageFragment.class, new PackageFragmentDtoProvider()); dtoFactory.registerProvider(PackageFragmentRoot.class, new PackageFragmentRootDtoProvider()); dtoFactory.registerProvider(ProgressReport.class, new ProgressReportDtoProvider()); dtoFactory.registerProvider(FileStructureCommandParameters.class, new FileStructureCommandParametersDtoProvider()); dtoFactory.registerProvider(RenameSelectionParams.class, new RenameSelectionParamsDtoProvider()); dtoFactory.registerProvider(JavaCoreOptions.class, new JavaCoreOptionsDtoProvider()); dtoFactory.registerProvider(TestPositionParameters.class, new TestPositionParametersDtoProvider()); dtoFactory.registerProvider(RenamingElementInfo.class, new RenamingElementInfoDtoProvider()); dtoFactory.registerProvider(ResourceLocation.class, new ResourceLocationDtoProvider()); dtoFactory.registerProvider(ClasspathEntry.class, new ClasspathEntryDtoProvider()); dtoFactory.registerProvider(MoveSettings.class, new MoveSettingsDtoProvider()); dtoFactory.registerProvider(JobResult.class, new JobResultDtoProvider()); dtoFactory.registerProvider(OrganizeImportParams.class, new OrganizeImportParamsDtoProvider()); dtoFactory.registerProvider(RefactoringStatusEntry.class, new RefactoringStatusEntryDtoProvider()); dtoFactory.registerProvider(SearchResult.class, new SearchResultDtoProvider()); dtoFactory.registerProvider(UpdateClasspathParameters.class, new UpdateClasspathParametersDtoProvider()); dtoFactory.registerProvider(Jar.class, new JarDtoProvider()); dtoFactory.registerProvider(UsagesResponse.class, new UsagesResponseDtoProvider()); dtoFactory.registerProvider(UpdateMavenModulesInfo.class, new UpdateMavenModulesInfoDtoProvider()); dtoFactory.registerProvider(RefactoringStatus.class, new RefactoringStatusDtoProvider()); dtoFactory.registerProvider(ImplementersResponse.class, new ImplementersResponseDtoProvider()); dtoFactory.registerProvider(RenameSettings.class, new RenameSettingsDtoProvider()); dtoFactory.registerProvider(OrganizeImportsResult.class, new OrganizeImportsResultDtoProvider()); dtoFactory.registerProvider(JdtLsPreferences.class, new JdtLsPreferencesDtoProvider()); dtoFactory.registerProvider(UpdateWorkspaceParameters.class, new UpdateWorkspaceParametersDtoProvider());
errorMessage = dtoFactory.createDtoFromJson(errorMessage, ServiceError.class).getMessage(); if (errorMessage.equals("Unable get private ssh key")) { console.printError(locale.messagesUnableGetSshKey());
@Override public Promise<Void> flushPreferences() { if (changedPreferences.isEmpty()) { return promiseProvider.resolve(null); } JavaCoreOptions javaCoreOptions = dtoFactory.createDto(JavaCoreOptions.class); javaCoreOptions.setOptions(changedPreferences); return service .updateJavaCoreOptions(javaCoreOptions) .then( (Function<Boolean, Void>) result -> { persistedPreferences.putAll(changedPreferences); changedPreferences.clear(); return null; }); }
@Override public Promise<Void> add(Path project, boolean update, Path[] paths) { AddRequest addRequest = dtoFactory.createDto(AddRequest.class).withUpdate(update); addRequest.setFilePattern( paths == null ? DEFAULT_PATTERN : stream(paths).map(path -> path.isEmpty() ? "." : path.toString()).collect(toList())); String url = getWsAgentBaseUrl() + ADD + "?projectPath=" + encodePath(project); return asyncRequestFactory.createPostRequest(url, addRequest).loader(loader).send(); }