Merge branch 'master' into spi
commit
cfc0fa03b7
|
|
@ -5,12 +5,12 @@ md-content .create-factory
|
|||
padding 0 14px
|
||||
|
||||
.che-input-box
|
||||
padding 25px 0
|
||||
padding 25px
|
||||
border-bottom 1px solid $list-separator-color
|
||||
|
||||
div.che-label-container-label, div.che-input-box-desktop-label
|
||||
min-width 160px
|
||||
width 160px
|
||||
div.che-label-container-label, div.che-input-box-desktop-label
|
||||
min-width 160px
|
||||
width 160px
|
||||
|
||||
button
|
||||
margin-left 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
.factory-from-template
|
||||
min-height 80px
|
||||
|
||||
che-toggle che-toggle-button
|
||||
height inherit
|
||||
line-height inherit
|
||||
&:first-child
|
||||
margin-right 10px
|
||||
|
||||
.CodeMirror
|
||||
border 1px solid $list-separator-color
|
||||
margin-top 25px
|
||||
min-height 500px
|
||||
border 1px solid $list-separator-color
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ export class WorkspaceDetailsController {
|
|||
this.ideSvc = ideSvc;
|
||||
this.workspaceDetailsService = workspaceDetailsService;
|
||||
|
||||
if (!initData.workspaceDetails) {
|
||||
cheNotification.showError(`There is no workspace with name ${initData.workspaceName}`);
|
||||
$location.path('/workspaces').search({});
|
||||
return;
|
||||
}
|
||||
|
||||
this.namespaceId = initData.namespaceId;
|
||||
this.workspaceName = initData.workspaceName;
|
||||
this.workspaceId = initData.workspaceDetails.id;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<che-row-toolbar
|
||||
title="{{workspaceDetailsController.workspaceName}}"
|
||||
che-title="{{workspaceDetailsController.workspaceName}}"
|
||||
link-href="#/workspaces" link-title="Workspaces" class="workspace-details-toolbar">
|
||||
<div layout="row" layout-align="start center" class="toolbar-info">
|
||||
<workspace-status che-status="workspaceDetailsController.getWorkspaceStatus()"></workspace-status>
|
||||
|
|
|
|||
|
|
@ -329,9 +329,6 @@ export class WorkspacesConfig {
|
|||
return workspaceConfigService.resolveWorkspaceRoute().then(() => {
|
||||
const {namespace, workspaceName} = $route.current.params;
|
||||
const workspaceDetails = cheWorkspace.getWorkspaceByName(namespace, workspaceName);
|
||||
if (!workspaceDetails) {
|
||||
return $q.reject();
|
||||
}
|
||||
return {namespaceId: namespace, workspaceName: workspaceName, workspaceDetails: workspaceDetails};
|
||||
});
|
||||
}]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* @description
|
||||
* `<che-row-toolbar>` defines a top for row toolbar.
|
||||
*
|
||||
* @param {string=} title the title of the toolbar
|
||||
* @param {string=} cheTitle the title of the toolbar
|
||||
* @param {string=} link-href the optional link of the toolbar
|
||||
* @param {string=} link-title the link title
|
||||
* @usage
|
||||
|
|
@ -37,7 +37,7 @@ export class CheRowToolbar {
|
|||
scope = {
|
||||
linkTitle: '@',
|
||||
linkHref: '@',
|
||||
title: '@'
|
||||
cheTitle: '@'
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<a class="che-toolbar-control-button che-toolbar-breadcrumb"
|
||||
ng-href="{{linkHref}}">{{linkTitle}}</a>
|
||||
<span class="fa fa-chevron-right"></span>
|
||||
<span>{{title}}</span>
|
||||
<span>{{cheTitle}}</span>
|
||||
</div>
|
||||
<div layout="row" layout-align="start center" flex ng-transclude></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,18 +10,17 @@
|
|||
*/
|
||||
package org.eclipse.che.ide.actions;
|
||||
|
||||
import static java.lang.Integer.parseInt;
|
||||
import static org.eclipse.che.api.promises.client.callback.CallbackPromiseHelper.createFromCallback;
|
||||
import static org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode.FLOAT_MODE;
|
||||
import static org.eclipse.che.ide.api.notification.StatusNotification.Status.FAIL;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.gwt.core.client.Callback;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import org.eclipse.che.api.promises.client.Operation;
|
||||
import org.eclipse.che.api.promises.client.OperationException;
|
||||
import org.eclipse.che.api.promises.client.Promise;
|
||||
import org.eclipse.che.api.promises.client.callback.CallbackPromiseHelper.Call;
|
||||
import org.eclipse.che.api.promises.client.js.JsPromiseError;
|
||||
|
|
@ -37,14 +36,10 @@ import org.eclipse.che.ide.api.editor.text.TextPosition;
|
|||
import org.eclipse.che.ide.api.editor.texteditor.TextEditor;
|
||||
import org.eclipse.che.ide.api.notification.NotificationManager;
|
||||
import org.eclipse.che.ide.api.parts.ActivePartChangedEvent;
|
||||
import org.eclipse.che.ide.api.parts.ActivePartChangedHandler;
|
||||
import org.eclipse.che.ide.api.resources.File;
|
||||
import org.eclipse.che.ide.resource.Path;
|
||||
import org.eclipse.che.ide.util.loging.Log;
|
||||
|
||||
/**
|
||||
* TODO maybe rename it to factory open file?
|
||||
*
|
||||
* @author Sergii Leschenko
|
||||
* @author Vlad Zhukovskyi
|
||||
*/
|
||||
|
|
@ -95,53 +90,58 @@ public class OpenFileAction extends Action implements PromisableAction {
|
|||
.getWorkspaceRoot()
|
||||
.getFile(pathToOpen)
|
||||
.then(
|
||||
new Operation<Optional<File>>() {
|
||||
@Override
|
||||
public void apply(Optional<File> optionalFile) throws OperationException {
|
||||
if (optionalFile.isPresent()) {
|
||||
if (actionCompletedCallback != null) {
|
||||
actionCompletedCallback.onSuccess(null);
|
||||
}
|
||||
|
||||
editorAgent.openEditor(
|
||||
optionalFile.get(),
|
||||
new EditorAgent.OpenEditorCallback() {
|
||||
@Override
|
||||
public void onEditorOpened(EditorPartPresenter editor) {
|
||||
if (!(editor instanceof TextEditor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
int lineNumber =
|
||||
Integer.parseInt(event.getParameters().get(LINE_PARAM_ID)) - 1;
|
||||
((TextEditor) editor)
|
||||
.getDocument()
|
||||
.setCursorPosition(new TextPosition(lineNumber, 0));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.error(getClass(), localization.fileToOpenLineIsNotANumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializationFailed() {}
|
||||
|
||||
@Override
|
||||
public void onEditorActivated(EditorPartPresenter editor) {}
|
||||
});
|
||||
|
||||
} else {
|
||||
if (actionCompletedCallback != null) {
|
||||
actionCompletedCallback.onFailure(null);
|
||||
}
|
||||
|
||||
notificationManager.notify(
|
||||
localization.unableOpenResource(pathToOpen), FAIL, FLOAT_MODE);
|
||||
optionalFile -> {
|
||||
if (optionalFile.isPresent()) {
|
||||
if (actionCompletedCallback != null) {
|
||||
actionCompletedCallback.onSuccess(null);
|
||||
}
|
||||
|
||||
editorAgent.openEditor(
|
||||
optionalFile.get(),
|
||||
new EditorAgent.OpenEditorCallback() {
|
||||
@Override
|
||||
public void onEditorOpened(EditorPartPresenter editor) {
|
||||
scrollToLine(editor, event.getParameters().get(LINE_PARAM_ID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializationFailed() {}
|
||||
|
||||
@Override
|
||||
public void onEditorActivated(EditorPartPresenter editor) {
|
||||
scrollToLine(editor, event.getParameters().get(LINE_PARAM_ID));
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
if (actionCompletedCallback != null) {
|
||||
actionCompletedCallback.onFailure(null);
|
||||
}
|
||||
|
||||
notificationManager.notify(
|
||||
localization.unableOpenResource(pathToOpen), FAIL, FLOAT_MODE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void scrollToLine(EditorPartPresenter editor, String lineParam) {
|
||||
if (!(editor instanceof TextEditor)) {
|
||||
return;
|
||||
}
|
||||
new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
int lineNumber = parseInt(lineParam);
|
||||
TextEditor textEditor = (TextEditor) editor;
|
||||
textEditor.getDocument().setCursorPosition(new TextPosition(lineNumber - 1, 0));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.error(getClass(), localization.fileToOpenLineIsNotANumber());
|
||||
}
|
||||
}
|
||||
}.schedule(300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Promise<Void> promise(final ActionEvent actionEvent) {
|
||||
if (actionEvent.getParameters() == null) {
|
||||
|
|
@ -163,16 +163,13 @@ public class OpenFileAction extends Action implements PromisableAction {
|
|||
handlerRegistration =
|
||||
eventBus.addHandler(
|
||||
ActivePartChangedEvent.TYPE,
|
||||
new ActivePartChangedHandler() {
|
||||
@Override
|
||||
public void onActivePartChanged(ActivePartChangedEvent event) {
|
||||
if (event.getActivePart() instanceof EditorPartPresenter) {
|
||||
EditorPartPresenter editor = (EditorPartPresenter) event.getActivePart();
|
||||
handlerRegistration.removeHandler();
|
||||
if (Path.valueOf(pathToOpen)
|
||||
.equals(editor.getEditorInput().getFile().getLocation())) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
event -> {
|
||||
if (event.getActivePart() instanceof EditorPartPresenter) {
|
||||
EditorPartPresenter editor = (EditorPartPresenter) event.getActivePart();
|
||||
handlerRegistration.removeHandler();
|
||||
if (Path.valueOf(pathToOpen)
|
||||
.equals(editor.getEditorInput().getFile().getLocation())) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import static org.eclipse.che.ide.api.resources.ResourceDelta.UPDATED;
|
|||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
|
@ -160,6 +161,10 @@ public class ProjectExplorerPresenter extends BasePresenter
|
|||
});
|
||||
}
|
||||
|
||||
public void addSelectionHandler(SelectionHandler<Node> handler) {
|
||||
getTree().getSelectionModel().addSelectionHandler(handler);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void initFileWatchers() {
|
||||
final String method = "track/project-tree";
|
||||
|
|
|
|||
|
|
@ -13,16 +13,19 @@ package org.eclipse.che.ide.resources.action;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.eclipse.che.ide.part.perspectives.project.ProjectPerspective.PROJECT_PERSPECTIVE_ID;
|
||||
import static org.eclipse.che.ide.resource.Path.valueOf;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.eclipse.che.ide.api.action.AbstractPerspectiveAction;
|
||||
import org.eclipse.che.ide.api.action.ActionEvent;
|
||||
import org.eclipse.che.ide.api.app.AppContext;
|
||||
import org.eclipse.che.ide.api.resources.Resource;
|
||||
import org.eclipse.che.ide.resource.Path;
|
||||
import org.eclipse.che.ide.resources.reveal.RevealResourceEvent;
|
||||
|
||||
/**
|
||||
|
|
@ -35,6 +38,8 @@ import org.eclipse.che.ide.resources.reveal.RevealResourceEvent;
|
|||
@Singleton
|
||||
public class RevealResourceAction extends AbstractPerspectiveAction {
|
||||
|
||||
private static final String PATH = "path";
|
||||
|
||||
private final AppContext appContext;
|
||||
private final EventBus eventBus;
|
||||
|
||||
|
|
@ -57,10 +62,21 @@ public class RevealResourceAction extends AbstractPerspectiveAction {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final Resource[] resources = appContext.getResources();
|
||||
Map<String, String> params = e.getParameters();
|
||||
String pathToReveal = params.get(PATH);
|
||||
|
||||
checkState(resources != null && resources.length == 1);
|
||||
if (pathToReveal != null) {
|
||||
Path path = valueOf(pathToReveal);
|
||||
|
||||
eventBus.fireEvent(new RevealResourceEvent(resources[0]));
|
||||
checkState(!path.isEmpty());
|
||||
|
||||
eventBus.fireEvent(new RevealResourceEvent(path));
|
||||
} else {
|
||||
final Resource[] resources = appContext.getResources();
|
||||
|
||||
checkState(resources != null && resources.length == 1);
|
||||
|
||||
eventBus.fireEvent(new RevealResourceEvent(resources[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,11 @@ public class TreeView {
|
|||
}
|
||||
|
||||
Element rootContainer = getNodeContainer(node);
|
||||
|
||||
if (rootContainer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
rootContainer.addClassName(tree.getTreeStyles().styles().loading());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,12 @@ public class GitExtension {
|
|||
public static final String REPOSITORY_GROUP_MAIN_MENU = "GitRepositoryGroup";
|
||||
public static final String COMMAND_GROUP_MAIN_MENU = "GitCommandGroup";
|
||||
public static final String HISTORY_GROUP_MAIN_MENU = "GitHistoryGroup";
|
||||
|
||||
public static final String GIT_COMPARE_WITH_LATEST = "gitCompareWithLatest";
|
||||
public static final String GIT_SHOW_BRANCHES_LIST = "gitBranches";
|
||||
public static final String GIT_SHOW_COMMIT_WINDOW = "gitCommit";
|
||||
public static final String GIT_SHOW_PULL_DIALOG = "gitPull";
|
||||
public static final String GIT_SHOW_PUSH_DIALOG = "gitPush";
|
||||
|
||||
public static final String NEXT_DIFF_ACTION_ID = "nextDiff";
|
||||
public static final String PREV_DIFF_ACTION_ID = "prevDiff";
|
||||
|
|
@ -130,9 +135,9 @@ public class GitExtension {
|
|||
commandGroup.add(resetToCommitAction);
|
||||
actionManager.registerAction("gitRemoveFromIndexCommit", removeFromIndexAction);
|
||||
commandGroup.add(removeFromIndexAction);
|
||||
actionManager.registerAction("gitCommit", commitAction);
|
||||
actionManager.registerAction(GIT_SHOW_COMMIT_WINDOW, commitAction);
|
||||
commandGroup.add(commitAction);
|
||||
actionManager.registerAction("gitBranches", showBranchesAction);
|
||||
actionManager.registerAction(GIT_SHOW_BRANCHES_LIST, showBranchesAction);
|
||||
commandGroup.add(showBranchesAction);
|
||||
actionManager.registerAction("gitCheckoutReference", checkoutReferenceAction);
|
||||
commandGroup.add(checkoutReferenceAction);
|
||||
|
|
@ -150,16 +155,16 @@ public class GitExtension {
|
|||
historyGroup.add(historyAction);
|
||||
actionManager.registerAction("gitStatus", showStatusAction);
|
||||
historyGroup.add(showStatusAction);
|
||||
actionManager.registerAction("gitPush", pushAction);
|
||||
actionManager.registerAction(GIT_SHOW_PUSH_DIALOG, pushAction);
|
||||
remoteGroup.add(pushAction);
|
||||
actionManager.registerAction("gitFetch", fetchAction);
|
||||
remoteGroup.add(fetchAction);
|
||||
actionManager.registerAction("gitPull", pullAction);
|
||||
actionManager.registerAction(GIT_SHOW_PULL_DIALOG, pullAction);
|
||||
remoteGroup.add(pullAction);
|
||||
actionManager.registerAction("gitRemote", showRemoteAction);
|
||||
remoteGroup.add(showRemoteAction);
|
||||
|
||||
actionManager.registerAction("gitCompareWithLatest", compareWithLatestAction);
|
||||
actionManager.registerAction(GIT_COMPARE_WITH_LATEST, compareWithLatestAction);
|
||||
compareGroup.add(compareWithLatestAction);
|
||||
actionManager.registerAction("gitCompareWithBranch", compareWithBranchAction);
|
||||
compareGroup.add(compareWithBranchAction);
|
||||
|
|
@ -193,6 +198,18 @@ public class GitExtension {
|
|||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().action().alt().charCode('d').build(), GIT_COMPARE_WITH_LATEST);
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().action().charCode('b').build(), GIT_SHOW_BRANCHES_LIST);
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().alt().charCode('c').build(), GIT_SHOW_COMMIT_WINDOW);
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().alt().charCode('C').build(), GIT_SHOW_PUSH_DIALOG);
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
.addKey(new KeyBuilder().alt().charCode('p').build(), GIT_SHOW_PULL_DIALOG);
|
||||
|
||||
keyBinding
|
||||
.getGlobal()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.eclipse.che.commons.lang.ZipUtils;
|
|||
|
||||
/**
|
||||
* @author Musienko Maxim
|
||||
* @author Morhun Mykola
|
||||
* @author Mykola Morhun
|
||||
*/
|
||||
@Singleton
|
||||
public class TestProjectServiceClient {
|
||||
|
|
|
|||
|
|
@ -37,10 +37,15 @@ import org.eclipse.che.selenium.core.user.TestUser;
|
|||
import org.eclipse.che.selenium.core.user.TestUserNamespaceResolver;
|
||||
import org.eclipse.che.selenium.core.utils.WaitUtils;
|
||||
import org.eclipse.che.selenium.core.workspace.MemoryMeasure;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/** @author Musienko Maxim */
|
||||
@Singleton
|
||||
public class TestWorkspaceServiceClient {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TestWorkspaceServiceClient.class);
|
||||
|
||||
private final TestApiEndpointUrlProvider apiEndpointProvider;
|
||||
private final HttpJsonRequestFactory requestFactory;
|
||||
private final TestUserNamespaceResolver testUserNamespaceResolver;
|
||||
|
|
@ -126,6 +131,12 @@ public class TestWorkspaceServiceClient {
|
|||
}
|
||||
|
||||
requestFactory.fromUrl(getIdBasedUrl(workspace.getId())).useDeleteMethod().request();
|
||||
|
||||
LOG.info(
|
||||
"Workspace name='{}', id='{}' and of user with name='{}' is removed",
|
||||
workspaceName,
|
||||
workspace.getId(),
|
||||
userName);
|
||||
}
|
||||
|
||||
/** Waits needed status. */
|
||||
|
|
@ -166,12 +177,17 @@ public class TestWorkspaceServiceClient {
|
|||
workspace.setName(workspaceName);
|
||||
workspace.setDefaultEnv(workspaceName);
|
||||
|
||||
return requestFactory
|
||||
.fromUrl(getBaseUrl())
|
||||
.usePostMethod()
|
||||
.setBody(workspace)
|
||||
.request()
|
||||
.asDto(WorkspaceDto.class);
|
||||
WorkspaceDto workspaceDto =
|
||||
requestFactory
|
||||
.fromUrl(getBaseUrl())
|
||||
.usePostMethod()
|
||||
.setBody(workspace)
|
||||
.request()
|
||||
.asDto(WorkspaceDto.class);
|
||||
|
||||
LOG.info("Workspace name='{}' and id='{}' created", workspaceName, workspaceDto.getId());
|
||||
|
||||
return workspaceDto;
|
||||
}
|
||||
|
||||
/** Sends start workspace request. */
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ package org.eclipse.che.selenium.core.utils;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/** @author Morhun Mykola */
|
||||
/** @author Mykola Morhun */
|
||||
public class WaitUtils {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,9 +55,7 @@ public class TestWorkspaceImpl implements TestWorkspace {
|
|||
final Workspace ws =
|
||||
workspaceServiceClient.createWorkspace(name, memoryInGB, GB, template);
|
||||
workspaceServiceClient.start(id.updateAndGet((s) -> ws.getId()), name, owner);
|
||||
|
||||
LOG.info("Workspace name='{}' id='{}' has been created.", name, ws.getId());
|
||||
|
||||
LOG.info("Workspace name='{}' id='{}' started.", name, ws.getId());
|
||||
} catch (Exception e) {
|
||||
String errorMessage = format("Workspace name='%s' start failed.", name);
|
||||
LOG.error(errorMessage, e);
|
||||
|
|
@ -102,7 +100,6 @@ public class TestWorkspaceImpl implements TestWorkspace {
|
|||
aVoid -> {
|
||||
try {
|
||||
workspaceServiceClient.delete(name, owner.getName());
|
||||
LOG.info("Workspace name='{}', id='{}' removed", name, getId());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(format("Failed to remove workspace '%s'", this), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,13 @@ package org.eclipse.che.selenium.core.workspace;
|
|||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Named;
|
||||
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
|
||||
import org.eclipse.che.commons.lang.NameGenerator;
|
||||
|
|
@ -138,7 +141,7 @@ public class TestWorkspaceProviderImpl implements TestWorkspaceProvider {
|
|||
LOG.info("Workspace threads pool is terminated");
|
||||
}
|
||||
|
||||
LOG.info("Destroy remained workspaces: {}.", testWorkspaceQueue.size());
|
||||
LOG.info("Destroy remained workspaces: {}.", extractWorkspaceInfo());
|
||||
testWorkspaceQueue.forEach(TestWorkspace::delete);
|
||||
|
||||
if (isInterrupted) {
|
||||
|
|
@ -146,6 +149,20 @@ public class TestWorkspaceProviderImpl implements TestWorkspaceProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> extractWorkspaceInfo() {
|
||||
return testWorkspaceQueue
|
||||
.stream()
|
||||
.map(
|
||||
s -> {
|
||||
try {
|
||||
return s.getName();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException("Error of getting name of workspace.", e);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void initializePool(final TestWorkspaceServiceClient workspaceServiceClient) {
|
||||
LOG.info("Initialize workspace pool with {} entries.", poolSize);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.openqa.selenium.support.ui.ExpectedConditions;
|
|||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
/**
|
||||
* @author Morhun Mykola
|
||||
* @author Mykola Morhun
|
||||
* @author Andrey Chizhikov
|
||||
*/
|
||||
@Singleton
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.eclipse.che.selenium.core.user.DefaultTestUser;
|
|||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
@ -38,6 +39,11 @@ public class RenameWorkspaceTest {
|
|||
dashboard.open();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() throws Exception {
|
||||
workspaceServiceClient.delete(CHANGE_WORKSPACE_NAME, user.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renameNameWorkspaceTest() {
|
||||
dashboard.selectWorkspacesItemOnDashboard();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import java.util.Date;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.che.selenium.core.SeleniumWebDriver;
|
||||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
|
||||
import org.eclipse.che.selenium.core.user.DefaultTestUser;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
|
|
@ -32,12 +33,14 @@ import org.eclipse.che.selenium.pageobject.ProjectExplorer;
|
|||
import org.eclipse.che.selenium.pageobject.Wizard;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.DashboardFactory;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/** @author Musienko Maxim */
|
||||
public class CreateNamedFactoryFromDashBoard {
|
||||
private static final String PROJECT_NAME = CreateNamedFactoryFromDashBoard.class.getSimpleName();
|
||||
private static final String NEW_WORKSPACE_SUFFIX = "_1";
|
||||
|
||||
@Inject private TestWorkspace testWorkspace;
|
||||
@Inject private Ide ide;
|
||||
|
|
@ -53,6 +56,7 @@ public class CreateNamedFactoryFromDashBoard {
|
|||
@Inject private TestProjectServiceClient testProjectServiceClient;
|
||||
@Inject private Wizard wizard;
|
||||
@Inject private Menu menu;
|
||||
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() throws Exception {
|
||||
|
|
@ -63,6 +67,12 @@ public class CreateNamedFactoryFromDashBoard {
|
|||
wizard.selectProjectAndCreate(Wizard.SamplesName.WEB_JAVA_SPRING, PROJECT_NAME);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void tearDown() throws Exception {
|
||||
String newWorkspaceName = testWorkspace.getName() + NEW_WORKSPACE_SUFFIX;
|
||||
workspaceServiceClient.delete(newWorkspaceName, user.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createFactoryFromDashBoard() throws ExecutionException, InterruptedException {
|
||||
String currentWin = ide.driver().getWindowHandle();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ Switch to previous editor tab Alt+←
|
|||
Switch to next editor tab Alt+→
|
||||
Signature Help Ctrl+P
|
||||
Show Commands Palette Shift+F10
|
||||
Commit ... Alt+C
|
||||
Work With Branches... Ctrl+B
|
||||
Push Changes to Remote Repository... Alt+Shift+C
|
||||
Pull Data from Remote Repository... Alt+P
|
||||
Compare with latest repository version Ctrl+Alt+D
|
||||
Edit debug configurations Alt+Shift+F9
|
||||
Connect to debugger with the selected configuration Shift+F9
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@
|
|||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>wsagent-local</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.text</groupId>
|
||||
<artifactId>org.eclipse.text</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.everrest</groupId>
|
||||
<artifactId>everrest-websockets</artifactId>
|
||||
|
|
@ -180,6 +184,11 @@
|
|||
<artifactId>che-core-commons-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.equinox</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.everrest</groupId>
|
||||
<artifactId>everrest-core</artifactId>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
|
|
@ -65,6 +64,9 @@ import org.eclipse.che.api.vfs.search.QueryExpression;
|
|||
import org.eclipse.che.api.vfs.search.SearchResult;
|
||||
import org.eclipse.che.api.vfs.search.SearchResultEntry;
|
||||
import org.eclipse.che.api.vfs.search.Searcher;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -269,22 +271,20 @@ public abstract class LuceneSearcher implements Searcher {
|
|||
|
||||
float res = queryScorer.getTokenScore();
|
||||
if (res > 0.0F && startOffset <= endOffset) {
|
||||
String tokenText = txt.substring(startOffset, endOffset);
|
||||
Scanner sc = new Scanner(txt);
|
||||
int lineNum = 0;
|
||||
long len = 0;
|
||||
String foundLine = "";
|
||||
while (sc.hasNextLine()) {
|
||||
foundLine = sc.nextLine();
|
||||
lineNum++;
|
||||
len += foundLine.length();
|
||||
if (len > startOffset) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
IDocument document = new org.eclipse.jface.text.Document(txt);
|
||||
int lineNum = document.getLineOfOffset(startOffset);
|
||||
IRegion lineInfo = document.getLineInformation(lineNum);
|
||||
String foundLine = document.get(lineInfo.getOffset(), lineInfo.getLength());
|
||||
String tokenText = document.get(startOffset, endOffset - startOffset);
|
||||
|
||||
offsetData.add(
|
||||
new OffsetData(
|
||||
tokenText, startOffset, endOffset, docId, res, lineNum, foundLine));
|
||||
} catch (BadLocationException e) {
|
||||
LOG.error(e.getLocalizedMessage(), e);
|
||||
throw new ServerException("Can not provide data for token " + termAtt.toString());
|
||||
}
|
||||
offsetData.add(
|
||||
new OffsetData(
|
||||
tokenText, startOffset, endOffset, docId, res, lineNum, foundLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue