CHE-6237: Add icon to pull-request panel tab (#7175)

1. Add icon to pull-request panel tab:
2. Make pull-request panel tab active, if no active parts are present.
6.19.x
Igor Vinokur 2017-11-07 14:09:13 +00:00 committed by GitHub
parent bbee7536a0
commit 1fcfd01097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 1 deletions

View File

@ -22,6 +22,9 @@ public interface ContributeResources extends ClientBundle {
@Source("images/refresh.svg")
SVGResource refreshIcon();
@Source("images/icon.svg")
SVGResource titleIcon();
interface ContributeCss extends CssResource {
String blueButton();

View File

@ -214,6 +214,9 @@ public class ContributionMixinProvider {
private void addPart(PartStack partStack) {
if (!partStack.containsPart(contributePart)) {
partStack.addPart(contributePart, FIRST);
if (partStack.getActivePart() == null) {
partStack.setActivePart(contributePart);
}
}
}

View File

@ -45,6 +45,7 @@ import org.eclipse.che.ide.ui.dialogs.input.InputValidator;
import org.eclipse.che.ide.util.browser.BrowserUtils;
import org.eclipse.che.ide.util.loging.Log;
import org.eclipse.che.plugin.pullrequest.client.ContributeMessages;
import org.eclipse.che.plugin.pullrequest.client.ContributeResources;
import org.eclipse.che.plugin.pullrequest.client.events.ContextInvalidatedEvent;
import org.eclipse.che.plugin.pullrequest.client.events.ContextInvalidatedHandler;
import org.eclipse.che.plugin.pullrequest.client.events.ContextPropertyChangeEvent;
@ -58,6 +59,7 @@ import org.eclipse.che.plugin.pullrequest.client.workflow.Context;
import org.eclipse.che.plugin.pullrequest.client.workflow.Step;
import org.eclipse.che.plugin.pullrequest.client.workflow.WorkflowExecutor;
import org.eclipse.che.plugin.pullrequest.client.workflow.WorkflowStatus;
import org.vectomatic.dom.svg.ui.SVGResource;
/**
* Part for the contribution configuration.
@ -72,6 +74,7 @@ public class ContributePartPresenter extends BasePresenter
CurrentContextChangedHandler,
ContextInvalidatedHandler {
private final ContributePartView view;
private final ContributeResources resources;
private final WorkspaceAgent workspaceAgent;
private final ContributeMessages messages;
private final WorkflowExecutor workflowExecutor;
@ -84,6 +87,7 @@ public class ContributePartPresenter extends BasePresenter
public ContributePartPresenter(
final ContributePartView view,
final ContributeMessages messages,
final ContributeResources resources,
final WorkspaceAgent workspaceAgent,
final EventBus eventBus,
final WorkflowExecutor workflow,
@ -92,6 +96,7 @@ public class ContributePartPresenter extends BasePresenter
final DialogFactory dialogFactory,
final Map<String, StagesProvider> stagesProviders) {
this.view = view;
this.resources = resources;
this.workspaceAgent = workspaceAgent;
this.workflowExecutor = workflow;
this.messages = messages;
@ -251,6 +256,11 @@ public class ContributePartPresenter extends BasePresenter
updateControls();
}
@Override
public SVGResource getTitleImage() {
return resources.titleIcon();
}
@Override
public void onOpenPullRequestOnVcsHost() {
final Context context = workflowExecutor.getCurrentContext();
@ -340,7 +350,7 @@ public class ContributePartPresenter extends BasePresenter
@Nullable
@Override
public String getTitleToolTip() {
return null;
return messages.contributePartTitle();
}
@Override

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Copyright (c) 2012-2017 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Red Hat, Inc. - initial API and implementation
-->
<svg
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 8.4666659 8.4666659">
<g
transform="translate(0,-288.53334)">
<path
style="fill:#ffffff;fill-opacity:1;stroke-width:0.75590551;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
d="M 6 1 A 4.9999997 5.0000236 0 0 0 1 6 A 4.9999997 5.0000236 0 0 0 3.9023438 10.53125 L 3.9023438 21.466797 A 4.9999997 5.0000236 0 0 0 1 26 A 4.9999997 5.0000236 0 0 0 6 31 A 4.9999997 5.0000236 0 0 0 11 26 A 4.9999997 5.0000236 0 0 0 8 21.423828 L 8 10.580078 A 4.9999997 5.0000236 0 0 0 11 6 A 4.9999997 5.0000236 0 0 0 6 1 z M 6 3.5 A 2.5000002 2.500013 0 0 1 8.5 6 A 2.5000002 2.500013 0 0 1 6 8.5 A 2.5000002 2.500013 0 0 1 3.5 6 A 2.5000002 2.500013 0 0 1 6 3.5 z M 6 23.5 A 2.5000002 2.500013 0 0 1 8.5 26 A 2.5000002 2.500013 0 0 1 6 28.5 A 2.5000002 2.500013 0 0 1 3.5 26 A 2.5000002 2.500013 0 0 1 6 23.5 z "
transform="matrix(0.26458333,0,0,0.26458333,0,288.53334)"
id="path12"/>
<path
style="fill:#ffffff;fill-opacity:1;stroke-width:0.75590551;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers stroke fill"
d="M 19.001953 1.2421875 L 11 6 L 18.998047 10.767578 L 19 8 L 21 8 C 24 7.9999988 24 11 24 11 L 24 21.419922 A 4.9999997 5.0000236 0 0 0 21 26 A 4.9999997 5.0000236 0 0 0 26 31 A 4.9999997 5.0000236 0 0 0 31 26 A 4.9999997 5.0000236 0 0 0 28 21.423828 L 28 11 C 28 11 28 4 21 4 L 19 4 L 19.001953 1.2421875 z M 26 23.5 A 2.5000002 2.500013 0 0 1 28.5 26 A 2.5000002 2.500013 0 0 1 26 28.5 A 2.5000002 2.500013 0 0 1 23.5 26 A 2.5000002 2.500013 0 0 1 26 23.5 z "
transform="matrix(0.26458333,0,0,0.26458333,0,288.53334)"
id="path12-6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -156,6 +156,7 @@ public class PullRequestPluginTest {
@Test(priority = 1)
public void createPullRequest() {
explorer.waitItem(FIRST_PROJECT_NAME);
explorer.selectItem(FIRST_PROJECT_NAME);
explorer.openItemByPath(FIRST_PROJECT_NAME);
explorer.openItemByPath(FIRST_PROJECT_NAME + "/README.md");
@ -218,6 +219,7 @@ public class PullRequestPluginTest {
explorer.waitProjectExplorer();
explorer.waitItem(FIRST_PROJECT_NAME);
explorer.waitItem(SECOND_PROJECT_NAME);
explorer.selectItem(FIRST_PROJECT_NAME);
explorer.openItemByPath(FIRST_PROJECT_NAME);
explorer.openItemByPath(FIRST_PROJECT_NAME + "/README.md");
editor.waitActiveEditor();