Skip to content

Commit

Permalink
CHE-3369 Git history panel is not opened (#3414)
Browse files Browse the repository at this point in the history
* CHE-3369 Git history panel is not opened

* CHE-3369 Git history panel is not opened

* CHE-3369 Git history panel is not opened
  • Loading branch information
Vitaliy Guliy authored Dec 19, 2016
1 parent 9218383 commit 22efeaa
Show file tree
Hide file tree
Showing 217 changed files with 88 additions and 746 deletions.
Binary file removed docs/assets/fonts/FontAwesome.eot
Binary file not shown.
655 changes: 0 additions & 655 deletions docs/assets/fonts/FontAwesome.svg

This file was deleted.

Binary file removed docs/assets/fonts/FontAwesome.ttf
Binary file not shown.
Binary file removed docs/assets/fonts/FontAwesome.woff
Binary file not shown.
Binary file not shown.
Binary file removed docs/assets/imgs/2016-09-16_18-38-15.gif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/assets/imgs/Capture.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Capture2.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Capture2_.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Capture_.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Capture_.png
Binary file not shown.
Binary file removed docs/assets/imgs/Capture_embed.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Capture_preview.PNG
Binary file not shown.
Binary file removed docs/assets/imgs/Che-Stack-Delete.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Che-Stack-Duplicate.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Che-machine-information-edit.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Che-machine-information.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Che-recipe-expose-ports.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard12.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard13.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard2.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard3.jpg
Binary file not shown.
Binary file removed docs/assets/imgs/Clipboard4.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Clipboard5.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Clipboard6.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Clipboard7.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Clipboard8.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Clipboard9.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(1).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(2).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(3).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(4).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(5).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(6).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(7).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting(8).png
Diff not rendered.
Binary file removed docs/assets/imgs/Docker--CodenvyMeeting.png
Diff not rendered.
Binary file removed docs/assets/imgs/Extensibility.PNG
Diff not rendered.
Binary file removed docs/assets/imgs/GitLabSSH.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/ImportProjectDashboard.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/Installation-Manager-API.png
Diff not rendered.
4 changes: 0 additions & 4 deletions docs/assets/imgs/JIRAplugin-DevelopandReviewinIDE(1).svg
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ProjectType-JsonExample.png
Diff not rendered.
Binary file removed docs/assets/imgs/ProjectType.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScaleCodenvy.PNG
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-05-27at09.16.31.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-29at16.14.16.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-29at16.21.10.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-30at5.53.20PM.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-30at5.55.07PM.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-30at5.56.22PM.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-09-30at6.15.03PM.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.04.47.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.05.46.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.06.23.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.07.45.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.14.00.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.22.26.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-06at15.23.13.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.13.02.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.15.20.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.24.09.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.27.40.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.57.02.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at14.59.27.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at15.05.00.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at15.30.00.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at15.34.00.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at16.28.28.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at16.34.24.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at16.35.54.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at16.40.08.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-13at16.55.05.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-21at11.13.34.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-21at11.14.24.png
Diff not rendered.
Binary file removed docs/assets/imgs/ScreenShot2016-10-21at15.15.16.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/Screenshot2.png
Diff not rendered.
Binary file removed docs/assets/imgs/Screenshot3.png
Diff not rendered.
Binary file removed docs/assets/imgs/Selection_005.png
Diff not rendered.
Binary file removed docs/assets/imgs/Selection_009.png
Diff not rendered.
Binary file removed docs/assets/imgs/Selection_017.png
Diff not rendered.
Binary file removed docs/assets/imgs/Slide1.PNG
Diff not rendered.
Binary file removed docs/assets/imgs/Slide2.PNG
Diff not rendered.
Binary file removed docs/assets/imgs/Slide3.PNG
Diff not rendered.
Binary file removed docs/assets/imgs/Swagger.PNG
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/Virtualboxaddusb.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/WorksapceBasicArchitecture.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/aio.png
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-1.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-11.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-12.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-13.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-2.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-3.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-4.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-5.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-6.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-7.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-8.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artik-blink-led-9.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artikIDEafterconnection.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artikapi.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artikctrlq.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artikmanager.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/artikmanageradddevice.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/breakpoint.png
Diff not rendered.
Binary file removed docs/assets/imgs/che-add-stack.gif
Diff not rendered.
Binary file removed docs/assets/imgs/che-create-snapshot.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-edit-stack.gif
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial1.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial2.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial3.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial4.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial6.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial7.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-multimachine-tutorial8.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-mysql-tutorial1.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-previewHTML.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-recipe-write.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-sharing2.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-sharing3.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-sharing4.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-stacks1.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-stacks2.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che-svn-username-password.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/che_helloworld.png
Diff not rendered.
Binary file removed docs/assets/imgs/che_networking.png
Diff not rendered.
Binary file removed docs/assets/imgs/compile.png
Diff not rendered.
Binary file removed docs/assets/imgs/configure-classpath.png
Diff not rendered.
Binary file removed docs/assets/imgs/consolepanes.gif
Diff not rendered.
Binary file removed docs/assets/imgs/createwsandproject.jpg
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/debug-configurations.png
Diff not rendered.
Binary file removed docs/assets/imgs/debug.png
Diff not rendered.
Binary file removed docs/assets/imgs/debug_.png
Diff not rendered.
Binary file removed docs/assets/imgs/debug_chrome.png
Diff not rendered.
Binary file removed docs/assets/imgs/debugger_chrome.png
Diff not rendered.
Binary file removed docs/assets/imgs/editor-errors.png
Diff not rendered.
Binary file removed docs/assets/imgs/editor-prefs.png
Diff not rendered.
Binary file removed docs/assets/imgs/editor-simple.png
Diff not rendered.
Binary file removed docs/assets/imgs/editorpanes.gif
Diff not rendered.
Diff not rendered.
Binary file removed docs/assets/imgs/find-editor.png
Diff not rendered.
Binary file removed docs/assets/imgs/find-usages.png
Diff not rendered.
Binary file removed docs/assets/imgs/git-menu.png
Diff not rendered.
Binary file removed docs/assets/imgs/github-button.png
Diff not rendered.
Binary file removed docs/assets/imgs/ide-update-dep.png
Diff not rendered.
Binary file removed docs/assets/imgs/image.png
Diff not rendered.
Binary file removed docs/assets/imgs/image00.png
Diff not rendered.
Binary file removed docs/assets/imgs/image01.png
Diff not rendered.
Binary file removed docs/assets/imgs/image03.png
Diff not rendered.
Binary file removed docs/assets/imgs/image04.png
Diff not rendered.
Binary file removed docs/assets/imgs/image05.png
Diff not rendered.
Binary file removed docs/assets/imgs/image06.png
Diff not rendered.
Binary file removed docs/assets/imgs/image07.png
Diff not rendered.
Binary file removed docs/assets/imgs/image08.png
Diff not rendered.
Binary file removed docs/assets/imgs/image11.png
Diff not rendered.
Binary file removed docs/assets/imgs/image13.png
Diff not rendered.
Binary file removed docs/assets/imgs/image14.png
Diff not rendered.
Binary file removed docs/assets/imgs/image15.png
Diff not rendered.
Binary file removed docs/assets/imgs/img-features-commands.png
Diff not rendered.
Binary file removed docs/assets/imgs/import-existing-maven-projects.png
Diff not rendered.
Binary file removed docs/assets/imgs/install-jetty8.png
Diff not rendered.
Binary file removed docs/assets/imgs/install-plugin1.png
Diff not rendered.
Binary file removed docs/assets/imgs/install-plugin2.png
Diff not rendered.
Binary file removed docs/assets/imgs/install-plugin3.png
Diff not rendered.
Binary file removed docs/assets/imgs/install-plugin4.png
Diff not rendered.
Binary file removed docs/assets/imgs/java-compiler-prefs.png
Diff not rendered.
Binary file removed docs/assets/imgs/jenkinsjob.png
Diff not rendered.
Binary file removed docs/assets/imgs/keybindings.png
Diff not rendered.
1 change: 0 additions & 1 deletion docs/assets/imgs/logo-eclipseche.svg
Diff not rendered.
Binary file removed docs/assets/imgs/machine.png
Diff not rendered.
Binary file removed docs/assets/imgs/maven.png
Diff not rendered.
Binary file removed docs/assets/imgs/module.png
Diff not rendered.
Binary file removed docs/assets/imgs/move-item.png
Diff not rendered.
Binary file removed docs/assets/imgs/nonexistent-dependency.png
Diff not rendered.
Binary file removed docs/assets/imgs/open-declaration.png
Diff not rendered.
Binary file removed docs/assets/imgs/php.png
Diff not rendered.
Binary file removed docs/assets/imgs/plugins.png
Diff not rendered.
Binary file removed docs/assets/imgs/postbuild.png
Diff not rendered.
Binary file removed docs/assets/imgs/preview.png
Diff not rendered.
Binary file removed docs/assets/imgs/project-tree.png
Diff not rendered.
Binary file removed docs/assets/imgs/quick-documentation.png
Diff not rendered.
Binary file removed docs/assets/imgs/rename.png
Diff not rendered.
Binary file removed docs/assets/imgs/sdm-intellij.jpg
Diff not rendered.
Binary file removed docs/assets/imgs/selectjava.png
Diff not rendered.
Binary file removed docs/assets/imgs/server.png
Diff not rendered.
Binary file removed docs/assets/imgs/slim.png
Diff not rendered.
Binary file removed docs/assets/imgs/svn-menu.png
Diff not rendered.
Binary file removed docs/assets/imgs/templates.png
Diff not rendered.
Binary file removed docs/assets/imgs/tokens.png
Diff not rendered.
Binary file removed docs/assets/imgs/yatta-installer.png
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,8 @@ public void addPart(@NotNull PartPresenter part) {
@Override
public void addPart(@NotNull PartPresenter part, @Nullable Constraints constraint) {
if (containsPart(part)) {
workBenchPartController.setHidden(true);

TabItem selectedItem = getTabByPart(part);

if (selectedItem != null) {
selectedItem.unSelect();
}

TabItem tab = getTabByPart(part);
onTabClicked(tab);
return;
}

Expand Down Expand Up @@ -203,13 +197,33 @@ public PartPresenter getActivePart() {
@Override
public void setActivePart(@NotNull PartPresenter part) {
TabItem tab = getTabByPart(part);

if (tab == null) {
return;
}

activePart = part;
activeTab = tab;

if (state == State.MINIMIZED) {
state = State.NORMAL;
workBenchPartController.setSize(currentSize);
workBenchPartController.setHidden(false);

// Notify the part stack state has been changed.
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
eventBus.fireEvent(new PartStackStateChangedEvent(PartStackPresenter.this));
}
});
} else if (state == State.COLLAPSED) {
// Collapsed state means the other part stack is maximized.
// Ask the delegate to restore part stacks.
if (delegate != null) {
delegate.onRestore(this);
}
}

selectActiveTab(tab);
}

Expand Down Expand Up @@ -241,7 +255,6 @@ public void openPreviousActivePart() {
}

TabItem selectedTab = getTabByPart(activePart);

if (selectedTab != null) {
selectActiveTab(selectedTab);
}
Expand Down Expand Up @@ -321,6 +334,7 @@ public void collapse() {
// Collapse and update the state.
currentSize = workBenchPartController.getSize();
workBenchPartController.setSize(0);
workBenchPartController.setHidden(true);
state = State.COLLAPSED;

// Deselect the active tab.
Expand Down Expand Up @@ -358,6 +372,7 @@ public void minimize() {
if (state == State.NORMAL) {
currentSize = workBenchPartController.getSize();
workBenchPartController.setSize(0);
workBenchPartController.setHidden(true);
state = State.MINIMIZED;
}

Expand Down Expand Up @@ -389,6 +404,7 @@ public void restore() {
State prevState = state;
state = State.NORMAL;
workBenchPartController.setSize(currentSize);
workBenchPartController.setHidden(false);

// Ask the delegate to restore part stacks if this part stack was maximized.
if (prevState == State.MAXIMIZED) {
Expand Down Expand Up @@ -458,7 +474,6 @@ private void selectActiveTab(@NotNull TabItem selectedTab) {
workBenchPartController.setHidden(false);

PartPresenter selectedPart = parts.get(selectedTab);

view.selectTab(selectedPart);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,10 @@ public void addPart(@NotNull PartPresenter part, @NotNull PartStackType type, @N
PartStack destPartStack = partStacks.get(type);

List<String> rules = part.getRules();

if (rules.isEmpty() && !destPartStack.containsPart(part)) {
if (rules.isEmpty() || rules.contains(perspectiveId)) {
destPartStack.addPart(part, constraint);
return;
}

if (rules.contains(perspectiveId)) {
destPartStack.addPart(part, constraint);
}
}

@Override
Expand Down Expand Up @@ -344,24 +339,20 @@ private JsonObject getPartStackState(PartStack partStack, WorkBenchPartControlle
public void loadState(@NotNull JsonObject state) {
if (state.hasKey("PART_STACKS")) {
JsonObject part_stacks = state.getObject("PART_STACKS");
List<PartPresenter> activeParts = new ArrayList<>();
for (String partStackType : part_stacks.keys()) {
JsonObject partStack = part_stacks.getObject(partStackType);
switch (PartStackType.valueOf(partStackType)) {
case INFORMATION:
restorePartController(partStacks.get(INFORMATION), belowPartController, partStack, activeParts);
restorePartController(partStacks.get(INFORMATION), belowPartController, partStack);
break;
case NAVIGATION:
restorePartController(partStacks.get(NAVIGATION), leftPartController, partStack, activeParts);
restorePartController(partStacks.get(NAVIGATION), leftPartController, partStack);
break;
case TOOLING:
restorePartController(partStacks.get(TOOLING), rightPartController, partStack, activeParts);
restorePartController(partStacks.get(TOOLING), rightPartController, partStack);
break;
}
}
for (PartPresenter part : activeParts) {
setActivePart(part);
}
}

if (state.hasKey("ACTIVE_PART")) {
Expand All @@ -373,46 +364,44 @@ public void loadState(@NotNull JsonObject state) {
}
}

private void restorePartController(PartStack stack, WorkBenchPartController controller, JsonObject partStack,
List<PartPresenter> activeParts) {
double size = 0;
if (partStack.hasKey("SIZE")) {
size = partStack.getNumber("SIZE");
controller.setSize(size);
}

if (partStack.hasKey("HIDDEN")) {
controller.setHidden(partStack.getBoolean("HIDDEN"));
}

if (partStack.hasKey("PARTS")) {
JsonArray parts = partStack.get("PARTS");
private void restorePartController(PartStack partStack, WorkBenchPartController controller, JsonObject partStackJSON) {
if (partStackJSON.hasKey("PARTS")) {
JsonArray parts = partStackJSON.get("PARTS");
for (int i = 0; i < parts.length(); i++) {
JsonObject value = parts.get(i);
if (value.hasKey("CLASS")) {
String className = value.getString("CLASS");
Provider<PartPresenter> provider = dynaProvider.getProvider(className);
if (provider != null) {
PartPresenter partPresenter = provider.get();
if (!stack.containsPart(partPresenter)) {
stack.addPart(partPresenter);
if (!partStack.containsPart(partPresenter)) {
partStack.addPart(partPresenter);
}
}
}
}
}

//hide part stack if we cannot restore opened parts
if (stack.getParts().isEmpty()) {
//hide part stack if it has no parts
if (partStack.getParts().isEmpty()) {
controller.setHidden(true);
return;
}

if (partStack.hasKey("ACTIVE_PART")) {
String className = partStack.getString("ACTIVE_PART");
Provider<PartPresenter> provider = dynaProvider.getProvider(className);
if (provider != null) {
activeParts.add(provider.get());
if (partStackJSON.hasKey("HIDDEN") && partStackJSON.getBoolean("HIDDEN")) {
partStack.minimize();
return;
}

if (partStackJSON.hasKey("SIZE")) {
double size = partStackJSON.getNumber("SIZE");

// Size of the part must not be less 100 pixels.
if (size < 100) {
size = 100;
}

controller.setSize(size);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.mockito.Captor;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.vectomatic.dom.svg.ui.SVGResource;

import java.util.List;
Expand All @@ -41,8 +40,6 @@
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -157,17 +154,13 @@ public void partShouldBeAddedWithoutConstraints() {
}

@Test
public void partShouldNotBeAddedWhenItAlreadyExist() {
public void partShouldBeSelectedIfItIsAddedTwice() {
presenter.addPart(partPresenter);
reset(view);

presenter.addPart(partPresenter);

verify(workBenchPartController).setHidden(true);

verify(partButton).unSelect();

verify(view, never()).addTab(partButton, partPresenter);
verify(view).selectTab(partPresenter);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

Expand All @@ -56,6 +55,7 @@
*/
@RunWith(GwtMockitoTestRunner.class)
public class AbstractPerspectivePersistenceTest {

//constructor mocks
@Mock
private PerspectiveViewImpl view;
Expand Down Expand Up @@ -96,7 +96,6 @@ public class AbstractPerspectivePersistenceTest {
@Mock
private Provider<PartPresenter> partProvider;


private AbstractPerspective perspective;

@Before
Expand Down Expand Up @@ -152,38 +151,51 @@ public void shouldNotStoreEditorPartStack() throws Exception {
@Test
public void shouldRestorePartStackSize() throws Exception {
JsonObject state = Json.createObject();
JsonObject parts = Json.createObject();
state.put("PART_STACKS", parts);
JsonObject partStack = Json.createObject();
parts.put("INFORMATION", partStack);
partStack.put("SIZE", 42);

JsonObject parts = Json.createObject();
state.put("PART_STACKS", parts);

JsonObject partStack = Json.createObject();
parts.put("INFORMATION", partStack);

JsonArray partsArray = Json.createArray();
partStack.put("PARTS", partsArray);

JsonObject part = Json.createObject();
partsArray.set(0, part);
part.put("CLASS", "foo.Bar");

partStack.put("SIZE", 42);

// partStackPresenter.getParts() must return non empty list
final List<PartPresenter> partPresenters = new ArrayList<>();
partPresenters.add(partPresenter);
when(partStackPresenter.getParts()).thenAnswer(new Answer<List<? extends PartPresenter>>() {
@Override
public List<? extends PartPresenter> answer(InvocationOnMock invocationOnMock) throws Throwable {
return partPresenters;
}
});

perspective.loadState(state);

verify(workBenchController).setSize(42d);

}

@Test
public void shouldRestoreHiddenPartStackState() throws Exception {
JsonObject state = Json.createObject();
JsonObject parts = Json.createObject();
state.put("PART_STACKS", parts);
JsonObject partStack = Json.createObject();
parts.put("INFORMATION", partStack);
partStack.put("HIDDEN", true);

//PartStackPresenter should not be empty otherwise setHidden() will call twice
final List<PartPresenter> partPresenters = new ArrayList<>();
partPresenters.add(mock(PartPresenter.class));
when(partStackPresenter.getParts()).thenAnswer(new Answer<List<? extends PartPresenter>>() {
public List<? extends PartPresenter> answer(InvocationOnMock invocation) throws Throwable {
return partPresenters;
}
JsonObject parts = Json.createObject();
state.put("PART_STACKS", parts);

});
JsonObject partStack = Json.createObject();
parts.put("INFORMATION", partStack);

partStack.put("HIDDEN", true);

perspective.loadState(state);

verify(workBenchController).setHidden(true);
}

Expand All @@ -210,6 +222,6 @@ public void shouldRestoreOpenedParts() throws Exception {
verify(partProvider).get();

verify(partStackPresenter).addPart(partPresenter);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ public void showDialog(Project project) {
if (isViewClosed) {
workspaceAgent.openPart(this, PartStackType.TOOLING);
isViewClosed = false;
}

PartPresenter activePart = partStack.getActivePart();
if (activePart == null || !activePart.equals(this)) {
} else {
partStack.setActivePart(this);
}
}
Expand Down

0 comments on commit 22efeaa

Please sign in to comment.