diff --git a/dashboard/src/app/factories/create-factory/create-factory.styl b/dashboard/src/app/factories/create-factory/create-factory.styl index 616f4d98ed..a402a5da7f 100644 --- a/dashboard/src/app/factories/create-factory/create-factory.styl +++ b/dashboard/src/app/factories/create-factory/create-factory.styl @@ -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 diff --git a/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.styl b/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.styl index f329466d2a..76bfd2a4df 100644 --- a/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.styl +++ b/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.styl @@ -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 diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts index 7c33faab86..0ca4139324 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts @@ -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; diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.html b/dashboard/src/app/workspaces/workspace-details/workspace-details.html index 63eb16645e..00e664266e 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.html +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.html @@ -1,5 +1,5 @@
diff --git a/dashboard/src/app/workspaces/workspaces-config.ts b/dashboard/src/app/workspaces/workspaces-config.ts index 0942592cbe..e8b9de76eb 100644 --- a/dashboard/src/app/workspaces/workspaces-config.ts +++ b/dashboard/src/app/workspaces/workspaces-config.ts @@ -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}; }); }] diff --git a/dashboard/src/components/widget/toolbar/che-row-toolbar.directive.ts b/dashboard/src/components/widget/toolbar/che-row-toolbar.directive.ts index 3e4cdcbe95..186ecbd7da 100644 --- a/dashboard/src/components/widget/toolbar/che-row-toolbar.directive.ts +++ b/dashboard/src/components/widget/toolbar/che-row-toolbar.directive.ts @@ -20,7 +20,7 @@ * @description * `` 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: '@' }; } diff --git a/dashboard/src/components/widget/toolbar/che-row-toolbar.html b/dashboard/src/components/widget/toolbar/che-row-toolbar.html index 8811822c17..edbe56ed16 100644 --- a/dashboard/src/components/widget/toolbar/che-row-toolbar.html +++ b/dashboard/src/components/widget/toolbar/che-row-toolbar.html @@ -17,7 +17,7 @@ {{linkTitle}} - {{title}} + {{cheTitle}}
diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/OpenFileAction.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/OpenFileAction.java index 60c93149c0..73a0564e15 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/OpenFileAction.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/actions/OpenFileAction.java @@ -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>() { - @Override - public void apply(Optional 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 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); } } }); diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerPresenter.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerPresenter.java index ca3be5e51f..91f46a2522 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerPresenter.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/part/explorer/project/ProjectExplorerPresenter.java @@ -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 handler) { + getTree().getSelectionModel().addSelectionHandler(handler); + } + @Inject public void initFileWatchers() { final String method = "track/project-tree"; diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/resources/action/RevealResourceAction.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/resources/action/RevealResourceAction.java index 1de227da75..f2a2d5aaf0 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/resources/action/RevealResourceAction.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/resources/action/RevealResourceAction.java @@ -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 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])); + } } } diff --git a/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/smartTree/TreeView.java b/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/smartTree/TreeView.java index c124aa5873..6bc4de4b42 100644 --- a/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/smartTree/TreeView.java +++ b/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/smartTree/TreeView.java @@ -211,6 +211,11 @@ public class TreeView { } Element rootContainer = getNodeContainer(node); + + if (rootContainer == null) { + return; + } + if (loading) { rootContainer.addClassName(tree.getTreeStyles().styles().loading()); } else { diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/GitExtension.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/GitExtension.java index d5fcc4e45e..600e469519 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/GitExtension.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/GitExtension.java @@ -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() diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java index a0d8f432d7..81a77e184c 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java @@ -36,7 +36,7 @@ import org.eclipse.che.commons.lang.ZipUtils; /** * @author Musienko Maxim - * @author Morhun Mykola + * @author Mykola Morhun */ @Singleton public class TestProjectServiceClient { diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestWorkspaceServiceClient.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestWorkspaceServiceClient.java index 68bae62d75..88feeaad82 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestWorkspaceServiceClient.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestWorkspaceServiceClient.java @@ -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. */ diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/utils/WaitUtils.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/utils/WaitUtils.java index 13e0c3efce..b216b35042 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/utils/WaitUtils.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/utils/WaitUtils.java @@ -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 { /** diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceImpl.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceImpl.java index ff3127f675..3740ab7c08 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceImpl.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceImpl.java @@ -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); } diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceProviderImpl.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceProviderImpl.java index fa7572ad55..e151e31e51 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceProviderImpl.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/workspace/TestWorkspaceProviderImpl.java @@ -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 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); diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/KeyBindings.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/KeyBindings.java index 1754034f08..b0bfee4534 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/KeyBindings.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/KeyBindings.java @@ -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 diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java index cc0ae5aaec..a5b1af05d4 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java @@ -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(); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashBoard.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashBoard.java index 32e14ab0cf..644f316bf8 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashBoard.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashBoard.java @@ -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(); diff --git a/selenium/che-selenium-test/src/test/resources/org/eclipse/che/selenium/assistant/key-bindings.txt b/selenium/che-selenium-test/src/test/resources/org/eclipse/che/selenium/assistant/key-bindings.txt index 450cddb69c..8be1489438 100644 --- a/selenium/che-selenium-test/src/test/resources/org/eclipse/che/selenium/assistant/key-bindings.txt +++ b/selenium/che-selenium-test/src/test/resources/org/eclipse/che/selenium/assistant/key-bindings.txt @@ -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 diff --git a/wsagent/che-core-api-project/pom.xml b/wsagent/che-core-api-project/pom.xml index 9ad7907604..f998da4022 100644 --- a/wsagent/che-core-api-project/pom.xml +++ b/wsagent/che-core-api-project/pom.xml @@ -131,6 +131,10 @@ org.eclipse.che.core wsagent-local + + org.eclipse.text + org.eclipse.text + org.everrest everrest-websockets @@ -180,6 +184,11 @@ che-core-commons-test test + + org.eclipse.equinox + common + test + org.everrest everrest-core diff --git a/wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/search/impl/LuceneSearcher.java b/wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/search/impl/LuceneSearcher.java index be31dc4db1..03c441496b 100644 --- a/wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/search/impl/LuceneSearcher.java +++ b/wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/search/impl/LuceneSearcher.java @@ -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)); } } }