diff --git a/org.fortiss.tooling.ext.quality.ui/.classpath b/org.fortiss.tooling.ext.quality.ui/.classpath index e801ebfb4680123285c15553dc70584276fe0057..7da5e78bcec0db3ae186e9e53ec67460725c601a 100644 --- a/org.fortiss.tooling.ext.quality.ui/.classpath +++ b/org.fortiss.tooling.ext.quality.ui/.classpath @@ -3,5 +3,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="res"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF index 6aae7a77c90d056622cece521f411aad8dc34a23..22a3e7f3852fe86b186456f500b2023197dd5cf6 100644 --- a/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: org.fortiss.tooling.ext.quality.ui +Bundle-Name: %pluginName Bundle-SymbolicName: org.fortiss.tooling.ext.quality.ui;singleton:=true Bundle-Version: 1.0.0 Automatic-Module-Name: org.fortiss.tooling.ext.quality.ui diff --git a/org.fortiss.tooling.ext.quality.ui/icons/library.png b/org.fortiss.tooling.ext.quality.ui/icons/library.png new file mode 100644 index 0000000000000000000000000000000000000000..3c63b714bc5d9b65e08f80b35ac8df1e1b5a7339 Binary files /dev/null and b/org.fortiss.tooling.ext.quality.ui/icons/library.png differ diff --git a/org.fortiss.tooling.ext.quality.ui/plugin.xml b/org.fortiss.tooling.ext.quality.ui/plugin.xml index 29c7ad1646b7a67aa0d97602fb355f22a891410d..e8d5d353ab3b5a6bfb1eae75f0e0bc83c174e8d0 100644 --- a/org.fortiss.tooling.ext.quality.ui/plugin.xml +++ b/org.fortiss.tooling.ext.quality.ui/plugin.xml @@ -8,4 +8,14 @@ contributor="org.fortiss.tooling.ext.quality.ui.ModelQualityExtractionMenu"> </contextMenuContribution> </extension> + <extension + point="org.eclipse.ui.views"> + <view + class="org.fortiss.tooling.ext.quality.ui.view.fx.MetricsFXViewPart" + icon="icons/library.png" + id="org.fortiss.tooling.ext.quality.ui.metricsView" + name="Metrics" + restorable="true"> + </view> + </extension> </plugin> \ No newline at end of file diff --git a/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml b/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml new file mode 100644 index 0000000000000000000000000000000000000000..f3d4a50e9711da5891f51b524d256b3397e4bfbc --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.SplitPane?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.control.TreeTableView?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.BorderPane?> + +<SplitPane fx:id="metricsSplitPane" + dividerPositions="0.5" maxHeight="1.7976931348623157E308" + maxWidth="1.7976931348623157E308" minHeight="-Infinity" + minWidth="-Infinity" orientation="VERTICAL" prefHeight="400.0" + prefWidth="1035.0" xmlns="http://javafx.com/javafx/13" + xmlns:fx="http://javafx.com/fxml/1"> + <items> + <BorderPane maxHeight="-Infinity" minHeight="-Infinity" + prefHeight="25.0" prefWidth="626.0"> + <center> + <Label fx:id="topLabel" alignment="CENTER" + contentDisplay="CENTER" prefHeight="51.0" prefWidth="247.0" + textAlignment="CENTER" BorderPane.alignment="CENTER" /> + </center> + <left> + <Button fx:id="refreshButton" mnemonicParsing="false" + onAction="#onRefreshMetricsSubmit" text="Refresh Metrics" + BorderPane.alignment="CENTER" /> + </left> + </BorderPane> + </items> +</SplitPane> diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java new file mode 100644 index 0000000000000000000000000000000000000000..058875fa6d7f04ce4e2fcd40c4d5e5927cdca312 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java @@ -0,0 +1,28 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 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.ext.quality.ui.view.fx; + +/** + * Interface for views displaying the Metrics view + * + * @author groh + */ +public interface IMetricsViewPart { + + /** View ID for reuse library views. */ + // Keep in sync with plugin.xml + public static String REUSE_LIBRARY_VIEW_ID = "org.fortiss.tooling.ext.quality.ui.metricsView"; +} diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java new file mode 100644 index 0000000000000000000000000000000000000000..40f38516dc0e530c543eb4cb507338366f9acb66 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java @@ -0,0 +1,67 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 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.ext.quality.ui.view.fx; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase; + +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.SplitPane; + +/** + * FX Controller for the Metrics view. + * + * @author groh + */ + +@SuppressWarnings("unchecked") +public class MetricsFXController extends CompositeFXControllerBase<SplitPane, Node> { + + /** The refresh {@link Button} to refresh the metrics. */ + @FXML + private Button refreshButton; + + /** The central top {@link Label} to display short messages. */ + @FXML + private Label topLabel; + + /** Time format when displaying updating time. */ + private final DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern("HH:mm:ss"); + + /** {@inheritDoc} */ + @Override + public String getFXMLLocation() { + return "MetricsViewFx.fxml"; + } + + /** {@inheritDoc} */ + @Override + public void initialize() { + + } + + /** + * Is triggered when the refresh button is pressed. + */ + public void onRefreshMetricsSubmit() { + LocalDateTime currentTime = LocalDateTime.now(); + topLabel.setText("View was updated at " + timeFormat.format(currentTime)); + } +} diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java new file mode 100644 index 0000000000000000000000000000000000000000..d422973c64b135368a59a8b87ee003517f8c7ae5 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java @@ -0,0 +1,50 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 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.ext.quality.ui.view.fx; + +import org.eclipse.ui.part.ViewPart; +import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; + +/** + * {@link ViewPart} for the FX implementation of the metrics view. + * + * @author groh + */ +public class MetricsFXViewPart extends AF3FXViewPart implements IMetricsViewPart { + + /** The FX Controller for this view. */ + private static final MetricsFXController VIEW_CONTROLLER = new MetricsFXController(); + + /** + * Constructor. + * + * @throws Exception + */ + public MetricsFXViewPart() throws Exception { + super(VIEW_CONTROLLER, null); + } + + /** + * Returns the initialized {@link MetricsFXController} for the reuse + * version of the {@link AF3FXViewPart}. + * + * @return The view controller for the metrics view + */ + public static MetricsFXController getMetricsFXController() { + return VIEW_CONTROLLER; + } + +}