Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added version to the workbench layout interface #1603

Merged
merged 1 commit into from
Mar 29, 2018

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Mar 28, 2018

@elaihau elaihau force-pushed the T1075-hotfix branch 2 times, most recently from 52c055b to 48cf081 Compare March 28, 2018 18:49
@elaihau
Copy link
Contributor Author

elaihau commented Mar 28, 2018

This change is the first step to resolve #1075.

We want to reset the work bench if there is a version mismatch, to avoid the confusion.

All users who get this change would see a reset workbench the first time s/he loads theia.

setLayoutData({ version, mainPanel, bottomPanel, leftPanel, rightPanel, statusBar }: ApplicationShell.LayoutData): void {
if (version !== LAYOUT_DATA_VERSION) {
throw new Error(`Saved workbench layout (version ${version || 'unknown'}) is incompatible with the current (${LAYOUT_DATA_VERSION})`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to extract this check to a protected method checkLayoutData so it can be overridden. That method could return the passed layout data if the version matches, so by overriding it it's easy to implement conversions between data format versions.

    setLayoutData(layoutData: ApplicationShell.LayoutData): void {
        const { mainPanel, bottomPanel, etc. } = this.checkLayoutData(layoutData);
        ...
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the checkLayoutData() returns an object, i prefer to name it in the way of getXXXX(). WDYT?

@elaihau elaihau force-pushed the T1075-hotfix branch 2 times, most recently from 8ec2e39 to 47568d1 Compare March 29, 2018 13:28
@elaihau
Copy link
Contributor Author

elaihau commented Mar 29, 2018

@spoenemann
Do we want to remove the editor-related labels and button from the status bar in case that the workbench is reset ?

As far as I can tell, after a workbench reset the editors are gone, so it does not make sense to have those labels and buttons on the right hand side of the status bar (see screenshot below, including the "problems" button) any more.

screenshot from 2018-03-29 09-57-50

@spoenemann
Copy link
Contributor

Resetting the workbench also clears the status bar, so we don't need to do anything in that case.

@elaihau
Copy link
Contributor Author

elaihau commented Mar 29, 2018

Tested. yep you are right :)

- The initial step that resolves eclipse-theia#1075

Signed-off-by: elaihau <liang.huang@ericsson.com>
@elaihau elaihau merged commit cd757db into eclipse-theia:master Mar 29, 2018
@elaihau elaihau deleted the T1075-hotfix branch March 29, 2018 15:23
@kittaakos kittaakos mentioned this pull request Jul 17, 2019
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[workbench layout restore] Detect failure, reset to default layout
2 participants