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

Change default perspective selection logic #1562

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public void execute(MApplication app, EModelService modelService, EPartService p

// clone each snippet that is a perspective and add the cloned
// perspective into the main PerspectiveStack
boolean isFirst = true;
for (MPerspective perspective : perspectivesProvider.getInitialPerspectives()) {

perspectiveStack.getChildren().add(perspective);
if (isFirst) {

// set default (welcome) perspective
if (perspective.getElementId().equals(perspectivesProvider.getDefaultPerspectiveId())) {
perspectiveStack.setSelectedElement(perspective);
isFirst = false;
}

subscribeChangedElement(broker, perspective);
subscribeSelectedPerspective(broker, perspective);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class PerspectivesProvider {
private EModelService modelService;

private static final String MAIN_PERSPECTIVE_STACK_ID = "uk.ac.stfc.isis.ibex.client.e4.product.perspectivestack.0";

private static final String DEFAULT_PERSPECTIVE_ID = "uk.ac.stfc.isis.ibex.client.e4.product.perspective.weblinks";

/**
* Instantiates the class and initialises the internal perspective list with
* all perspectives found in the application model.
Expand Down Expand Up @@ -126,6 +127,13 @@ public List<MPerspective> getInitialPerspectives() {
}
return perspectives;
}

/**
* @return the default perspective id (usually displayed on launch as landing page)
*/
public String getDefaultPerspectiveId() {
return DEFAULT_PERSPECTIVE_ID;
}

/**
* Switches to a given perspective by id.
Expand Down