diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/.ratings index 12467927525d334654803c4f29f212de9bb6ad4c..200faabbb6032efeccae72d1fb5d7f129597312b 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/.ratings @@ -1,2 +1,2 @@ GraphicUtils.java 9373a2c7a5ebb0d87284d0f6f983348812e5b90d GREEN -JavaFXUtils.java db3cf28289109ffec64c8f96c7b2de779a977b3b GREEN +JavaFXUtils.java 1f7d16c1af5ba938276c09f5ecb89c6add84061e GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/JavaFXUtils.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/JavaFXUtils.java index db3cf28289109ffec64c8f96c7b2de779a977b3b..1f7d16c1af5ba938276c09f5ecb89c6add84061e 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/JavaFXUtils.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/util/JavaFXUtils.java @@ -26,6 +26,7 @@ import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.Tooltip; /** * Utility methods for {@link Scene} graph. @@ -197,4 +198,14 @@ public final class JavaFXUtils { } return null; } + + /** + * Creates a tooltip with the given text, yellow background and black font. The standard tooltip + * is white font on yellow background which is hardly readable. + */ + public static Tooltip createToolTip(String description) { + Tooltip value = new Tooltip(description); + value.setStyle("-fx-background-color: yellow; -fx-text-fill: black;"); + return value; + } } diff --git a/org.fortiss.tooling.kernel.ui/.classpath b/org.fortiss.tooling.kernel.ui/.classpath index 8e91bb2b015125cb38f46704cbab9dee0ed07166..4eba2db1f9df658b65a02ba6639e3066fefa2536 100644 --- a/org.fortiss.tooling.kernel.ui/.classpath +++ b/org.fortiss.tooling.kernel.ui/.classpath @@ -6,6 +6,6 @@ </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> + <classpathentry excluding="org/fortiss/tooling/kernel/ui/internal/views/MarkerViewEditorFX/SimpleAnnotationTableFXController.java|org/fortiss/tooling/kernel/ui/internal/views/MarkerViewEditorFX/SimpleAnnotationTableFXViewPart.java" kind="src" path="src"/> <classpathentry kind="output" path="build"/> </classpath> diff --git a/org.fortiss.tooling.kernel.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.kernel.ui/META-INF/MANIFEST.MF index 42452ac708700fc5d00ba48a053d87656216458a..6ef02a93991a98d4e4402e95f0ba0ed432aebd1d 100644 --- a/org.fortiss.tooling.kernel.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.kernel.ui/META-INF/MANIFEST.MF @@ -30,3 +30,7 @@ Export-Package: org.fortiss.tooling.kernel.ui, org.fortiss.tooling.kernel.ui.util Bundle-ClassPath: . Automatic-Module-Name: org.fortiss.tooling.kernel.ui +Import-Package: org.fortiss.af3.expression.model.definitions, + org.fortiss.af3.project.model.typesystem, + org.fortiss.tooling.base.model.base, + org.fortiss.tooling.base.model.element diff --git a/org.fortiss.tooling.kernel.ui/build.properties b/org.fortiss.tooling.kernel.ui/build.properties index 18adab1cb32cf9127272831fd9b0de8a362e33e7..1554d67f7ff1243b04701de95399865c40b8da7f 100644 --- a/org.fortiss.tooling.kernel.ui/build.properties +++ b/org.fortiss.tooling.kernel.ui/build.properties @@ -5,6 +5,7 @@ output.. = build/ bin.includes = .,\ plugin.xml,\ icons/,\ - META-INF/ + META-INF/,\ + src/ src.includes = schema/,\ icons/ diff --git a/org.fortiss.tooling.kernel.ui/plugin.xml b/org.fortiss.tooling.kernel.ui/plugin.xml index 49ada2a0098929caeaf43f51087c5eeed666d69c..a88f3123f8c29f582b158518cc76c0a3082b1d2e 100644 --- a/org.fortiss.tooling.kernel.ui/plugin.xml +++ b/org.fortiss.tooling.kernel.ui/plugin.xml @@ -32,13 +32,6 @@ name="Model Navigator" restorable="true"> </view> - <view - class="org.fortiss.tooling.kernel.ui.internal.views.MarkerViewPart" - icon="icons/marker_view.gif" - id="org.fortiss.tooling.kernel.model.marker" - name="Model Markers" - restorable="true"> - </view> <view class="org.fortiss.tooling.kernel.ui.internal.views.ModelElementsViewFX" icon="icons/library.png" @@ -54,13 +47,23 @@ name="Kernel Introspection System Service (KISS)" restorable="true"> </view> - <view - class="org.fortiss.tooling.kernel.ui.internal.views.library.LibraryViewPart" - icon="icons/library.png" - id="org.fortiss.tooling.kernel.ui.internal.views.library.LibraryViewPart" - name="Library View" - restorable="true"> - </view> + + <view + class="org.fortiss.tooling.kernel.ui.internal.views.fx.ErrorViewFXViewPart" + icon="icons/marker_view.gif" + id="org.fortiss.tooling.kernel.ui.internal.views.fx.ErrorViewFXViewPart" + name="Marker View FX" + restorable="true"> + </view> + <view + class="org.fortiss.tooling.kernel.ui.internal.views.MarkerViewPart" + id="org.fortiss.tooling.kernel.ui.internal.views.MarkerViewPart" + name="Marker View OLD" + restorable="true"> + </view> + + + </extension> <extension point="org.eclipse.core.runtime.adapters"> diff --git a/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayout.fxml b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayout.fxml new file mode 100644 index 0000000000000000000000000000000000000000..362cfe0ea00076ba089c52f110c7bce403f42e46 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/res/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayout.fxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.ScrollPane?> +<?import javafx.scene.control.ToggleButton?> +<?import javafx.scene.layout.BorderPane?> +<?import javafx.scene.layout.HBox?> +<?import javafx.scene.layout.VBox?> + +<ScrollPane fitToHeight="true" fitToWidth="true" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1"> + <content> + <VBox> + <children> + <HBox> + <children> + <ToggleButton fx:id="errorBtn" mnemonicParsing="false" onAction="#onErrorBtn" text="Error" /> + <ToggleButton fx:id="infoBtn" mnemonicParsing="false" onAction="#onInfoBtn" text="Info" /> + <ToggleButton fx:id="debugBtn" mnemonicParsing="false" onAction="#onDebugBtn" text="Debug" /> + <ToggleButton fx:id="warningBtn" mnemonicParsing="false" onAction="#onWarningBtn" text="Warning" /> + <ToggleButton fx:id="fatalBtn" mnemonicParsing="false" onAction="#onFatalBtn" text="Fatal" /> + </children> + </HBox> + <BorderPane fx:id="pane" /> + </children> + </VBox> + </content> +</ScrollPane> diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/.ratings index 4c8db7b8f82b4874d000ac500f3dfbe3033ec88e..941c3827afea9599130f4cfb4b550933b0bcb478 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/.ratings @@ -1,3 +1,3 @@ ESharedImages.java d33fea62344c1654b5da296fb51a18098cb09eed GREEN ToolingKernelUI.java 250e5dde230272e286aa8d327fd597cf542774fe GREEN -ToolingKernelUIActivator.java fc281e60592e54bd606d0b6667168afdfde8389e GREEN +ToolingKernelUIActivator.java 94420418da064146fbbf40244d5a5b0d277696bf GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java index fc281e60592e54bd606d0b6667168afdfde8389e..94420418da064146fbbf40244d5a5b0d277696bf 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/ToolingKernelUIActivator.java @@ -31,6 +31,8 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; import org.fortiss.tooling.kernel.ui.service.INavigatorService; import org.osgi.framework.BundleContext; +import javafx.scene.image.ImageView; + /** * The activator class controls the plug-in life cycle. * @@ -91,4 +93,14 @@ public class ToolingKernelUIActivator extends AbstractUIPlugin { protected void initializeImageRegistry(ImageRegistry registry) { ESharedImages.registerImages(registry); } + + /** Returns an FX {@link ImageView} for the given icon path. Null otherwise. */ + public static ImageView getFXImage(String iconPath) { + try { + ImageView iv = new ImageView(iconPath); + return iv; + } catch(NullPointerException | IllegalArgumentException e) { + return null; + } + } } 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 bb65e43fe71feacf8e73f7fb1bd1b652bdc7564e..d42e678844b8badac5fc16e0c78df8b2e695f121 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 @@ -2,7 +2,7 @@ ActionService.java e29126b5947c9fd2f1d82bb87001b9d0ead50c3b GREEN AllocationEditPartFactoryService.java 81bd227736013f1157ba9d0f79a9f3deefe10064 GREEN ContextMenuService.java ca3c899293f25b70ce8e5f0d86ca2f9683329d81 GREEN EditPartFactoryService.java e9180c0020f1769d9e24ef3c08f9ca5599dbc5c3 GREEN -MarkerService.java 208f97f3ccabf0947702a17ddca23d8766a268f4 GREEN +MarkerService.java 505296c356f8d66c5c009b6d6181a971d02a9501 GREEN ModelEditorBindingService.java d980691db4b700714c0669050014d08751354d5e GREEN ModelElementHandlerService.java eeb07f6926012aa98256d452d1e554a5486dc657 GREEN NavigatorService.java 1d773dde3791ddf7051616fe249558e7e307757d GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java index 208f97f3ccabf0947702a17ddca23d8766a268f4..505296c356f8d66c5c009b6d6181a971d02a9501 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java @@ -17,6 +17,7 @@ package org.fortiss.tooling.kernel.ui.internal; import static java.util.Collections.emptyList; import static java.util.Collections.sort; +import static org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator.getFXImage; import static org.fortiss.tooling.kernel.ui.ToolingKernelUIActivator.getImageDescriptor; import static org.fortiss.tooling.kernel.utils.EcoreUtils.postRefreshNotification; @@ -43,9 +44,11 @@ import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.service.IConstraintCheckerService; import org.fortiss.tooling.kernel.service.IPersistencyService; import org.fortiss.tooling.kernel.service.listener.IPersistencyServiceListener; -import org.fortiss.tooling.kernel.ui.internal.views.MarkerViewPart; +import org.fortiss.tooling.kernel.ui.internal.views.fx.ErrorViewFXLayoutController; import org.fortiss.tooling.kernel.ui.service.IMarkerService; +import javafx.scene.image.ImageView; + /** * This class implements the {@link IMarkerService} interface. * @@ -77,8 +80,8 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene private final UIJob updateUI = new UIJob("Update Model Decorators") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { - if(markerView != null) { - markerView.refresh(); + if(markerController != null) { + markerController.refresh(); } return Status.OK_STATUS; } @@ -91,7 +94,7 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene private final List<ITopLevelElement> invalidElements = new LinkedList<ITopLevelElement>(); /** Stores the marker view. */ - private MarkerViewPart markerView; + private ErrorViewFXLayoutController markerController; /** Stores the constraint checking job. */ private final Job constraintCheckerJob = new Job("Model Constraint Checker Job") { @@ -139,8 +142,8 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene } /** Sets the current marker view. */ - public void setMarkerViewPart(MarkerViewPart view) { - this.markerView = view; + public void setMarkerViewPart(ErrorViewFXLayoutController errorViewFXLayoutController) { + this.markerController = errorViewFXLayoutController; } /** {@inheritDoc} */ @@ -388,6 +391,30 @@ public class MarkerService implements IMarkerService, IPersistencyServiceListene return list; } + /** {@inheritDoc} */ + @Override + public ImageView getFXImageFor(ESeverity severity, boolean smallDecoration) { + switch(severity) { + case FATAL: + return getFXImage("icons/fatal.gif"); + case ERROR: + if(smallDecoration) { + return getFXImage("icons/error_small.gif"); + } + return getFXImage("icons/error.gif"); + case WARNING: + if(smallDecoration) { + return getFXImage("icons/warning_small.gif"); + } + return getFXImage("icons/warning.gif"); + case INFO: + return getFXImage("icons/info.gif"); + case DEBUG: + return getFXImage("icons/debug.gif"); + } + return null; + } + /** {@inheritDoc} */ @Override public ImageDescriptor getImageFor(ESeverity severity, boolean smallDecoration) { diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewContentProvider.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewContentProvider.java deleted file mode 100644 index 4cb1192baebe21bca951c439c163d0c171512515..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewContentProvider.java +++ /dev/null @@ -1,90 +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.views; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; -import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; -import org.fortiss.tooling.kernel.ui.service.IMarkerService; - -/** - * Content provider for the {@link MarkerViewPart}. - * - * @author hoelzl - */ -public class MarkerViewContentProvider implements ITreeContentProvider { - /** The marker view of this provider. */ - private final MarkerViewPart markerView; - - /** Constructor. */ - public MarkerViewContentProvider(MarkerViewPart markerViewPart) { - this.markerView = markerViewPart; - } - - /** {@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 instanceof IConstraintViolation<?>) { - return ((IConstraintViolation<?>)element).getSeverity(); - } - return null; - } - - /** {@inheritDoc} */ - @Override - public Object[] getElements(Object inputElement) { - List<ESeverity> result = new ArrayList<ESeverity>(); - for(ESeverity sev : ESeverity.values()) { - if(sev != ESeverity.lowest() && markerView.getToggleState(sev)) { - result.add(sev); - } - } - return result.toArray(); - } - - /** {@inheritDoc} */ - @Override - public Object[] getChildren(Object parentElement) { - if(parentElement instanceof ESeverity) { - return IMarkerService.getInstance() - .getAllViolationsWithSeverity((ESeverity)parentElement).toArray(); - } - return null; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java deleted file mode 100644 index cbb650271b6877af205421b7cb11f930440a7ef9..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java +++ /dev/null @@ -1,226 +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.views; - -import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.DEBUG; -import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.ERROR; -import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.FATAL; -import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.INFO; -import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.WARNING; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.part.ViewPart; -import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; -import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; -import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; -import org.fortiss.tooling.kernel.service.IPersistencyService; -import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; -import org.fortiss.tooling.kernel.ui.internal.MarkerService; -import org.fortiss.tooling.kernel.ui.service.IMarkerService; -import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; - -/** - * {@link ViewPart} for the marker display. - * - * @author hoelzl - */ -public class MarkerViewPart extends ViewPart { - - /** Stores the toggle state of for each severity level. */ - private Map<ESeverity, Boolean> toggleState = new HashMap<ESeverity, Boolean>(); - - /** GUI builder viewer instance. */ - private MarkerViewerGUI gui; - - /** Toggle expert severity filter actions. */ - private Action[] toggleSeverityFilterAction = new Action[5]; - - /** Constructor. */ - public MarkerViewPart() { - ((MarkerService)IMarkerService.getInstance()).setMarkerViewPart(this); - toggleState.put(DEBUG, false); - toggleState.put(INFO, false); - toggleState.put(WARNING, true); - toggleState.put(ERROR, true); - toggleState.put(FATAL, false); - } - - /** {@inheritDoc} */ - @Override - @SuppressWarnings("unchecked") - public void createPartControl(Composite parent) { - parent.setLayout(new FillLayout()); - gui = new MarkerViewerGUI(parent, SWT.NONE); - gui.getTreeViewer().setContentProvider(new MarkerViewContentProvider(this)); - gui.getSeverityColumn().setLabelProvider(new CellLabelProvider() { - @Override - public void update(ViewerCell cell) { - if(cell.getElement() instanceof ESeverity) { - final ESeverity severity = (ESeverity)cell.getElement(); - cell.setText(severity.toString()); - cell.setImage(IMarkerService.getInstance().getSharedImageFor(severity, false)); - } else { - cell.setText(""); - } - } - }); - gui.getElementColumn().setLabelProvider(new CellLabelProvider() { - @Override - public void update(ViewerCell cell) { - if(cell.getElement() instanceof IConstraintViolation) { - IConstraintViolation<? extends EObject> violation = - (IConstraintViolation<? extends EObject>)cell.getElement(); - IModelElementHandlerService hs = IModelElementHandlerService.getInstance(); - IModelElementHandler<EObject> handler = - hs.getModelElementHandler(violation.getSource()); - cell.setText(handler != null ? handler.getName(violation.getSource()) : ""); - } else { - cell.setText(""); - } - } - }); - gui.getExplanationColumn().setLabelProvider(new CellLabelProvider() { - @Override - public void update(ViewerCell cell) { - if(cell.getElement() instanceof IConstraintViolation) { - IConstraintViolation<? extends EObject> violation = - (IConstraintViolation<? extends EObject>)cell.getElement(); - cell.setText(violation.getExplanation()); - } else { - cell.setText(""); - } - } - }); - - gui.getProjectColumn().setLabelProvider(new CellLabelProvider() { - @Override - public void update(ViewerCell cell) { - if(cell.getElement() instanceof IConstraintViolation) { - IConstraintViolation<? extends EObject> violation = - (IConstraintViolation<? extends EObject>)cell.getElement(); - IPersistencyService ps = IPersistencyService.getInstance(); - ITopLevelElement topElement = ps.getTopLevelElementFor(violation.getSource()); - - IModelElementHandler<EObject> handler = null; - EObject rootElement = null; - if(topElement != null) { - rootElement = topElement.getRootModelElement(); - - IModelElementHandlerService hs = IModelElementHandlerService.getInstance(); - handler = hs.getModelElementHandler(rootElement); - } - cell.setText(handler != null ? handler.getName(rootElement) : ""); - } else { - cell.setText(""); - } - } - }); - - ColumnViewerToolTipSupport.enableFor(gui.getElementColumn().getViewer()); - ColumnViewerToolTipSupport.enableFor(gui.getExplanationColumn().getViewer()); - ColumnViewerToolTipSupport.enableFor(gui.getProjectColumn().getViewer()); - - gui.getTreeViewer().addDoubleClickListener(new DoubleClick(true) { - /** {@inheritDoc} */ - @Override - protected EObject getDoubleClickedElement(IStructuredSelection selection) { - if(selection.getFirstElement() instanceof IConstraintViolation) { - return ((IConstraintViolation<EObject>)selection.getFirstElement()) - .getContainer(); - } - return super.getDoubleClickedElement(selection); - } - }); - gui.getTreeViewer().setInput(IMarkerService.getInstance()); - - createToggleActions(); - } - - /** {@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(); - } - } - - /** Returns toggleState. */ - /* package */Boolean getToggleState(ESeverity sev) { - return toggleState.get(sev); - } - - /** Creates the toggle actions. */ - private void createToggleActions() { - toggleSeverityFilterAction[0] = - new SeverityFilterAction("D", "Toggle DEBUG Messages", DEBUG); - toggleSeverityFilterAction[1] = new SeverityFilterAction("I", "Toggle INFO Messages", INFO); - toggleSeverityFilterAction[2] = - new SeverityFilterAction("W", "Toggle WARNING Messages", WARNING); - toggleSeverityFilterAction[3] = - new SeverityFilterAction("E", "Toggle ERROR Messages", ERROR); - toggleSeverityFilterAction[4] = - new SeverityFilterAction("F", "Toggle FATAL Messages", FATAL); - - IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); - Separator additionsSeperator = new Separator("additions"); - additionsSeperator.setVisible(true); - toolBarManager.add(additionsSeperator); - for(int i = 0; i < toggleSeverityFilterAction.length; i++) { - toolBarManager.insertAfter("additions", toggleSeverityFilterAction[i]); - } - } - - /** Action for severity filter toggle. */ - private class SeverityFilterAction extends Action { - /** Stores the severity level this action toggles. */ - private final ESeverity severity; - - /** Constructor. */ - public SeverityFilterAction(String name, String tooltip, ESeverity severity) { - super(name, SWT.TOGGLE); - this.severity = severity; - setToolTipText(tooltip); - setChecked(toggleState.get(severity)); - setImageDescriptor(IMarkerService.getInstance().getImageFor(severity, false)); - } - - /** {@inheritDoc} */ - @Override - public void run() { - // invert state - toggleState.put(severity, !toggleState.get(severity)); - refresh(); - } - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewerGUI.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewerGUI.java deleted file mode 100644 index 39be28060309b888872cc543c997b1aa53a8e7a9..0000000000000000000000000000000000000000 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewerGUI.java +++ /dev/null @@ -1,99 +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.views; - -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -/** - * GENERATED CODE (WindowBuilder) - * - * @author hoelzlf - */ -@SuppressWarnings("javadoc") -public class MarkerViewerGUI extends Composite { - private TreeViewer treeViewer; - private TreeViewerColumn treeViewerColumn; - private TreeViewerColumn treeViewerColumn_1; - private TreeViewerColumn treeViewerColumn_2; - private TreeViewerColumn treeViewerColumn_3; - - /** - * Create the composite. - * - * @param parent - * @param style - */ - public MarkerViewerGUI(Composite parent, int style) { - super(parent, style); - setLayout(new FillLayout(SWT.HORIZONTAL)); - - treeViewer = new TreeViewer(this, SWT.BORDER); - Tree tree = treeViewer.getTree(); - tree.setLinesVisible(true); - tree.setHeaderVisible(true); - - treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn trclmnSeverity = treeViewerColumn.getColumn(); - trclmnSeverity.setWidth(100); - trclmnSeverity.setText("Severity"); - - treeViewerColumn_1 = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn trclmnElement = treeViewerColumn_1.getColumn(); - trclmnElement.setWidth(100); - trclmnElement.setText("Element"); - - treeViewerColumn_3 = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn trclmnExplanation = treeViewerColumn_3.getColumn(); - trclmnExplanation.setWidth(302); - trclmnExplanation.setText("Explanation"); - - treeViewerColumn_2 = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn trclmnProject = treeViewerColumn_2.getColumn(); - trclmnProject.setWidth(100); - trclmnProject.setText("Project"); - } - - @Override - protected void checkSubclass() { - // Disable the check that prevents subclassing of SWT components - } - - public TreeViewer getTreeViewer() { - return treeViewer; - } - - public TreeViewerColumn getSeverityColumn() { - return treeViewerColumn; - } - - public TreeViewerColumn getElementColumn() { - return treeViewerColumn_1; - } - - public TreeViewerColumn getProjectColumn() { - return treeViewerColumn_2; - } - - public TreeViewerColumn getExplanationColumn() { - return treeViewerColumn_3; - } -} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/.ratings new file mode 100644 index 0000000000000000000000000000000000000000..a973120c509887bc315615f805e9b767f84205cf --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/.ratings @@ -0,0 +1,4 @@ +ErrorViewFXLayoutController.java 382b8014acf4b0c625817d6279dfcdd670296cb2 GREEN +ErrorViewFXViewPart.java f620022aef647d7a019be8afc5351fabde05dcee GREEN +MarkerViewFXContentProvider.java ecf92449414b2b8648ad151bc932189baa23dc12 GREEN +MarkerViewFXUIProvider.java c5719d95ac7bd5605fff65d6150eca8b9ca6fc02 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayoutController.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayoutController.java new file mode 100644 index 0000000000000000000000000000000000000000..382b8014acf4b0c625817d6279dfcdd670296cb2 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXLayoutController.java @@ -0,0 +1,171 @@ +/*-------------------------------------------------------------------------+ +| 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.internal.views.fx; + +import static org.fortiss.tooling.common.ui.javafx.util.JavaFXUtils.createToolTip; +import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.DEBUG; +import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.ERROR; +import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.FATAL; +import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.INFO; +import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity.WARNING; + +import java.util.HashMap; +import java.util.Map; + +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.common.ui.javafx.layout.CompositeFXControllerBase; +import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; +import org.fortiss.tooling.kernel.ui.internal.MarkerService; +import org.fortiss.tooling.kernel.ui.service.IMarkerService; + +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.ToggleButton; +import javafx.scene.image.ImageView; +import javafx.scene.layout.BorderPane; + +/** + * Controller class for the "marker view". References the FXML layout and contains all control + * logic. + * + * @author abid + */ + +public class ErrorViewFXLayoutController extends CompositeFXControllerBase<Node, Node> { + + /** Debug Button */ + @FXML + private ToggleButton debugBtn; + /** Info Button */ + @FXML + private ToggleButton infoBtn; + /** Warning Button */ + @FXML + private ToggleButton warningBtn; + /** Error Button */ + @FXML + private ToggleButton errorBtn; + /** Fatal Button */ + @FXML + private ToggleButton fatalBtn; + /** Border Pane for the tree table */ + @FXML + private BorderPane pane; + + /** Toggle State */ + private Map<ESeverity, Boolean> toggleState = new HashMap<ESeverity, Boolean>(); + /** Tree table */ + private DynamicTreeTableViewer<Object> treeTable; + + /** Constructor. */ + @SuppressWarnings("unchecked") + public ErrorViewFXLayoutController(Map<ESeverity, Boolean> toggleState) { + this.toggleState = toggleState; + ((MarkerService)IMarkerService.getInstance()).setMarkerViewPart(this); + } + + /** Called when debug checkbox is pushed. */ + public void onDebugBtn() { + toggleState.put(DEBUG, debugBtn.isSelected()); + refresh(); + } + + /** Called when info check-box is pushed. */ + public void onInfoBtn() { + toggleState.put(INFO, infoBtn.isSelected()); + refresh(); + } + + /** Called when warning check-box is pushed. */ + public void onWarningBtn() { + toggleState.put(WARNING, warningBtn.isSelected()); + refresh(); + } + + /** Called when error check-box is pushed. */ + public void onErrorBtn() { + toggleState.put(ERROR, errorBtn.isSelected()); + refresh(); + } + + /** Called when fatal check-box is pushed. */ + public void onFatalBtn() { + toggleState.put(FATAL, fatalBtn.isSelected()); + refresh(); + } + + /** {@inheritDoc} */ + @Override + public String getFXMLLocation() { + return "ErrorViewFXLayout.fxml"; + } + + /** Refreshes the tree table. */ + public void refresh() { + treeTable.update(); + } + + /** {@inheritDoc} */ + @Override + public void initialize() { + DynamicTreeContentProviderBase<Object> contentProvider = new MarkerViewFXContentProvider(); + DynamicTreeTableUIProviderBase<Object> uiProvider = new MarkerViewFXUIProvider(); + treeTable = new DynamicTreeTableViewer<Object>(toggleState, false, 2, contentProvider, + uiProvider); + treeTable.addColumn("Severity", 80); + treeTable.addColumn("Element", 80); + treeTable.addColumn("Explanation", 80); + treeTable.addColumn("Project", 80); + + // set up icons + ImageView debugImg = IMarkerService.getInstance().getFXImageFor(DEBUG, false); + debugBtn.setGraphic(debugImg); + debugBtn.setText(""); + debugBtn.setTooltip(createToolTip(DEBUG.name())); + toggleState.put(DEBUG, false); + + ImageView errorImg = IMarkerService.getInstance().getFXImageFor(ERROR, false); + errorBtn.setGraphic(errorImg); + errorBtn.setText(""); + errorBtn.setTooltip(createToolTip(ERROR.name())); + toggleState.put(ERROR, true); + errorBtn.setSelected(true); + + ImageView fatalImg = IMarkerService.getInstance().getFXImageFor(FATAL, false); + fatalBtn.setGraphic(fatalImg); + fatalBtn.setText(""); + fatalBtn.setTooltip(createToolTip(FATAL.name())); + toggleState.put(FATAL, false); + + ImageView infoImg = IMarkerService.getInstance().getFXImageFor(INFO, false); + infoBtn.setGraphic(infoImg); + infoBtn.setText(""); + infoBtn.setTooltip(createToolTip(INFO.name())); + toggleState.put(INFO, false); + + ImageView warnImg = IMarkerService.getInstance().getFXImageFor(WARNING, false); + warningBtn.setGraphic(warnImg); + warningBtn.setText(""); + warningBtn.setTooltip(createToolTip(WARNING.name())); + toggleState.put(WARNING, true); + warningBtn.setSelected(true); + + pane.setCenter(treeTable.getControl()); + refresh(); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXViewPart.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXViewPart.java new file mode 100644 index 0000000000000000000000000000000000000000..f620022aef647d7a019be8afc5351fabde05dcee --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/ErrorViewFXViewPart.java @@ -0,0 +1,51 @@ +/*-------------------------------------------------------------------------+ +| 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.internal.views.fx; + +import java.util.HashMap; +import java.util.Map; + +import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; +import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; + +/** + * JavaFX view part of the Marker View. + * + * Wrapper for the {@link ErrorViewFXViewPart}. This class can be referenced in the + * {@code plugin.xml} file to register the view. + * + * @author abid + */ + +public class ErrorViewFXViewPart extends AF3FXViewPart { + + /** The classes ID. */ + public static final String ID = ErrorViewFXViewPart.class.getName(); + + /** Stores the toggle state of for each severity level. */ + private static Map<ESeverity, Boolean> toggleState = new HashMap<ESeverity, Boolean>(); + + /** Constructor. */ + + public ErrorViewFXViewPart() throws Exception { + super(new ErrorViewFXLayoutController(toggleState), null); + } + + /** Returns toggleState. */ + /* package */Boolean getToggleState(ESeverity sev) { + return toggleState.get(sev); + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXContentProvider.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXContentProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..ecf92449414b2b8648ad151bc932189baa23dc12 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXContentProvider.java @@ -0,0 +1,54 @@ +/*-------------------------------------------------------------------------+ +| 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.internal.views.fx; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Map.Entry; + +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeContentProviderBase; +import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; +import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; +import org.fortiss.tooling.kernel.ui.service.IMarkerService; + +/** + * Content provider for the error marker view. + * + * @author abid + */ +public class MarkerViewFXContentProvider extends DynamicTreeContentProviderBase<Object> { + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override + public Collection<? extends Object> getChildren(Object parent) { + Map<ESeverity, Boolean> servList; + Collection<IConstraintViolation<?>> violation_list = + new ArrayList<IConstraintViolation<?>>(); + if(parent instanceof Map<?, ?>) { + servList = (Map<ESeverity, Boolean>)parent; + for(Entry<ESeverity, Boolean> e : servList.entrySet()) { + if(e.getValue()) { + violation_list.addAll( + IMarkerService.getInstance().getAllViolationsWithSeverity(e.getKey())); + } + } + return violation_list; + } + return null; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXUIProvider.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXUIProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..c5719d95ac7bd5605fff65d6150eca8b9ca6fc02 --- /dev/null +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/fx/MarkerViewFXUIProvider.java @@ -0,0 +1,92 @@ +/*-------------------------------------------------------------------------+ +| 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.internal.views.fx; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; +import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; +import org.fortiss.tooling.kernel.service.ICommandStackService; +import org.fortiss.tooling.kernel.service.IPersistencyService; +import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; +import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; + +import javafx.scene.control.ContextMenu; + +/** + * UI (label) provider for the marker view. + * + * @author abid + */ +public class MarkerViewFXUIProvider extends DynamicTreeTableUIProviderBase<Object> { + + /** {@inheritDoc} */ + @Override + /** {@inheritDoc} */ + public void updateValue(Object element, int column, Object value) { + if(column == 0 && element instanceof INamedCommentedElement) { + INamedCommentedElement elem = (INamedCommentedElement)element; + ICommandStackService.getInstance().runAsCommand(elem, () -> { + elem.setComment((String)value); + }); + } + } + + /** {@inheritDoc} */ + @Override + public ContextMenu createContextMenu(Object element, int col) { + if(element == null || col != 0) { + return null; + } + ContextMenu menu = new ContextMenu(); + return menu; + } + + /** {@inheritDoc} */ + @Override + public String getLabel(Object element, int col) { + IConstraintViolation<?> violation = (IConstraintViolation<?>)element; + if(element instanceof IConstraintViolation) { + switch(col) { + case 0: // Severity Column + return violation.getSeverity().toString(); + case 1: // Element Column + IModelElementHandlerService hs = IModelElementHandlerService.getInstance(); + IModelElementHandler<EObject> handler = + hs.getModelElementHandler(violation.getSource()); + if(handler != null) { + return handler.getName(violation.getSource()); + } + case 2: // Explanation Column + return violation.getExplanation(); + case 3: // Project Column + IPersistencyService ps = IPersistencyService.getInstance(); + ITopLevelElement topElement = ps.getTopLevelElementFor(violation.getSource()); + IModelElementHandler<EObject> handler_prj = null; + EObject rootElement = null; + if(topElement != null) { + rootElement = topElement.getRootModelElement(); + IModelElementHandlerService hs_prj = + IModelElementHandlerService.getInstance(); + handler_prj = hs_prj.getModelElementHandler(rootElement); + } + return(handler_prj != null ? handler_prj.getName(rootElement) : ""); + } + } + return ""; + } +} diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/.ratings index c551f593428eb93077d2566f0329de729970a97a..217a664d614f56a94965c0e74077679e0702d5c8 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/.ratings @@ -2,7 +2,7 @@ IActionService.java 22eafafc8708cbff7f855f7b1b9bef042c127f25 GREEN IAllocationEditPartFactoryService.java ac7243a8ff8a6c3f71937ecf3e63a04e271ca1d5 GREEN IContextMenuService.java cfb6b8237b6cd2b0e461991a9ceb95969f330265 GREEN IEditPartFactoryService.java c448bff63fb81f57037c9f1dc5319859c12d0c4d GREEN -IMarkerService.java d433e838e387dd2fe61b8dea7395ebb7203ae39b GREEN +IMarkerService.java c52acc1f68e909954554b3e9e2f2e232efb052cd GREEN IModelEditorBindingService.java ce2ae1957e2232bb0fac1d1d262103f9adfc5266 GREEN IModelElementHandlerService.java 748ffd22d6836a5599f8785f023469eb58c80ece GREEN INavigatorService.java 8fc66f7e554cfb547f2ce65dec9f48ac0559c54e GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java index d433e838e387dd2fe61b8dea7395ebb7203ae39b..c52acc1f68e909954554b3e9e2f2e232efb052cd 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/service/IMarkerService.java @@ -25,6 +25,9 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESeverity; import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.service.IConstraintCheckerService; import org.fortiss.tooling.kernel.ui.internal.MarkerService; +import org.fortiss.tooling.kernel.ui.internal.views.fx.ErrorViewFXViewPart; + +import javafx.scene.image.ImageView; /** * The marker service manages model element specific markers. It uses the @@ -36,7 +39,7 @@ import org.fortiss.tooling.kernel.ui.internal.MarkerService; public interface IMarkerService { /** Returns view id of the marker view. */ - public static final String MARKER_VIEW = "org.fortiss.tooling.kernel.model.marker"; + public static final String MARKER_VIEW = ErrorViewFXViewPart.ID; /** Returns the service instance. */ public static IMarkerService getInstance() { @@ -68,6 +71,9 @@ public interface IMarkerService { */ ImageDescriptor getImageFor(ESeverity severity, boolean smallDecoration); + /** Similar to {@link #getImageFor(ESeverity, boolean)} but for Java FX. */ + ImageView getFXImageFor(ESeverity severity, boolean smallDecoration); + /** * <p> * Returns a shared icon appropriate for the severity. Flag indicates small sized image.