diff --git a/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF index 1f31d0fee19be06af973efd6703114e0670808bf..3155f6637d9cbbafd59f6bcccc3fb23630466958 100644 --- a/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.base.ui/META-INF/MANIFEST.MF @@ -12,7 +12,6 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: fortiss GmbH Export-Package: org.fortiss.tooling.base.ui, - org.fortiss.tooling.base.ui.annotation, org.fortiss.tooling.base.ui.annotation.view, org.fortiss.tooling.base.ui.annotation.view.fx, org.fortiss.tooling.base.ui.contentprovider, diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings index 3e45f94c4093ed5ace0c18f9768a45acbddc7f9a..3ef238d8425fcf37bc9d91f32eab1332757e8bc1 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings @@ -1 +1,2 @@ -ModelElementTreeViewer.java 9c7637313b0ce4d70566ebb4f90dfca0d9931d09 GREEN +DynamicTreeTableNameProvider.java 3ca45f24b94e97b02313e80b16ba8b370f541541 GREEN +ModelElementTreeViewer.java b541376d1b21d38dec80ae6dd5357fe289dcb643 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerLabelProvider.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java similarity index 63% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerLabelProvider.java rename to org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java index 639495bdc8ce8c13edd464869ff625f745ed9809..3ca45f24b94e97b02313e80b16ba8b370f541541 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerLabelProvider.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/DynamicTreeTableNameProvider.java @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------+ -| Copyright 2016 fortiss GmbH | +| Copyright 2020 fortiss GmbH | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | @@ -13,29 +13,24 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection; +package org.fortiss.tooling.base.ui.javafx.control.treetableview; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; +import org.fortiss.tooling.kernel.model.INamedElement; /** - * Label provider for the tree viewer of the {@link KISSViewPart}. + * Extensible {@link DynamicTreeTableUIProviderBase} providing the names of elements in the first + * column. * - * @author hoelzl + * @author diewald */ -final class KISSViewerLabelProvider extends LabelProvider { +public class DynamicTreeTableNameProvider<T extends INamedElement> + extends DynamicTreeTableUIProviderBase<T> { /** {@inheritDoc} */ @Override - public Image getImage(Object element) { - return null; - } - - /** {@inheritDoc} */ - @Override - public String getText(Object element) { - if(element instanceof IIntrospectionItem) { - return ((IIntrospectionItem)element).getIntrospectionLabel(); + public String getLabel(T element, int column) { + if(column == 0) { + return element.getName(); } return null; } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java index 9c7637313b0ce4d70566ebb4f90dfca0d9931d09..b541376d1b21d38dec80ae6dd5357fe289dcb643 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java @@ -25,7 +25,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; -import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeItem; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeItemBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeUIProviderBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeViewer; import org.fortiss.tooling.kernel.model.INamedElement; @@ -131,7 +131,12 @@ public class ModelElementTreeViewer<T extends INamedElement> { /** Expands the tree down to the given value. */ public void expandItem(T value) { - DynamicTreeItem<T> item = dynTreeViewer.findItem(value); + DynamicTreeItemBase<T> item = dynTreeViewer.findItem(value); dynTreeViewer.expandItem(item); } + + /** Returns the {@link DynamicTreeItemBase} of the given {@code value} if it exists. */ + public DynamicTreeItemBase<T> findItem(T value) { + return dynTreeViewer.findItem(value); + } } diff --git a/org.fortiss.tooling.common.ui/.classpath b/org.fortiss.tooling.common.ui/.classpath index 0920a6fed0bb5a3313c4f46b95ea1fcb99101429..68769be698d53ccfa66089606406c1afe54c939d 100644 --- a/org.fortiss.tooling.common.ui/.classpath +++ b/org.fortiss.tooling.common.ui/.classpath @@ -3,6 +3,11 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="external-src"/> <classpathentry kind="src" path="res"/> + <classpathentry exported="true" kind="lib" path="lib/controlsfx-11.0.2.jar" sourcepath="lib/controlsfx-11.0.2-sources.jar"> + <attributes> + <attribute name="javadoc_location" value="jar:platform:/resource/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar!/"/> + </attributes> + </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> <attributes> <attribute name="module" value="true"/> diff --git a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF index 8904b24d996d445d452ec69850534811444df865..8bfe85a7e12837873c671306b1c388c58163c498 100644 --- a/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.common.ui/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.fortiss.tooling.common;visibility:=reexport, Bundle-ClassPath: ., lib/org.conqat.ide.commons.gef.jar, lib/org.conqat.ide.commons.ui.jar, - lib/swt-grouplayout.jar + lib/swt-grouplayout.jar, + lib/controlsfx-11.0.2.jar Export-Package: aerofx, aquafx, jfxtras, @@ -69,6 +70,20 @@ Export-Package: aerofx, org.conqat.ide.commons.ui.xmlmodel, org.conqat.ide.commons.ui.xmlmodel.databinding, org.conqat.ide.commons.ui.xmlmodel.undo, + org.controlsfx.control, + org.controlsfx.control.action, + org.controlsfx.control.cell, + org.controlsfx.control.decoration, + org.controlsfx.control.table, + org.controlsfx.control.table.model, + org.controlsfx.control.textfield, + org.controlsfx.dialog, + org.controlsfx.glyphfont, + org.controlsfx.property, + org.controlsfx.property.editor, + org.controlsfx.tools, + org.controlsfx.validation, + org.controlsfx.validation.decoration, org.eclipse.gmf.runtime.draw2d.ui.figures, org.eclipse.gmf.runtime.draw2d.ui.geometry, org.eclipse.jface.viewers, @@ -80,7 +95,6 @@ Export-Package: aerofx, org.fortiss.tooling.common.ui.javafx, org.fortiss.tooling.common.ui.javafx.control.treetableview, org.fortiss.tooling.common.ui.javafx.layout, - org.fortiss.tooling.common.ui.javafx.style, org.fortiss.tooling.common.ui.javafx.lwfxef, org.fortiss.tooling.common.ui.javafx.lwfxef.change, org.fortiss.tooling.common.ui.javafx.lwfxef.controller, @@ -96,6 +110,7 @@ Export-Package: aerofx, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.elliptic, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.rectangular, org.fortiss.tooling.common.ui.javafx.lwfxef.visual.widgets, + org.fortiss.tooling.common.ui.javafx.style, org.fortiss.tooling.common.ui.javafx.util Bundle-Vendor: fortiss GmbH Bundle-Activator: org.fortiss.tooling.common.ui.ToolingCommonUIActivator diff --git a/org.fortiss.tooling.common.ui/build.properties b/org.fortiss.tooling.common.ui/build.properties index 15f0431a4cec282c6243329a527a4754af3d8fd7..7e845aef4697e9d73c38739b7f670209ae04e1a0 100644 --- a/org.fortiss.tooling.common.ui/build.properties +++ b/org.fortiss.tooling.common.ui/build.properties @@ -6,7 +6,8 @@ bin.includes = .,\ lib/org.conqat.ide.commons.ui.jar,\ lib/swt-grouplayout.jar,\ res/,\ - icons/ + icons/,\ + lib/controlsfx-11.0.2.jar jars.compile.order = . source.. = src/,\ res/,\ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar new file mode 100644 index 0000000000000000000000000000000000000000..5111ad27bce8ee8e7a2dc3cf5d54e69d13b597bf Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-javadoc.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar new file mode 100644 index 0000000000000000000000000000000000000000..26c842885fe58f8c0fc1a2ff7d5fdf7c84edc2d7 Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2-sources.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..229be507f29a785eb6f235542064703420e35d82 Binary files /dev/null and b/org.fortiss.tooling.common.ui/lib/controlsfx-11.0.2.jar differ diff --git a/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt b/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c084bb20d0cc2350f1a0e2d4dcb2a75b72ac40d --- /dev/null +++ b/org.fortiss.tooling.common.ui/lib/license-controlsFX.txt @@ -0,0 +1,29 @@ +License of the ControlsFX library + +Copyright (c) 2013, ControlsFX +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of ControlsFX, any associated website, nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings index 925a4859f625d2879fb2a81017f7e7649f75f97d..825df80796e30c4c40591907a2748bb3bcb5ce4d 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings @@ -1 +1 @@ -AF3FXViewPart.java 3e4510f9e9f86ecf5ba29432342acd50e030aaaa GREEN +AF3FXViewPart.java af974e21c086a86134d4b2d6cdf9da1a31aea7de GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java index 3e4510f9e9f86ecf5ba29432342acd50e030aaaa..af974e21c086a86134d4b2d6cdf9da1a31aea7de 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java @@ -49,7 +49,7 @@ public abstract class AF3FXViewPart extends FXViewPart { private Pane root; /** Specifies the view part's layout and logic. */ - private ICompositeFXController<? extends Node, ? extends Node> controller; + protected final ICompositeFXController<? extends Node, ? extends Node> controller; /** * Constructor. Allows to pass the view's FXML definition file. diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index b5e34a048324998476890ec6a11cfc00332f6a29..8968633b32b9581e72c0bba01c9fb48260501d7a 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -1,9 +1,14 @@ -DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff YELLOW -DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN -DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN -DynamicTreeTableUIProviderBase.java dba6edaebf9e56067d80b51564379dd05697f830 YELLOW -DynamicTreeTableViewer.java 3d91b1bd43393f5d0733a253a85436b8255526ae YELLOW -DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN -DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN +DynamicList.java 786300e2e914826da239329d190abea1710478ea GREEN +DynamicListContentProvider.java 817cba44f246a361207a88ef9a4e1869215803f7 GREEN +DynamicStreamContentProvider.java f46e91400609cba54793dd240be0fe2aa0d5cced GREEN +DynamicTreeContentProviderBase.java 0f6e0a6894752d135847608bc45efa504972bb28 GREEN +DynamicTreeItem.java 7486071d20e896d6ca9a9101bf105caccf3656d0 GREEN +DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN +DynamicTreeTableUIProviderBase.java 1078bd28a6bce5a5a2c60500f2aa1d8b1fdd341b GREEN +DynamicTreeTableViewer.java ea4ac3530edfa179cfce53bdd7e3a7ae80c435e4 GREEN +DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN +DynamicTreeViewer.java e58d2cf7239e45f1b790ce9770a8a8649b1b5fb9 GREEN DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN +EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 GREEN IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN +IDynamicItem.java 083d02459e7ec33542d9910c04abe2581e0b5422 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java new file mode 100644 index 0000000000000000000000000000000000000000..786300e2e914826da239329d190abea1710478ea --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicList.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * Alexander Diewald (fortiss GmbH) - backport to AF3 & Integration + * improvements + * + *******************************************************************************/ +package org.fortiss.tooling.common.ui.javafx.control.treetableview; + +import java.util.Collection; +import java.util.HashMap; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import javafx.scene.control.TreeItem; + +/** + * {@link TreeItem} with support for dynamic children using the + * {@link DynamicList#update()} method. + */ +public class DynamicList<T> extends DynamicTreeItemBase<T> { + /** The viewer. */ + private DynamicTreeContentProviderBase<T> contentProvider; + + /** + * Constructor. The given {@link Supplier} is queried on updates to retrieve a recent list of + * elements to display. + */ + @SuppressWarnings("unchecked") + public DynamicList(Supplier<Stream<T>> data, + DynamicStreamContentProvider<T, Supplier<Stream<T>>> contentProvider) { + super((T)data); + this.contentProvider = contentProvider; + } + + /** Constructor. The given collection must be updated by the initializer to reflect changes. */ + @SuppressWarnings("unchecked") + public DynamicList(Collection<T> data, DynamicTreeContentProviderBase<T> contentProvider) { + super((T)data); + this.contentProvider = contentProvider; + } + + /** {@inheritDoc} */ + @Override + public void update() { + // remember expanded state of children + HashMap<T, TreeItem<T>> expanded = new HashMap<>(); + for(TreeItem<T> c : getChildren()) { + if(c.isExpanded()) { + expanded.put(c.getValue(), c); + } + } + // get list of children and create tree items + getChildren().clear(); + for(T element : contentProvider.getFilteredSortedChildren(getValue())) { + DynamicTreeItem<T> dti = new DynamicTreeItem<T>(element, contentProvider); + getChildren().add(dti); + dti.update(); + } + } + + /** {@inheritDoc} */ + @Override + public boolean isLeaf() { + Collection<? extends Object> children = + contentProvider.getFilteredSortedChildren(getValue()); + return children == null || children.isEmpty(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..817cba44f246a361207a88ef9a4e1869215803f7 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicListContentProvider.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2016, 2018 fortiss GmbH. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v2.0 which is available at + * http://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Florian Hoelzl (fortiss GmbH) - initial implementation + * Alexander Diewald (fortiss GmbH) - backport to AF3 & Integration + * improvements + * + *******************************************************************************/ +package org.fortiss.tooling.common.ui.javafx.control.treetableview; + +import static java.util.Collections.emptyList; + +import java.util.Collection; + +/** + * Base class for implementing tree content providers used in {@link DynamicTreeViewer} and + * {@link DynamicTreeTableViewer}. + */ +public class DynamicListContentProvider<T> extends DynamicTreeContentProviderBase<T> { + /** Returns the children of the given parent in the tree. */ + @SuppressWarnings("unchecked") + @Override + protected Collection<T> getChildren(T parent) { + // Pseudo-cast... + if(parent instanceof Collection) { + return (Collection<T>)parent; + } + return emptyList(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..f46e91400609cba54793dd240be0fe2aa0d5cced --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicStreamContentProvider.java @@ -0,0 +1,42 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.common.ui.javafx.control.treetableview; + +import static java.util.Collections.emptyList; +import static java.util.stream.Collectors.toList; + +import java.util.Collection; +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * Content provider whose element list is dynamically retrieved from a supplier. + * + * @author diewald + */ +public class DynamicStreamContentProvider<T, S extends Supplier<Stream<T>>> + extends DynamicTreeContentProviderBase<T> { + + /** {@inheritDoc} */ + @Override + protected Collection<? extends T> getChildren(T parent) { + if(parent instanceof Supplier) { + @SuppressWarnings("unchecked") Supplier<Stream<T>> supp = ((S)parent); + return supp.get().collect(toList()); + } + return emptyList(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java index 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3..0f6e0a6894752d135847608bc45efa504972bb28 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeContentProviderBase.java @@ -51,10 +51,10 @@ public abstract class DynamicTreeContentProviderBase<T> { * toString() contains the filter value. Sub-classes may override or implement * {@link #filter(Object, String)}. */ - protected Predicate<T> getFilterPredicate(String filterValue) { - if(filterValue != null && !"".equals(filterValue.trim())) { + protected Predicate<T> getFilterPredicate() { + if(getFilterExpression() != null && !"".equals(getFilterExpression().trim())) { return (o) -> { - return filter(o, filterValue); + return filter(o, getFilterExpression()); }; } return (o) -> true; @@ -77,12 +77,19 @@ public abstract class DynamicTreeContentProviderBase<T> { } /** Returns the filtered children of the given element. */ + @SuppressWarnings("unchecked") public final Collection<? extends T> getFilteredSortedChildren(T parent) { - Collection<? extends T> l = getChildren(parent); + Collection<? extends T> l = null; + if(parent instanceof Collection) { + l = (Collection<T>)parent; + } else { + l = getChildren(parent); + } + if(l == null) { return emptyList(); } - return l.stream().filter(getFilterPredicate(getFilterExpression())) - .sorted(getSortingComparator()).collect(toList()); + return l.stream().filter(getFilterPredicate()).sorted(getSortingComparator()) + .collect(toList()); } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java index 75dc5534b119ffdb3c10a65810c2a0f330b7955e..7486071d20e896d6ca9a9101bf105caccf3656d0 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItem.java @@ -24,17 +24,18 @@ import javafx.scene.control.TreeItem; * {@link TreeItem} with support for dynamic children using the * {@link DynamicTreeItem#update()} method. */ -public class DynamicTreeItem<T> extends TreeItem<T> { +public class DynamicTreeItem<T> extends DynamicTreeItemBase<T> { /** The viewer. */ - private DynamicTreeViewerBase<T> viewer; + private DynamicTreeContentProviderBase<T> contentProvider; /** Constructor. */ - public DynamicTreeItem(T data, DynamicTreeViewerBase<T> viewer) { + public DynamicTreeItem(T data, DynamicTreeContentProviderBase<T> viewer) { super(data); - this.viewer = viewer; + this.contentProvider = viewer; } - /** Updates the children of this item from the underlying content model. */ + /** {@inheritDoc} */ + @Override public void update() { // remember expanded state of children HashMap<T, TreeItem<T>> expanded = new HashMap<>(); @@ -45,13 +46,12 @@ public class DynamicTreeItem<T> extends TreeItem<T> { } // get list of children and create tree items getChildren().clear(); - DynamicTreeContentProviderBase<T> cp = viewer.getContentProvider(); - for(T element : cp.getFilteredSortedChildren(getValue())) { + for(T element : contentProvider.getFilteredSortedChildren(getValue())) { DynamicTreeItem<T> dti; if(expanded.containsKey(element)) { dti = (DynamicTreeItem<T>)expanded.get(element); } else { - dti = new DynamicTreeItem<T>(element, viewer); + dti = new DynamicTreeItem<T>(element, contentProvider); } getChildren().add(dti); dti.update(); @@ -61,7 +61,8 @@ public class DynamicTreeItem<T> extends TreeItem<T> { /** {@inheritDoc} */ @Override public boolean isLeaf() { - Collection<? extends Object> children = viewer.getContentProvider().getChildren(getValue()); + Collection<? extends Object> children = + contentProvider.getFilteredSortedChildren(getValue()); return children == null || children.isEmpty(); } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java new file mode 100644 index 0000000000000000000000000000000000000000..d883066ecc181120302ca32f328538de7a45b093 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeItemBase.java @@ -0,0 +1,31 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.common.ui.javafx.control.treetableview; + +import javafx.scene.control.TreeItem; + +/** + * Base class for dynamic {@link TreeItem}s. + * + * @author diewald + */ +public abstract class DynamicTreeItemBase<T> extends TreeItem<T> implements IDynamicItem { + + /** Constructor. */ + public DynamicTreeItemBase(T data) { + super(data); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java index dba6edaebf9e56067d80b51564379dd05697f830..b326c4b666e54285ebbb67570da05d002d52fb3c 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java @@ -70,8 +70,22 @@ public abstract class DynamicTreeTableUIProviderBase<T> { } /** - * Determines the background color for a given element in the specified column. + * Returns the style that shall be applied to the {@link TreeItem} of the given element. Return * + * {@code null} for the default style. + * + * @param element + * to apply a style to. + * @param column + * column of to apply the style (the element is a row in the table). + * @return style of the element in the CSS format. + */ + public String getCellStyle(T element, int column) { + return null; + } + + /** +* Determines the background color for a given element in the specified column. * @param element * The element to specify the background color for. * @param column @@ -376,6 +390,17 @@ public abstract class DynamicTreeTableUIProviderBase<T> { validateOnKeyReleased(t, columnIndex, item, tf.getText()); } }); + tf.focusedProperty().addListener(new ChangeListener<Boolean>() { + // If the focus is lost (user clicking elsewhere), the currently entered value is + // committed. + @Override + public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, + Boolean newVal) { + if(!newVal) { + commitEdit(tf.getText()); + } + } + }); } /** {@inheritDoc} */ @@ -435,6 +460,11 @@ public abstract class DynamicTreeTableUIProviderBase<T> { // JFX-builtin handling is non-operation in Linux. addContextMenuHandler(menu, data); } + + String style = getCellStyle(data, colIndex); + if(style != null) { + this.setStyle(style); + } } this.setGraphic(icon); this.setContextMenu(menu); diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java index 3d91b1bd43393f5d0733a253a85436b8255526ae..51e2658564cdea5e6d96ac898a43764787d7bb9e 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java @@ -16,9 +16,12 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static java.lang.Integer.MAX_VALUE; +import static javafx.scene.control.cell.CheckBoxTreeTableCell.forTreeTableColumn; import java.util.Collection; import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Stream; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.control.SelectionMode; @@ -27,7 +30,6 @@ import javafx.scene.control.TreeTableColumn; import javafx.scene.control.TreeTableRow; import javafx.scene.control.TreeTableView; import javafx.scene.control.TreeTableView.TreeTableViewSelectionModel; -import javafx.scene.control.cell.CheckBoxTreeTableCell; import javafx.scene.input.TransferMode; import javafx.util.Callback; @@ -48,15 +50,51 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { /** The UI provider of this tree-table. */ private final DynamicTreeTableUIProviderBase<T> uiProvider; + /** + * Constructor. The given {@link Supplier} is queried on updates to obtain a list of elements to + * display. + */ + public DynamicTreeTableViewer(TreeTableView<T> view, Supplier<Stream<T>> listFctn, + DynamicStreamContentProvider<T, Supplier<Stream<T>>> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(listFctn, contentProvider), false, 0, contentProvider, + uiProvider); + } + + /** + * Constructor. The given input collection must be updated by the caller such that changes are + * reflected in the corresponding {@link TreeTableView}. + */ + public DynamicTreeTableViewer(TreeTableView<T> view, Collection<T> list, + DynamicListContentProvider<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(list, contentProvider), false, 0, contentProvider, + uiProvider); + } + /** Constructor. */ public DynamicTreeTableViewer(TreeTableView<T> view, T root, boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, DynamicTreeTableUIProviderBase<T> uiProvider) { + this(view, new DynamicTreeItem<T>(root, contentProvider), showRoot, revealLevel, + contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeTableViewer(T root, boolean showRoot, int revealLevel, + DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { + this(new TreeTableView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeTableViewer(TreeTableView<T> view, DynamicTreeItemBase<T> rootItem, + boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeTableUIProviderBase<T> uiProvider) { super(view, contentProvider); this.uiProvider = uiProvider; // construct view this.view = view; - DynamicTreeItem<T> rootItem = new DynamicTreeItem<T>(root, this); view.setRoot(rootItem); view.setShowRoot(showRoot); view.setEditable(true); @@ -91,21 +129,14 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { }); rootItem.update(); - // expand to reveal (+1 if root node is not shown + // expand to reveal (+1 if root node is not shown) expandItem(rootItem, showRoot ? revealLevel : revealLevel + 1); } - /** Constructor. */ - public DynamicTreeTableViewer(T root, boolean showRoot, int revealLevel, - DynamicTreeContentProviderBase<T> contentProvider, - DynamicTreeTableUIProviderBase<T> uiProvider) { - this(new TreeTableView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); - } - /** Updates the viewer content. */ public void update() { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); + IDynamicItem rootItem = (IDynamicItem)view.getRoot(); rootItem.update(); view.refresh(); } @@ -184,7 +215,7 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { int num = view.getColumns().size(); TreeTableColumn<T, Boolean> column = new TreeTableColumn<>(headerLabel); column.setPrefWidth(prefWidth); - column.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(column)); + column.setCellFactory(forTreeTableColumn(column)); uiProvider.applyToCheckboxColumn(num, column); view.getColumns().add(column); return column; diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java index e9b68607683de279d0cb8712a28dc131c5c33ece..82d3c051213f0147f4c67ad247a08696cee73110 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java @@ -15,6 +15,7 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import javafx.scene.Node; import javafx.scene.control.ContextMenu; +import javafx.scene.control.TreeItem; import javafx.scene.input.ClipboardContent; import javafx.scene.input.Dragboard; @@ -41,6 +42,18 @@ public abstract class DynamicTreeUIProviderBase<T> { return null; } + /** + * Returns the style that shall be applied to the {@link TreeItem} of the given element. Return + * {@code null} for the default style. + * + * @param element + * to apply a style to. + * @return style of the element in the CSS format. + */ + public String getCellStyle(T element) { + return null; + } + /** * @param element * the displayed element diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java index 725f41f4fb4b6bfa813f010fb9083ab02eea164a..e58d2cf7239e45f1b790ce9770a8a8649b1b5fb9 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java @@ -17,10 +17,13 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview; import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX; +import java.util.Collection; + import javafx.beans.value.ChangeListener; import javafx.scene.control.ContextMenu; import javafx.scene.control.TreeCell; import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeTableView; import javafx.scene.control.TreeView; import javafx.scene.input.ClipboardContent; import javafx.scene.input.DragEvent; @@ -38,21 +41,47 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { /** The {@link TreeView} control to be managed. */ private final TreeView<T> view; /** {@link TreeItem} constructed for the root object. */ - private final DynamicTreeItem<T> rootItem; + private final DynamicTreeItemBase<T> rootItem; /** The UI provider implementation. */ private final DynamicTreeUIProviderBase<T> uiProvider; /** The selection change listener. */ private ChangeListener<Object> selectionChangeListener = null; + /** + * Constructor. The given input collection must be updated by the caller such that changes are + * reflected in the corresponding {@link TreeTableView}. + */ + public DynamicTreeViewer(TreeView<T> view, Collection<T> list, + DynamicListContentProvider<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { + this(view, new DynamicList<T>(list, contentProvider), false, 0, contentProvider, + uiProvider); + } + /** Constructor. */ public DynamicTreeViewer(TreeView<T> view, T root, boolean showRoot, int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, DynamicTreeUIProviderBase<T> uiProvider) { + this(view, new DynamicTreeItem<T>(root, contentProvider), showRoot, revealLevel, + contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeViewer(T root, boolean showRoot, int revealLevel, + DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { + this(new TreeView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); + } + + /** Constructor. */ + public DynamicTreeViewer(TreeView<T> view, DynamicTreeItemBase<T> rootItem, boolean showRoot, + int revealLevel, DynamicTreeContentProviderBase<T> contentProvider, + DynamicTreeUIProviderBase<T> uiProvider) { super(view, contentProvider); this.uiProvider = uiProvider; // construct view this.view = view; - rootItem = new DynamicTreeItem<T>(root, this); + this.rootItem = rootItem; view.setRoot(rootItem); view.setShowRoot(showRoot); configureCellFactory(); @@ -68,36 +97,29 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { expandItem(rootItem, showRoot ? revealLevel : revealLevel + 1); } - /** Constructor. */ - public DynamicTreeViewer(T root, boolean showRoot, int revealLevel, - DynamicTreeContentProviderBase<T> contentProvider, - DynamicTreeUIProviderBase<T> uiProvider) { - this(new TreeView<T>(), root, showRoot, revealLevel, contentProvider, uiProvider); - } - /** Updates the tree view. */ public void update() { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); + DynamicTreeItemBase<T> rootItem = (DynamicTreeItemBase<T>)view.getRoot(); rootItem.update(); } /** Sets the selection of this tree view. */ public void setSelection(Object value) { // wild cast works: see constructor - DynamicTreeItem<T> rootItem = (DynamicTreeItem<T>)view.getRoot(); - DynamicTreeItem<T> item = findItem(rootItem, value); + DynamicTreeItemBase<T> rootItem = (DynamicTreeItemBase<T>)view.getRoot(); + DynamicTreeItemBase<T> item = findItem(rootItem, value); int row = view.getRow(item); view.getSelectionModel().select(row); } /** Searches the {@link DynamicTreeItem} for the given value from the root. */ - public DynamicTreeItem<T> findItem(T value) { + public DynamicTreeItemBase<T> findItem(T value) { return findItem(rootItem, value); } /** Searches the {@link DynamicTreeItem} for the given value. */ - public DynamicTreeItem<T> findItem(DynamicTreeItem<T> item, Object value) { + public DynamicTreeItemBase<T> findItem(DynamicTreeItemBase<T> item, Object value) { if(item == null || value == null || item.getValue() == null) { return null; } @@ -105,8 +127,8 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { return item; } for(TreeItem<T> subItem : item.getChildren()) { - if(subItem instanceof DynamicTreeItem) { - DynamicTreeItem<T> i = findItem((DynamicTreeItem<T>)subItem, value); + if(subItem instanceof DynamicTreeItemBase) { + DynamicTreeItemBase<T> i = findItem((DynamicTreeItemBase<T>)subItem, value); if(i != null) { return i; } @@ -137,6 +159,8 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { this.setText(uiProvider.getLabel(item)); this.setGraphic(uiProvider.getIconNode(item)); + this.setStyle(uiProvider.getCellStyle(item)); + this.setOnDragDetected(evt -> { dragDetected(evt, this, item); }); diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/EmptyChildrenContentProvider.java @@ -0,0 +1,35 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2019 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.common.ui.javafx.control.treetableview; + +import static java.util.Collections.emptyList; + +import java.util.Collection; + +/** + * Dummy {@link DynamicListContentProvider} for collections whose elements do not provide further + * children. + * + * @author diewald + */ +public class EmptyChildrenContentProvider<T> extends DynamicListContentProvider<T> { + + /** {@inheritDoc} */ + @Override + protected Collection<T> getChildren(T parent) { + return emptyList(); + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java new file mode 100644 index 0000000000000000000000000000000000000000..083d02459e7ec33542d9910c04abe2581e0b5422 --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/IDynamicItem.java @@ -0,0 +1,29 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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.common.ui.javafx.control.treetableview; + +import javafx.scene.control.TreeItem; + +/** + * Common methods of dynamic {@link TreeItem}s of lists and tables. + * + * @author diewald + */ +public interface IDynamicItem { + + /** Updates the children of this item from the underlying content model. */ + public void update(); +} diff --git a/org.fortiss.tooling.kernel.ui/build.properties b/org.fortiss.tooling.kernel.ui/build.properties index 1554d67f7ff1243b04701de95399865c40b8da7f..e4432a590c6e2defff90ce2fbb1dd0199074cfa8 100644 --- a/org.fortiss.tooling.kernel.ui/build.properties +++ b/org.fortiss.tooling.kernel.ui/build.properties @@ -1,6 +1,7 @@ # (c) 2011 fortiss GmbH -source.. = src/ +source.. = src/,\ + res/ output.. = build/ bin.includes = .,\ plugin.xml,\ diff --git a/org.fortiss.tooling.kernel.ui/plugin.xml b/org.fortiss.tooling.kernel.ui/plugin.xml index b52cc5a353826bb11a74dbed186990fa5ca83f0f..906080ba36514fd1ff4e45d47fd062150f06f2be 100644 --- a/org.fortiss.tooling.kernel.ui/plugin.xml +++ b/org.fortiss.tooling.kernel.ui/plugin.xml @@ -41,9 +41,9 @@ </view> <view allowMultiple="false" - class="org.fortiss.tooling.kernel.ui.internal.introspection.KISSViewPart" + class="org.fortiss.tooling.kernel.ui.introspection.KISSServicesFXViewPart" icon="icons/introspection.gif" - id="org.fortiss.tooling.kernel.ui.introspection.view" + id="org.fortiss.tooling.kernel.ui.introspection" name="Kernel Introspection System Service (KISS)" restorable="true"> </view> diff --git a/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISS.fxml b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISS.fxml new file mode 100644 index 0000000000000000000000000000000000000000..1a43ce1c7c2719256bf97b1e2b60cc43c764d88d --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISS.fxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.layout.BorderPane?> + +<BorderPane fx:id="borderPane" xmlns:fx="http://javafx.com/fxml/1" /> diff --git a/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISSServices.fxml b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISSServices.fxml new file mode 100644 index 0000000000000000000000000000000000000000..715e0df084fc1ecd69ca03957abe3895ee2d45c8 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/introspection/KISSServices.fxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.ScrollPane?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.VBox?> + + +<AnchorPane xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <BorderPane fx:id="borderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <bottom> + <VBox fx:id="vBox" prefHeight="150.0" prefWidth="800.0" BorderPane.alignment="CENTER"> + <children> + <ScrollPane fitToWidth="true" hbarPolicy="NEVER" prefHeight="300.0" prefWidth="800.0"> + <content> + <Label fx:id="label" style="-fx-padding: 5; -fx-border-style: solid inside; -fx-border-width: 2; -fx-border-insets: 5; -fx-border-radius: 5; -fx-border-color: lightblue;" text="Welcome to KISS! This is the kernel introspection system service." wrapText="true" /> + </content> + </ScrollPane> + </children> + </VBox> + </bottom> + </BorderPane> + </children> +</AnchorPane> diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/.ratings index e039d39f894c2359d5eec38e68a158d58f1e65fa..e01229fef8b905d6d41c6a20a1da1992bf6bef16 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/.ratings @@ -8,4 +8,4 @@ IModelElementHandler.java 86a8ec88b9679bbe7f53cfa8d1592bd862873f80 GREEN ITutorialStepUI.java b8aee2b95857484ab6ad9ecd55b5de9f0ea158e5 GREEN ITutorialUIProvider.java aa0ff5db4d7ba0953e34edeb99f3e8279567e18f GREEN ITutorialUIWhitelistProvider.java d703c1531c6ae7677c2d94cbc95d498dfa4a7e9b GREEN -ModelEditorNotAvailableBinding.java aa2a519ff0dcc53985b9759a94adb52f213ecc84 GREEN +ModelEditorNotAvailableBinding.java ba0ea0fe9004cf16579d053d0ddf7eb3f35ed101 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/ModelEditorNotAvailableBinding.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/ModelEditorNotAvailableBinding.java index aa2a519ff0dcc53985b9759a94adb52f213ecc84..ba0ea0fe9004cf16579d053d0ddf7eb3f35ed101 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/ModelEditorNotAvailableBinding.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/ModelEditorNotAvailableBinding.java @@ -24,7 +24,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelEditorBindingBase; * * @author barner */ -public final class ModelEditorNotAvailableBinding extends ModelEditorBindingBase<EObject> { +public class ModelEditorNotAvailableBinding<T extends EObject> extends ModelEditorBindingBase<T> { // Nothing to do: The type ModelEditorNotAvailableBinding is used in ModelEditorBindingService // to make a case distinction for model elements without dedicated editors. } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/.ratings index d42e678844b8badac5fc16e0c78df8b2e695f121..a72461b88e58768fad85a1299d2067b9b9516dcf 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/.ratings @@ -1,10 +1,10 @@ ActionService.java e29126b5947c9fd2f1d82bb87001b9d0ead50c3b GREEN -AllocationEditPartFactoryService.java 81bd227736013f1157ba9d0f79a9f3deefe10064 GREEN -ContextMenuService.java ca3c899293f25b70ce8e5f0d86ca2f9683329d81 GREEN -EditPartFactoryService.java e9180c0020f1769d9e24ef3c08f9ca5599dbc5c3 GREEN +AllocationEditPartFactoryService.java 1656319f018b4df6d18643e2eb76e012f45c2392 GREEN +ContextMenuService.java 802b6d0ade78f91478cd8959cfb423b9963d43bf GREEN +EditPartFactoryService.java 14c44fd426da4a26bfd4012652ea510a4b149421 GREEN MarkerService.java 505296c356f8d66c5c009b6d6181a971d02a9501 GREEN -ModelEditorBindingService.java d980691db4b700714c0669050014d08751354d5e GREEN -ModelElementHandlerService.java eeb07f6926012aa98256d452d1e554a5486dc657 GREEN +ModelEditorBindingService.java 52038a912db203fb8d63a000a59872cfa94e0eea GREEN +ModelElementHandlerService.java 34adeef844bf98c69f1b9a7252f34d0a2b741b54 GREEN NavigatorService.java 1d773dde3791ddf7051616fe249558e7e307757d GREEN ToolingKernelUIInternal.java a70d19883dfb315d860233156d8524cf1ac2952f GREEN TutorialUIService.java b1d632eca91b4feb583f3930cd6ee4722dd9bfed GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/AllocationEditPartFactoryService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/AllocationEditPartFactoryService.java index 81bd227736013f1157ba9d0f79a9f3deefe10064..1656319f018b4df6d18643e2eb76e012f45c2392 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/AllocationEditPartFactoryService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/AllocationEditPartFactoryService.java @@ -28,7 +28,7 @@ import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; import org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator; import org.fortiss.tooling.kernel.ui.extension.IAllocationEditPartFactory; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.AllocationEditPartFactoryServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.AllocationEditPartFactoryKISSDetailsItem; import org.fortiss.tooling.kernel.ui.service.IAllocationEditPartFactoryService; import org.fortiss.tooling.kernel.utils.LoggingUtils; @@ -150,6 +150,6 @@ public class AllocationEditPartFactoryService /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new AllocationEditPartFactoryServiceIntrospectionDetailsItem(handlerMap); + return new AllocationEditPartFactoryKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ContextMenuService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ContextMenuService.java index ca3c899293f25b70ce8e5f0d86ca2f9683329d81..802b6d0ade78f91478cd8959cfb423b9963d43bf 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ContextMenuService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ContextMenuService.java @@ -39,7 +39,7 @@ import org.fortiss.tooling.kernel.service.ITutorialService; import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor; import org.fortiss.tooling.kernel.ui.extension.IContextMenuMultiSelectionContributor; import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ContextMenuServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.ContextMenuKISSDetailsItem; import org.fortiss.tooling.kernel.ui.service.IActionService; import org.fortiss.tooling.kernel.ui.service.IContextMenuService; import org.fortiss.tooling.kernel.ui.service.ITutorialUIService; @@ -278,6 +278,6 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ContextMenuServiceIntrospectionDetailsItem(contextMenuContributorList); + return new ContextMenuKISSDetailsItem(contextMenuContributorList); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java index e9180c0020f1769d9e24ef3c08f9ca5599dbc5c3..14c44fd426da4a26bfd4012652ea510a4b149421 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; import org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator; import org.fortiss.tooling.kernel.ui.extension.IEditPartFactory; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.EditPartFactoryServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.EditPartFactoryKISSDetailsItem; import org.fortiss.tooling.kernel.ui.service.IEditPartFactoryService; /** @@ -147,6 +147,6 @@ public class EditPartFactoryService extends EObjectAwareServiceBase<IEditPartFac /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new EditPartFactoryServiceIntrospectionDetailsItem(handlerMap); + return new EditPartFactoryKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelEditorBindingService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelEditorBindingService.java index d980691db4b700714c0669050014d08751354d5e..52038a912db203fb8d63a000a59872cfa94e0eea 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelEditorBindingService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelEditorBindingService.java @@ -58,8 +58,8 @@ import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.extension.ModelEditorNotAvailableBinding; import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor; import org.fortiss.tooling.kernel.ui.internal.editor.ModelElementEditorInput; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelEditorBindingServiceIntrospectionDetailsItem; import org.fortiss.tooling.kernel.ui.internal.views.library.LibraryViewPart; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelEditorBindingKISSDetailsItem; import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; @@ -155,18 +155,18 @@ public class ModelEditorBindingService extends EObjectAwareServiceBase<IModelEdi List<IModelEditorBinding<EObject>> bindings = getBindings(element); int numBindings = bindings.size(); - // There is exactly one binding that indicates that no editor should be displayed. - if(numBindings == 1 && bindings.get(0) instanceof ModelEditorNotAvailableBinding) { - return; - } - // Recurse if there is an editor for one the model element's ancestors. - if(numBindings == 0) { + // Recurse if there is no binding or no editor for the current model element. + boolean noEditor = + numBindings == 1 && bindings.get(0) instanceof ModelEditorNotAvailableBinding; + boolean noBindings = numBindings == 0; + if(noBindings || noEditor) { if(element.eContainer() != null) { openInEditor(element.eContainer()); } return; } + try { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage(); @@ -404,6 +404,6 @@ public class ModelEditorBindingService extends EObjectAwareServiceBase<IModelEdi /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ModelEditorBindingServiceIntrospectionDetailsItem(handlerMap); + return new ModelEditorBindingKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java index eeb07f6926012aa98256d452d1e554a5486dc657..34adeef844bf98c69f1b9a7252f34d0a2b741b54 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java @@ -30,7 +30,7 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelElementHandlerServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelElementHandlerKISSDetailsItem; import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; import javafx.scene.Node; @@ -186,6 +186,6 @@ public class ModelElementHandlerService /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ModelElementHandlerServiceIntrospectionDetailsItem(handlerMap); + return new ModelElementHandlerKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/.ratings deleted file mode 100644 index 0b5ef34a425cd5fe7fefe2825ad5c785c3c7d8e7..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/.ratings +++ /dev/null @@ -1,3 +0,0 @@ -KISSViewPart.java 0de931d1947b2fc8c95cb5b5c9ed9d9d3bc82c6e GREEN -KISSViewerContentProvider.java b9740ee3471a70726f3f7e4dd500668301af3f61 GREEN -KISSViewerLabelProvider.java 639495bdc8ce8c13edd464869ff625f745ed9809 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewPart.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewPart.java deleted file mode 100644 index 0de931d1947b2fc8c95cb5b5c9ed9d9d3bc82c6e..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewPart.java +++ /dev/null @@ -1,123 +0,0 @@ -/*-------------------------------------------------------------------------+ -| Copyright 2011 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.internal.introspection; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.part.ViewPart; -import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.KISSDetailsUIRegistry; - -/** - * {@link ViewPart} for the marker display. - * - * @author hoelzl - */ -public class KISSViewPart extends ViewPart implements ISelectionChangedListener { - - /** The greeting text. */ - private static final String GREETING = - "Welcome to KISS!\n\nThis is the kernel introspection system service."; - - /** GUI builder viewer instance. */ - private KISSViewerGUI gui; - - /** {@inheritDoc} */ - @Override - public void createPartControl(Composite parent) { - parent.setLayout(new FillLayout()); - gui = new KISSViewerGUI(parent, SWT.NONE); - TreeViewer tv = gui.getTreeViewer(); - tv.setContentProvider(new KISSViewerContentProvider()); - tv.setLabelProvider(new KISSViewerLabelProvider()); - tv.setComparator(new ViewerComparator()); - tv.addSelectionChangedListener(this); - - gui.getDescriptionText().setText(GREETING); - - // the class is used as hidden root element, which contains the instance - // see also content provider implementation for this setup - tv.setInput(KernelIntrospectionSystemService.class); - } - - /** {@inheritDoc} */ - @Override - public void setFocus() { - gui.getTreeViewer().getControl().setFocus(); - } - - /** Refreshes the view. Needs to be called on UI thread. */ - public void refresh() { - if(!gui.getTreeViewer().getControl().isDisposed()) { - gui.getTreeViewer().refresh(); - } - } - - /** {@inheritDoc} */ - @Override - public void selectionChanged(SelectionChangedEvent event) { - if(gui.getTreeViewer().getControl().isDisposed()) { - return; - } - if(event.getSelection().isEmpty()) { - gui.getDescriptionText().setText(GREETING); - return; - } - if(event.getSelection() instanceof IStructuredSelection) { - IStructuredSelection sel = (IStructuredSelection)event.getSelection(); - if(sel.getFirstElement() instanceof IIntrospectiveKernelService) { - updateWidgets((IIntrospectiveKernelService)sel.getFirstElement()); - return; - } - } - // fallback - gui.getDescriptionText().setText(GREETING); - } - - /** Update the KISS view widgets and controls. */ - private void updateWidgets(IIntrospectiveKernelService service) { - gui.getDescriptionText().setText(service.getIntrospectionDescription()); - - ScrolledComposite sc = gui.getDetailsScrolledComposite(); - if(sc.getContent() != null) { - Control old = sc.getContent(); - gui.getDetailsScrolledComposite().setContent(null); - old.dispose(); - } - IIntrospectionDetailsItem item = service.getDetailsItem(); - if(item != null) { - DetailsUIHandlerBase handler = - KISSDetailsUIRegistry.getInstance().getHandler(item.getClass()); - if(handler != null) { - handler.setService(service); - handler.setDataItem(item); - Control newContent = handler.createComposite(sc); - sc.setContent(newContent); - } - } - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerContentProvider.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerContentProvider.java deleted file mode 100644 index b9740ee3471a70726f3f7e4dd500668301af3f61..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerContentProvider.java +++ /dev/null @@ -1,85 +0,0 @@ -/*-------------------------------------------------------------------------+ -| Copyright 2013 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.internal.introspection; - -import java.util.Collection; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; -import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; -import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; - -/** - * Content provider for the {@link KISSViewPart}. - * - * @author hoelzl - */ -public class KISSViewerContentProvider implements ITreeContentProvider { - /** {@inheritDoc} */ - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void dispose() { - // do nothing - } - - /** {@inheritDoc} */ - @Override - public boolean hasChildren(Object element) { - Object[] objs = getChildren(element); - return objs != null && objs.length > 0; - } - - /** {@inheritDoc} */ - @Override - public Object getParent(Object element) { - if(element == IKernelIntrospectionSystemService.getInstance()) { - return KernelIntrospectionSystemService.class; - } - if(element instanceof IIntrospectiveKernelService) { - return IKernelIntrospectionSystemService.getInstance(); - } - return null; - } - - /** {@inheritDoc} */ - @Override - public Object[] getElements(Object inputElement) { - if(inputElement == KernelIntrospectionSystemService.class) { - return new Object[] {IKernelIntrospectionSystemService.getInstance()}; - } - return getChildren(inputElement); - } - - /** {@inheritDoc} */ - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement instanceof IIntrospectionItem) { - Collection<IIntrospectionItem> items = - ((IIntrospectionItem)parentElement).getIntrospectionItems(); - if(items != null) { - return items.stream().filter(c -> c.showInIntrospectionNavigation()).toArray(); - } - } - return null; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerGUI.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerGUI.java deleted file mode 100644 index 2a2fd67ffb5f9e0c32048fc2f81dcf3824b68af4..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/KISSViewerGUI.java +++ /dev/null @@ -1,90 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection; - -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; - -/** - * GENERATED CODE (WindowBuilder) - * - * @author hoelzl - */ -@SuppressWarnings("javadoc") -public class KISSViewerGUI extends Composite { - private TreeViewer treeViewer; - private ScrolledComposite detailsScrolledComposite; - private Composite descriptionComposite; - private Text descriptionText; - - /** - * Create the composite. - * - * @param parent - * @param style - */ - public KISSViewerGUI(Composite parent, int style) { - super(parent, style); - setLayout(new FillLayout(SWT.HORIZONTAL)); - - SashForm verticalSplitSash = new SashForm(this, SWT.VERTICAL | SWT.BORDER | SWT.SMOOTH); - - SashForm horizontalSplitSash = new SashForm(verticalSplitSash, SWT.BORDER | SWT.SMOOTH); - - treeViewer = new TreeViewer(horizontalSplitSash, SWT.SINGLE | SWT.BORDER); - treeViewer.setAutoExpandLevel(2); - - detailsScrolledComposite = new ScrolledComposite(horizontalSplitSash, - SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - detailsScrolledComposite.setExpandHorizontal(true); - detailsScrolledComposite.setExpandVertical(true); - horizontalSplitSash.setWeights(new int[] {1, 5}); - - descriptionComposite = new Composite(verticalSplitSash, SWT.BORDER); - descriptionComposite.setLayout(new GridLayout()); - verticalSplitSash.setWeights(new int[] {7, 1}); - - descriptionText = new Text(descriptionComposite, SWT.READ_ONLY | SWT.V_SCROLL | SWT.MULTI); - Color gray = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); - descriptionText.setBackground(gray); - descriptionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - } - - public TreeViewer getTreeViewer() { - return treeViewer; - } - - public ScrolledComposite getDetailsScrolledComposite() { - return detailsScrolledComposite; - } - - public Composite getDescriptionComposite() { - return descriptionComposite; - } - - public Text getDescriptionText() { - return descriptionText; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/.ratings deleted file mode 100644 index 5be567a381cb00bbd092fd15f0bedb8d6e158f38..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/.ratings +++ /dev/null @@ -1,2 +0,0 @@ -DetailsUIHandlerBase.java d3d2038cee67f61ca0be7e0c832ffc95771cee0f GREEN -KISSDetailsUIRegistry.java 4ae512082e0a7751f9da1d631b1bba44c2e5e8c4 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/DetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/DetailsUIHandlerBase.java deleted file mode 100644 index d3d2038cee67f61ca0be7e0c832ffc95771cee0f..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/DetailsUIHandlerBase.java +++ /dev/null @@ -1,49 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details; - -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; - -/** - * Base class for factory implementations of the details view of the - * {@link KernelIntrospectionSystemService} GUI. - * - * @author hoelzl - */ -public abstract class DetailsUIHandlerBase { - - /** The {@link IIntrospectionDetailsItem data item}. */ - protected IIntrospectiveKernelService service; - /** The {@link IIntrospectionDetailsItem data item}. */ - protected IIntrospectionDetailsItem dataItem; - - /** Sets the data item. */ - public final void setDataItem(IIntrospectionDetailsItem dataItem) { - this.dataItem = dataItem; - } - - /** Sets the service. */ - public final void setService(IIntrospectiveKernelService service) { - this.service = service; - } - - /** Creates the control within the given parent scrolled composite. */ - public abstract Control createComposite(ScrolledComposite parent); -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/KISSDetailsUIRegistry.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/KISSDetailsUIRegistry.java deleted file mode 100644 index 4ae512082e0a7751f9da1d631b1bba44c2e5e8c4..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/KISSDetailsUIRegistry.java +++ /dev/null @@ -1,111 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details; - -import java.util.HashMap; - -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.internal.introspection.details.handler.AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ConnectionCompositorServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ConstraintCheckerServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ContextMenuServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.EclipseResourceStorageProviderIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.EditPartFactoryServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ElementCompositorServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.LibraryServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.MigrationServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ModelEditorBindingServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ModelElementHandlerServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.PersistencyServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.PrototypeServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.TransformationServiceIntrospectionDetailsUIHandler; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.AllocationEditPartFactoryServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ContextMenuServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.EditPartFactoryServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelEditorBindingServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelElementHandlerServiceIntrospectionDetailsItem; - -/** - * Registry class to provide the details GUI for a given {@link IIntrospectionItem}. - * - * @author hoelzl - */ -public final class KISSDetailsUIRegistry { - /** Returns the singleton instance of the service. */ - private static final KISSDetailsUIRegistry INSTANCE = new KISSDetailsUIRegistry(); - - /** Returns the singleton instance. */ - public static KISSDetailsUIRegistry getInstance() { - return INSTANCE; - } - - /** The registry. */ - private final HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUIHandlerBase> registry = - new HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUIHandlerBase>(); - - /** 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, - new ModelEditorBindingServiceIntrospectionDetailsUIHandler()); - registerHandler(ModelElementHandlerServiceIntrospectionDetailsItem.class, - new ModelElementHandlerServiceIntrospectionDetailsUIHandler()); - registerHandler(PrototypeServiceIntrospectionDetailsItem.class, - new PrototypeServiceIntrospectionDetailsUIHandler()); - registerHandler(PersistencyServiceIntrospectionDetailsItem.class, - new PersistencyServiceIntrospectionDetailsUIHandler()); - registerHandler(TransformationServiceIntrospectionDetailsItem.class, - new TransformationServiceIntrospectionDetailsUIHandler()); - } - - /** Registers the given composite */ - public void registerHandler(Class<? extends IIntrospectionDetailsItem> clazz, - DetailsUIHandlerBase detailsHandler) { - registry.put(clazz, detailsHandler); - } - - /** Returns the composite factory for the given class. */ - public DetailsUIHandlerBase getHandler(Class<? extends IIntrospectionDetailsItem> clazz) { - return registry.get(clazz); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/.ratings deleted file mode 100644 index 7603b3de5398117aa2b0d0afd8b299f9f63c8c9c..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/.ratings +++ /dev/null @@ -1,19 +0,0 @@ -AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java 944cc4d5db305ceba7ca1f1f1957a5160511a228 GREEN -ConnectionCompositorServiceIntrospectionDetailsUIHandler.java bf4744afe94f1b97c2f8442466c10d4969b81854 GREEN -ConstraintCheckerServiceIntrospectionDetailsUIHandler.java 33758640bc77148162b88143dd1ed758a12bcf30 GREEN -ContextMenuServiceIntrospectionDetailsUIHandler.java 33f39e000e14a9c2661ca280e82139593852be7c GREEN -CopyClassNameToClipBoardRunnable.java 884555c7026c466d3401b272fc64b9f693074950 GREEN -EObjectAware2IntrospectionDetailsUIHandlerBase.java 18aefde758dc370f564a535d71bab9afc8bdf91f GREEN -EObjectAwareIntrospectionDetailsUIHandlerBase.java dc14e1cdcb550aaada7d35396de60cb6515d04ce GREEN -EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java 987f882a82cfa20af08e85629e2767c0ebab042f GREEN -EditPartFactoryServiceIntrospectionDetailsUIHandler.java e14b000ffface065dd58f7a9799cceb74acd095e GREEN -ElementCompositorServiceIntrospectionDetailsUIHandler.java 3e5d8e4c268a4498c0b17d2ab83bf17665b37cd0 GREEN -IntrospectionDetailsUIHandlerBase.java fae98d41eaf47401b27e80da542e187d952fb287 GREEN -LibraryServiceIntrospectionDetailsUIHandler.java a17e31bfdb1215b9d50279a37165fac6db0733ea GREEN -MigrationServiceIntrospectionDetailsUIHandler.java 66c7b9094dbf373e56c5a5558bb35073e70d4ec3 GREEN -ModelEditorBindingServiceIntrospectionDetailsUIHandler.java e8c55cd97cba5b4286c9681649970e348e248bf2 GREEN -ModelElementHandlerServiceIntrospectionDetailsUIHandler.java c4f7b3ddb66b2bfa14e0dd64516d613fa54d6df0 GREEN -PersistencyServiceIntrospectionDetailsUIHandler.java 8019c9fa146eb5831be048edc94c8d284cc90595 GREEN -PrototypeServiceIntrospectionDetailsUIHandler.java b61fffe1291bec05fc0f727834be9ab0f1a7acba GREEN -TableViewerPatternFilter.java 7a7cb1f25d12b5c89c91a3e29169412de8cbb867 GREEN -TransformationServiceIntrospectionDetailsUIHandler.java 8e8d54dbc2ad0b765467a25b1fc1fdbc8c388a20 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConnectionCompositorServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConnectionCompositorServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index bf4744afe94f1b97c2f8442466c10d4969b81854..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConnectionCompositorServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.ConnectionCompositorServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.items.EObjectAware2IntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.service.IConnectionCompositorService; - -/** - * Introspection UI handler for the {@link IConnectionCompositorService}. - * - * @author hoelzl - */ -public final class ConnectionCompositorServiceIntrospectionDetailsUIHandler - extends EObjectAware2IntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered connection compositors:"; - String footer = "Number of currently registered connection compositors: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Compositors"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Source / Target / Compositor", 250, "Compositor Class", 400, - "Source EObject Class", 400, "Target EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAware2TreeContentProviderBase() { - @Override - protected EObjectAware2IntrospectionDetailsItemBase<?> getInputObject() { - return ConnectionCompositorServiceIntrospectionDetailsUIHandler.this - .getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ConnectionCompositorServiceIntrospectionDetailsItem getInputObject() { - return (ConnectionCompositorServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConstraintCheckerServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConstraintCheckerServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index 33758640bc77148162b88143dd1ed758a12bcf30..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ConstraintCheckerServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,150 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.extension.IConstraintChecker; -import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; -import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.service.IConstraintCheckerService; - -/** - * Introspection UI handler for {@link IIntrospectionItem}s provided by - * {@link IConstraintCheckerService}. - * - * @author hoelzl - */ -public final class ConstraintCheckerServiceIntrospectionDetailsUIHandler - extends IntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String h = "Type to search registered checkers:"; - String f = "Number of registered constraint checkers: " + countCheckers(); - return createFilteredTreeInTabFolder(parent, h, f, "Registered Checkers"); - } - - /** Computes the number of constraint checkers. */ - private int countCheckers() { - int count = 0; - for(Class<?> c : getInputObject().getHandlerKeyClasses()) { - count += getInputObject().getHandlerList(c).size(); - } - return count; - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText("Model Element / Checker"); - col0.setWidth(400); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText("Model Element Class"); - col1.setWidth(400); - - TreeColumn col2 = new TreeColumn(tree, SWT.LEFT); - col2.setText("Constraint Checker Implementation Class"); - col2.setWidth(400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new TreeContentProviderBase() { - - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return getInputObject().getHandlerKeyClasses().toArray(); - } else if(parentElement instanceof Class) { - return getInputObject().getHandlerList((Class<?>)parentElement).toArray(); - } - return null; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ITableLabelProvider createLabelProvider() { - return new TableLabelProviderBase() { - - @SuppressWarnings("unchecked") - @Override - public String getColumnText(Object element, int columnIndex) { - if(element instanceof Class) { - switch(columnIndex) { - case 0: - return ((Class<?>)element).getSimpleName(); - case 1: - return ((Class<?>)element).getName(); - } - } else if(element instanceof IConstraintChecker) { - IConstraintChecker<EObject> icc = (IConstraintChecker<EObject>)element; - switch(columnIndex) { - case 0: - return icc.getClass().getSimpleName(); - case 2: - return icc.getClass().getName(); - } - } - return ""; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - return new TableViewerPatternFilter(); - } - - /** {@inheritDoc} */ - @Override - protected ConstraintCheckerServiceIntrospectionDetailsItem getInputObject() { - return (ConstraintCheckerServiceIntrospectionDetailsItem)dataItem; - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - return true; - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - if(selection instanceof Class<?>) { - mgr.add(createCopyClassNameAction((Class<?>)selection)); - } else if(selection instanceof IConstraintChecker<?>) { - mgr.add(createCopyClassNameAction(selection.getClass())); - } - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ContextMenuServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ContextMenuServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index 33f39e000e14a9c2661ca280e82139593852be7c..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ContextMenuServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,150 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; -import org.fortiss.tooling.kernel.service.IConstraintCheckerService; -import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ContextMenuServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.ui.service.IContextMenuService; - -/** - * Introspection UI handler for {@link IIntrospectionItem}s provided by - * {@link IConstraintCheckerService}. - * - * @author hoelzl - */ -public final class ContextMenuServiceIntrospectionDetailsUIHandler - extends IntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String h = "Type to search registered menu contributors:"; - String f = "Number of registered menu contributors: " + getInputObject().getHandlerList(); - return createFilteredTreeInTabFolder(parent, h, f, "Registered Contributors"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText("Menu Section"); - col0.setWidth(400); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText("Menu Provider Class"); - col1.setWidth(500); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new TreeContentProviderBase() { - - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return IContextMenuService.MENU_SECTION_IDS; - } else if(parentElement instanceof String) { - return getInputObject().getHandlerList().stream() - .filter(h -> parentElement.equals(h.getMenuSectionID())).toArray(); - } - return null; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ITableLabelProvider createLabelProvider() { - return new TableLabelProviderBase() { - @Override - public String getColumnText(Object element, int columnIndex) { - if(element instanceof String && columnIndex == 0) { - return (String)element; - } else if(element instanceof IContextMenuContributor) { - IContextMenuContributor icc = (IContextMenuContributor)element; - switch(columnIndex) { - case 0: - return icc.getClass().getSimpleName(); - case 1: - return icc.getClass().getName(); - } - } - return ""; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - return selection instanceof IContextMenuContributor; - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - IContextMenuContributor c = (IContextMenuContributor)selection; - mgr.add(createCopyClassNameAction(c.getClass())); - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - return new TableViewerPatternFilter(); - } - - /** {@inheritDoc} */ - @Override - protected ViewerComparator createComparator() { - return new ViewerComparator() { - /** {@inheritDoc} */ - @Override - public int category(Object element) { - if(element instanceof String) { - String section = (String)element; - for(int i = 0; i < IContextMenuService.MENU_SECTION_IDS.length; i++) { - if(section.equals(IContextMenuService.MENU_SECTION_IDS[i])) { - return i; - } - } - return IContextMenuService.MENU_SECTION_IDS.length; - } - return super.category(element); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ContextMenuServiceIntrospectionDetailsItem getInputObject() { - return (ContextMenuServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/CopyClassNameToClipBoardRunnable.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/CopyClassNameToClipBoardRunnable.java deleted file mode 100644 index 884555c7026c466d3401b272fc64b9f693074950..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/CopyClassNameToClipBoardRunnable.java +++ /dev/null @@ -1,46 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.widgets.Display; - -/** - * {@link Runnable} implementation that copies a given class name to the {@link Clipboard}. - * - * @author hoelzl - */ -public final class CopyClassNameToClipBoardRunnable implements Runnable { - - /** The class name. */ - private final String className; - - /** Constructor. */ - public CopyClassNameToClipBoardRunnable(String className) { - this.className = className; - } - - /** {@inheritDoc} */ - @Override - public void run() { - Clipboard clipboard = new Clipboard(Display.getCurrent()); - String[] content = new String[] {className}; - Transfer[] transfer = new Transfer[] {TextTransfer.getInstance()}; - clipboard.setContents(content, transfer); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAware2IntrospectionDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAware2IntrospectionDetailsUIHandlerBase.java deleted file mode 100644 index 18aefde758dc370f564a535d71bab9afc8bdf91f..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAware2IntrospectionDetailsUIHandlerBase.java +++ /dev/null @@ -1,179 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import java.util.Collection; -import java.util.List; - -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; -import org.conqat.lib.commons.collections.Pair; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.introspection.items.EObjectAware2IntrospectionDetailsItemBase; - -/** - * Base class for details UI implementations with filtered tree viewer. - * - * @author hoelzl - */ -public abstract class EObjectAware2IntrospectionDetailsUIHandlerBase - extends IntrospectionDetailsUIHandlerBase { - - /** Creates the default tree columns. */ - protected final void createDefaultTreeColumns(Tree tree, String text0, int width0, String text1, - int width1, String text2, int width2, String text3, int width3) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText(text0); - col0.setWidth(width0); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText(text1); - col1.setWidth(width1); - - TreeColumn col2 = new TreeColumn(tree, SWT.LEFT); - col2.setText(text2); - col2.setWidth(width2); - - TreeColumn col3 = new TreeColumn(tree, SWT.LEFT); - col3.setText(text3); - col3.setWidth(width3); - } - - /** {@inheritDoc} */ - @Override - protected ITableLabelProvider createLabelProvider() { - return new EObjectAware2TableLabelProvider(); - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - PatternFilter pf = new TableViewerPatternFilter(); - pf.setIncludeLeadingWildcard(true); - return pf; - } - - /** Table label provider for handler registrations with two classes. */ - protected static class EObjectAware2TableLabelProvider extends TableLabelProviderBase { - /** {@inheritDoc} */ - @Override - public String getColumnText(Object element, int columnIndex) { - if(element instanceof Class) { - return columnIndex == 0 ? ((Class<?>)element).getSimpleName() : ""; - } - if(element instanceof Pair) { - Pair<?, ?> pair = (Pair<?, ?>)element; - if(pair.getFirst() instanceof Class) { - Class<?> c = (Class<?>)((Pair<?, ?>)element).getSecond(); - return columnIndex == 0 ? c.getSimpleName() : ""; - } - if(pair.getFirst() != null) { - Object provider = pair.getFirst(); - Pair<?, ?> regClasses = (Pair<?, ?>)pair.getSecond(); - Class<?> sourceClass = (Class<?>)regClasses.getFirst(); - Class<?> targetClass = (Class<?>)regClasses.getSecond(); - switch(columnIndex) { - case 0: - return provider.getClass().getSimpleName(); - case 1: - return provider.getClass().getName(); - case 2: - return sourceClass.getName(); - case 3: - return targetClass.getName(); - } - } - } - return ""; - } - } - - /** Tree content provider for handler registrations with two classes. */ - protected static abstract class EObjectAware2TreeContentProviderBase - extends TreeContentProviderBase { - - /** Returns the input object for this content provider. */ - protected abstract EObjectAware2IntrospectionDetailsItemBase<?> getInputObject(); - - /** {@inheritDoc} */ - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return getInputObject().getFirstHandlerKeyClasses().toArray(); - } - if(parentElement instanceof Class<?>) { - Class<?> firstClass = (Class<?>)parentElement; - Collection<Class<?>> secondaryClasses = - getInputObject().getSecondHandlerKeyClasses(firstClass); - if(secondaryClasses == null || secondaryClasses.isEmpty()) { - return new Object[0]; - } - Pair<?, ?>[] pairs = new Pair<?, ?>[secondaryClasses.size()]; - int idx = 0; - for(Class<?> secondary : secondaryClasses) { - pairs[idx] = new Pair<Class<?>, Class<?>>(firstClass, secondary); - idx++; - } - return pairs; - } - if(parentElement instanceof Pair) { - Pair<?, ?> pair = (Pair<?, ?>)parentElement; - if(pair.getFirst() instanceof Class) { - Class<?> first = (Class<?>)pair.getFirst(); - Class<?> second = (Class<?>)pair.getSecond(); - List<?> handlerList = getInputObject().getHandlerList(first, second); - if(handlerList == null || handlerList.isEmpty()) { - return new Object[0]; - } - Pair<?, ?>[] pairs = new Pair<?, ?>[handlerList.size()]; - int idx = 0; - for(Object handler : handlerList) { - pairs[idx] = new Pair<Object, Pair<?, ?>>(handler, pair); - idx++; - } - return pairs; - } - // no children for handlers - } - return new Object[0]; - } - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - if(selection instanceof Pair<?, ?>) { - Pair<?, ?> pair = (Pair<?, ?>)selection; - return !(pair.getFirst() instanceof Class<?>); - } - return false; - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - Pair<?, ?> pair = (Pair<?, ?>)selection; - mgr.add(createCopyClassNameAction(pair.getFirst().getClass())); - Pair<?, ?> classPair = (Pair<?, ?>)pair.getSecond(); - mgr.add(createCopyClassNameAction((Class<?>)classPair.getFirst())); - mgr.add(createCopyClassNameAction((Class<?>)classPair.getSecond())); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAwareIntrospectionDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAwareIntrospectionDetailsUIHandlerBase.java deleted file mode 100644 index dc14e1cdcb550aaada7d35396de60cb6515d04ce..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EObjectAwareIntrospectionDetailsUIHandlerBase.java +++ /dev/null @@ -1,140 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import java.util.List; - -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; -import org.conqat.lib.commons.collections.Pair; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; - -/** - * Base class for details UI implementations with filtered tree viewer. - * - * @author hoelzl - */ -public abstract class EObjectAwareIntrospectionDetailsUIHandlerBase - extends IntrospectionDetailsUIHandlerBase { - - /** Creates the default tree columns. */ - protected final void createDefaultTreeColumns(Tree tree, String text0, int width0, String text1, - int width1, String text2, int width2) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText(text0); - col0.setWidth(width0); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText(text1); - col1.setWidth(width1); - - TreeColumn col2 = new TreeColumn(tree, SWT.LEFT); - col2.setText(text2); - col2.setWidth(width2); - } - - /** {@inheritDoc} */ - @Override - protected ITableLabelProvider createLabelProvider() { - return new EObjectAwareTableLabelProvider(); - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - PatternFilter pf = new TableViewerPatternFilter(); - pf.setIncludeLeadingWildcard(true); - return pf; - } - - /** Table label provider for handler registrations with two classes. */ - protected static class EObjectAwareTableLabelProvider extends TableLabelProviderBase { - /** {@inheritDoc} */ - @Override - public String getColumnText(Object element, int columnIndex) { - if(element instanceof Class) { - return columnIndex == 0 ? ((Class<?>)element).getSimpleName() : ""; - } - if(element instanceof Pair) { - Pair<?, ?> pair = (Pair<?, ?>)element; - if(pair.getFirst() != null) { - Object provider = pair.getFirst(); - Class<?> regClass = (Class<?>)pair.getSecond(); - switch(columnIndex) { - case 0: - return provider.getClass().getSimpleName(); - case 1: - return provider.getClass().getName(); - case 2: - return regClass.getName(); - } - } - } - return ""; - } - } - - /** Tree content provider for handler registrations with two classes. */ - protected static abstract class EObjectAwareTreeContentProviderBase - extends TreeContentProviderBase { - - /** Returns the input object for this content provider. */ - protected abstract EObjectAwareIntrospectionDetailsItemBase<?> getInputObject(); - - /** {@inheritDoc} */ - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return getInputObject().getHandlerKeyClasses().toArray(); - } - if(parentElement instanceof Class<?>) { - Class<?> regClass = (Class<?>)parentElement; - List<?> handlerList = getInputObject().getHandlerList(regClass); - if(handlerList == null || handlerList.isEmpty()) { - return new Object[0]; - } - Pair<?, ?>[] pairs = new Pair<?, ?>[handlerList.size()]; - int idx = 0; - for(Object handler : handlerList) { - pairs[idx] = new Pair<Object, Class<?>>(handler, regClass); - idx++; - } - return pairs; - } - return new Object[0]; - } - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - return selection instanceof Pair<?, ?>; - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - Pair<?, ?> pair = (Pair<?, ?>)selection; - mgr.add(createCopyClassNameAction(pair.getFirst().getClass())); - mgr.add(createCopyClassNameAction((Class<?>)pair.getSecond())); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ElementCompositorServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ElementCompositorServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index 3e5d8e4c268a4498c0b17d2ab83bf17665b37cd0..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ElementCompositorServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.introspection.items.ElementCompositorServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.service.IElementCompositorService; - -/** - * Introspection UI handler for the {@link IElementCompositorService}. - * - * @author hoelzl - */ -public final class ElementCompositorServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered element compositors:"; - String footer = "Number of currently registered element compositors: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Compositors"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Class / Compositor", 250, "Compositor Class", 400, - "EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAwareTreeContentProviderBase() { - @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return ElementCompositorServiceIntrospectionDetailsUIHandler.this.getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ElementCompositorServiceIntrospectionDetailsItem getInputObject() { - return (ElementCompositorServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/IntrospectionDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/IntrospectionDetailsUIHandlerBase.java deleted file mode 100644 index fae98d41eaf47401b27e80da542e187d952fb287..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/IntrospectionDetailsUIHandlerBase.java +++ /dev/null @@ -1,187 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.dialogs.FilteredTree; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; - -/** - * Base class for details UI implementations with filtered tree viewer. - * - * @author hoelzl - */ -public abstract class IntrospectionDetailsUIHandlerBase extends DetailsUIHandlerBase { - - /** Creates only the filtered tree control. */ - protected final Composite createFilteredTree(Composite parent) { - return createFilteredTree(parent, null, null); - } - - /** Creates the filtered tree control. */ - protected final Composite createFilteredTree(Composite parent, String headingsLabel, - String footerLabel) { - Composite composite = new Composite(parent, SWT.BORDER); - composite.setLayout(new GridLayout(1, true)); - - if(headingsLabel != null) { - Label heading = new Label(composite, SWT.NONE); - heading.setText(headingsLabel); - heading.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false)); - } - - FilteredTree filteredTree = - new FilteredTree(composite, SWT.BORDER, createPatternFilter(), true); - - TreeViewer treeViewer = filteredTree.getViewer(); - Tree tree = treeViewer.getTree(); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - - createTreeColumns(tree); - - treeViewer.setContentProvider(createContentProvider()); - treeViewer.setLabelProvider(createLabelProvider()); - treeViewer.setComparator(createComparator()); - treeViewer.setInput(getInputObject()); - - addContextMenu(treeViewer); - - if(footerLabel != null) { - Label lbl = new Label(composite, SWT.BOLD); - lbl.setText(footerLabel); - lbl.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false)); - } - - return composite; - } - - /** - * Creates the context menu by delegating menu entry creation - * to {@link #populateContextMenu(Object, MenuManager)} and {@link #testSelection(Object)}. - */ - private void addContextMenu(final TreeViewer treeViewer) { - final MenuManager mgr = new MenuManager(); - mgr.setRemoveAllWhenShown(true); - mgr.addMenuListener(new IMenuListener() { - - @Override - public void menuAboutToShow(IMenuManager manager) { - IStructuredSelection sel = (IStructuredSelection)treeViewer.getSelection(); - if(sel != null && !sel.isEmpty() && testSelection(sel.getFirstElement())) { - populateContextMenu(sel.getFirstElement(), mgr); - } - } - }); - treeViewer.getControl().setMenu(mgr.createContextMenu(treeViewer.getControl())); - } - - /** - * Populates the context menu. May assume {@link #testSelection(Object)} returned {@code true}. - * The default does not create any menu entry. - */ - protected void populateContextMenu(@SuppressWarnings("unused") Object selection, - @SuppressWarnings("unused") MenuManager mgr) { - // create nothing - } - - /** Creates an action with the given name and selection handler. */ - protected final Action createAction(String name, Runnable runner) { - return new Action(name) { - /** {@inheritDoc} */ - @Override - public void run() { - runner.run(); - } - }; - } - - /** Creates the copy class name action for the given class. */ - protected final Action createCopyClassNameAction(Class<?> clazz) { - return createAction("Copy Qualified Class Name: " + clazz.getSimpleName(), - new CopyClassNameToClipBoardRunnable(clazz.getName())); - } - - /** - * Tests the given selected object for validity to show context menu. The default returns - * {@code false}. - */ - protected boolean testSelection(@SuppressWarnings("unused") Object selection) { - return false; - } - - /** Creates a tab folder with the filtered tree as a tab. */ - protected final CTabFolder createTabFolder(Composite parent, String... tabNames) { - CTabFolder tabFolder = new CTabFolder(parent, SWT.BOTTOM); - if(tabNames != null && tabNames.length > 0) { - for(String tName : tabNames) { - CTabItem filterTreeTab = new CTabItem(tabFolder, SWT.NULL); - filterTreeTab.setText(tName); - } - tabFolder.setSelection(tabFolder.getItem(0)); - } - return tabFolder; - } - - /** Creates the filtered tree inside the tab folder. */ - protected final CTabFolder createFilteredTreeInTabFolder(Composite parent, String headingsLabel, - String footerLabel, String... tabNames) { - CTabFolder tabFolder = createTabFolder(parent, tabNames); - Composite c = createFilteredTree(tabFolder, headingsLabel, footerLabel); - tabFolder.getItem(0).setControl(c); - return tabFolder; - } - - /** Create the columns of the tree. */ - protected abstract void createTreeColumns(Tree tree); - - /** Creates the content provider. */ - protected abstract ITreeContentProvider createContentProvider(); - - /** Creates the label provider. */ - protected abstract ITableLabelProvider createLabelProvider(); - - /** Creates the pattern filter. */ - protected abstract PatternFilter createPatternFilter(); - - /** Returns the input object for the tree viewer. */ - protected abstract Object getInputObject(); - - /** - * Creates the comparator for the filtered tree. The default is - * {@link ViewerComparator#ViewerComparator()}. - */ - protected ViewerComparator createComparator() { - return new ViewerComparator(); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/MigrationServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/MigrationServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index 66c7b9094dbf373e56c5a5558bb35073e70d4ec3..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/MigrationServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.introspection.items.MigrationServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.service.IMigrationService; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; - -/** - * {@link DetailsUIHandlerBase} for {@link IMigrationService}. - * - * @author hoelzl - */ -public class MigrationServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered migration providers:"; - String footer = "Number of currently registered migration providers: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Providers"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Class / Provider", 250, "Provider Class", 400, - "EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAwareTreeContentProviderBase() { - @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return MigrationServiceIntrospectionDetailsUIHandler.this.getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected MigrationServiceIntrospectionDetailsItem getInputObject() { - return (MigrationServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelEditorBindingServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelEditorBindingServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index e8c55cd97cba5b4286c9681649970e348e248bf2..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelEditorBindingServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.ui.internal.ModelEditorBindingService; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelEditorBindingServiceIntrospectionDetailsItem; - -/** - * {@link DetailsUIHandlerBase} for {@link ModelEditorBindingService}. - * - * @author hoelzl - */ -public final class ModelEditorBindingServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered model editor bindings:"; - String footer = "Number of currently registered model editor bindings: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Bindings"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Class / Binding", 250, "Binding Class", 400, - "EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAwareTreeContentProviderBase() { - @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return ModelEditorBindingServiceIntrospectionDetailsUIHandler.this.getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ModelEditorBindingServiceIntrospectionDetailsItem getInputObject() { - return (ModelEditorBindingServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelElementHandlerServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelElementHandlerServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index c4f7b3ddb66b2bfa14e0dd64516d613fa54d6df0..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/ModelElementHandlerServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.ui.internal.ModelElementHandlerService; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.ModelElementHandlerServiceIntrospectionDetailsItem; - -/** - * {@link DetailsUIHandlerBase} for {@link ModelElementHandlerService}. - * - * @author hoelzl - */ -public final class ModelElementHandlerServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered model element handlers:"; - String footer = "Number of currently registered model element handlers: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Handlers"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Class / Handler", 250, "Handler Class", 400, - "EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAwareTreeContentProviderBase() { - @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return ModelElementHandlerServiceIntrospectionDetailsUIHandler.this - .getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ModelElementHandlerServiceIntrospectionDetailsItem getInputObject() { - return (ModelElementHandlerServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index b61fffe1291bec05fc0f727834be9ab0f1a7acba..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PrototypeServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,157 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; -import org.fortiss.tooling.kernel.extension.IPrototypeProvider; -import org.fortiss.tooling.kernel.extension.data.Prototype; -import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; -import org.fortiss.tooling.kernel.service.IPrototypeService; - -/** - * Introspection UI handler for the {@link IPrototypeService}. - * - * @author hoelzl - */ -public final class PrototypeServiceIntrospectionDetailsUIHandler - extends IntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to search registered providers:"; - String footer = "Number of currently registered prototypes: " + - IPrototypeService.getInstance().getAllPrototypes().size() + " (" + - IPrototypeService.getInstance().getPrimaryPrototypes().size() + - " primary prototypes)"; - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Providers"); - } - - /** Find the prototype provider for the given prototype. */ - private Class<? extends IPrototypeProvider> findProtoypeProviderClass(Prototype proto) { - for(IPrototypeProvider provider : IPrototypeService.getInstance().getPrototypeProviders()) { - if(provider.getPrototypes().contains(proto)) { - return provider.getClass(); - } - } - return null; - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText("Category / Prototype"); - col0.setWidth(200); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText("Provider Class"); - col1.setWidth(400); - - TreeColumn col2 = new TreeColumn(tree, SWT.LEFT); - col2.setText("EObject Class"); - col2.setWidth(400); - - TreeColumn col3 = new TreeColumn(tree, SWT.CENTER); - col3.setText("Primary"); - col3.setWidth(50); - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - Prototype proto = (Prototype)selection; - final Class<? extends IPrototypeProvider> provClass = findProtoypeProviderClass(proto); - mgr.add(createCopyClassNameAction(provClass)); - mgr.add(createCopyClassNameAction(proto.getPrototype().getClass())); - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - return selection instanceof Prototype; - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new TreeContentProviderBase() { - - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement instanceof IPrototypeService) { - IPrototypeService srv = (IPrototypeService)parentElement; - return srv.getAllTopLevelPrototypesCategories().toArray(); - } - if(parentElement instanceof PrototypeCategory) { - PrototypeCategory cat = (PrototypeCategory)parentElement; - return cat.getChildren(); - } - return null; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected ITableLabelProvider createLabelProvider() { - return new TableLabelProviderBase() { - @Override - public String getColumnText(Object parentElement, int columnIndex) { - if(parentElement instanceof PrototypeCategory) { - PrototypeCategory cat = (PrototypeCategory)parentElement; - return columnIndex == 0 ? cat.getName() : ""; - } - if(parentElement instanceof Prototype) { - Prototype proto = (Prototype)parentElement; - switch(columnIndex) { - case 0: - return proto.getName(); - case 1: - return findProtoypeProviderClass(proto).getName(); - case 2: - return proto.getPrototype().getClass().getName(); - case 3: - return proto.isPrimary() ? "X" : ""; - } - } - return ""; - } - }; - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - return new TableViewerPatternFilter(); - } - - /** {@inheritDoc} */ - @Override - protected Object getInputObject() { - return IPrototypeService.getInstance(); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TableViewerPatternFilter.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TableViewerPatternFilter.java deleted file mode 100644 index 7a7cb1f25d12b5c89c91a3e29169412de8cbb867..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TableViewerPatternFilter.java +++ /dev/null @@ -1,58 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.ui.dialogs.PatternFilter; - -/** - * Class for tree table viewer {@link PatternFilter}s. - * Sub-classes should override {@link #basicMatch(String, int)}. - * - * @author hoelzl - */ -class TableViewerPatternFilter extends PatternFilter { - /** {@inheritDoc} */ - @Override - protected boolean isLeafMatch(Viewer viewer, Object element) { - TreeViewer tv = (TreeViewer)viewer; - int nCols = tv.getTree().getColumnCount(); - boolean isMatch = false; - for(int columnIndex = 0; columnIndex < nCols; columnIndex++) { - ColumnLabelProvider labelProvider = - (ColumnLabelProvider)tv.getLabelProvider(columnIndex); - String labelText = labelProvider.getText(element); - isMatch |= basicMatch(labelText, columnIndex); - } - return isMatch; - } - - /** - * Matches the label in the given column. - * - * @param labelText - * Label text to be matched. - * @param columnIndex - * Index of column for which label text has to be matched. - * - * @return {@code true} in case of match. - */ - protected boolean basicMatch(String labelText, int columnIndex) { - return wordMatches(labelText); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TransformationServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TransformationServiceIntrospectionDetailsUIHandler.java deleted file mode 100644 index 8e8d54dbc2ad0b765467a25b1fc1fdbc8c388a20..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/TransformationServiceIntrospectionDetailsUIHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.details.handler; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAware2IntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.introspection.items.TransformationServiceIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.service.ITransformationService; - -/** - * Introspection UI handler for the {@link ITransformationService}. - * - * @author hoelzl - */ -public final class TransformationServiceIntrospectionDetailsUIHandler - extends EObjectAware2IntrospectionDetailsUIHandlerBase { - - /** {@inheritDoc} */ - @Override - public Control createComposite(ScrolledComposite parent) { - String heading = "Type to serach registered transformation providers:"; - String footer = "Number of currently registered transformation providers: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Providers"); - } - - /** {@inheritDoc} */ - @Override - protected void createTreeColumns(Tree tree) { - createDefaultTreeColumns(tree, "Source / Target / Provider", 250, "Provider Class", 400, - "Source EObject Class", 400, "Target EObject Class", 400); - } - - /** {@inheritDoc} */ - @Override - protected ITreeContentProvider createContentProvider() { - return new EObjectAware2TreeContentProviderBase() { - @Override - protected EObjectAware2IntrospectionDetailsItemBase<?> getInputObject() { - return TransformationServiceIntrospectionDetailsUIHandler.this.getInputObject(); - } - }; - } - - /** {@inheritDoc} */ - @Override - protected TransformationServiceIntrospectionDetailsItem getInputObject() { - return (TransformationServiceIntrospectionDetailsItem)dataItem; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/package.html b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/package.html deleted file mode 100644 index d07768e69acb8ea235c58eb6834108e6aebbeed3..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/package.html +++ /dev/null @@ -1,5 +0,0 @@ -<!-- (c) 2017 fortiss GmbH --> -<body> -User interface for details display of the kernel introspection system service (KISS). -This package contains service-specific, detailed information UI elements. -</body> diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/package.html b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/package.html deleted file mode 100644 index 9f8e01e9ee5f5c09bf33d93cf96cf6faa7c4948b..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/package.html +++ /dev/null @@ -1,5 +0,0 @@ -<!-- (c) 2017 fortiss GmbH --> -<body> -User interface for details display of the kernel introspection system service (KISS). -This package contains base classes for the service-specific, detailed information UI elements. -</body> diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/.ratings deleted file mode 100644 index cf998a62cc03308101d57266a57e1116a2e3850f..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/.ratings +++ /dev/null @@ -1,5 +0,0 @@ -AllocationEditPartFactoryServiceIntrospectionDetailsItem.java e2067b2d95c270a9aed82a2368177d76b0144d79 GREEN -ContextMenuServiceIntrospectionDetailsItem.java ce7c725510e986b99fcddb40676cf6a5e7c2351d GREEN -EditPartFactoryServiceIntrospectionDetailsItem.java f11316c73b6de0e254c4e319e063065e598d5c96 GREEN -ModelEditorBindingServiceIntrospectionDetailsItem.java b241c242f5d8597542d9b63276b64ac2ca81ec7d GREEN -ModelElementHandlerServiceIntrospectionDetailsItem.java 327eec0c247f1413bc629dd57b3a71a885e51a1b GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelEditorBindingServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelEditorBindingServiceIntrospectionDetailsItem.java deleted file mode 100644 index b241c242f5d8597542d9b63276b64ac2ca81ec7d..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelEditorBindingServiceIntrospectionDetailsItem.java +++ /dev/null @@ -1,40 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.items; - -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.ui.extension.IModelEditorBinding; -import org.fortiss.tooling.kernel.ui.internal.ModelEditorBindingService; - -/** - * {@link IIntrospectionDetailsItem} for {@link ModelEditorBindingService}. - * - * @author hoelzl - */ -public final class ModelEditorBindingServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IModelEditorBinding<EObject>> { - - /** Constructor. */ - public ModelEditorBindingServiceIntrospectionDetailsItem( - Map<Class<?>, List<IModelEditorBinding<EObject>>> handlerMap) { - super(handlerMap); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelElementHandlerServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelElementHandlerServiceIntrospectionDetailsItem.java deleted file mode 100644 index 327eec0c247f1413bc629dd57b3a71a885e51a1b..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ModelElementHandlerServiceIntrospectionDetailsItem.java +++ /dev/null @@ -1,40 +0,0 @@ -/*-------------------------------------------------------------------------+ -| 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.internal.introspection.items; - -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; -import org.fortiss.tooling.kernel.ui.internal.ModelElementHandlerService; - -/** - * {@link IIntrospectionDetailsItem} for {@link ModelElementHandlerService}. - * - * @author hoelzl - */ -public final class ModelElementHandlerServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IModelElementHandler<EObject>> { - - /** Constructor. */ - public ModelElementHandlerServiceIntrospectionDetailsItem( - Map<Class<?>, List<IModelElementHandler<EObject>>> handlerMap) { - super(handlerMap); - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/package.html b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/package.html deleted file mode 100644 index 4ed8679dfe6fb1ff7f815bb6efea4a1843a9014c..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/package.html +++ /dev/null @@ -1,7 +0,0 @@ -<!-- (c) 2017 fortiss GmbH --> -<body> -User interface for the kernel introspection system service (KISS). -It provides an Eclipse view with a tree viewer showing all introspective -services (and their specific items) as well as a section for service-specific, -detailed information. -</body> diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings index 3eaf205055aa0f29358d52b9ec081c6466a441ba..3ae4b409f10d61647e757cce57470e67ab4f936f 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/.ratings @@ -2,9 +2,7 @@ DoubleClick.java a94d27299814a93b0d8914050a5da7378a7eccd1 GREEN GenericNewMenu.java 7e0dd435cb5ca6d4b486235ec17eef3e5c7aa5f6 GREEN LibraryViewDragSourceAdapter.java 56ef61b214ef5d6cb5b751791a92158bda0391ec GREEN LinkWithEditorPartListener.java c5ab74424378e7b158a805c4dd14fc03c8abeded GREEN -MarkerViewContentProvider.java 4cb1192baebe21bca951c439c163d0c171512515 GREEN -MarkerViewPart.java cbb650271b6877af205421b7cb11f930440a7ef9 GREEN -ModelElementsViewFX.java b1d03d57b67bf2c7b1d8da0ad3b16ea7d59efab5 GREEN +ModelElementsViewFX.java 68accd2cc94a0df58a2742329f75f6fda25a8606 GREEN NavigatorNewMenu.java a35e391960d1dacbe7f77982e53e1891e9382d5a GREEN NavigatorTreeContentComparator.java d9f1354cfdff78b104b28887d2397e5ca0e9755b GREEN NavigatorTreeContentProvider.java 1fbe97bebf3805cc1af190cecd784fc1cfd12306 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java index b1d03d57b67bf2c7b1d8da0ad3b16ea7d59efab5..68accd2cc94a0df58a2742329f75f6fda25a8606 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ModelElementsViewFX.java @@ -24,7 +24,6 @@ import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParent import java.util.Collection; import java.util.List; import java.util.Set; -import java.util.function.Predicate; import org.conqat.ide.commons.ui.ui.EmptyPartListener; import org.conqat.lib.commons.collections.IdentityHashSet; @@ -193,19 +192,6 @@ public final class ModelElementsViewFX extends FXViewPart { } return false; } - - /** {@inheritDoc} */ - @Override - protected Predicate<Object> getFilterPredicate(String filterValue) { - // this override is needed, because super implementation does not - // call filter(Object, String) when filter value is null. - if(filterValue == null || "".equals(filterValue)) { - return (o) -> { - return filter(o, null); - }; - } - return super.getFilterPredicate(filterValue); - } } /** {@link DynamicTreeUIProviderBase} for the library view. */ diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/.ratings new file mode 100644 index 0000000000000000000000000000000000000000..752d9f907120707e50923f82915543147b841840 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/.ratings @@ -0,0 +1,5 @@ +ClipboardCopyHelper.java 1d9a9891278ab84932857eaa978dda4391978047 GREEN +KISSCompositeFXController.java 10f73a3a2034824eb14a8fda1f67bcc05285e3b0 GREEN +KISSFXController.java c38fc9efa826c68e74ac118e666088f407cb54fb GREEN +KISSServicesFXController.java cb59024c94164cf187041634c38a6dee1107e3a2 GREEN +KISSServicesFXViewPart.java 1a8370028bf79a8071f616dae985df3831c7f8b6 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/ClipboardCopyHelper.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/ClipboardCopyHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..1d9a9891278ab84932857eaa978dda4391978047 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/ClipboardCopyHelper.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2019 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.ui.introspection; + +import static javafx.scene.input.Clipboard.getSystemClipboard; + +import javafx.scene.control.ContextMenu; +import javafx.scene.control.MenuItem; +import javafx.scene.input.Clipboard; +import javafx.scene.input.ClipboardContent; + +/** Helper class for copying a class name to the system clipboard. */ +public final class ClipboardCopyHelper { + /** Creates a context menu to copy the given class name. */ + public static ContextMenu createCopyClassNameMenu(Class<?> toCopy) { + return createCopyClassNameMenu(toCopy.getName()); + } + + /** Creates a context menu to copy the given class name. */ + public static ContextMenu createCopyClassNameMenu(String fullyQualified) { + return createContextMenu("Copy '" + fullyQualified + "' to clipboard.", fullyQualified); + } + + /** Creates a context menu to copy the stack trace of the given {@link Throwable}. */ + public static ContextMenu createCopyStrackTraceMenu(Throwable throwable) { + StringBuilder sb = new StringBuilder(); + for(StackTraceElement ste : throwable.getStackTrace()) { + sb.append(ste.toString()).append('\n'); + } + return createContextMenu("Copy Stack Trace", sb.toString()); + } + + /** Creates the context menu. */ + private static ContextMenu createContextMenu(String label, String data) { + ContextMenu menu = new ContextMenu(); + MenuItem item = new MenuItem(label); + item.setOnAction(event -> { + Clipboard clipboard = getSystemClipboard(); + ClipboardContent content = new ClipboardContent(); + content.putString(data); + clipboard.setContent(content); + }); + menu.getItems().add(item); + return menu; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ContextMenuServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSCompositeFXController.java similarity index 55% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ContextMenuServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSCompositeFXController.java index ce7c725510e986b99fcddb40676cf6a5e7c2351d..10f73a3a2034824eb14a8fda1f67bcc05285e3b0 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/ContextMenuServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSCompositeFXController.java @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------+ -| Copyright 2016 fortiss GmbH | +| Copyright 2020 fortiss GmbH | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | @@ -13,25 +13,27 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.items; +package org.fortiss.tooling.kernel.ui.introspection; -import java.util.List; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; +import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase; +import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; -import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; -import org.fortiss.tooling.kernel.introspection.items.HandlerListIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor; -import org.fortiss.tooling.kernel.ui.internal.ContextMenuService; +import javafx.scene.Node; /** - * {@link IIntrospectionDetailsItem} for the {@link ContextMenuService}. + * Abstract class specifying the functionality to be provided by a controller to be contained in a + * {@link KISSFXController}-based view. * - * @author hoelzl + * @author munaro */ -public final class ContextMenuServiceIntrospectionDetailsItem - extends HandlerListIntrospectionDetailsItemBase<IContextMenuContributor> { +@SuppressWarnings("unchecked") +public abstract class KISSCompositeFXController<T extends Node> + extends CompositeFXControllerBase<T, Node> { - /** Constructor. */ - public ContextMenuServiceIntrospectionDetailsItem(List<IContextMenuContributor> handlerList) { - super(handlerList); - } + /** + * This method is executed each time the {@link IIntrospectionItem} selected in the + * {@link KISSFXController}'s {@link DynamicTreeTableViewer} changes. + */ + public abstract void changed(IIntrospectionItem selection); } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSFXController.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSFXController.java new file mode 100644 index 0000000000000000000000000000000000000000..c38fc9efa826c68e74ac118e666088f407cb54fb --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSFXController.java @@ -0,0 +1,119 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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; + +import static org.fortiss.tooling.common.util.LambdaUtils.getFirst; + +import java.util.stream.Collectors; + +import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase; +import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; +import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; + +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.TreeCell; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.scene.layout.BorderPane; + +/** + * Controller for the Java FX-based UI common to all KISS-based views. The specific views to be + * displayed have extend the abstract {@link KISSCompositeFXController} class. + * + * @author munaro + */ +public class KISSFXController extends CompositeFXControllerBase<BorderPane, Node> + implements ChangeListener<TreeItem<IIntrospectionItem>> { + + /** The pane of the view. */ + @FXML + protected BorderPane borderPane; + + /** The introspection service. */ + protected KernelIntrospectionSystemService kiss; + /** The tree viewer. */ + private TreeView<IIntrospectionItem> treeview; + /** The {@link KISSCompositeFXController} of the specific KISS view to be displayed. */ + private KISSCompositeFXController<? extends Node> composite; + + /** Constructor. */ + @SuppressWarnings("unchecked") + public KISSFXController(KISSCompositeFXController<? extends Node> composite) { + super(composite); + this.composite = composite; + this.kiss = KernelIntrospectionSystemService.getInstance(); + } + + /** + * Implementation for tree cells returning the + * {@link IIntrospectionItem#getIntrospectionLabel()}. + */ + private class TreeCellImpl extends TreeCell<IIntrospectionItem> { + /** {@inheritDoc} */ + @Override + protected void updateItem(IIntrospectionItem item, boolean empty) { + super.updateItem(item, empty); + String text = null; + if(!empty && item != null) { + text = item.getIntrospectionLabel(); + } + setText(text); + setGraphic(null); + } + } + + /** {@inheritDoc} */ + @Override + public String getFXMLLocation() { + return "KISS.fxml"; + } + + /** {@inheritDoc} */ + @Override + public void initialize() { + TreeItem<IIntrospectionItem> root = new TreeItem<IIntrospectionItem>(kiss); + root.getChildren() + .addAll(kiss.getIntrospectionItems().stream().map((IIntrospectionItem iii) -> { + return new TreeItem<IIntrospectionItem>(iii); + }).collect(Collectors.toList())); + root.setExpanded(true); + root.getChildren().sort((c0, c1) -> { + String l0 = c0.getValue().getIntrospectionLabel(); + String l1 = c1.getValue().getIntrospectionLabel(); + return l0.compareTo(l1); + }); + treeview = new TreeView<IIntrospectionItem>(root); + treeview.setCellFactory((TreeView<IIntrospectionItem> tv) -> { + return new TreeCellImpl(); + }); + treeview.getSelectionModel().selectedItemProperty().addListener(this); + + borderPane.setLeft(treeview); + + Node center = getFirst(getContainments()).get().getLayout(); + borderPane.setCenter(center); + } + + /** {@inheritDoc} */ + @Override + public void changed(ObservableValue<? extends TreeItem<IIntrospectionItem>> observable, + TreeItem<IIntrospectionItem> oldValue, TreeItem<IIntrospectionItem> newValue) { + composite.changed(newValue.getValue()); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXController.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXController.java new file mode 100644 index 0000000000000000000000000000000000000000..cb59024c94164cf187041634c38a6dee1107e3a2 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXController.java @@ -0,0 +1,87 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 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; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; +import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.details.KISSDetailsUIRegistry; + +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.Label; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.VBox; + +/** + * Controller for the view for the detailed inspection of KISS services. + * + * @author munaro + */ +public class KISSServicesFXController extends KISSCompositeFXController<VBox> { + + /** {@link BorderPane} displaying the description and the details of the selected service. */ + @FXML + private BorderPane borderPane; + + /** {@link VBox} displaying the description of the selected service. */ + @FXML + private VBox vBox; + + /** The description label at the bottom. */ + @FXML + private Label label; + + /** The greeting text. */ + static final String GREETING = + "Welcome to KISS!\n\nThis is the kernel introspection system service."; + + /** {@inheritDoc} */ + @Override + public String getFXMLLocation() { + return "KISSServices.fxml"; + } + + /** {@inheritDoc} */ + @Override + public void initialize() { + // nothing to do + } + + /** {@inheritDoc} */ + @Override + public void changed(IIntrospectionItem selection) { + Node center = new Label("No details available!"); + String descr = GREETING; + if(selection instanceof IIntrospectiveKernelService) { + IIntrospectiveKernelService ks = (IIntrospectiveKernelService)selection; + descr = ks.getIntrospectionDescription(); + IIntrospectionDetailsItem item = ks.getDetailsItem(); + if(item != null) { + DetailsUIHandlerBase handler = + KISSDetailsUIRegistry.getInstance().getHandler(item.getClass()); + if(handler != null) { + handler.setService(ks); + handler.setDataItem(item); + center = handler.createDisplayControl(); + } + } + } + label.setText(descr); + borderPane.setCenter(center); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXViewPart.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXViewPart.java new file mode 100644 index 0000000000000000000000000000000000000000..1a8370028bf79a8071f616dae985df3831c7f8b6 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/KISSServicesFXViewPart.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection; + +import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; +import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; + +/** View part for {@link KernelIntrospectionSystemService KISS}. */ +public class KISSServicesFXViewPart extends AF3FXViewPart { + /** Constructor. */ + public KISSServicesFXViewPart() throws Exception { + super(new KISSFXController(new KISSServicesFXController()), null); + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..7114a0c9dd4bc79017a35ded4ef7090bd1c90342 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/.ratings @@ -0,0 +1,2 @@ +DetailsUIHandlerBase.java 123df7b1e0ca97f3ed190cc725a83730f09d3bf1 GREEN +KISSDetailsUIRegistry.java e8264a46606710b58fe5e6d830b37c223d9ddced GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/DetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/DetailsUIHandlerBase.java new file mode 100644 index 0000000000000000000000000000000000000000..123df7b1e0ca97f3ed190cc725a83730f09d3bf1 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/DetailsUIHandlerBase.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; +import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService; + +import javafx.scene.Node; + +/** + * Base class for factory implementations of the details view of the + * {@link KernelIntrospectionSystemService} GUI. + * + * @author hoelzl + */ +public abstract class DetailsUIHandlerBase { + /** The {@link IIntrospectionDetailsItem data item}. */ + protected IIntrospectiveKernelService service; + /** The {@link IIntrospectionDetailsItem data item}. */ + protected IIntrospectionDetailsItem dataItem; + + /** Sets the data item. */ + public final void setDataItem(IIntrospectionDetailsItem dataItem) { + this.dataItem = dataItem; + } + + /** Sets the service. */ + public final void setService(IIntrospectiveKernelService service) { + this.service = service; + } + + /** Creates the control for the details display. */ + public abstract Node createDisplayControl(); +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..e8264a46606710b58fe5e6d830b37c223d9ddced --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/KISSDetailsUIRegistry.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details; + +import java.util.HashMap; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; +import org.fortiss.tooling.kernel.introspection.items.ConnectionCompositorKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.ElementCompositorKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.LibraryKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.MigrationKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.PersistencyKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.PrototypeKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.TransformationKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.AllocationEditPartFactoryKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ConnectionCompositorKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ConstraintCheckerKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ContextMenuKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.EclipseResourceStorageKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.EditPartFactoryKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ElementCompositorKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.LibraryKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.MigrationKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ModelEditorBindingKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.ModelElementHandlerKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.PersistencyKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.PrototypeKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.details.handler.TransformationKISSDetailsUIHandler; +import org.fortiss.tooling.kernel.ui.introspection.items.AllocationEditPartFactoryKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.ContextMenuKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.EditPartFactoryKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelEditorBindingKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelElementHandlerKISSDetailsItem; + +/** Registry class to provide the details GUI for a given {@link IIntrospectionItem}. */ +public final class KISSDetailsUIRegistry { + + /** Returns the singleton instance of the service. */ + private static final KISSDetailsUIRegistry INSTANCE = new KISSDetailsUIRegistry(); + + /** Returns the singleton instance. */ + public static KISSDetailsUIRegistry getInstance() { + return INSTANCE; + } + + /** The registry. */ + private final HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUIHandlerBase> registry = + new HashMap<Class<? extends IIntrospectionDetailsItem>, DetailsUIHandlerBase>(); + + /** Constructor. */ + public KISSDetailsUIRegistry() { + registerHandler(AllocationEditPartFactoryKISSDetailsItem.class, + new AllocationEditPartFactoryKISSDetailsUIHandler()); + registerHandler(ConnectionCompositorKISSDetailsItem.class, + new ConnectionCompositorKISSDetailsUIHandler()); + registerHandler(ConstraintCheckerKISSDetailsItem.class, + new ConstraintCheckerKISSDetailsUIHandler()); + registerHandler(ContextMenuKISSDetailsItem.class, + new ContextMenuKISSDetailsUIHandler()); + registerHandler(EclipseResourceStorageKISSDetailsItem.class, + new EclipseResourceStorageKISSDetailsUIHandler()); + registerHandler(EditPartFactoryKISSDetailsItem.class, + new EditPartFactoryKISSDetailsUIHandler()); + registerHandler(ElementCompositorKISSDetailsItem.class, + new ElementCompositorKISSDetailsUIHandler()); + registerHandler(LibraryKISSDetailsItem.class, + new LibraryKISSDetailsUIHandler()); + registerHandler(MigrationKISSDetailsItem.class, + new MigrationKISSDetailsUIHandler()); + registerHandler(ModelEditorBindingKISSDetailsItem.class, + new ModelEditorBindingKISSDetailsUIHandler()); + registerHandler(ModelElementHandlerKISSDetailsItem.class, + new ModelElementHandlerKISSDetailsUIHandler()); + registerHandler(PrototypeKISSDetailsItem.class, + new PrototypeKISSDetailsUIHandler()); + registerHandler(PersistencyKISSDetailsItem.class, + new PersistencyKISSDetailsUIHandler()); + registerHandler(TransformationKISSDetailsItem.class, + new TransformationKISSDetailsUIHandler()); + } + + /** Registers the given composite */ + public void registerHandler(Class<? extends IIntrospectionDetailsItem> clazz, + DetailsUIHandlerBase detailsHandler) { + registry.put(clazz, detailsHandler); + } + + /** Returns the composite factory for the given class. */ + public DetailsUIHandlerBase getHandler(Class<? extends IIntrospectionDetailsItem> clazz) { + return registry.get(clazz); + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..49cd9020ddc8ffce7c7820ea5a74daa9b6ab87c9 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/.ratings @@ -0,0 +1,17 @@ +AllocationEditPartFactoryKISSDetailsUIHandler.java 96794fac55a7d37451d361312a0c4314695ede83 GREEN +ConnectionCompositorKISSDetailsUIHandler.java ebc85ae220655ca741af69c8957a8dd018de013d GREEN +ConstraintCheckerKISSDetailsUIHandler.java a4472923f74039e53162bac35694f0c01857315a GREEN +ContextMenuKISSDetailsUIHandler.java 6e329ca7f4e4919285a743cf49fba90e3789fcab GREEN +EObjectAware2KISSDetailsUIHandlerBase.java 301276017de4db9bdd7fb90df09eaba8342a9e26 GREEN +EObjectAwareKISSDetailsUIHandlerBase.java ff5a70e09a5a556cd7848179ca07031c87a3a17e GREEN +EclipseResourceStorageKISSDetailsUIHandler.java b4a8d448631af61f79196e2b225aec586a77179d GREEN +EditPartFactoryKISSDetailsUIHandler.java 6f04164781420e096cfbafa889449b037df11df2 GREEN +ElementCompositorKISSDetailsUIHandler.java 9d416344ef4ae563a3d17ed81344c2b11bea1aa7 GREEN +KISSDetailsUIHandlerBase.java 5008ec4bd54df3f7dbd91463a859dd955db5532b GREEN +LibraryKISSDetailsUIHandler.java 47fe04336719264f697847671c7ec6fdacaf71ba GREEN +MigrationKISSDetailsUIHandler.java eff83731e0115c0dff73b21438199e20b645ce39 GREEN +ModelEditorBindingKISSDetailsUIHandler.java 324aa57296919b09c882ab415b90507267c5f75e GREEN +ModelElementHandlerKISSDetailsUIHandler.java 3a20a86d7e053e7c7801e9f895628e451c93077b GREEN +PersistencyKISSDetailsUIHandler.java 05d704220db19e0e31fb94ada2ddfc4dd6f28355 GREEN +PrototypeKISSDetailsUIHandler.java 772e56f5ac42d719b93b4de894e3893528c47f7b GREEN +TransformationKISSDetailsUIHandler.java f3641f3cc43df7b285badee15c31261f1a83a51b GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryKISSDetailsUIHandler.java similarity index 59% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryKISSDetailsUIHandler.java index 944cc4d5db305ceba7ca1f1f1957a5160511a228..96794fac55a7d37451d361312a0c4314695ede83 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/AllocationEditPartFactoryKISSDetailsUIHandler.java @@ -13,56 +13,56 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler; +package org.fortiss.tooling.kernel.ui.introspection.details.handler; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +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.EObjectAwareKISSDetailsItemBase; import org.fortiss.tooling.kernel.ui.internal.AllocationEditPartFactoryService; -import org.fortiss.tooling.kernel.ui.internal.introspection.details.DetailsUIHandlerBase; -import org.fortiss.tooling.kernel.ui.internal.introspection.items.AllocationEditPartFactoryServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.items.AllocationEditPartFactoryKISSDetailsItem; + +import javafx.scene.Node; /** * {@link DetailsUIHandlerBase} for {@link AllocationEditPartFactoryService}. * * @author hoelzl */ -public class AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { +public class AllocationEditPartFactoryKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { /** {@inheritDoc} */ @Override - public Control createComposite(ScrolledComposite parent) { + public Node createDisplayControl() { String heading = "Type to search registered allocation editpart factories:"; String footer = "Number of currently registered allocation editpart factories: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Factories"); + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); } /** {@inheritDoc} */ @Override - protected void createTreeColumns(Tree tree) { + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { createDefaultTreeColumns(tree, "Class / Factory", 250, "Factory Class", 400, "EObject Class", 400); } /** {@inheritDoc} */ @Override - protected ITreeContentProvider createContentProvider() { + protected DynamicTreeContentProviderBase<Object> createContentProvider() { return new EObjectAwareTreeContentProviderBase() { @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return AllocationEditPartFactoryServiceIntrospectionDetailsUIHandler.this - .getInputObject(); + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return AllocationEditPartFactoryKISSDetailsUIHandler.this + .getRootObject(); } }; } /** {@inheritDoc} */ @Override - protected AllocationEditPartFactoryServiceIntrospectionDetailsItem getInputObject() { - return (AllocationEditPartFactoryServiceIntrospectionDetailsItem)dataItem; + protected AllocationEditPartFactoryKISSDetailsItem getRootObject() { + return (AllocationEditPartFactoryKISSDetailsItem)dataItem; } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConnectionCompositorKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConnectionCompositorKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..ebc85ae220655ca741af69c8957a8dd018de013d --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConnectionCompositorKISSDetailsUIHandler.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.ConnectionCompositorKISSDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EObjectAware2KISSDetailsItemBase; +import org.fortiss.tooling.kernel.service.IConnectionCompositorService; + +import javafx.scene.Node; + +/** + * Introspection UI handler for the {@link IConnectionCompositorService}. + * + * @author hoelzl + */ +public final class ConnectionCompositorKISSDetailsUIHandler + extends EObjectAware2KISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered connection compositors:"; + String footer = "Number of currently registered connection compositors: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Source / Target / Compositor", 250, "Compositor Class", 400, + "Source EObject Class", 400, "Target EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAware2TreeContentProviderBase() { + @Override + protected EObjectAware2KISSDetailsItemBase<?> getInputObject() { + return ConnectionCompositorKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ConnectionCompositorKISSDetailsItem getRootObject() { + return (ConnectionCompositorKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConstraintCheckerKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConstraintCheckerKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..a4472923f74039e53162bac35694f0c01857315a --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ConstraintCheckerKISSDetailsUIHandler.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +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.IConstraintChecker; +import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; +import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerKISSDetailsItem; +import org.fortiss.tooling.kernel.service.IConstraintCheckerService; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Introspection UI handler for {@link IIntrospectionItem}s provided by + * {@link IConstraintCheckerService}. + * + * @author hoelzl + */ +public final class ConstraintCheckerKISSDetailsUIHandler extends KISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String h = "Type to search registered checkers:"; + String f = "Number of registered constraint checkers: " + countCheckers(); + return createFilteredTree(h, f); + } + + /** Computes the number of constraint checkers. */ + private int countCheckers() { + int count = 0; + for(Class<?> c : getRootObject().getHandlerKeyClasses()) { + count += getRootObject().getHandlerList(c).size(); + } + return count; + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + tree.addColumn("Model Element / Checker", 400); + tree.addColumn("Model Element Class", 400); + tree.addColumn("Constraint Checker Implementation Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { + /** {@inheritDoc} */ + @Override + protected Collection<? extends Object> getChildren(Object parent) { + if(parent == getRootObject()) { + return getRootObject().getHandlerKeyClasses(); + } else if(parent instanceof Class) { + return getRootObject().getHandlerList((Class<?>)parent); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public Node getIconNode(Object element, int column) { + return null; + } + + @Override + public String getLabel(Object data, int column) { + if(data instanceof Class) { + switch(column) { + case 0: + return ((Class<?>)data).getSimpleName(); + case 1: + return ((Class<?>)data).getName(); + } + } else if(data instanceof IConstraintChecker) { + IConstraintChecker<EObject> icc = (IConstraintChecker<EObject>)data; + switch(column) { + case 0: + return icc.getClass().getSimpleName(); + case 2: + return icc.getClass().getName(); + } + } + return null; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof Class) { + return createCopyClassNameMenuItem((Class<?>)element); + } + if(element instanceof IConstraintChecker<?>) { + return createCopyClassNameMenuItem(element.getClass()); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ConstraintCheckerKISSDetailsItem getRootObject() { + return (ConstraintCheckerKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ContextMenuKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ContextMenuKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..6e329ca7f4e4919285a743cf49fba90e3789fcab --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ContextMenuKISSDetailsUIHandler.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; + +import java.util.Collection; + +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.introspection.IIntrospectionItem; +import org.fortiss.tooling.kernel.service.IConstraintCheckerService; +import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor; +import org.fortiss.tooling.kernel.ui.introspection.items.ContextMenuKISSDetailsItem; +import org.fortiss.tooling.kernel.ui.service.IContextMenuService; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Introspection UI handler for {@link IIntrospectionItem}s provided by + * {@link IConstraintCheckerService}. + * + * @author hoelzl + */ +public final class ContextMenuKISSDetailsUIHandler extends KISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String h = "Type to search registered menu contributors:"; + String f = "Number of registered menu contributors: " + + getRootObject().getHandlerList().size(); + return createFilteredTree(h, f); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + tree.addColumn("Menu Section", 400); + tree.addColumn("Menu Provider Class", 500); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { + /** {@inheritDoc} */ + @Override + protected Collection<? extends Object> getChildren(Object parent) { + if(parent == getRootObject()) { + return asList(IContextMenuService.MENU_SECTION_IDS); + } else if(parent instanceof String) { + return getRootObject().getHandlerList().stream() + .filter(h -> parent.equals(h.getMenuSectionID())).collect(toList()); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public Node getIconNode(Object element, int column) { + return null; + } + + @Override + public String getLabel(Object data, int column) { + if(data instanceof String && column == 0) { + return (String)data; + } else if(data instanceof IContextMenuContributor) { + IContextMenuContributor icc = (IContextMenuContributor)data; + switch(column) { + case 0: + return icc.getClass().getSimpleName(); + case 1: + return icc.getClass().getName(); + } + } + return null; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof IContextMenuContributor) { + return createCopyClassNameMenuItem(element.getClass()); + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ContextMenuKISSDetailsItem getRootObject() { + return (ContextMenuKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAware2KISSDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAware2KISSDetailsUIHandlerBase.java new file mode 100644 index 0000000000000000000000000000000000000000..301276017de4db9bdd7fb90df09eaba8342a9e26 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAware2KISSDetailsUIHandlerBase.java @@ -0,0 +1,183 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +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.introspection.items.EObjectAware2KISSDetailsItemBase; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Base class for details UI implementations with filtered tree viewer. + * + * @author hoelzl + */ +public abstract class EObjectAware2KISSDetailsUIHandlerBase extends KISSDetailsUIHandlerBase { + + /** Creates the default tree columns. */ + protected final void createDefaultTreeColumns(DynamicTreeTableViewer<Object> viewer, + String text0, int width0, String text1, int width1, String text2, int width2, + String text3, int width3) { + viewer.addColumn(text0, width0); + viewer.addColumn(text1, width1); + viewer.addColumn(text2, width2); + viewer.addColumn(text3, width3); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new EObjectAware2TableLabelProvider(); + } + + /** Table label provider for handler registrations with two classes. */ + protected class EObjectAware2TableLabelProvider extends DynamicTreeTableUIProviderBase<Object> { + /** {@inheritDoc} */ + @Override + public String getLabel(Object element, int columnIndex) { + if(element instanceof Class) { + return columnIndex == 0 ? ((Class<?>)element).getSimpleName() : ""; + } + if(element instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)element; + if(pair.getLeft() instanceof Class) { + Class<?> c = (Class<?>)((Pair<?, ?>)element).getRight(); + return columnIndex == 0 ? c.getSimpleName() : ""; + } + if(pair.getLeft() != null) { + Object provider = pair.getLeft(); + Pair<?, ?> regClasses = (Pair<?, ?>)pair.getRight(); + Class<?> sourceClass = (Class<?>)regClasses.getLeft(); + Class<?> targetClass = (Class<?>)regClasses.getRight(); + switch(columnIndex) { + case 0: + return provider.getClass().getSimpleName(); + case 1: + return provider.getClass().getName(); + case 2: + return sourceClass.getName(); + case 3: + return targetClass.getName(); + } + } + } + return ""; + } + + /** {@inheritDoc} */ + @Override + public Node getIconNode(Object element, int column) { + return null; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)element; + if(pair.getLeft() != null && pair.getRight() instanceof Pair) { + Pair<?, ?> rightPair = (Pair<?, ?>)pair.getRight(); + switch(column) { + case 0: + break; + case 1: + Class<?> handlerClass = pair.getLeft().getClass(); + return createCopyClassNameMenuItem(handlerClass); + case 2: + Class<?> srcClass = (Class<?>)rightPair.getLeft(); + return createCopyClassNameMenuItem(srcClass); + case 3: + Class<?> trgClass = (Class<?>)rightPair.getRight(); + return createCopyClassNameMenuItem(trgClass); + default: + } + } + } + return null; + } + } + + /** Tree content provider for handler registrations with two classes. */ + protected static abstract class EObjectAware2TreeContentProviderBase + extends DynamicTreeContentProviderBase<Object> { + + /** Returns the input object for this content provider. */ + protected abstract EObjectAware2KISSDetailsItemBase<?> getInputObject(); + + /** {@inheritDoc} */ + @Override + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getInputObject()) { + return getInputObject().getFirstHandlerKeyClasses(); + } + if(parentElement instanceof Class<?>) { + Class<?> firstClass = (Class<?>)parentElement; + Collection<Class<?>> secondaryClasses = + getInputObject().getSecondHandlerKeyClasses(firstClass); + if(secondaryClasses == null || secondaryClasses.isEmpty()) { + return null; + } + Collection<Pair<?, ?>> pairs = new ArrayList<Pair<?, ?>>(secondaryClasses.size()); + for(Class<?> secondary : secondaryClasses) { + pairs.add(new ImmutablePair<Class<?>, Class<?>>(firstClass, secondary)); + } + return pairs; + } + if(parentElement instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)parentElement; + if(pair.getLeft() instanceof Class) { + Class<?> first = (Class<?>)pair.getLeft(); + Class<?> second = (Class<?>)pair.getRight(); + List<?> handlerList = getInputObject().getHandlerList(first, second); + if(handlerList == null || handlerList.isEmpty()) { + return null; + } + Collection<Pair<?, ?>> pairs = new ArrayList<Pair<?, ?>>(handlerList.size()); + for(Object handler : handlerList) { + pairs.add(new ImmutablePair<Object, Pair<?, ?>>(handler, pair)); + } + return pairs; + } + // no children for handlers + } + return null; + } + } + + /** {@inheritDoc} */ + @Override + protected Comparator<Object> createSorter() { + return (o1, o2) -> { + if(o1 instanceof Pair && o2 instanceof Pair) { + Pair<?, ?> pair1 = (Pair<?, ?>)o1; + Pair<?, ?> pair2 = (Pair<?, ?>)o2; + o1 = pair1.getLeft().getClass(); + o2 = pair2.getLeft().getClass(); + // fall through to next if statement + } + if(o1 instanceof Class && o2 instanceof Class) { + return ((Class<?>)o1).getSimpleName().compareTo(((Class<?>)o2).getSimpleName()); + } + return 0; + }; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAwareKISSDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAwareKISSDetailsUIHandlerBase.java new file mode 100644 index 0000000000000000000000000000000000000000..ff5a70e09a5a556cd7848179ca07031c87a3a17e --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EObjectAwareKISSDetailsUIHandlerBase.java @@ -0,0 +1,165 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +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.introspection.items.EObjectAwareKISSDetailsItemBase; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Base class for details UI implementations with filtered tree viewer. + * + * @author hoelzl + */ +public abstract class EObjectAwareKISSDetailsUIHandlerBase extends KISSDetailsUIHandlerBase { + + /** Creates the default tree columns. */ + protected final void createDefaultTreeColumns(DynamicTreeTableViewer<Object> viewer, + String text0, int width0, String text1, int width1, String text2, int width2) { + viewer.addColumn(text0, width0); + viewer.addColumn(text1, width1); + viewer.addColumn(text2, width2); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public String getLabel(Object element, int column) { + if(element instanceof Class) { + return column == 0 ? ((Class<?>)element).getSimpleName() : ""; + } + if(element instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)element; + if(pair.getLeft() != null) { + Object provider = pair.getLeft(); + Class<?> regClass = (Class<?>)pair.getRight(); + switch(column) { + case 0: + return provider.getClass().getSimpleName(); + case 1: + return provider.getClass().getName(); + case 2: + return regClass.getName(); + } + } + } + return ""; + } + + @Override + public Node getIconNode(Object element, int column) { + return null; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)element; + if(pair.getLeft() == null) { + return null; + } + Object provider = pair.getLeft(); + Class<?> regClass = (Class<?>)pair.getRight(); + switch(column) { + case 0: + break; + case 1: + return createCopyClassNameMenuItem(provider.getClass()); + case 2: + return createCopyClassNameMenuItem(regClass); + default: + } + } + return null; + } + }; + } + + /** {@inheritDoc} */ + @Override + protected boolean testObjectFilter(String filterExpression, Object element) { + Class<?> toMatch = null; + if(element instanceof Class) { + toMatch = (Class<?>)element; + } else if(element instanceof Pair) { + Pair<?, ?> pair = (Pair<?, ?>)element; + if(pair.getLeft() != null) { + toMatch = pair.getLeft().getClass(); + } + } + if(toMatch == null) { + return false; + } + filterExpression = filterExpressionSanityCheck(filterExpression); + return toMatch.getSimpleName().matches(filterExpression); + } + + /** {@inheritDoc} */ + @Override + protected Comparator<Object> createSorter() { + return (o1, o2) -> { + if(o1 instanceof Pair && o2 instanceof Pair) { + Pair<?, ?> pair1 = (Pair<?, ?>)o1; + Pair<?, ?> pair2 = (Pair<?, ?>)o2; + o1 = pair1.getLeft().getClass(); + o2 = pair2.getLeft().getClass(); + // fall through to next if statement + } + if(o1 instanceof Class && o2 instanceof Class) { + return ((Class<?>)o1).getSimpleName().compareTo(((Class<?>)o2).getSimpleName()); + } + return 0; + }; + } + + /** Tree content provider for handler registrations with two classes. */ + protected static abstract class EObjectAwareTreeContentProviderBase + extends DynamicTreeContentProviderBase<Object> { + /** Returns the input object for this content provider. */ + protected abstract EObjectAwareKISSDetailsItemBase<?> getInputObject(); + + /** {@inheritDoc} */ + @Override + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getInputObject()) { + return getInputObject().getHandlerKeyClasses(); + } + if(parentElement instanceof Class<?>) { + Class<?> regClass = (Class<?>)parentElement; + List<?> handlerList = getInputObject().getHandlerList(regClass); + if(handlerList == null || handlerList.isEmpty()) { + return null; + } + Collection<Pair<?, ?>> pairs = new ArrayList<Pair<?, ?>>(handlerList.size()); + for(Object handler : handlerList) { + pairs.add(new ImmutablePair<Object, Class<?>>(handler, regClass)); + } + return pairs; + } + return null; + } + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageKISSDetailsUIHandler.java similarity index 53% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageKISSDetailsUIHandler.java index 987f882a82cfa20af08e85629e2767c0ebab042f..b4a8d448631af61f79196e2b225aec586a77179d 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EclipseResourceStorageProviderIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EclipseResourceStorageKISSDetailsUIHandler.java @@ -13,54 +13,48 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler; +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import static java.util.Arrays.asList; + +import java.util.Collection; -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; import org.eclipse.core.resources.IFile; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; +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 org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageKISSDetailsItem; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; /** - * Introspection UI handler for the {@link EclipseResourceStorageServiceIntrospectionDetailsItem}s. + * Introspection UI handler for the {@link EclipseResourceStorageKISSDetailsItem}s. * * @author hoelzl */ -public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler - extends IntrospectionDetailsUIHandlerBase { +public final class EclipseResourceStorageKISSDetailsUIHandler + extends KISSDetailsUIHandlerBase { /** {@inheritDoc} */ @Override - public Control createComposite(ScrolledComposite parent) { + public Node createDisplayControl() { String heading = "Type to search registered Eclipse resource providers:"; String footer = "Number of currently registered storage providers: " + - getInputObject().getStorageProviderList().size() + " (providing " + - getInputObject().getLoadedFiles().size() + " file[s], " + - getInputObject().getErrorFiles().size() + " erroneous)."; - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Providers"); + getRootObject().getStorageProviderList().size() + " (providing " + + getRootObject().getLoadedFiles().size() + " file[s], " + + getRootObject().getErrorFiles().size() + " erroneous)."; + return createFilteredTree(heading, footer); } /** {@inheritDoc} */ @Override - protected void createTreeColumns(Tree tree) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText("Category / Provider / File"); - col0.setWidth(450); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText("Implementation Class / Path / Storage Error Message"); - col1.setWidth(400); + 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. */ @@ -69,22 +63,22 @@ public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler /** {@inheritDoc} */ @Override - protected ITreeContentProvider createContentProvider() { - return new TreeContentProviderBase() { + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return ROOT_CATEGORY; + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getRootObject()) { + return asList(ROOT_CATEGORY); } if(ROOT_CATEGORY[0].equals(parentElement)) { - return getInputObject().getStorageProviderList().toArray(); + return getRootObject().getStorageProviderList(); } if(ROOT_CATEGORY[1].equals(parentElement)) { - return getInputObject().getLoadedFiles().toArray(); + return getRootObject().getLoadedFiles(); } if(ROOT_CATEGORY[2].equals(parentElement)) { - return getInputObject().getErrorFiles().toArray(); + return getRootObject().getErrorFiles(); } return null; } @@ -93,10 +87,10 @@ public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler /** {@inheritDoc} */ @Override - protected ITableLabelProvider createLabelProvider() { - return new TableLabelProviderBase() { + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { @Override - public String getColumnText(Object parentElement, int columnIndex) { + public String getLabel(Object parentElement, int columnIndex) { if(parentElement instanceof IEclipseResourceStorageLocationProvider || parentElement instanceof IEclipseResourcePostLoadProvider) { return columnIndex == 0 ? parentElement.getClass().getSimpleName() @@ -115,31 +109,18 @@ public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler } return ""; } - }; - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - return new TableViewerPatternFilter(); - } - /** {@inheritDoc} */ - @Override - protected EclipseResourceStorageServiceIntrospectionDetailsItem getInputObject() { - return (EclipseResourceStorageServiceIntrospectionDetailsItem)dataItem; - } - - /** {@inheritDoc} */ - @Override - protected boolean testSelection(Object selection) { - return selection instanceof IEclipseResourceStorageLocationProvider || - selection instanceof IEclipseResourcePostLoadProvider; + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + return createCopyClassNameMenuItem(element.getClass()); + } + }; } /** {@inheritDoc} */ @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - mgr.add(createCopyClassNameAction(selection.getClass())); + protected EclipseResourceStorageKISSDetailsItem getRootObject() { + return (EclipseResourceStorageKISSDetailsItem)dataItem; } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryKISSDetailsUIHandler.java similarity index 60% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryKISSDetailsUIHandler.java index e14b000ffface065dd58f7a9799cceb74acd095e..6f04164781420e096cfbafa889449b037df11df2 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/EditPartFactoryServiceIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/EditPartFactoryKISSDetailsUIHandler.java @@ -13,55 +13,55 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler; +package org.fortiss.tooling.kernel.ui.introspection.details.handler; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; +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.EObjectAwareKISSDetailsItemBase; 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 org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.items.EditPartFactoryKISSDetailsItem; + +import javafx.scene.Node; /** * {@link DetailsUIHandlerBase} for {@link EditPartFactoryService}. * * @author hoelzl */ -public class EditPartFactoryServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { +public class EditPartFactoryKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { /** {@inheritDoc} */ @Override - public Control createComposite(ScrolledComposite parent) { + public Node createDisplayControl() { String heading = "Type to search registered editpart factories:"; String footer = "Number of currently registered editpart factories: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Factories"); + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); } /** {@inheritDoc} */ @Override - protected void createTreeColumns(Tree tree) { + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { createDefaultTreeColumns(tree, "Class / Factory", 250, "Factory Class", 400, "EObject Class", 400); } /** {@inheritDoc} */ @Override - protected ITreeContentProvider createContentProvider() { + protected DynamicTreeContentProviderBase<Object> createContentProvider() { return new EObjectAwareTreeContentProviderBase() { @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return EditPartFactoryServiceIntrospectionDetailsUIHandler.this.getInputObject(); + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return EditPartFactoryKISSDetailsUIHandler.this.getRootObject(); } }; } /** {@inheritDoc} */ @Override - protected EditPartFactoryServiceIntrospectionDetailsItem getInputObject() { - return (EditPartFactoryServiceIntrospectionDetailsItem)dataItem; + protected EditPartFactoryKISSDetailsItem getRootObject() { + return (EditPartFactoryKISSDetailsItem)dataItem; } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ElementCompositorKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ElementCompositorKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..9d416344ef4ae563a3d17ed81344c2b11bea1aa7 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ElementCompositorKISSDetailsUIHandler.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.introspection.items.ElementCompositorKISSDetailsItem; +import org.fortiss.tooling.kernel.service.IElementCompositorService; + +import javafx.scene.Node; + +/** + * Introspection UI handler for the {@link IElementCompositorService}. + * + * @author hoelzl + */ +public final class ElementCompositorKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered element compositors:"; + String footer = "Number of currently registered element compositors: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> viewer) { + createDefaultTreeColumns(viewer, "Class / Compositor", 250, "Compositor Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return ElementCompositorKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ElementCompositorKISSDetailsItem getRootObject() { + return (ElementCompositorKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/KISSDetailsUIHandlerBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/KISSDetailsUIHandlerBase.java new file mode 100644 index 0000000000000000000000000000000000000000..5008ec4bd54df3f7dbd91463a859dd955db5532b --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/KISSDetailsUIHandlerBase.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +import static java.util.Comparator.comparing; +import static org.fortiss.tooling.kernel.ui.introspection.ClipboardCopyHelper.createCopyClassNameMenu; + +import java.util.Comparator; + +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.ui.introspection.details.DetailsUIHandlerBase; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.BorderPane; + +/** + * Base class for details UI implementations with filtered tree viewer. + * + * @author hoelzl + */ +public abstract class KISSDetailsUIHandlerBase extends DetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + return new Label("No details available!"); + } + + /** Creates the filtered tree control. */ + protected final BorderPane createFilteredTree(String searchFieldAdvice, String footerLabel) { + BorderPane pane = new BorderPane(); + DynamicTreeTableViewer<Object> treeView = new DynamicTreeTableViewer<Object>( + getRootObject(), false, 0, createContentProvider(), createUIProvider()); + createTreeColumns(treeView); + pane.setCenter(treeView.getControl()); + if(searchFieldAdvice != null) { + TextField searchField = new TextField(); + searchField.setPromptText(searchFieldAdvice); + searchField.textProperty().addListener((obs, oldValue, newValue) -> { + treeView.update(); + }); + pane.setTop(searchField); + } + if(footerLabel != null) { + Label footer = new Label(footerLabel); + pane.setBottom(footer); + } + return pane; + } + + /** Returns the root object for the tree-table viewer. */ + protected abstract Object getRootObject(); + + /** Returns the content provider for the tree-table viewer. */ + protected abstract DynamicTreeContentProviderBase<Object> createContentProvider(); + + /** Returns the label provider for the tree-table viewer. */ + protected abstract DynamicTreeTableUIProviderBase<Object> createUIProvider(); + + /** Returns the Comparator used to sort the elements in the viewer. */ + protected Comparator<Object> createSorter() { + return comparing(Object::toString); + } + + /** + * Tests the given object's toString representation for inclusion under the given text filter + * expression. The filter expression supports wildcard matching with {@code '?'} for a single + * character and {@code '*'} for arbitrary many characters. + */ + protected boolean testObjectFilter(String filterExpression, Object dataItem) { + if(dataItem == null) { + return false; + } + filterExpression = filterExpressionSanityCheck(filterExpression); + return dataItem.toString().matches(filterExpression); + } + + /** Tests the given filter expression and replaces it if necessary. */ + protected String filterExpressionSanityCheck(String filterExpression) { + if(filterExpression == null || filterExpression.trim().equals("")) { + filterExpression = ".*"; + } else { + if(!filterExpression.endsWith("*")) { + filterExpression += '*'; + } + if(!filterExpression.startsWith("*")) { + filterExpression = '*' + filterExpression; + } + filterExpression = filterExpression.replace("?", ".?").replace("*", ".*"); + } + return filterExpression; + } + + /** Creates the columns for the tree-table viewer. */ + protected abstract void createTreeColumns(DynamicTreeTableViewer<Object> viewer); + + /** Creates a context menu with an entry to copy the given String. */ + protected final ContextMenu createCopyClassNameMenuItem(Class<?> toCopy) { + return createCopyClassNameMenu(toCopy); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryKISSDetailsUIHandler.java similarity index 60% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryKISSDetailsUIHandler.java index a17e31bfdb1215b9d50279a37165fac6db0733ea..47fe04336719264f697847671c7ec6fdacaf71ba 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/LibraryServiceIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/LibraryKISSDetailsUIHandler.java @@ -13,54 +13,54 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler; +package org.fortiss.tooling.kernel.ui.introspection.details.handler; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.fortiss.tooling.kernel.introspection.items.EObjectAwareIntrospectionDetailsItemBase; -import org.fortiss.tooling.kernel.introspection.items.LibraryServiceIntrospectionDetailsItem; +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.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.introspection.items.LibraryKISSDetailsItem; import org.fortiss.tooling.kernel.service.ILibraryService; +import javafx.scene.Node; + /** - * {@link IntrospectionDetailsUIHandlerBase} for {@link ILibraryService}. + * {@link KISSDetailsUIHandlerBase} for {@link ILibraryService}. * * @author hoelzl */ -public final class LibraryServiceIntrospectionDetailsUIHandler - extends EObjectAwareIntrospectionDetailsUIHandlerBase { +public final class LibraryKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { /** {@inheritDoc} */ @Override - public Control createComposite(ScrolledComposite parent) { + public Node createDisplayControl() { String heading = "Type to search registered library element handler:"; String footer = "Number of currently registered library element handlers: " + - getInputObject().countHandlers(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Handlers"); + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); } /** {@inheritDoc} */ @Override - protected void createTreeColumns(Tree tree) { + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { createDefaultTreeColumns(tree, "Class / Provider", 250, "Provider Class", 400, "EObject Class", 400); } /** {@inheritDoc} */ @Override - protected ITreeContentProvider createContentProvider() { + protected DynamicTreeContentProviderBase<Object> createContentProvider() { return new EObjectAwareTreeContentProviderBase() { @Override - protected EObjectAwareIntrospectionDetailsItemBase<?> getInputObject() { - return LibraryServiceIntrospectionDetailsUIHandler.this.getInputObject(); + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return LibraryKISSDetailsUIHandler.this.getRootObject(); } }; } /** {@inheritDoc} */ @Override - protected LibraryServiceIntrospectionDetailsItem getInputObject() { - return (LibraryServiceIntrospectionDetailsItem)dataItem; + protected LibraryKISSDetailsItem getRootObject() { + return (LibraryKISSDetailsItem)dataItem; } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/MigrationKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/MigrationKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..eff83731e0115c0dff73b21438199e20b645ce39 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/MigrationKISSDetailsUIHandler.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.introspection.items.MigrationKISSDetailsItem; +import org.fortiss.tooling.kernel.service.IMigrationService; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; + +import javafx.scene.Node; + +/** + * {@link DetailsUIHandlerBase} for {@link IMigrationService}. + * + * @author hoelzl + */ +public class MigrationKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered migration providers:"; + String footer = "Number of currently registered migration providers: " + + 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 EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return MigrationKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected MigrationKISSDetailsItem getRootObject() { + return (MigrationKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelEditorBindingKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelEditorBindingKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..324aa57296919b09c882ab415b90507267c5f75e --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelEditorBindingKISSDetailsUIHandler.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.ui.internal.ModelEditorBindingService; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelEditorBindingKISSDetailsItem; + +import javafx.scene.Node; + +/** + * {@link DetailsUIHandlerBase} for {@link ModelEditorBindingService}. + * + * @author hoelzl + */ +public final class ModelEditorBindingKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered model editor bindings:"; + String footer = "Number of currently registered model editor bindings: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Class / Binding", 250, "Binding Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return ModelEditorBindingKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ModelEditorBindingKISSDetailsItem getRootObject() { + return (ModelEditorBindingKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelElementHandlerKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelElementHandlerKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..3a20a86d7e053e7c7801e9f895628e451c93077b --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/ModelElementHandlerKISSDetailsUIHandler.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.ui.internal.ModelElementHandlerService; +import org.fortiss.tooling.kernel.ui.introspection.details.DetailsUIHandlerBase; +import org.fortiss.tooling.kernel.ui.introspection.items.ModelElementHandlerKISSDetailsItem; + +import javafx.scene.Node; + +/** + * {@link DetailsUIHandlerBase} for {@link ModelElementHandlerService}. + * + * @author hoelzl + */ +public final class ModelElementHandlerKISSDetailsUIHandler + extends EObjectAwareKISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to search registered model element handlers:"; + String footer = "Number of currently registered model element handlers: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Class / Handler", 250, "Handler Class", 400, + "EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAwareTreeContentProviderBase() { + @Override + protected EObjectAwareKISSDetailsItemBase<?> getInputObject() { + return ModelElementHandlerKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected ModelElementHandlerKISSDetailsItem getRootObject() { + return (ModelElementHandlerKISSDetailsItem)dataItem; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyKISSDetailsUIHandler.java similarity index 57% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyKISSDetailsUIHandler.java index 8019c9fa146eb5831be048edc94c8d284cc90595..05d704220db19e0e31fb94ada2ddfc4dd6f28355 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/details/handler/PersistencyServiceIntrospectionDetailsUIHandler.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PersistencyKISSDetailsUIHandler.java @@ -13,81 +13,72 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler; +package org.fortiss.tooling.kernel.ui.introspection.details.handler; + +import static java.util.Arrays.asList; + +import java.util.Collection; -import org.conqat.ide.commons.ui.jface.TreeContentProviderBase; import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TableLabelProviderBase; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.dialogs.PatternFilter; +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.introspection.items.PersistencyKISSDetailsItem; 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 { +public final class PersistencyKISSDetailsUIHandler + extends KISSDetailsUIHandlerBase { /** {@inheritDoc} */ @Override - public Control createComposite(ScrolledComposite parent) { + public Node createDisplayControl() { String heading = "Type to search registered persistency providers:"; String footer = "Number of currently registered providers: " + - getInputObject().getStorageProviders().size(); - return createFilteredTreeInTabFolder(parent, heading, footer, "Registered Providers"); + getRootObject().getStorageProviders().size(); + return createFilteredTree(heading, footer); } /** {@inheritDoc} */ @Override - protected void createTreeColumns(Tree tree) { - TreeColumn col0 = new TreeColumn(tree, SWT.LEFT); - col0.setText("Storage Provider Class / Toplevel Element"); - col0.setWidth(450); - - TreeColumn col1 = new TreeColumn(tree, SWT.LEFT); - col1.setText("Toplevel EObject Class / Storage Error Message"); - col1.setWidth(400); - - TreeColumn col2 = new TreeColumn(tree, SWT.LEFT); - col2.setText("Error Cause Exception"); - col2.setWidth(400); + 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 ITreeContentProvider createContentProvider() { - return new TreeContentProviderBase() { + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { @Override - public Object[] getChildren(Object parentElement) { - if(parentElement == getInputObject()) { - return getInputObject().getStorageProviders().toArray(); + public Collection<? extends Object> getChildren(Object parentElement) { + if(parentElement == getRootObject()) { + return getRootObject().getStorageProviders(); } if(parentElement instanceof IStorageProvider) { IStorageProvider prov = (IStorageProvider)parentElement; - return new Object[] {new ToplevelOrErrorTreeNode(prov, true), - new ToplevelOrErrorTreeNode(prov, false)}; + 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().toArray(); + return node.provider.getTopLevelElements(); } - return node.provider.getStorageErrors().toArray(); + return node.provider.getStorageErrors(); } return null; } @@ -96,10 +87,21 @@ public final class PersistencyServiceIntrospectionDetailsUIHandler /** {@inheritDoc} */ @Override - protected ITableLabelProvider createLabelProvider() { - return new TableLabelProviderBase() { + 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 getColumnText(Object parentElement, int columnIndex) { + public String getLabel(Object parentElement, int columnIndex) { if(parentElement instanceof IStorageProvider) { IStorageProvider isp = (IStorageProvider)parentElement; return columnIndex == 0 ? isp.getClass().getName() : ""; @@ -141,38 +143,15 @@ public final class PersistencyServiceIntrospectionDetailsUIHandler /** {@inheritDoc} */ @Override - protected boolean testSelection(Object selection) { - return selection instanceof IStorageProvider || selection instanceof ITopLevelElement; - } - - /** {@inheritDoc} */ - @Override - protected void populateContextMenu(Object selection, MenuManager mgr) { - if(selection instanceof IStorageProvider) { - mgr.add(createCopyClassNameAction(selection.getClass())); - } else if(selection instanceof ITopLevelElement) { - EObject eo = ((ITopLevelElement)selection).getRootModelElement(); - mgr.add(createCopyClassNameAction(eo.getClass())); - } - } - - /** {@inheritDoc} */ - @Override - protected PatternFilter createPatternFilter() { - return new TableViewerPatternFilter(); - } - - /** {@inheritDoc} */ - @Override - protected PersistencyServiceIntrospectionDetailsItem getInputObject() { - return (PersistencyServiceIntrospectionDetailsItem)dataItem; + protected PersistencyKISSDetailsItem getRootObject() { + return (PersistencyKISSDetailsItem)dataItem; } /** Class for tree nodes below storage providers. */ private static class ToplevelOrErrorTreeNode { /** The storage provider. */ public final IStorageProvider provider; - /** The toplevel flag. */ + /** The top level flag. */ public final boolean isToplevel; /** Constructor. */ diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..772e56f5ac42d719b93b4de894e3893528c47f7b --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/PrototypeKISSDetailsUIHandler.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.details.handler; + +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; + +import java.util.Collection; + +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.IPrototypeProvider; +import org.fortiss.tooling.kernel.extension.data.Prototype; +import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; +import org.fortiss.tooling.kernel.service.IPrototypeService; + +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; + +/** + * Introspection UI handler for the {@link IPrototypeService}. + * + * @author hoelzl + */ +public final class PrototypeKISSDetailsUIHandler extends KISSDetailsUIHandlerBase { + + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String footer = "Number of currently registered Prototypes: " + + IPrototypeService.getInstance().getAllPrototypes().size() + " (" + + IPrototypeService.getInstance().getPrimaryPrototypes().size() + + " primary Prototypes)"; + return createFilteredTree(null, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> viewer) { + viewer.addColumn("Category / Prototype", 200); + viewer.addColumn("Provider Class", 400); + viewer.addColumn("EObject Class", 400); + viewer.addColumn("Primary", 80); + } + + /** Returns the label for the given Prototype and column. */ + private String getPrototypeLabelForFirstColumn(Prototype arche, int column) { + switch(column) { + case 0: + return arche.getName(); + case 1: + return findPrototypeProviderClass(arche).getName(); + case 2: + return arche.getPrototype().getClass().getName(); + case 3: + return arche.isPrimary() ? "X" : null; + default: + } + return null; + } + + /** Find the Prototype provider for the given Prototype. */ + private Class<? extends IPrototypeProvider> findPrototypeProviderClass(Prototype arche) { + for(IPrototypeProvider provider : IPrototypeService.getInstance().getPrototypeProviders()) { + if(provider.getPrototypes().contains(arche)) { + return provider.getClass(); + } + } + return null; + } + + /** {@inheritDoc} */ + @Override + protected Object getRootObject() { + return IPrototypeService.getInstance(); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new DynamicTreeContentProviderBase<Object>() { + /** {@inheritDoc} */ + @Override + protected Collection<? extends Object> getChildren(Object parent) { + if(parent instanceof IPrototypeService) { + return ((IPrototypeService)parent).getAllTopLevelPrototypesCategories(); + } + if(parent instanceof PrototypeCategory) { + PrototypeCategory cat = (PrototypeCategory)parent; + return asList(cat.getChildren()); + } + // Prototype + return emptyList(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeTableUIProviderBase<Object> createUIProvider() { + return new DynamicTreeTableUIProviderBase<Object>() { + @Override + public String getLabel(Object element, int column) { + if(element instanceof Prototype) { + return getPrototypeLabelForFirstColumn((Prototype)element, column); + } + if(element instanceof PrototypeCategory) { + return column == 0 ? ((PrototypeCategory)element).getName() : null; + } + if(element == IPrototypeService.getInstance()) { + return column == 0 ? "Prototype Service" : null; + } + return null; + } + + @Override + public Node getIconNode(Object element, int column) { + return null; + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int column) { + if(element instanceof Prototype) { + Prototype arche = (Prototype)element; + Class<?> toCopy; + if(column == 1) { + toCopy = findPrototypeProviderClass(arche); + } else if(column == 2) { + toCopy = arche.getPrototype().getClass(); + } else { + toCopy = null; + } + if(toCopy != null) { + return createCopyClassNameMenuItem(toCopy); + } + } + return null; + } + }; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/TransformationKISSDetailsUIHandler.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/TransformationKISSDetailsUIHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..f3641f3cc43df7b285badee15c31261f1a83a51b --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/details/handler/TransformationKISSDetailsUIHandler.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.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.EObjectAware2KISSDetailsItemBase; +import org.fortiss.tooling.kernel.introspection.items.TransformationKISSDetailsItem; +import org.fortiss.tooling.kernel.service.ITransformationService; + +import javafx.scene.Node; + +/** + * Introspection UI handler for the {@link ITransformationService}. + * + * @author hoelzl + */ +public final class TransformationKISSDetailsUIHandler + extends EObjectAware2KISSDetailsUIHandlerBase { + /** {@inheritDoc} */ + @Override + public Node createDisplayControl() { + String heading = "Type to serach registered transformation providers:"; + String footer = "Number of currently registered transformation providers: " + + getRootObject().countHandlers(); + return createFilteredTree(heading, footer); + } + + /** {@inheritDoc} */ + @Override + protected void createTreeColumns(DynamicTreeTableViewer<Object> tree) { + createDefaultTreeColumns(tree, "Source / Target / Provider", 250, "Provider Class", 400, + "Source EObject Class", 400, "Target EObject Class", 400); + } + + /** {@inheritDoc} */ + @Override + protected DynamicTreeContentProviderBase<Object> createContentProvider() { + return new EObjectAware2TreeContentProviderBase() { + @Override + protected EObjectAware2KISSDetailsItemBase<?> getInputObject() { + return TransformationKISSDetailsUIHandler.this.getRootObject(); + } + }; + } + + /** {@inheritDoc} */ + @Override + protected TransformationKISSDetailsItem getRootObject() { + return (TransformationKISSDetailsItem)dataItem; + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..b6a4d0829c9bf47ceaa7a4bbfccc751647c52c46 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/.ratings @@ -0,0 +1,5 @@ +AllocationEditPartFactoryKISSDetailsItem.java 32851f78313d514dbdceaf7ff403b72519970c04 GREEN +ContextMenuKISSDetailsItem.java 5842153c7f7445ad2863614aee78c0c205011521 GREEN +EditPartFactoryKISSDetailsItem.java 78706937ac2cdf0545bb512a3190de0437f0770f GREEN +ModelEditorBindingKISSDetailsItem.java a95423f878cc2a13e84c2aebdd6d5e4376c7ec94 GREEN +ModelElementHandlerKISSDetailsItem.java 24d1ab16879d66cd15ee03b9ed61d39d7ca35aab GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryKISSDetailsItem.java similarity index 84% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryKISSDetailsItem.java index e2067b2d95c270a9aed82a2368177d76b0144d79..32851f78313d514dbdceaf7ff403b72519970c04 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/AllocationEditPartFactoryServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/AllocationEditPartFactoryKISSDetailsItem.java @@ -13,13 +13,13 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.items; +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.introspection.items.EObjectAwareKISSDetailsItemBase; import org.fortiss.tooling.kernel.ui.extension.IAllocationEditPartFactory; import org.fortiss.tooling.kernel.ui.internal.AllocationEditPartFactoryService; @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.ui.internal.AllocationEditPartFactoryService; * * @author hoelzl */ -public final class AllocationEditPartFactoryServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IAllocationEditPartFactory> { +public final class AllocationEditPartFactoryKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IAllocationEditPartFactory> { /** Constructor. */ - public AllocationEditPartFactoryServiceIntrospectionDetailsItem( + public AllocationEditPartFactoryKISSDetailsItem( Map<Class<?>, List<IAllocationEditPartFactory>> handlerMap) { super(handlerMap); } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ContextMenuKISSDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ContextMenuKISSDetailsItem.java new file mode 100644 index 0000000000000000000000000000000000000000..5842153c7f7445ad2863614aee78c0c205011521 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ContextMenuKISSDetailsItem.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.items; + +import java.util.List; + +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.HandlerListKISSDetailsItemBase; +import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor; +import org.fortiss.tooling.kernel.ui.internal.ContextMenuService; + +/** + * {@link IIntrospectionDetailsItem} for the {@link ContextMenuService}. + * + * @author hoelzl + */ +public final class ContextMenuKISSDetailsItem + extends HandlerListKISSDetailsItemBase<IContextMenuContributor> { + /** Constructor. */ + public ContextMenuKISSDetailsItem(List<IContextMenuContributor> handlerList) { + super(handlerList); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryKISSDetailsItem.java similarity index 85% rename from org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryKISSDetailsItem.java index f11316c73b6de0e254c4e319e063065e598d5c96..78706937ac2cdf0545bb512a3190de0437f0770f 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/introspection/items/EditPartFactoryServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/EditPartFactoryKISSDetailsItem.java @@ -13,13 +13,13 @@ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.internal.introspection.items; +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.introspection.items.EObjectAwareKISSDetailsItemBase; import org.fortiss.tooling.kernel.ui.extension.IEditPartFactory; import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService; @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.ui.internal.EditPartFactoryService; * * @author hoelzl */ -public final class EditPartFactoryServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IEditPartFactory> { +public final class EditPartFactoryKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IEditPartFactory> { /** Constructor. */ - public EditPartFactoryServiceIntrospectionDetailsItem( + public EditPartFactoryKISSDetailsItem( Map<Class<?>, List<IEditPartFactory>> handlerMap) { super(handlerMap); } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelEditorBindingKISSDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelEditorBindingKISSDetailsItem.java new file mode 100644 index 0000000000000000000000000000000000000000..a95423f878cc2a13e84c2aebdd6d5e4376c7ec94 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelEditorBindingKISSDetailsItem.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.items; + +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.ui.extension.IModelEditorBinding; +import org.fortiss.tooling.kernel.ui.internal.ModelEditorBindingService; + +/** + * {@link IIntrospectionDetailsItem} for {@link ModelEditorBindingService}. + * + * @author hoelzl + */ +public final class ModelEditorBindingKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IModelEditorBinding<EObject>> { + + /** Constructor. */ + public ModelEditorBindingKISSDetailsItem( + Map<Class<?>, List<IModelEditorBinding<EObject>>> handlerMap) { + super(handlerMap); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelElementHandlerKISSDetailsItem.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelElementHandlerKISSDetailsItem.java new file mode 100644 index 0000000000000000000000000000000000000000..24d1ab16879d66cd15ee03b9ed61d39d7ca35aab --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/introspection/items/ModelElementHandlerKISSDetailsItem.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.ui.introspection.items; + +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EObjectAwareKISSDetailsItemBase; +import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; +import org.fortiss.tooling.kernel.ui.internal.ModelElementHandlerService; + +/** + * {@link IIntrospectionDetailsItem} for {@link ModelElementHandlerService}. + * + * @author hoelzl + */ +public final class ModelElementHandlerKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IModelElementHandler<EObject>> { + + /** Constructor. */ + public ModelElementHandlerKISSDetailsItem( + Map<Class<?>, List<IModelElementHandler<EObject>>> handlerMap) { + super(handlerMap); + } +} diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings index de432414d1ed2b332919fa81b6d94cf3adea2324..64dad4fdd31dac77c2ebb8894c02cd99953ca388 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/.ratings @@ -1,15 +1,15 @@ CommandLineInterfaceService.java 6b5c94c52702f773c60b181eff52204ab379b248 GREEN CommandStackService.java 957bda69b5feb91f002aed4d25ed334e92801e7e GREEN -ConnectionCompositorService.java d69a60cd7a3d06e91d24fd32b9c00125ea71e0dd GREEN -ConstraintCheckerService.java 459b5eb717598e7e8bb71a0c87e57ea85cb00e4b GREEN +ConnectionCompositorService.java 5a52f8a3e88c167ae6909c3d9eb3fb4706177e8b GREEN +ConstraintCheckerService.java abd4667ceef11c47235e20a6566d8943f3417cf3 GREEN DummyTopLevelElement.java 8394597464707992cd053e68129bb87ce9f696db GREEN -ElementCompositorService.java 98c5d27e09881e60aa4f87c1ac0c7787cdec9f7c GREEN +ElementCompositorService.java 38af0fde6746717f95b8151a621b725ddd088650 GREEN LibraryPrototypeProvider.java b77eddbdca78f561ffb1233e98817be361c690ae GREEN -LibraryService.java d22671ba820466062852c15873698adf28960d94 GREEN +LibraryService.java a56e71191cd9bab5a6be461000e7e9b605c7b0db GREEN LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN -MigrationService.java 2f800eac9793aa736089a802bbfc2c4c1c09770d GREEN -PersistencyService.java 2e3936012a9b7217a293cbe8272ffa5f02518045 GREEN -PrototypeService.java cf8e6fa96ba9c2f65b24400054ed68e93238a975 GREEN +MigrationService.java 017c8438262065f663427a998536035bc7732fe1 GREEN +PersistencyService.java 621898863371959d822edcde0f83c8a4d2757972 GREEN +PrototypeService.java 04093ccaea091776e8ed6f8fc723a62e4619ddb6 GREEN ToolingKernelInternal.java f6e7114825748683c7f1d040b41ab854a6c4d79b GREEN -TransformationService.java 3cdb86fe920158f93cd9466c6ef9697b2dd8ca7f GREEN +TransformationService.java 64ee4fb5ccc623f8acfba20866fc2b0944c4adab GREEN TutorialService.java 675d3f365ce062869f86baa3779d50687674bda0 GREEN diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConnectionCompositorService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConnectionCompositorService.java index d69a60cd7a3d06e91d24fd32b9c00125ea71e0dd..5a52f8a3e88c167ae6909c3d9eb3fb4706177e8b 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConnectionCompositorService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConnectionCompositorService.java @@ -25,7 +25,7 @@ import org.fortiss.tooling.kernel.extension.IConnectionCompositor; import org.fortiss.tooling.kernel.extension.data.IConnectionCompositionContext; 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.ConnectionCompositorKISSDetailsItem; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.base.EObjectAware2ServiceBase; @@ -231,6 +231,6 @@ public class ConnectionCompositorService /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ConnectionCompositorServiceIntrospectionDetailsItem(handlersBySource); + return new ConnectionCompositorKISSDetailsItem(handlersBySource); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConstraintCheckerService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConstraintCheckerService.java index 459b5eb717598e7e8bb71a0c87e57ea85cb00e4b..abd4667ceef11c47235e20a6566d8943f3417cf3 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConstraintCheckerService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ConstraintCheckerService.java @@ -30,7 +30,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerKISSDetailsItem; import org.fortiss.tooling.kernel.service.IConstraintCheckerService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; @@ -177,6 +177,6 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ConstraintCheckerServiceIntrospectionDetailsItem(unmodifiableMap(handlerMap)); + return new ConstraintCheckerKISSDetailsItem(unmodifiableMap(handlerMap)); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java index 98c5d27e09881e60aa4f87c1ac0c7787cdec9f7c..38af0fde6746717f95b8151a621b725ddd088650 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.extension.data.Prototype; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.ElementCompositorServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.ElementCompositorKISSDetailsItem; import org.fortiss.tooling.kernel.model.ILibraryElementReference; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; @@ -210,6 +210,6 @@ public final class ElementCompositorService /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new ElementCompositorServiceIntrospectionDetailsItem(handlerMap); + return new ElementCompositorKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/LibraryService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/LibraryService.java index d22671ba820466062852c15873698adf28960d94..a56e71191cd9bab5a6be461000e7e9b605c7b0db 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/LibraryService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/LibraryService.java @@ -38,7 +38,7 @@ import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.LibraryServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.LibraryKISSDetailsItem; import org.fortiss.tooling.kernel.model.ILibrary; import org.fortiss.tooling.kernel.model.ILibraryElement; import org.fortiss.tooling.kernel.model.ILibraryElementReference; @@ -329,6 +329,6 @@ public class LibraryService extends EObjectAwareServiceBase<ILibraryElementHandl /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new LibraryServiceIntrospectionDetailsItem(handlerMap); + return new LibraryKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java index 2f800eac9793aa736089a802bbfc2c4c1c09770d..017c8438262065f663427a998536035bc7732fe1 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/MigrationService.java @@ -38,7 +38,7 @@ import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.MigrationServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.MigrationKISSDetailsItem; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.IMigrationService; import org.fortiss.tooling.kernel.service.base.ObjectAwareServiceBase; @@ -118,7 +118,8 @@ public class MigrationService extends ObjectAwareServiceBase<IMigrationProvider> error(ToolingKernelActivator.getDefault(), "Migrating " + input.getSaveableName() + " failed: A need for " + "migration is indicated although the migration was " + - "already performed. Please fix the migrator (or model)."); + "already performed. Please fix the migrator " + + provider.getClass().getSimpleName() + " or the model."); } } unknownFeatures.entrySet().removeAll(migratedFeatures.entrySet()); @@ -202,6 +203,6 @@ public class MigrationService extends ObjectAwareServiceBase<IMigrationProvider> /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new MigrationServiceIntrospectionDetailsItem(handlerMap); + return new MigrationKISSDetailsItem(handlerMap); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PersistencyService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PersistencyService.java index 2e3936012a9b7217a293cbe8272ffa5f02518045..621898863371959d822edcde0f83c8a4d2757972 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PersistencyService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PersistencyService.java @@ -49,7 +49,7 @@ import org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorag import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.PersistencyServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.PersistencyKISSDetailsItem; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.ILibraryService; import org.fortiss.tooling.kernel.service.IPersistencyService; @@ -378,7 +378,7 @@ public class PersistencyService implements IPersistencyService, IIntrospectiveKe /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new PersistencyServiceIntrospectionDetailsItem( + return new PersistencyKISSDetailsItem( unmodifiableList(storageProviderList)); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PrototypeService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PrototypeService.java index cf8e6fa96ba9c2f65b24400054ed68e93238a975..04093ccaea091776e8ed6f8fc723a62e4619ddb6 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PrototypeService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/PrototypeService.java @@ -37,7 +37,7 @@ import org.fortiss.tooling.kernel.extension.data.PrototypeCategory; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.PrototypeServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.PrototypeKISSDetailsItem; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.IPrototypeService; @@ -236,6 +236,6 @@ public class PrototypeService implements IPrototypeService, IIntrospectiveKernel /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new PrototypeServiceIntrospectionDetailsItem(prototypeProviderList); + return new PrototypeKISSDetailsItem(prototypeProviderList); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/TransformationService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/TransformationService.java index 3cdb86fe920158f93cd9466c6ef9697b2dd8ca7f..64ee4fb5ccc623f8acfba20866fc2b0944c4adab 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/TransformationService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/TransformationService.java @@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.extension.exception.TransformationFailedExcept import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.TransformationServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.TransformationKISSDetailsItem; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.ITransformationService; import org.fortiss.tooling.kernel.service.base.ObjectAware2ServiceBase; @@ -213,6 +213,6 @@ public class TransformationService extends ObjectAware2ServiceBase<ITransformati /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new TransformationServiceIntrospectionDetailsItem(handlersBySource); + return new TransformationKISSDetailsItem(handlersBySource); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings index 605b741d853bf1e95bbf06c68ab9a477dea3beb5..0eae779d6882320da1e58a473bd81f9bf3b3b4c2 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/.ratings @@ -1,5 +1,5 @@ AutoUndoCommandStack.java fc326adf66c6cea2354884cdc240da5f2f82689a GREEN EMFTransactionalCommand.java ba4b5bead9768b6ce6c955b9238cd96cb722533c GREEN -EclipseResourceStorageService.java e29e32272286921c5e43963253902b3ba54490c7 GREEN +EclipseResourceStorageService.java e917c822c53eacada70188e66215d91241a29a5c GREEN ModelContext.java db1735834c85e7b508266f56463d011f2b72af0e GREEN NonDirtyingEMFTransactionalCommand.java d288ebe35d22442c603496b0c917fb99a8febeea GREEN diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageService.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageService.java index e29e32272286921c5e43963253902b3ba54490c7..e917c822c53eacada70188e66215d91241a29a5c 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageService.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageService.java @@ -62,7 +62,7 @@ import org.fortiss.tooling.kernel.extension.data.ModelStorageError; import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; import org.fortiss.tooling.kernel.introspection.IIntrospectionItem; import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService; -import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageServiceIntrospectionDetailsItem; +import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageKISSDetailsItem; import org.fortiss.tooling.kernel.service.IEclipseResourceStorageService; import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService; import org.fortiss.tooling.kernel.service.IMigrationService; @@ -380,7 +380,7 @@ public class EclipseResourceStorageService /** {@inheritDoc} */ @Override public IIntrospectionDetailsItem getDetailsItem() { - return new EclipseResourceStorageServiceIntrospectionDetailsItem( + return new EclipseResourceStorageKISSDetailsItem( unmodifiableList(storageProviderList), unmodifiableSet(loadedContexts.keySet()), unmodifiableList(errorFiles)); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/.ratings b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/.ratings index 4d68392c608bdb58c04bcb591a4119a9a93348a7..13afc760803d6b4a301f485a54102dc9c4692244 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/.ratings +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/.ratings @@ -1,13 +1,12 @@ -ConnectionCompositorServiceIntrospectionDetailsItem.java c6befabe02548ce9ecb0f22731fe6381b1157934 GREEN -ConstraintCheckerServiceIntrospectionDetailsItem.java d298a458c082340ae1fd661515b3f377025956e9 GREEN -ConstraintVerificationServiceIntrospectionDetailsItem.java 9499a4b7ffa68d0090bb27e8cd9da13381f298c7 GREEN -EObjectAware2IntrospectionDetailsItemBase.java 989074df3614be4e2bbe08d42f131e6e28f76be1 GREEN -EObjectAwareIntrospectionDetailsItemBase.java 9da902642592eef8ab9ef6fa81afca04a487cd02 GREEN -EclipseResourceStorageServiceIntrospectionDetailsItem.java 029a4571636c00694d89cd3bd23890013788c694 GREEN -ElementCompositorServiceIntrospectionDetailsItem.java 7b500c302eacec901c341b595a4376077d343805 GREEN -HandlerListIntrospectionDetailsItemBase.java c715c41a16949e242d41bd4aaacc5e60ec038ad3 GREEN -LibraryServiceIntrospectionDetailsItem.java e28c0d0c68d78c302631453e5d81fa51726d4f14 GREEN -MigrationServiceIntrospectionDetailsItem.java bd1047ae6790bdfceac484b6fcf50fa9c8d229de GREEN -PersistencyServiceIntrospectionDetailsItem.java a7009895eed0e9d662be1639a31c27ff4114a676 GREEN -PrototypeServiceIntrospectionDetailsItem.java 6f108541a632c33dbc5a547d7f7908c0287f9a67 GREEN -TransformationServiceIntrospectionDetailsItem.java c0a076c3feaae46ffe7374c0926c1a81e3bb05ca GREEN +ConnectionCompositorKISSDetailsItem.java b5c705a339240fe38045dfafe2832994bfe7f8f9 GREEN +ConstraintCheckerKISSDetailsItem.java 231b58db35fd6e16c568d3e58741f48c10e9f991 GREEN +EObjectAware2KISSDetailsItemBase.java 4b0a7db4a86790ba8483fd9e89cef6a58f197955 GREEN +EObjectAwareKISSDetailsItemBase.java 45d235bff6440100df2c5b0bd9ab7c60ca5e6fb8 GREEN +EclipseResourceStorageKISSDetailsItem.java d2a9cd0310528a518364e0be6cc65ac97f551109 GREEN +ElementCompositorKISSDetailsItem.java 932775656f0afa0de489497617f30d78f7044ca7 GREEN +HandlerListKISSDetailsItemBase.java 8ef06b5ba28b0d4e1ecf17c7fd4489a5287e36d4 GREEN +LibraryKISSDetailsItem.java d23d29838c290d14b2b2cf99d4b2c2f2e2d6f6b7 GREEN +MigrationKISSDetailsItem.java 2411c72ca2c0637ae6966c89fbd4f4c3bc55ba04 GREEN +PersistencyKISSDetailsItem.java 1afa6a1254150a4dd61bc9c22837ac442931d524 GREEN +PrototypeKISSDetailsItem.java 4af5eda84a717ca471c70d4e801a17a103ec391b GREEN +TransformationKISSDetailsItem.java f2fc5a23bbc911f66c91d8d0b6ce3e03db369447 GREEN diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorKISSDetailsItem.java similarity index 88% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorKISSDetailsItem.java index c6befabe02548ce9ecb0f22731fe6381b1157934..b5c705a339240fe38045dfafe2832994bfe7f8f9 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConnectionCompositorKISSDetailsItem.java @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public final class ConnectionCompositorServiceIntrospectionDetailsItem extends - EObjectAware2IntrospectionDetailsItemBase<IConnectionCompositor<EObject, EObject, EObject>> { +public final class ConnectionCompositorKISSDetailsItem extends + EObjectAware2KISSDetailsItemBase<IConnectionCompositor<EObject, EObject, EObject>> { /** Constructor. */ - public ConnectionCompositorServiceIntrospectionDetailsItem( + public ConnectionCompositorKISSDetailsItem( Map<Class<?>, Map<Class<?>, List<IConnectionCompositor<EObject, EObject, EObject>>>> handlersBySource) { super(handlersBySource); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerKISSDetailsItem.java similarity index 89% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerKISSDetailsItem.java index d298a458c082340ae1fd661515b3f377025956e9..231b58db35fd6e16c568d3e58741f48c10e9f991 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ConstraintCheckerKISSDetailsItem.java @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.service.IConstraintCheckerService; * * @author hoelzl */ -public final class ConstraintCheckerServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IConstraintChecker<EObject>> { +public final class ConstraintCheckerKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IConstraintChecker<EObject>> { /** Constructor. */ - public ConstraintCheckerServiceIntrospectionDetailsItem( + public ConstraintCheckerKISSDetailsItem( Map<Class<?>, List<IConstraintChecker<EObject>>> handlerMap) { super(handlerMap); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2IntrospectionDetailsItemBase.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2KISSDetailsItemBase.java similarity index 96% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2IntrospectionDetailsItemBase.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2KISSDetailsItemBase.java index 989074df3614be4e2bbe08d42f131e6e28f76be1..4b0a7db4a86790ba8483fd9e89cef6a58f197955 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2IntrospectionDetailsItemBase.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAware2KISSDetailsItemBase.java @@ -35,14 +35,14 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public abstract class EObjectAware2IntrospectionDetailsItemBase<T extends Object> +public abstract class EObjectAware2KISSDetailsItemBase<T extends Object> implements IIntrospectionDetailsItem { /** Read-only copy of the services handler list. */ protected final Map<Class<?>, Map<Class<?>, List<T>>> handlerMap; /** Constructor. */ - public EObjectAware2IntrospectionDetailsItemBase( + public EObjectAware2KISSDetailsItemBase( Map<Class<?>, Map<Class<?>, List<T>>> handlerMap) { this.handlerMap = handlerMap; } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareIntrospectionDetailsItemBase.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareKISSDetailsItemBase.java similarity index 93% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareIntrospectionDetailsItemBase.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareKISSDetailsItemBase.java index 9da902642592eef8ab9ef6fa81afca04a487cd02..45d235bff6440100df2c5b0bd9ab7c60ca5e6fb8 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareIntrospectionDetailsItemBase.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EObjectAwareKISSDetailsItemBase.java @@ -33,14 +33,14 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public abstract class EObjectAwareIntrospectionDetailsItemBase<T extends Object> +public abstract class EObjectAwareKISSDetailsItemBase<T extends Object> implements IIntrospectionDetailsItem { /** Read-only copy of the services handler list. */ protected final Map<Class<?>, List<T>> handlerMap; /** Constructor. */ - public EObjectAwareIntrospectionDetailsItemBase(Map<Class<?>, List<T>> handlerMap) { + public EObjectAwareKISSDetailsItemBase(Map<Class<?>, List<T>> handlerMap) { this.handlerMap = handlerMap; } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageKISSDetailsItem.java similarity index 95% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageKISSDetailsItem.java index 029a4571636c00694d89cd3bd23890013788c694..d2a9cd0310528a518364e0be6cc65ac97f551109 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/EclipseResourceStorageKISSDetailsItem.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.service.IEclipseResourceStorageService; * * @author hoelzl */ -public final class EclipseResourceStorageServiceIntrospectionDetailsItem +public final class EclipseResourceStorageKISSDetailsItem implements IIntrospectionDetailsItem { /** Stores the registered storage providers. */ @@ -42,7 +42,7 @@ public final class EclipseResourceStorageServiceIntrospectionDetailsItem private final List<ModelStorageError> errorFiles; /** Constructor. */ - public EclipseResourceStorageServiceIntrospectionDetailsItem( + public EclipseResourceStorageKISSDetailsItem( List<IEclipseResourceStorageLocationProvider> storageProviderList, Collection<IFile> loadedContexts, List<ModelStorageError> errorFiles) { this.storageProviderList = storageProviderList; diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorKISSDetailsItem.java similarity index 89% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorKISSDetailsItem.java index 7b500c302eacec901c341b595a4376077d343805..932775656f0afa0de489497617f30d78f7044ca7 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/ElementCompositorKISSDetailsItem.java @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public final class ElementCompositorServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IElementCompositor<EObject>> { +public final class ElementCompositorKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IElementCompositor<EObject>> { /** Constructor. */ - public ElementCompositorServiceIntrospectionDetailsItem( + public ElementCompositorKISSDetailsItem( Map<Class<?>, List<IElementCompositor<EObject>>> handlers) { super(handlers); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListIntrospectionDetailsItemBase.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListKISSDetailsItemBase.java similarity index 92% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListIntrospectionDetailsItemBase.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListKISSDetailsItemBase.java index c715c41a16949e242d41bd4aaacc5e60ec038ad3..8ef06b5ba28b0d4e1ecf17c7fd4489a5287e36d4 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListIntrospectionDetailsItemBase.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/HandlerListKISSDetailsItemBase.java @@ -28,14 +28,14 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public abstract class HandlerListIntrospectionDetailsItemBase<T extends Object> +public abstract class HandlerListKISSDetailsItemBase<T extends Object> implements IIntrospectionDetailsItem { /** Read-only copy of the services handler list. */ protected final List<T> handlerList; /** Constructor. */ - public HandlerListIntrospectionDetailsItemBase(List<T> handlerList) { + public HandlerListKISSDetailsItemBase(List<T> handlerList) { this.handlerList = handlerList; } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryKISSDetailsItem.java similarity index 89% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryKISSDetailsItem.java index e28c0d0c68d78c302631453e5d81fa51726d4f14..d23d29838c290d14b2b2cf99d4b2c2f2e2d6f6b7 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/LibraryKISSDetailsItem.java @@ -28,11 +28,11 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public final class LibraryServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<ILibraryElementHandler<EObject>> { +public final class LibraryKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<ILibraryElementHandler<EObject>> { /** Constructor. */ - public LibraryServiceIntrospectionDetailsItem( + public LibraryKISSDetailsItem( Map<Class<?>, List<ILibraryElementHandler<EObject>>> handlerMap) { super(handlerMap); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationKISSDetailsItem.java similarity index 90% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationKISSDetailsItem.java index bd1047ae6790bdfceac484b6fcf50fa9c8d229de..2411c72ca2c0637ae6966c89fbd4f4c3bc55ba04 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/MigrationKISSDetailsItem.java @@ -27,11 +27,11 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem; * * @author hoelzl */ -public final class MigrationServiceIntrospectionDetailsItem - extends EObjectAwareIntrospectionDetailsItemBase<IMigrationProvider> { +public final class MigrationKISSDetailsItem + extends EObjectAwareKISSDetailsItemBase<IMigrationProvider> { /** Constructor. */ - public MigrationServiceIntrospectionDetailsItem( + public MigrationKISSDetailsItem( Map<Class<?>, List<IMigrationProvider>> handlers) { super(handlers); } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyKISSDetailsItem.java similarity index 90% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyKISSDetailsItem.java index a7009895eed0e9d662be1639a31c27ff4114a676..1afa6a1254150a4dd61bc9c22837ac442931d524 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PersistencyKISSDetailsItem.java @@ -26,13 +26,13 @@ import org.fortiss.tooling.kernel.service.IPersistencyService; * * @author hoelzl */ -public final class PersistencyServiceIntrospectionDetailsItem implements IIntrospectionDetailsItem { +public final class PersistencyKISSDetailsItem implements IIntrospectionDetailsItem { /** The storage providers. */ private final Collection<IStorageProvider> providers; /** Constructor. */ - public PersistencyServiceIntrospectionDetailsItem(Collection<IStorageProvider> providers) { + public PersistencyKISSDetailsItem(Collection<IStorageProvider> providers) { this.providers = providers; } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeKISSDetailsItem.java similarity index 87% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeKISSDetailsItem.java index 6f108541a632c33dbc5a547d7f7908c0287f9a67..4af5eda84a717ca471c70d4e801a17a103ec391b 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/PrototypeKISSDetailsItem.java @@ -26,11 +26,11 @@ import org.fortiss.tooling.kernel.service.IPrototypeService; * * @author hoelzl */ -public final class PrototypeServiceIntrospectionDetailsItem - extends HandlerListIntrospectionDetailsItemBase<IPrototypeProvider> { +public final class PrototypeKISSDetailsItem + extends HandlerListKISSDetailsItemBase<IPrototypeProvider> { /** Constructor. */ - public PrototypeServiceIntrospectionDetailsItem(List<IPrototypeProvider> handlerList) { + public PrototypeKISSDetailsItem(List<IPrototypeProvider> handlerList) { super(handlerList); } } diff --git a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationServiceIntrospectionDetailsItem.java b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationKISSDetailsItem.java similarity index 89% rename from org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationServiceIntrospectionDetailsItem.java rename to org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationKISSDetailsItem.java index c0a076c3feaae46ffe7374c0926c1a81e3bb05ca..f2fc5a23bbc911f66c91d8d0b6ce3e03db369447 100644 --- a/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationServiceIntrospectionDetailsItem.java +++ b/org.fortiss.tooling.kernel/src/org/fortiss/tooling/kernel/introspection/items/TransformationKISSDetailsItem.java @@ -27,11 +27,11 @@ import org.fortiss.tooling.kernel.service.ITransformationService; * * @author hoelzl */ -public final class TransformationServiceIntrospectionDetailsItem - extends EObjectAware2IntrospectionDetailsItemBase<ITransformationProvider> { +public final class TransformationKISSDetailsItem + extends EObjectAware2KISSDetailsItemBase<ITransformationProvider> { /** Constructor. */ - public TransformationServiceIntrospectionDetailsItem( + public TransformationKISSDetailsItem( Map<Class<?>, Map<Class<?>, List<ITransformationProvider>>> handlerMap) { super(handlerMap); }