From 26b55d0e95e73918bc120476599d06f938ac3bf0 Mon Sep 17 00:00:00 2001 From: Tiziano Munaro <munaro@fortiss.org> Date: Wed, 12 Aug 2020 16:55:57 +0200 Subject: [PATCH] Adapt AF3-specific detail item handles to the FX-based KISS view Issue-Ref: 4020 Issue-Url: https://af3-developer.fortiss.org/issues/4020 Signed-off-by: Tiziano Munaro <munaro@fortiss.org> --- .../kernel/ui/introspection/details/.ratings | 2 +- .../details/KISSDetailsUIRegistry.java | 20 +++ .../ui/introspection/details/handler/.ratings | 7 +- ...yServiceIntrospectionDetailsUIHandler.java | 68 ++++++++ ...ProviderIntrospectionDetailsUIHandler.java | 126 ++++++++++++++ ...yServiceIntrospectionDetailsUIHandler.java | 67 +++++++ ...yServiceIntrospectionDetailsUIHandler.java | 66 +++++++ ...yServiceIntrospectionDetailsUIHandler.java | 163 ++++++++++++++++++ ...eServiceIntrospectionDetailsUIHandler.java | 6 +- .../kernel/ui/introspection/items/.ratings | 2 + ...actoryServiceIntrospectionDetailsItem.java | 39 +++++ ...actoryServiceIntrospectionDetailsItem.java | 39 +++++ .../extension/IKISSConsoleCommandHandler.java | 31 ---- 13 files changed, 600 insertions(+), 36 deletions(-) create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java delete mode 100644 org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/extension/IKISSConsoleCommandHandler.java diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/.ratings index 1db657254..871747c49 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/.ratings @@ -1,2 +1,2 @@ DetailsUIHandlerBase.java 3472e600cf406d96e00ae4e51d3bd4c159a712da YELLOW -KISSDetailsUIRegistry.java a8b0591a9c2a92c813d5ae4452b4254d462b05fb YELLOW +KISSDetailsUIRegistry.java 0aa953ec980d980408c036ffe4b0a6ec64096458 YELLOW diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/KISSDetailsUIRegistry.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/KISSDetailsUIRegistry.java index a8b0591a9..0aa953ec9 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/KISSDetailsUIRegistry.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/KISSDetailsUIRegistry.java @@ -17,20 +17,30 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.items.ConnectionCompositorServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.items.ElementCompositorServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.LibraryServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.items.MigrationServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.PersistencyServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.items.PrototypeServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.items.TransformationServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ConnectionCompositorServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ConstraintCheckerServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ContextMenuServiceIntrospectionDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.EclipseResourceStorageProviderIntrospectionDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.EditPartFactoryServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ElementCompositorServiceIntrospectionDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.LibraryServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.MigrationServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ModelEditorBindingServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.ModelElementHandlerServiceIntrospectionDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.PersistencyServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.PrototypeServiceIntrospectionDetailsUIHandler; import org.fortiss.tooling.kernel.ui.introspection.details.handler.TransformationServiceIntrospectionDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.items.AllocationEditPartFactoryServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.ui.introspection.items.ContextMenuServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.EditPartFactoryServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.ui.introspection.items.ModelEditorBindingServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.ui.introspection.items.ModelElementHandlerServiceIntrospectionDetailsItem; @@ -51,14 +61,22 @@ public final class KISSDetailsUIRegistry { /** Constructor. */ public KISSDetailsUIRegistry() { + registerHandler(AllocationEditPartFactoryServiceIntrospectionDetailsItem.class, + new AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler()); registerHandler(ConnectionCompositorServiceIntrospectionDetailsItem.class, new ConnectionCompositorServiceIntrospectionDetailsUIHandler()); registerHandler(ConstraintCheckerServiceIntrospectionDetailsItem.class, new ConstraintCheckerServiceIntrospectionDetailsUIHandler()); registerHandler(ContextMenuServiceIntrospectionDetailsItem.class, new ContextMenuServiceIntrospectionDetailsUIHandler()); + registerHandler(EclipseResourceStorageServiceIntrospectionDetailsItem.class, + new EclipseResourceStorageProviderIntrospectionDetailsUIHandler()); + registerHandler(EditPartFactoryServiceIntrospectionDetailsItem.class, + new EditPartFactoryServiceIntrospectionDetailsUIHandler()); registerHandler(ElementCompositorServiceIntrospectionDetailsItem.class, new ElementCompositorServiceIntrospectionDetailsUIHandler()); + registerHandler(LibraryServiceIntrospectionDetailsItem.class, + new LibraryServiceIntrospectionDetailsUIHandler()); registerHandler(MigrationServiceIntrospectionDetailsItem.class, new MigrationServiceIntrospectionDetailsUIHandler()); registerHandler(ModelEditorBindingServiceIntrospectionDetailsItem.class, @@ -67,6 +85,8 @@ public final class KISSDetailsUIRegistry { new ModelElementHandlerServiceIntrospectionDetailsUIHandler()); registerHandler(PrototypeServiceIntrospectionDetailsItem.class, new PrototypeServiceIntrospectionDetailsUIHandler()); + registerHandler(PersistencyServiceIntrospectionDetailsItem.class, + new PersistencyServiceIntrospectionDetailsUIHandler()); registerHandler(TransformationServiceIntrospectionDetailsItem.class, new TransformationServiceIntrospectionDetailsUIHandler()); } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/.ratings index c7d20a6d3..2bcfbe391 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/.ratings @@ -1,12 +1,17 @@ +AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java 42d3597f13eb95b064a3ed3161139847e3522e01 YELLOW ConnectionCompositorServiceIntrospectionDetailsUIHandler.java 1f2c3d4ec8a02720f4040d96a2a26a83b3e51904 YELLOW ConstraintCheckerServiceIntrospectionDetailsUIHandler.java 1138c27d2f9c264d007443a9e0b675bcbda8d746 YELLOW ContextMenuServiceIntrospectionDetailsUIHandler.java 4ec6611b4b8e60cb97baf81e7aab485c16c394bb YELLOW EObjectAware2IntrospectionDetailsUIHandlerBase.java abbadb009798f39fdf35ed766cfe1bbe637ec476 YELLOW EObjectAwareIntrospectionDetailsUIHandlerBase.java 3a0dd8b9d875654c935103ef64e33fb19206867d YELLOW +EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java 9886325eca3417a1608d04dfe8b3206f1c7ae499 YELLOW +EditPartFactoryServiceIntrospectionDetailsUIHandler.java 5de8a9333c7ab7b703fb4a35da0b14c5620d9267 YELLOW ElementCompositorServiceIntrospectionDetailsUIHandler.java ca6a50a3211f33ab04c4038494d88b11aae1cbe4 YELLOW IntrospectionDetailsUIHandlerBase.java d9f18b2662aebc0af2a7713dd3b553d8e7194e30 YELLOW +LibraryServiceIntrospectionDetailsUIHandler.java 341f00d515ffb451915cf2c0edd4c5eaf19db2c4 YELLOW MigrationServiceIntrospectionDetailsUIHandler.java d3c97dd4558073dff7608df552aab3daf808ad77 YELLOW ModelEditorBindingServiceIntrospectionDetailsUIHandler.java bf1f031595b2b1e7aa05e1a012125470bea8ddf3 YELLOW ModelElementHandlerServiceIntrospectionDetailsUIHandler.java c37435b747608b58293d7564bcc3cba5f1335b16 YELLOW -PrototypeServiceIntrospectionDetailsUIHandler.java 60a7edda82bdbac2196ee5dbfaa750b7b7bda0ed YELLOW +PersistencyServiceIntrospectionDetailsUIHandler.java 9c24bef0f937e7d7d724905a281c3ad96abab2c3 YELLOW +PrototypeServiceIntrospectionDetailsUIHandler.java a6d9c726e66d29fced1554af0361278545ceb149 YELLOW TransformationServiceIntrospectionDetailsUIHandler.java e00e52e89aa2d62e44d19bed0c92e2bea8a2e9c5 YELLOW diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java new file mode 100644 index 000000000..42d3597f1 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java @@ -0,0 +1,68 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +import org.fortiss.tooling.kernel.ui.internal.AllocationEditPartFactoryService; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.items.AllocationEditPartFactoryServiceIntrospectionDetailsItem; + +import javafx.scene.Node; + +/** + * {@link DetailsUIHandlerBase} for {@link AllocationEditPartFactoryService}. + * + * @author hoelzl + */ +public class AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler + extends EObjectAwareIntrospectionDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered allocation editpart factories:"; + String footer = "Number of currently registered allocation editpart factories: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Class / Factory", 250, "Factory Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { + return AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.this + .getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected AllocationEditPartFactoryServiceIntrospectionDetailsItem getRootObject() { + return (AllocationEditPartFactoryServiceIntrospectionDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java new file mode 100644 index 000000000..9886325ec --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java @@ -0,0 +1,126 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import static java.util.Arrays.asList; + +import java.util.Collection; + +import org.eclipse.core.resources.IFile; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.kernel.extension.IEclipseResourcePostLoadProvider; +import org.fortiss.tooling.kernel.extension.IEclipseResourceStorageLocationProvider; +import org.fortiss.tooling.kernel.extension.data.ModelStorageError; +import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageServiceIntrospectionDetailsItem; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Introspection UI handler for the {@link EclipseResourceStorageServiceIntrospectionDetailsItem}s. + * + * @author hoelzl + */ +public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler + extends IntrospectionDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered Eclipse resource providers:"; + String footer = "Number of currently registered storage providers: " + + getRootObject().getStorageProviderList().size() + " (providing " + + getRootObject().getLoadedFiles().size() + " file[s], " + + getRootObject().getErrorFiles().size() + " erroneous)."; + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + tree.addColumn("Category / Provider / File", 450); + tree.addColumn("Implementation Class / Path / Storage Error Message", 400); + } + + /** String array of root categories. */ + private final String[] ROOT_CATEGORY = + new String[] {"Storage Provider", "Loaded Files", "Erroneous Files"}; + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { + + @Override + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getRootObject()) { + return asList(ROOT_CATEGORY); + } + if(ROOT_CATEGORY[0].equals(parentElement)) { + return getRootObject().getStorageProviderList(); + } + if(ROOT_CATEGORY[1].equals(parentElement)) { + return getRootObject().getLoadedFiles(); + } + if(ROOT_CATEGORY[2].equals(parentElement)) { + return getRootObject().getErrorFiles(); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public String getLabel(Object parentElement, int columnIndex) { + if(parentElement instanceof IEclipseResourceStorageLocationProvider || + parentElement instanceof IEclipseResourcePostLoadProvider) { + return columnIndex == 0 ? parentElement.getClass().getSimpleName() + : parentElement.getClass().getName(); + } + if(parentElement instanceof String) { + return columnIndex == 0 ? (String)parentElement : ""; + } + if(parentElement instanceof IFile) { + IFile file = (IFile)parentElement; + return columnIndex == 0 ? file.getName() : file.getFullPath().toString(); + } + if(parentElement instanceof ModelStorageError) { + ModelStorageError error = (ModelStorageError)parentElement; + return columnIndex == 0 ? "" : error.getMessage(); + } + return ""; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + return createCopyClassNameMenuItem(element.getClass()); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected EclipseResourceStorageServiceIntrospectionDetailsItem getRootObject() { + return (EclipseResourceStorageServiceIntrospectionDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java new file mode 100644 index 000000000..5de8a9333 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java @@ -0,0 +1,67 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService; +import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.internal.introspection.items.EditPartFactoryServiceIntrospectionDetailsItem; + +import javafx.scene.Node; + +/** + * {@link DetailsUIHandlerBase} for {@link EditPartFactoryService}. + * + * @author hoelzl + */ +public class EditPartFactoryServiceIntrospectionDetailsUIHandler + extends EObjectAwareIntrospectionDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered editpart factories:"; + String footer = "Number of currently registered editpart factories: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Class / Factory", 250, "Factory Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { + return EditPartFactoryServiceIntrospectionDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected EditPartFactoryServiceIntrospectionDetailsItem getRootObject() { + return (EditPartFactoryServiceIntrospectionDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java new file mode 100644 index 000000000..341f00d51 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java @@ -0,0 +1,66 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +import org.fortiss.tooling.kernel.introspection.items.LibraryServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.service.ILibraryService; + +import javafx.scene.Node; + +/** + * {@link IntrospectionDetailsUIHandlerBase} for {@link ILibraryService}. + * + * @author hoelzl + */ +public final class LibraryServiceIntrospectionDetailsUIHandler + extends EObjectAwareIntrospectionDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered library element handler:"; + String footer = "Number of currently registered library element handlers: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Class / Provider", 250, "Provider Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { + return LibraryServiceIntrospectionDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected LibraryServiceIntrospectionDetailsItem getRootObject() { + return (LibraryServiceIntrospectionDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java new file mode 100644 index 000000000..9c24bef0f --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java @@ -0,0 +1,163 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import static java.util.Arrays.asList; + +import java.util.Collection; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.kernel.extension.IStorageProvider; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.extension.data.ModelStorageError; +import org.fortiss.tooling.kernel.introspection.items.PersistencyServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.service.IPersistencyService; +import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Introspection UI handler for the {@link IPersistencyService}. + * + * @author hoelzl + */ +public final class PersistencyServiceIntrospectionDetailsUIHandler + extends IntrospectionDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered persistency providers:"; + String footer = "Number of currently registered providers: " + + getRootObject().getStorageProviders().size(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + tree.addColumn("Storage Provider Class / Toplevel Element", 450); + tree.addColumn("Toplevel EObject Class / Storage Error Message", 400); + tree.addColumn("Error Cause Exception", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { + + @Override + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getRootObject()) { + return getRootObject().getStorageProviders(); + } + if(parentElement instanceof IStorageProvider) { + IStorageProvider prov = (IStorageProvider)parentElement; + return asList(new Object[] {new ToplevelOrErrorTreeNode(prov, true), + new ToplevelOrErrorTreeNode(prov, false)}); + } + if(parentElement instanceof ToplevelOrErrorTreeNode) { + ToplevelOrErrorTreeNode node = (ToplevelOrErrorTreeNode)parentElement; + if(node.isToplevel) { + return node.provider.getTopLevelElements(); + } + return node.provider.getStorageErrors(); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof IStorageProvider) { + return createCopyClassNameMenuItem(element.getClass()); + } else if(element instanceof ITopLevelElement) { + EObject eo = ((ITopLevelElement)element).getRootModelElement(); + return createCopyClassNameMenuItem(eo.getClass()); + } + return null; + } + + @Override + public String getLabel(Object parentElement, int columnIndex) { + if(parentElement instanceof IStorageProvider) { + IStorageProvider isp = (IStorageProvider)parentElement; + return columnIndex == 0 ? isp.getClass().getName() : ""; + } + if(parentElement instanceof ToplevelOrErrorTreeNode) { + ToplevelOrErrorTreeNode node = (ToplevelOrErrorTreeNode)parentElement; + if(node.isToplevel) { + return columnIndex == 0 ? "Toplevel Elements" : ""; + } + return columnIndex == 0 ? "Model Storage Errors" : ""; + } + if(parentElement instanceof ITopLevelElement) { + ITopLevelElement top = (ITopLevelElement)parentElement; + switch(columnIndex) { + case 0: + return IModelElementHandlerService.getInstance() + .getName(top.getRootModelElement()); + case 1: + return top.getRootModelElement().getClass().getName(); + default: + return ""; + } + } + if(parentElement instanceof ModelStorageError) { + ModelStorageError error = (ModelStorageError)parentElement; + switch(columnIndex) { + case 0: + return ""; + case 1: + return error.getMessage(); + case 2: + return error.getCause().toString(); + } + } + return ""; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected PersistencyServiceIntrospectionDetailsItem getRootObject() { + return (PersistencyServiceIntrospectionDetailsItem)dataItem; + } + + /** Class for tree nodes below storage providers. */ + private static class ToplevelOrErrorTreeNode { + /** The storage provider. */ + public final IStorageProvider provider; + /** The top level flag. */ + public final boolean isToplevel; + + /** Constructor. */ + public ToplevelOrErrorTreeNode(IStorageProvider provider, boolean toplevel) { + this.provider = provider; + this.isToplevel = toplevel; + } + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java index 60a7edda8..a6d9c726e 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java @@ -56,7 +56,7 @@ public final class PrototypeServiceIntrospectionDetailsUIHandler case 0: return arche.getName(); case 1: - return findArcheypeProviderClass(arche).getName(); + return findPrototypeProviderClass(arche).getName(); case 2: return arche.getPrototype().getClass().getName(); case 3: @@ -67,7 +67,7 @@ public final class PrototypeServiceIntrospectionDetailsUIHandler } /** Find the Prototype provider for the given Prototype. */ - private Class<? extends IPrototypeProvider> findArcheypeProviderClass(Prototype arche) { + private Class<? extends IPrototypeProvider> findPrototypeProviderClass(Prototype arche) { for(IPrototypeProvider provider : IPrototypeService.getInstance().getPrototypeProviders()) { if(provider.getPrototypes().contains(arche)) { return provider.getClass(); @@ -132,7 +132,7 @@ public final class PrototypeServiceIntrospectionDetailsUIHandler Prototype arche = (Prototype)element; Class<?> toCopy; if(column == 1) { - toCopy = findArcheypeProviderClass(arche); + toCopy = findPrototypeProviderClass(arche); } else if(column == 2) { toCopy = arche.getPrototype().getClass(); } else { diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/.ratings index 86697813f..00315bfea 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/.ratings @@ -1,3 +1,5 @@ +AllocationEditPartFactoryServiceIntrospectionDetailsItem.java af4c2d2c76074119490b475cd4ad66e7c5a691f8 GREEN ContextMenuServiceIntrospectionDetailsItem.java 47c10552951ca6ddd6de798d020e425f71fb9eea YELLOW +EditPartFactoryServiceIntrospectionDetailsItem.java 8b3d89c2e9626c8c646807a9d2dc0d92d2146881 GREEN ModelEditorBindingServiceIntrospectionDetailsItem.java e4e2547729bbc023cdea6e5ae77ec84f9c9a89ff YELLOW ModelElementHandlerServiceIntrospectionDetailsItem.java 28798b18aa7d808c80fc0d0476cca62362425010 YELLOW diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java new file mode 100644 index 000000000..af4c2d2c7 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java @@ -0,0 +1,39 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.items; + +import java.util.List; +import java.util.Map; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +import org.fortiss.tooling.kernel.ui.extension.IAllocationEditPartFactory; +import org.fortiss.tooling.kernel.ui.internal.AllocationEditPartFactoryService; + +/** + * {@link IIntrospectionDetailsItem} for {@link AllocationEditPartFactoryService}. + * + * @author hoelzl + */ +public final class AllocationEditPartFactoryServiceIntrospectionDetailsItem + extends EObjectAwareIntrospectionDetailsItemBase<IAllocationEditPartFactory> { + + /** Constructor. */ + public AllocationEditPartFactoryServiceIntrospectionDetailsItem( + Map<Class<?>, List<IAllocationEditPartFactory>> handlerMap) { + super(handlerMap); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java new file mode 100644 index 000000000..8b3d89c2e --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java @@ -0,0 +1,39 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2016 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.kernel.ui.introspection.items; + +import java.util.List; +import java.util.Map; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +import org.fortiss.tooling.kernel.ui.extension.IEditPartFactory; +import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService; + +/** + * {@link IIntrospectionDetailsItem} for {@link EditPartFactoryService}. + * + * @author hoelzl + */ +public final class EditPartFactoryServiceIntrospectionDetailsItem + extends EObjectAwareIntrospectionDetailsItemBase<IEditPartFactory> { + + /** Constructor. */ + public EditPartFactoryServiceIntrospectionDetailsItem( + Map<Class<?>, List<IEditPartFactory>> handlerMap) { + super(handlerMap); + } +} diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/extension/IKISSConsoleCommandHandler.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/extension/IKISSConsoleCommandHandler.java deleted file mode 100644 index ff27d9df1..000000000 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/extension/IKISSConsoleCommandHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2018 fortiss GmbH. - * - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 - * which is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - *******************************************************************************/ -package org.fortiss.tooling.kernel.extension; - -import java.util.Collection; - -import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; - -/** Interface for {@link IKernelIntrospectionSystemService} console commands. */ -public interface IKISSConsoleCommandHandler { - /** - * Returns a short description of the command to be used in the help listing. The return value - * MUST NOT exceed forty characters. - */ - String getShortHelp(); - - /** Returns the long description of the command to be used by the help command. */ - String getLongHelp(); - - /** Executes the command and returns whether the update notification should be fired. */ - boolean execute(Collection<String> args, StringBuilder consoleContent); -} -- GitLab