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

Add persistence for the "show deprecated entities" option. #1232

Merged
merged 1 commit into from
Sep 18, 2024
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 @@ -16,6 +16,8 @@ public class ClassHierarchyPreferences {

private static final String DISPLAY_RELATIONSHIPS_KEY = "DISPLAY_RELATIONSHIPS";

private static final String DISPLAY_DEPRECATED_ENTITIES_KEY = "DISPLAY_DEPRECATED_ENTITIES";

private static Preferences getPreferences() {
return PreferencesManager.getInstance().getApplicationPreferences(CLASS_HIERARCHY_PREFERENCES);
}
Expand All @@ -31,4 +33,12 @@ public boolean isDisplayRelationships() {
public void setDisplayRelationships(boolean displayRelationships) {
getPreferences().putBoolean(DISPLAY_RELATIONSHIPS_KEY, displayRelationships);
}

public boolean isDisplayDeprecatedEntities() {
return getPreferences().getBoolean(DISPLAY_DEPRECATED_ENTITIES_KEY, false);
}

public void setDisplayDeprecatedEntities(boolean displayDeprecatedEntities) {
getPreferences().putBoolean(DISPLAY_DEPRECATED_ENTITIES_KEY, displayDeprecatedEntities);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.protege.editor.owl.ui.action;

import org.protege.editor.owl.model.hierarchy.ClassHierarchyPreferences;
import org.protege.editor.owl.ui.view.HasDisplayDeprecatedEntities;

import java.awt.event.ActionEvent;
Expand All @@ -13,13 +14,14 @@ public class DisplayDeprecatedEntitiesAction extends ComponentHierarchyAction<Ha

@Override
protected Class<HasDisplayDeprecatedEntities> initialiseAction() {
putValue(SELECTED_KEY, false);
putValue(SELECTED_KEY, ClassHierarchyPreferences.get().isDisplayDeprecatedEntities());
return HasDisplayDeprecatedEntities.class;
}

@Override
protected void actionPerformedOnTarget(ActionEvent e, HasDisplayDeprecatedEntities target) {
boolean value = (boolean) getValue(SELECTED_KEY);
target.setShowDeprecatedEntities(value);
ClassHierarchyPreferences.get().setDisplayDeprecatedEntities(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.protege.editor.core.ui.view.ViewMode;
import org.protege.editor.core.util.HandlerRegistration;
import org.protege.editor.owl.model.OWLModelManager;
import org.protege.editor.owl.model.hierarchy.ClassHierarchyPreferences;
import org.protege.editor.owl.model.hierarchy.OWLObjectHierarchyProvider;
import org.protege.editor.owl.ui.OWLObjectComparatorAdapter;
import org.protege.editor.owl.ui.action.AbstractOWLTreeAction;
Expand Down Expand Up @@ -170,8 +171,9 @@ public void mouseReleased(MouseEvent e) {

breadCrumbTrailProviderRegistration = getOWLWorkspace().registerBreadcrumbTrailProvider(this);

// Don't show deprecated entities by default
getHierarchyProvider().setFilter(this::isNotDeprecated);
if (!ClassHierarchyPreferences.get().isDisplayDeprecatedEntities()) {
getHierarchyProvider().setFilter(this::isNotDeprecated);
}
}

private void scrollSelectedPathToVisibleRect() {
Expand Down