Commit 8c2a2628 authored by Alexander Diewald's avatar Alexander Diewald

Navigator: Move the entire expert view logic

.. it is not used elsewhere. If the are other use cases for expert
modes, move the variable to the service again.

Issue-Ref: 3922
Issue-Url: https://af3-developer.fortiss.org/issues/3922Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 1545aa3d
......@@ -5,6 +5,6 @@ EditPartFactoryService.java e9180c0020f1769d9e24ef3c08f9ca5599dbc5c3 GREEN
MarkerService.java 208f97f3ccabf0947702a17ddca23d8766a268f4 GREEN
ModelEditorBindingService.java 577f5db41abf240291434dbad6bc6b0fde1eeb2b GREEN
ModelElementHandlerService.java eeb07f6926012aa98256d452d1e554a5486dc657 GREEN
NavigatorService.java 748c8b135031eadd3e58631ae04aa886f29d700a YELLOW
NavigatorService.java 0bda329ebdaf62af7a2f8a8a20ce208e1715ebfd YELLOW
ToolingKernelUIInternal.java a70d19883dfb315d860233156d8524cf1ac2952f GREEN
TutorialUIService.java b1d632eca91b4feb583f3930cd6ee4722dd9bfed GREEN
......@@ -124,12 +124,6 @@ public class NavigatorService implements INavigatorService, IPersistencyServiceL
return provider == navigatorViewPart;
}
/** {@inheritDoc} */
@Override
public boolean isExpertViewActive() {
return expertViewActive;
}
/** Toggles the expert mode. */
public void toggleExpertMode() {
expertViewActive = !expertViewActive;
......
LinkWithEditorPartListener.java 7ffa9dc9c26eca23ff85d6828ef693afe5c2367d YELLOW
NavigatorController.java 17128b9b981fbc7db49f426b612dfa6838c9cb3a RED
NavigatorController.java 0f9a57f5520425f3dfd698781a214c79163eb171 RED
NavigatorDoubleClickHandler.java 0f04e10d9ba387195934d8510377053297c8f9cc RED
NavigatorTreeContentComparator.java 17c35d3a680214de66a4e6c21429a2d7a8a19aa4 RED
NavigatorTreeContentProvider.java f6d5105d2f08d89579cb720b3238dcbca4d28efb RED
NavigatorTreeContentProvider.java 00a0d3aa1bab3721faf67c340c183bb23db0e4e9 RED
NavigatorTreeUIProvider.java 5b696e995d6f892a70bdf3a0030c1c03d97996f7 RED
NavigatorViewPart.java 24068952db4182389e888e7b4b6123ee2ec4b675 YELLOW
NavigatorViewPart.java 78819215c2b9a33a4f6bc31ed5091a42f5c0638a RED
......@@ -43,7 +43,6 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.internal.NavigatorService;
import org.fortiss.tooling.kernel.ui.service.IActionService;
import org.fortiss.tooling.kernel.ui.service.INavigatorService;
import org.fortiss.tooling.kernel.ui.util.SelectionUtils;
import javafx.scene.Node;
......@@ -127,7 +126,6 @@ public final class NavigatorController extends CompositeFXControllerBase<TreeVie
// TODO(AD): Check correctness of the IViewSite cast and replace the site field with this
// type if applicable
IActionService.getInstance().registerGlobalActions(((IViewSite)site).getActionBars());
// createLinkWithEditorAction();
}
/** Stores the UI update job. */
......@@ -161,26 +159,6 @@ public final class NavigatorController extends CompositeFXControllerBase<TreeVie
// ToolingKernelUIActivator.getImageDescriptor("icons/library.png"));
// toggleLibraryViewAction.setToolTipText("Toggle library view");
//
// toggleExpertViewAction = new Action("Toggle expert view", SWT.TOGGLE) {
//
// @Override
// public void run() {
// ((NavigatorTreeContentProvider)viewer.getContentProvider()).toggleExpertView();
// viewer.refresh();
// }
// };
//
// toggleExpertViewAction.setImageDescriptor(
// ToolingKernelUIActivator.getImageDescriptor("icons/expert_view.png"));
// toggleExpertViewAction.setToolTipText("Toggle expert view");
//
// IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
// Separator additionsSeperator = new Separator("additions");
// additionsSeperator.setVisible(true);
// toolBarManager.add(additionsSeperator);
//
// toolBarManager.insertAfter("additions", toggleExpertViewAction);
// toolBarManager.insertAfter("additions", linkWithEditorAction);
// toolBarManager.insertAfter("additions", toggleLibraryViewAction);
// }
......@@ -200,9 +178,14 @@ public final class NavigatorController extends CompositeFXControllerBase<TreeVie
dynTreeViewer.findItem(element);
}
/** En- or disables the expert view. */
public void setExpertView(boolean enabled) {
contentProvider.setExpertView(enabled);
}
/** Returns whether expert view is active. */
public boolean isExpertViewActive() {
return INavigatorService.getInstance().isExpertViewActive();
return contentProvider.isExpertViewEnabled();
}
/** Sets the library view to be active. */
......
......@@ -34,9 +34,7 @@ import org.fortiss.tooling.kernel.model.ILibraryElementReference;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.ITutorialService;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.internal.NavigatorService;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import org.fortiss.tooling.kernel.ui.service.INavigatorService;
import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
/**
......@@ -46,6 +44,11 @@ import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
*/
public class NavigatorTreeContentProvider extends DynamicTreeContentProviderBase<Object> {
/**
* Determines whether the expert mode is enabled. It shows more artifacts than the simple mode.
*/
private boolean isExpertModeEnabled = false;
/** Stores whether the library view is active. **/
private boolean libraryViewActive = false;
......@@ -118,11 +121,11 @@ public class NavigatorTreeContentProvider extends DynamicTreeContentProviderBase
}
/**
* If {@link INavigatorService#isExpertViewActive()} is false then we filter out elements
* If the expert mode is disabled, we filter out elements
* according to {@link IModelElementHandler#hiddenInNonExpertView()}
*/
private List<EObject> filterExpertElements(List<EObject> elements) {
if(!INavigatorService.getInstance().isExpertViewActive()) {
if(!isExpertModeEnabled) {
List<EObject> filtered = new ArrayList<EObject>();
for(EObject current : elements) {
IModelElementHandler<EObject> handler =
......@@ -140,8 +143,13 @@ public class NavigatorTreeContentProvider extends DynamicTreeContentProviderBase
* Toggle the expert view. When expert view is active then more objects are
* displayed in the tree.
*/
public void toggleExpertView() {
((NavigatorService)INavigatorService.getInstance()).toggleExpertMode();
public void setExpertView(boolean enableExpertView) {
isExpertModeEnabled = enableExpertView;
}
/** Returns whether the active mode is currently enabled. */
public boolean isExpertViewEnabled() {
return isExpertModeEnabled;
}
/**
......
......@@ -61,6 +61,9 @@ public class NavigatorViewPart extends AF3FXViewPart
/** Dialog setting ID for the link with editor action flag. */
private static final String LINK_WITH_EDITOR_FLAG = "navigatorSettingLinkWithEditor";
/** Dialog setting ID for the link with editor action flag. */
private static final String EXPERT_MODE_FLAG = "navigatorSettingExpertMode";
/** Constructor. */
public NavigatorViewPart() throws Exception {
super(new NavigatorController(), null);
......@@ -82,6 +85,7 @@ public class NavigatorViewPart extends AF3FXViewPart
// Actions and Listeners.
String additionString = createToolbarAdditions();
createExpertViewToggle(additionString);
createLinkWithEditorAction(additionString);
return super.createFxScene();
......@@ -97,6 +101,29 @@ public class NavigatorViewPart extends AF3FXViewPart
return additionString;
}
/** Create a toggle switch for the expert mode where more artifacts are exposed to the user. */
private void createExpertViewToggle(String additionString) {
final IDialogSettings settings = ToolingKernelUIActivator.getDefault().getDialogSettings();
boolean isLinkedWithEditor = settings.getBoolean(EXPERT_MODE_FLAG);
if(isLinkedWithEditor) {
getSite().getPage().addPartListener(editorListener);
}
Action toggleExpertViewAction = new Action("Toggle expert view", SWT.TOGGLE) {
@Override
public void run() {
controller.setExpertView(this.isChecked());
controller.refresh();
}
};
toggleExpertViewAction.setImageDescriptor(getImageDescriptor("icons/expert_view.png"));
toggleExpertViewAction.setToolTipText("Toggle expert view");
IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
toolBarManager.insertAfter(additionString, toggleExpertViewAction);
}
/** Creates the part listener and the view action. */
private void createLinkWithEditorAction(String additionString) {
final IDialogSettings settings = ToolingKernelUIActivator.getDefault().getDialogSettings();
......
......@@ -5,5 +5,5 @@ IEditPartFactoryService.java c448bff63fb81f57037c9f1dc5319859c12d0c4d GREEN
IMarkerService.java d433e838e387dd2fe61b8dea7395ebb7203ae39b GREEN
IModelEditorBindingService.java ce2ae1957e2232bb0fac1d1d262103f9adfc5266 GREEN
IModelElementHandlerService.java 1ff2bda9054f6bbd4017fc0ddc118b7702196815 GREEN
INavigatorService.java 0addcb013babec70e039a0989f43dfbce114e227 YELLOW
INavigatorService.java 9b7af7e6d51cad863b7451a7c18b2bea5716374c YELLOW
ITutorialUIService.java 72707c60c3d23d8ffc5c579cb9b022bb614eb094 GREEN
......@@ -58,9 +58,6 @@ public interface INavigatorService {
*/
boolean isNavigatorView(ContextMenuContextProvider provider);
/** Returns whether expert view is active. */
boolean isExpertViewActive();
/** Returns the saveables. */
Saveable[] getSaveables();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment