-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-3369 Git history panel is not opened #3414
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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")) { | ||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment is for <100 but code is == 0 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, fixed! |
||
if (size < 100) { | ||
size = 100; | ||
} | ||
|
||
controller.setSize(size); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tab is always non null ?
because signature of onTabClicked is requiring notNull but getTabByPart can return null
public void onTabClicked(@NotNull TabItem selectedTab) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the case is confuses a little bit. But here tab must be not null because of there is a verification before.