- * This class is being called everytime a document is being refreshed in the
- * files explorer view.
- *
- * In case there is no marker anymore (error && warning), this class restore
- * back the original icon.
- */
-public class InformationDecorator extends LabelProvider implements ILightweightLabelDecorator {
-
- /**
- * Link to the Violation Error icon
- */
- public static final String ICON = ImageFactory.INFO_VERY_SMALL;
- /**
- * Decorator ID
- */
- public static final String ID_INFORMATION_DECORATOR = "fr.cnes.analysis.tools.ui.decorators"
- + ".informationdecorator";
-
- /**
- * Class name
- **/
- private static final String CLASS = InformationDecorator.class.getName();
-
- /**
- * An Violation Error icon is being put on the top-right of the icon's file
- * only if the file contain a marker of type "ViolationErrorMarker".
- */
- @Override
- public void decorate(Object resource, final IDecoration decoration) {
- final String method = "decorate";
- ICodeLogger.entering(CLASS, method, new Object[]{
- resource, decoration
- });
-
- if (resource instanceof IResource) {
- // We add a Information decorator only if there is a information in
- // the file and that there is no errors markers nor warning markers
- // in the file
- final List vErrorMarkers = ViolationErrorMarker
- .findAllMarkers((IResource) resource);
- final List vWarningMarkers = ViolationWarningMarker
- .findAllMarkers((IResource) resource);
- final List vInformationMarkers = InformationMarker
- .findAllMarkers((IResource) resource);
- if (vErrorMarkers.isEmpty() && vWarningMarkers.isEmpty()
- && !vInformationMarkers.isEmpty()) {
- // If the file do not contain error marker and contain warning
- // markers then we put an overlay icon on the top right of the
- // file's icon
- decoration.addOverlay(ImageFactory.getDescriptor(ICON), IDecoration.TOP_RIGHT);
- } else {
- // otherwise we remove the overlay if there is no violation
- // error neither violation warning markers.
- // NOTE : When warnings decorators are activated, this is only
- // here that we remove the markers if both
- // Error and Warnings decorators are removed.
- if (vErrorMarkers.isEmpty() && vWarningMarkers.isEmpty()
- && vInformationMarkers.isEmpty()) {
- decoration.addOverlay(null);
- }
- }
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationErrorDecorator.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationErrorDecorator.java
deleted file mode 100755
index cb7f7c0d..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationErrorDecorator.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.decorators;
-
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.markers.ViolationErrorMarker;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.ui.IDecoratorManager;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.List;
-
-/**
- * Put a new Decoration in the files tree on the top right of an icon of a file
- * if a file contains a violation error marker.
- *
- * This class is being called everytime a document is being refreshed in the
- * files explorer view.
- *
- * In case there is no marker anymore (error && warning), this class restore
- * back the original icon.
- */
-public class ViolationErrorDecorator extends LabelProvider implements ILightweightLabelDecorator {
-
- /**
- * Link to the Violation Error icon
- */
- public static final String ICON = ImageFactory.ERROR_VERY_SMALL;
- /**
- * Decorator ID
- */
- public static final String ID_VIOLATION_ERROR_DECORATOR = "fr.cnes.tools.ui."
- + "decorators.violationerrordecorator";
- /**
- * Class name
- **/
- private static final String CLASS = ViolationErrorDecorator.class.getName();
-
- /**
- * An Violation Error icon is being put on the top-right of the icon's file
- * only if the file contain a marker of type "ViolationErrorMarker".
- */
- @Override
- public void decorate(Object resource, final IDecoration decoration) {
- final String method = "decorate";
- ICodeLogger.entering(CLASS, method, new Object[]{
- resource, decoration
- });
-
- /*
- * We call the decorator manager to be able to know if the Violation
- * Warning decorator is activated. If it's is activated then the
- * decorators removal will be done by the Violoation Warning decorator.
- * Otherwise, it's the Violation Error decorator that removes the errors
- * decorators.
- */
- final IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager();
- if (resource instanceof IResource) {
- final List markers = ViolationErrorMarker.findAllMarkers((IResource) resource);
- if (!markers.isEmpty()) {
- decoration.addOverlay(ImageFactory.getDescriptor(ICON), IDecoration.TOP_RIGHT);
- // By recursivity, decorate all parents.
-
- }
-
- } else if (!manager.getEnabled(ID_VIOLATION_ERROR_DECORATOR)) {
- decoration.addOverlay(null);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationWarningDecorator.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationWarningDecorator.java
deleted file mode 100755
index 0265c462..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/ViolationWarningDecorator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.decorators;
-
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.markers.ViolationErrorMarker;
-import fr.cnes.analysis.tools.ui.markers.ViolationWarningMarker;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-
-import java.util.List;
-
-/**
- * ViolationWarningDecorator add decorators to the file's icon when there is
- * markers of warning criticity and no marker of error criticity.
- *
- * This class is being called everytime a document is being refreshed in the
- * files explorer view.
- *
- * In case there is no marker anymore (error && warning), this class restore
- * back the original icon.
- */
-public class ViolationWarningDecorator extends LabelProvider implements ILightweightLabelDecorator {
-
- /**
- * Link to the i-Code CNES Warning criticity icon.
- */
- public static final String ICON = ImageFactory.WARNING_VERY_SMALL;
- /**
- * Decorator identifier
- */
- public static final String ID = "fr.cnes.analysis.tools.ui.decorators."
- + "violationwarningdecorator";
- /**
- * Class name
- **/
- private static final String CLASS = ViolationWarningDecorator.class.getName();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.
- * Object, org.eclipse.jface.viewers.IDecoration)
- */
- @Override
- public void decorate(final Object resource, final IDecoration decoration) {
- final String method = "decorate";
- ICodeLogger.entering(CLASS, method, new Object[]{
- resource, decoration
- });
-
- if (resource instanceof IResource) {
- // We add a ViolationWarningDecorator only if there is a warning in
- // the file and that there is no errors markers in the file
- final List vErrorMarkers = ViolationErrorMarker
- .findAllMarkers((IResource) resource);
- final List vWarningMarkers = ViolationWarningMarker
- .findAllMarkers((IResource) resource);
-
- if (vErrorMarkers.isEmpty() && !vWarningMarkers.isEmpty()) {
- // If the file do not contain error marker and contain warning
- // markers then we put an overlay icon on the top right of the
- // file's icon
- decoration.addOverlay(ImageFactory.getDescriptor(ICON), IDecoration.TOP_RIGHT);
- } else {
- // otherwise we remove the overlay if there is no violation
- // error neither violation warning markers.
- // NOTE : When warnings decorators are activated, this is only
- // here that we remove the markers if both
- // Error and Warnings decorators are removed.
- if (vErrorMarkers.isEmpty() && vWarningMarkers.isEmpty()) {
- decoration.addOverlay(null);
- }
- }
- }
- ICodeLogger.exiting(CLASS, method);
-
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/package-info.java
deleted file mode 100644
index a9b3a015..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/decorators/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Package containing i-Code CNES Decorator of UI Plug-in.
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Package containing i-Code CNES Decorator of UI Plug-in.
- */
-package fr.cnes.analysis.tools.ui.decorators;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/EditorFortran.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/EditorFortran.java
deleted file mode 100755
index 6be75474..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/EditorFortran.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-
-package fr.cnes.analysis.tools.ui.editors;
-
-import org.eclipse.ui.editors.text.TextEditor;
-
-/**
- * Editor extension for open all fortran files extensions.
- */
-public class EditorFortran extends TextEditor {
- /**
- * Constructor.
- */
- public EditorFortran() {
- super();
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/package-info.java
deleted file mode 100644
index d5149ea7..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/editors/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Package containing i-Code CNES Editors of UI Plug-in.
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Package containing i-Code CNES Editors of UI Plug-in.
- */
-package fr.cnes.analysis.tools.ui.editors;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyNodeException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyNodeException.java
deleted file mode 100755
index cfe86369..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyNodeException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * Exception throw when the page load is empty.
- */
-public class EmptyNodeException extends Exception {
-
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = -2622872998164155942L;
-
- /**
- * Default constructor.
- */
- public EmptyNodeException() {
- super();
- }
-
- /**
- * Constructor with a message as parameter.
- *
- * @param message The exception message.
- */
- public EmptyNodeException(final String message) {
- super(message);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyProviderException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyProviderException.java
deleted file mode 100755
index f2643e58..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyProviderException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * Exception throw when the provider load is empty.
- */
-public class EmptyProviderException extends Exception {
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = -1423752077318249456L;
-
- /**
- * Default constructor.
- */
- public EmptyProviderException() {
- super();
- }
-
- /**
- * Constructor with a message as parameter.
- *
- * @param message The exception message.
- */
- public EmptyProviderException(final String message) {
- super(message);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyResourceException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyResourceException.java
deleted file mode 100755
index eec27834..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptyResourceException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * Exception throw when the resource is empty : a folder or a project has no
- * members.
- */
-public class EmptyResourceException extends Exception {
-
- /**
- * Serial Version UID.
- */
- private static final long serialVersionUID = 6504785843304862870L;
-
- /**
- * Default constructor.
- */
- public EmptyResourceException() {
- super();
- }
-
- /**
- * Constructor with a message as parameter.
- *
- * @param message The exception message.
- */
- public EmptyResourceException(final String message) {
- super(message);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptySelectionException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptySelectionException.java
deleted file mode 100755
index 32f0be8b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/EmptySelectionException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * Exception throw when the package explorer selection is empty.
- */
-public class EmptySelectionException extends Exception {
-
- /**
- * Serial Version UID.
- */
- private static final long serialVersionUID = 4395611590755520580L;
-
- /**
- * Default constructor.
- */
- public EmptySelectionException() {
- super();
- }
-
- /**
- * Constructor with a message as parameter.
- *
- * @param message The exception message.
- */
- public EmptySelectionException(final String message) {
- super(message);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/InvalidResourceTypeException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/InvalidResourceTypeException.java
deleted file mode 100755
index 49224b34..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/InvalidResourceTypeException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * This exception is thrown whenever {IResource}'s type is ROOT, while its
- * parent is a project or a folder.
- */
-public class InvalidResourceTypeException extends Exception {
-
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = -8619336880299930548L;
-
- /**
- * Constructor with message.
- *
- * @param message the error message.
- */
- public InvalidResourceTypeException(final String message) {
- super(message);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/NonAccessibleResourceException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/NonAccessibleResourceException.java
deleted file mode 100755
index c256a167..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/NonAccessibleResourceException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * This exception is thrown whenever the resource is not accessible : a folder
- * does not exist, a project does not exist, a project is empty.
- */
-public class NonAccessibleResourceException extends Exception {
-
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = 6576045126274438859L;
-
- /**
- * Constructor with message.
- *
- * @param message the error message.
- */
- public NonAccessibleResourceException(final String message) {
- super(message);
- }
-
- /**
- * Constructor with message and original exception.
- *
- * @param message the error message.
- * @param exception original exception.
- */
- public NonAccessibleResourceException(final String message, final Exception exception) {
- super(message, exception);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownInstanceException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownInstanceException.java
deleted file mode 100755
index d8681249..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownInstanceException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * Exception throw when the page load is empty.
- */
-public class UnknownInstanceException extends Exception {
-
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = 431826525188171840L;
-
- /**
- * Default constructor.
- */
- public UnknownInstanceException() {
- super();
- }
-
- /**
- * Constructor with a message as parameter.
- *
- * @param message The exception message.
- */
- public UnknownInstanceException(final String message) {
- super(message);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownResourceTypeException.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownResourceTypeException.java
deleted file mode 100755
index 95572404..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/UnknownResourceTypeException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.exception;
-
-/**
- * This exception is thrown whenever { IResource}'s type is not FILE, nor
- * FOLDER, nor PROJECT, nor ROOT (which are the only 4 options).
- */
-public class UnknownResourceTypeException extends Exception {
-
- /**
- * Auto-generated serialVersionUID.
- */
- private static final long serialVersionUID = 4095575983823504009L;
-
- /**
- * Constructor with message.
- *
- * @param message the error message.
- */
- public UnknownResourceTypeException(final String message) {
- super(message);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/package-info.java
deleted file mode 100644
index 4d16408f..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/exception/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Package containing i-Code CNES Exceptions of UI Plug-in.
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Package containing i-Code CNES Exceptions of UI Plug-in.
- */
-package fr.cnes.analysis.tools.ui.exception;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisHandler.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisHandler.java
deleted file mode 100644
index ba560d98..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisHandler.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.handler;
-
-import fr.cnes.analysis.tools.ui.decorators.InformationDecorator;
-import fr.cnes.analysis.tools.ui.decorators.ViolationErrorDecorator;
-import fr.cnes.analysis.tools.ui.decorators.ViolationWarningDecorator;
-import fr.cnes.analysis.tools.ui.exception.EmptyProviderException;
-import fr.cnes.analysis.tools.ui.exception.EmptySelectionException;
-import fr.cnes.analysis.tools.ui.markers.InformationMarker;
-import fr.cnes.analysis.tools.ui.markers.ViolationErrorMarker;
-import fr.cnes.analysis.tools.ui.markers.ViolationWarningMarker;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.analysis.tools.ui.view.MetricsView;
-import fr.cnes.analysis.tools.ui.view.ViolationsView;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.core.runtime.jobs.JobGroup;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IDecoratorManager;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * This class can run analysis using {@link Analyzer} service.
- *
- * On {@link #execute(ExecutionEvent)} :
- *
- *
Identify which languages should be analyzed in
- * {@link IPreferenceStore}.
- *
Identify which Rules or Metric should be analyzed in
- * {@link IPreferenceStore}
- *
Identify which {@link File}s should be analyzed using
- * {@link PlatformUI}'s selection service.
- *
Run an analysis using {@link RuleAnalysisJob}
- *
- *
- *
- * @since 3.0
- */
-public class AnalysisHandler extends AbstractHandler {
-
- /**
- * Class name
- */
- private static final String CLASS = AnalysisHandler.class.getName();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final String method = "execute";
- ICodeLogger.entering(CLASS, method);
- /*
- * 1.Identification the languages to analyze :
- *
- */
- final List languagesIds = UserPreferencesService.getEnabledLanguagesIds();
- final List excludedChecksIds = UserPreferencesService.getDisabledCheckersIds();
-
- /*
- * 3. Identification of the selected files
- */
- List files = new ArrayList<>();
- try {
- files = retrieveSelectedFiles(HandlerUtil.getCurrentStructuredSelection(event));
-
- /*
- * 4. Creation of jobs to run analysis.
- */
- final AnalysisJob analysisJob = new AnalysisJob("Running analysis...", files,
- languagesIds, excludedChecksIds);
- analysisJob.setUser(true);
- analysisJob.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(final IJobChangeEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (analysisJob.getResult().isOK()) {
- final List results = ((AnalysisJob) event.getJob())
- .getCheckResults();
- final List resultsViolation = new ArrayList<>();
- final List resultsMetric = new ArrayList<>();
- for (CheckResult result : results) {
- if (result.getValue() == null) {
- resultsViolation.add(result);
- } else {
- resultsMetric.add(result);
- }
- }
- AnalysisHandler.updateViolationsView(resultsViolation);
- AnalysisHandler.updateMetricsView(resultsMetric);
- AnalysisHandler.insertMarkers(results);
- } else {
- ICodeLogger.error(CLASS, method,
- analysisJob.getResult().getMessage());
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getShell(),
- "i-Code CNES - Analysis failure",
- analysisJob.getResult().getMessage());
- }
- }
- });
- }
- });
-
- final JobGroup group = new JobGroup("i-Code CNES Analysis.", 2, 2);
- analysisJob.setJobGroup(group);
-
- // Launching the analysis.
- analysisJob.schedule();
-
- } catch (EmptySelectionException exception) {
- ICodeLogger.warning(CLASS, method, exception);
- MessageDialog.openWarning(HandlerUtil.getActiveShell(event), "i-Code CNES - Warning",
- exception.getMessage());
- } catch (CoreException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(HandlerUtil.getActiveShell(event), "i-Code CNES - ERROR",
- exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method, null);
- return null;
- }
-
- /**
- * This method return {@link File}s in UI selected by the user.
- *
- * @param pSelection currently selected by the user on UI
- * @return every {@link File}s in the selection
- * @throws EmptySelectionException when no selection is set.
- * @throws CoreException when some resources are not reachable.
- */
- private List retrieveSelectedFiles(IStructuredSelection pSelection)
- throws EmptySelectionException, CoreException {
- final String method = "retrieveSelectedFiles";
- ICodeLogger.entering(CLASS, method, pSelection);
- final List files = new ArrayList<>();
- final Iterator> selectionIterator = pSelection.iterator();
- if (!selectionIterator.hasNext()) {
- final EmptySelectionException exception = new EmptySelectionException(
- "i-Code CNES : Please select file(s) in the Project"
- + " Explorer before running an analysis.");
- ICodeLogger.throwing(CLASS, method, exception);
- throw exception;
- }
- while (selectionIterator.hasNext()) {
- final IResource selection = (IResource) selectionIterator.next();
- files.addAll(this.findFiles(selection));
- }
- ICodeLogger.exiting(CLASS, method, files);
- return files;
-
- }
-
- /**
- * This method can be used to find different File element of a selection.
- *
- *
- * Warning : this method is recursive
- *
- *
- * @param selection The selection to search for files
- * @return a list of file included in the selection
- * @throws CoreException when resources of a {@link IProject} or {@link IFolder}
- * couldn't be reached
- */
- private List findFiles(IResource selection) throws CoreException {
- final String method = "findFiles";
- ICodeLogger.entering(CLASS, method);
- final List files = new ArrayList<>();
- switch (selection.getType()) {
- case IResource.ROOT:
- for (IResource resource : ((IWorkspaceRoot) selection).members()) {
- files.addAll(this.findFiles(resource));
- }
- break;
- case IResource.PROJECT:
- for (IResource resource : ((IProject) selection).members()) {
- files.addAll(this.findFiles(resource));
- }
- break;
- case IResource.FOLDER:
- for (IResource resource : ((IFolder) selection).members()) {
- files.addAll(this.findFiles(resource));
- }
- break;
- case IResource.FILE:
- files.add(((IFile) selection).getLocation().toFile().getAbsoluteFile());
- break;
- default:
- break;
- }
- ICodeLogger.exiting(CLASS, method, files);
- return files;
- }
-
- /**
- * Update the violation's view
- *
- * @param violations to show in the view.
- */
- protected static void updateViolationsView(final List violations) {
- final String method = "updateCheckResultView";
- ICodeLogger.entering(CLASS, method, violations);
-
- try {
- // get the page
- final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
-
- // open view
- page.showView(ViolationsView.VIEW_ID);
-
- // get view
- final ViolationsView view = (ViolationsView) page.findView(ViolationsView.VIEW_ID);
-
- // show rules analyze results
- if (view != null) {
- view.display(violations);
- }
-
- } catch (final PartInitException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Update MetricsView
- *
- * @param values to show in the view
- */
- private static void updateMetricsView(final List values) {
- final String method = "updateMetricsView";
- ICodeLogger.entering(CLASS, method, values);
-
- try {
- // get the page
- final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
-
- // open view
- page.showView(MetricsView.VIEW_ID);
-
- // get view
- final MetricsView view = (MetricsView) page.findView(MetricsView.VIEW_ID);
-
- // show rules analyze results
- if (view != null) {
- view.display(values);
- }
-
- } catch (final PartInitException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- } catch (final EmptyProviderException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method insert for each violation detected a new marker on the line
- * of the violation.
- *
- * @param checks the checks to add marker with
- */
- public static void insertMarkers(List checks) {
- final String method = "insertMarkers";
- ICodeLogger.entering(CLASS, method, checks);
- final ProgressMonitorDialog pmdialog = new ProgressMonitorDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- try {
- pmdialog.run(true, true, new WorkspaceModifyOperation() {
- @Override
- protected void execute(final IProgressMonitor monitor) throws CoreException,
- InvocationTargetException, InterruptedException {
- try {
-
- final HashSet cleanedFiles = new HashSet();
- String message = "Violation detected here.";
- IFile file;
- for (final CheckResult check : checks) {
- file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
- new Path(check.getFile().getAbsolutePath())
- .makeRelativeTo(ResourcesPlugin
- .getWorkspace()
- .getRoot()
- .getFullPath()));
- if (file != null && file.exists()) {
- if (!cleanedFiles.contains(file)) {
- cleanedFiles.add(file);
- file.deleteMarkers(ViolationErrorMarker.MARKER, true, 1);
- file.deleteMarkers(ViolationWarningMarker.MARKER, true, 1);
- file.deleteMarkers(InformationMarker.MARKER, true, 1);
- }
- }
- Float limit = Float.valueOf(Float.NaN);
- boolean violation = false;
- if (UserPreferencesService.hasMaxValue(check.getId())
- && !UserPreferencesService.getMaxValue(check.getId())
- .isNaN()) {
- limit = UserPreferencesService.getMaxValue(check.getId());
- violation = check.getValue().compareTo(limit) > 0;
- if (violation) {
- message = getMaximumViolationMessage(check.getName(),
- check.getValue(), limit);
- } else {
- message = getMaximumComplianceMessage(check.getName(),
- check.getValue(), limit);
-
- }
- } else if (UserPreferencesService.hasMinValue(check.getId())
- && !UserPreferencesService.getMaxValue(check.getId())
- .isNaN()) {
- limit = UserPreferencesService.getMinValue(check.getId());
- violation = check.getValue().compareTo(limit) < 0;
- if (violation) {
- message = getMinimumViolationMessage(check.getName(),
- check.getValue(), limit);
- } else {
- message = getMinimumComplianceMessage(check.getName(),
- check.getValue(), limit);
- }
- } else {
- if (check.getMessage() == null || check.getMessage().isEmpty()) {
- if (check.getValue() != null && !check.getValue().isNaN()) {
- message = getDefaultMetricComputedMessage(check.getName(),
- check.getValue());
- } else {
- message = getDefaultMetricUncomputedMessage(
- check.getName());
- violation = false;
- }
- } else {
- message = check.getName() + " | " + check.getMessage();
- violation = true;
- }
-
- }
-
- if (violation && UserPreferencesService
- .getCheckerSeverity(check.getId())
- .equals(UserPreferencesService.PREF_SEVERITY_ERROR_VALUE)) {
- ViolationErrorMarker.createMarker(file, check.getLine(),
- check.getName(), message);
- } else if (violation && UserPreferencesService
- .getCheckerSeverity(check.getId())
- .equals(UserPreferencesService.PREF_SEVERITY_WARNING_VALUE)) {
- ViolationWarningMarker.createMarker(file, check.getLine(),
- check.getName(), message);
- } else {
- InformationMarker.createMarker(file, check.getLine(),
- check.getName(), message);
- }
- }
- } catch (final CoreException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getShell(),
- "Marker problem", exception.getMessage());
-
- }
- }
- });
- } catch (InvocationTargetException | InterruptedException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Marker problem", exception.getMessage());
- }
- // One time all markers have been insert, we refresh all
- // decorators.
-
- final IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager();
-
- manager.update(ViolationWarningDecorator.ID);
- manager.update(ViolationErrorDecorator.ID_VIOLATION_ERROR_DECORATOR);
- manager.update(InformationDecorator.ID_INFORMATION_DECORATOR);
-
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * @param name of the metric
- * @return Default message when a metric is not being computed for a
- * function.
- */
- protected static String getDefaultMetricUncomputedMessage(String name) {
- final String method = "getDefaultMetricUncomputedMessage";
- ICodeLogger.entering(CLASS, method, name);
- final String message = name
- + " | Checker value for this function was not computed. Please refer to CNES"
- + " RNC for more informations.";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param name of the metric
- * @param value of the metric
- * @return default message when a metric is computed.
- */
- protected static String getDefaultMetricComputedMessage(String name, Float value) {
- final String method = "getDefaultMetricComputedMessage";
- ICodeLogger.entering(CLASS, method, new Object[]{
- name, value
- });
- final String message = name + " | Value is " + value + ".";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param name of the metric
- * @param value of the metric
- * @param limit set by the user for the metric
- * @return the error message
- */
- protected static String getMaximumViolationMessage(String name, Float value, Float limit) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- name, value, limit
- });
- final String message = name + " | Value is " + value + " while it should not exceed "
- + limit + ".";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param name of the metric
- * @param value of the metric
- * @param limit set by the user for the metric
- * @return the compliance message
- */
- protected static String getMaximumComplianceMessage(String name, Float value, Float limit) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- name, value, limit
- });
- final String message = name + " | Value is " + value + ", below it's maximum limit of "
- + limit + ".";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param name of the metric
- * @param value of the metric
- * @param limit set by the user for the metric
- * @return the error message
- */
- protected static String getMinimumViolationMessage(String name, Float value, Float limit) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- name, value, limit
- });
- final String message = name + " | Value is " + value + " while it should not below " + limit
- + ".";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param name of the metric
- * @param value of the metric
- * @param limit set by the user for the metric
- * @return the error message
- */
- protected static String getMinimumComplianceMessage(String name, Float value, Float limit) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- name, value, limit
- });
- final String message = name + " | Value is " + value + " above it's minimum limit of "
- + limit + ".";
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisJob.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisJob.java
deleted file mode 100644
index 5b7ca6c4..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/AnalysisJob.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.handler;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.icode.Analyzer;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * This {@link Job} run an analysis using {@link Analyzer} service.
- *
- * @since 3.0
- */
-public class AnalysisJob extends Job {
-
- /**
- * Class name
- */
- private static final String CLASS = AnalysisJob.class.getName();
-
- /**
- * {@link Analyzer} service to run the analysis
- */
- private Analyzer analyzer;
- /**
- * List of files to analyze.
- */
- private List inputFiles;
- /**
- * List of languages plug-in identifiers to run analysis with
- */
- private List languageIds;
- /**
- * List of all metrics excluded from the analysis. More informations on
- * : {@link Analyzer#computeMetrics(List, List, List)}
- */
- private List excludedIds;
- /**
- * {@link FileValue} list from analysis result.
- */
- private List checks;
-
- /**
- * Constructor for {@link AnalysisJob}
- *
- * @param pName name of the Job
- * @param pInputFiles to analyze
- * @param pLanguageIds to run analysis with
- * @param pExcludedIds to exclude from analysis
- */
- public AnalysisJob(final String pName, final List pInputFiles,
- final List pLanguageIds, final List pExcludedIds) {
- super(pName);
- final String method = "AnalysisJob";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pName, pInputFiles, pLanguageIds, pExcludedIds
- });
- this.inputFiles = pInputFiles;
- this.languageIds = pLanguageIds;
- this.excludedIds = pExcludedIds;
- this.analyzer = new Analyzer();
- ICodeLogger.exiting(CLASS, method);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- final String method = "run";
- ICodeLogger.entering(this.getClass().getName(), method, monitor);
- IStatus status = this.verifyInputs();
- monitor.setTaskName("Analyzing files...");
- if (status.isOK()) {
- this.checks = analyzer.stableCheck(new HashSet<>(inputFiles), languageIds, excludedIds);
- }
- ICodeLogger.exiting(CLASS, method, status);
- return status;
- }
-
- /**
- * @return whether or not files to analyzer can be reachde in the file
- * system.
- */
- private IStatus verifyInputs() {
- final String method = "verifyInputs";
- ICodeLogger.entering(this.getClass().getName(), method);
- int counter = 0;
- IStatus status = Status.OK_STATUS;
- while (this.inputFiles.size() > counter && status.isOK()) {
- if (!inputFiles.get(counter).exists()) {
- ICodeLogger.warning(CLASS, method,
- "File unreachable : " + inputFiles.get(counter).getAbsolutePath());
- status = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "File unreachable : " + inputFiles.get(counter).getAbsolutePath());
- }
- counter++;
- }
- ICodeLogger.exiting(CLASS, method, status);
- return status;
- }
-
- /**
- * @return files to analyzed
- */
- public List getInputFiles() {
- final String method = "getInputFiles";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, inputFiles);
- return inputFiles;
- }
-
- /**
- * @param pInputFiles to analyze
- */
- public void setInputFiles(List pInputFiles) {
- final String method = "setInputFiles";
- ICodeLogger.entering(CLASS, method, pInputFiles);
- this.inputFiles = pInputFiles;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return checkerResults results from the analysis.
- */
- public List getCheckResults() {
- final String method = "getCheckResults";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, checks);
- return checks;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ClearHandler.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ClearHandler.java
deleted file mode 100755
index 9bd612b8..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ClearHandler.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.handler;
-
-import fr.cnes.analysis.tools.ui.exception.EmptyProviderException;
-import fr.cnes.analysis.tools.ui.view.MetricsView;
-import fr.cnes.analysis.tools.ui.view.ViolationsView;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IDecoratorManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler to clear the views.
- */
-public class ClearHandler extends AbstractHandler {
-
- /**
- * Class name
- */
- private static final String CLASS = ClearHandler.class.getName();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.
- * commands .ExecutionEvent)
- */
- @Override
- public Object execute(final ExecutionEvent event) {
- final String method = "execute";
- ICodeLogger.entering(this.getClass().getName(), method, event);
- try {
-
- // clear the violations view
- this.clearViolationsView();
-
- // clear the metrics view
- this.clearMetricsView();
-
- // delete markers
- this.clearAllMarkers();
-
- this.refreshDecorators();
-
- } catch (final EmptyProviderException exception) {
- ICodeLogger.error(this.getClass().getName(), method, exception);
- MessageDialog.openError(HandlerUtil.getActiveShell(event), "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(this.getClass().getName(), method, null);
- return null;
- }
-
- /**
- * Simply refresh all decorators to remove them from the IResource of type
- * IFile in the files tree.
- */
- private void refreshDecorators() {
- final String method = "refreshDecorators";
- ICodeLogger.entering(CLASS, method);
- final IDecoratorManager manager = PlatformUI.getWorkbench().getDecoratorManager();
-
- manager.update("fr.cnes.analysis.tools.ui.decorators.violationwarningdecorator");
- manager.update("fr.cnes.analysis.tools.ui.decorators.violationerrordecorator");
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method clear the violation view if it is opened.
- *
- * @throws EmptyProviderException error throw whenever the provider corresponding to the view
- * can't be found
- */
- private void clearViolationsView() throws EmptyProviderException {
- final String method = "clearViolationsView";
- ICodeLogger.entering(CLASS, method);
-
- final ViolationsView rulesView = (ViolationsView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .findView(ViolationsView.VIEW_ID);
- if (rulesView != null) {
- rulesView.clear();
- }
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * This method clear the metric view if it is opened.
- *
- * @throws EmptyProviderException error throw whenever the provider corresponding to the view
- * can't be found
- */
- private void clearMetricsView() throws EmptyProviderException {
- final String method = "clearMetricsView";
- ICodeLogger.entering(CLASS, method);
-
- final MetricsView metricsView = (MetricsView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().findView(MetricsView.VIEW_ID);
- if (metricsView != null) {
- metricsView.clear();
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method clear all the markers errors and warning from files.
- */
- private void clearAllMarkers() {
- final String method = "clearAllMarkers";
- ICodeLogger.entering(CLASS, method);
-
- final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- final int depth = IResource.DEPTH_INFINITE;
- try {
- resource.deleteMarkers("fr.cnes.analysis.tools.ui.markers.ViolationErrorMarker", true,
- depth);
- resource.deleteMarkers("fr.cnes.analysis.tools.ui.markers.ViolationWarningMarker", true,
- depth);
- resource.deleteMarkers("fr.cnes.analysis.tools.ui.markers.InformationMarker", true,
- depth);
- } catch (final CoreException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Marker deletion problem", exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ShowRuleTreeViewerHandler.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ShowRuleTreeViewerHandler.java
deleted file mode 100755
index 11330352..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/ShowRuleTreeViewerHandler.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.handler;
-
-import fr.cnes.analysis.tools.ui.view.ViolationsView;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.IHandlerListener;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This Handler is being used by {@link ViolationsView} to dispose and show
- * different tree viewers available for the user.
- *
- * @version 2.0
- * @since 2.0
- */
-public class ShowRuleTreeViewerHandler implements IHandler {
-
- /**
- * Class name
- */
- private static final String CLASS = ShowRuleTreeViewerHandler.class.getName();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core.
- * commands.IHandlerListener)
- */
- @Override
- public void addHandlerListener(IHandlerListener handlerListener) {
- // Do nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.IHandler#dispose()
- */
- @Override
- public void dispose() {
- // Do nothing.
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final String method = "execute";
- ICodeLogger.entering(CLASS, method, event);
- final ViolationsView view = (ViolationsView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .findView(ViolationsView.VIEW_ID);
- final String name = event.getParameter("TreeViewer");
- if (!view.getTreeViewerType().equals(name)) {
- view.setTreeViewerType(name);
- }
- ICodeLogger.exiting(CLASS, method, null);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.IHandler#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- final String method = "isEnabled";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.TRUE);
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.IHandler#isHandled()
- */
- @Override
- public boolean isHandled() {
- final String method = "isHandled";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.TRUE);
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.core
- * .commands.IHandlerListener)
- */
- @Override
- public void removeHandlerListener(IHandlerListener handlerListener) {
- // Do nothing
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/package-info.java
deleted file mode 100644
index 2e055460..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/handler/package-info.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Package containing i-Code CNES UI Plugin handlers.
- *
- * @version 3.0
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Package containing i-Code CNES UI Plugin handlers.
- *
- * @version 3.0
- */
-package fr.cnes.analysis.tools.ui.handler;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/ImageFactory.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/ImageFactory.java
deleted file mode 100644
index 1ad8e598..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/ImageFactory.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.images;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * This service should be used to reach images stored in the plugin resources.
- *
- * @since 3.0
- */
-public final class ImageFactory {
-
- /**
- * I-code logo red, 8x8
- */
- public static final String ENABLED = "./icons/enabled.png";
- /**
- * I-code logo red, 8x8
- */
- public static final String DISABLED = "./icons/disabled.png";
- /**
- * I-code logo red, 8x8
- */
- public static final String ERROR_VERY_SMALL = "./icons/logo-i-code-rouge-8x8.png";
- /**
- * I-code logo red, 16x16
- */
- public static final String ERROR_SMALL = "./icons/logo-i-code-rouge-16x16.png";
- /**
- * I-code logo red, 32x32
- */
- public static final String ERROR_MEDIUM = "./icons/logo-i-code-rouge-32x32.png";
- /**
- * I-code logo red, 8x8
- */
- public static final String ERROR_BIG = "./icons/logo-i-code-rouge-45x45.png";
- /**
- * I-code logo blue, 8x8
- */
- public static final String INFO_VERY_SMALL = "./icons/logo-i-code-bleue-8x8.png";
- /**
- * I-code logo blue, 16x16
- */
- public static final String INFO_SMALL = "./icons/logo-i-code-bleue-16x16.png";
- /**
- * I-code logo orange, 8x8
- */
- public static final String WARNING_VERY_SMALL = "./icons/logo-i-code-orange-8x8.png";
- /**
- * I-code logo orange, 16x16
- */
- public static final String WARNING_SMALL = "./icons/logo-i-code-orange-16x16.png";
- /**
- * I-code logo orange, 32x32
- */
- public static final String WARNING_MEDIUM = "./icons/logo-i-code-orange-32x32.png";
- /**
- * I-code logo orange, 8x8
- */
- public static final String WARNING_BIG = "./icons/logo-i-code-orange-45x45.png";
- /**
- * Class name
- */
- private static final String CLASS = ImageFactory.class.getName();
-
- /**
- * Private constructor to remove public constructor has this utility class
- * should not be instantiate.
- */
- private ImageFactory() {
- // not called
- }
-
- /**
- * @param pImageLocation Location of the image (relative to the plugin).
- * @return The ImageDescriptor located in pImageLocation
- */
- public static ImageDescriptor getDescriptor(final String pImageLocation) {
- final String method = "getDescriptor";
- ICodeLogger.entering(CLASS, method, pImageLocation);
- final ImageDescriptor descriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(Activator.PLUGIN_ID, pImageLocation);
- ICodeLogger.exiting(CLASS, method, descriptor);
- return descriptor;
- }
-
- /**
- * @param pImageLocation Location of the image file (relative to the plug-in).
- * @return The Image located in pImageLocation
- */
- public static Image getImage(final String pImageLocation) {
- final String method = "getImage";
- ICodeLogger.entering(CLASS, method, pImageLocation);
- final Image image = AbstractUIPlugin
- .imageDescriptorFromPlugin(Activator.PLUGIN_ID, pImageLocation)
- .createImage();
- ICodeLogger.exiting(CLASS, method, image);
- return image;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/package-info.java
deleted file mode 100644
index 8342a57a..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/images/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.images;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/InformationMarker.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/InformationMarker.java
deleted file mode 100644
index dfa12758..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/InformationMarker.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.markers;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ViolationErrorMarker This class implements the creation of marker and the
- * listing of theses ones. This class is useful for the use of markers and also
- * the decorator. It allows also multiple lines selection.
- */
-public final class InformationMarker {
- /**
- * ID of the marker
- */
- public static final String MARKER = "fr.cnes.analysis.tools.ui.markers.InformationMarker";
-
- /**
- * ID of the annotation
- */
- public static final String ANNOTATION = "fr.cnes.analysis.tools.ui.Information";
- /**
- * Class name
- */
- private static final String CLASS = InformationMarker.class.getName();
-
- /**
- * Default constructor removal to avoid instantiation.
- */
- private InformationMarker() {
-
- }
-
- /**
- * Create a new marker
- *
- * @param res The resource in which must be put the marker (file)
- * @param line Line number of the marker
- * @param description The description of the function
- * @param message The error message
- * @return the new marker
- * @throws CoreException when marker couldn't be created.
- */
- public static IMarker createMarker(final IResource res, final Integer line,
- final String description, final String message) throws CoreException {
- final String method = "createMarker";
- ICodeLogger.entering(CLASS, method, new Object[]{
- res, line, description, message
- });
- IMarker marker = null;
- // note: you use the id that is defined in your plugin.xml
- marker = res.createMarker(MARKER);
- marker.setAttribute(IMarker.MESSAGE, message);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_LOW);
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
- ICodeLogger.exiting(CLASS, method, marker);
- return marker;
- }
-
- /**
- * Find all markers in a file.
- *
- * @param resource resource to find marker on.
- * @return list of a resources markers
- */
- public static List findMarkers(final IResource resource) {
- final String method = "findMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_ZERO));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns a list of markers that are linked to the resource or any sub
- * resource of the resource
- *
- * @param resource resource to find marker on.
- * @return list of markers that are linked to the resource or any
- * sub-resource or resource
- */
- public static List findAllMarkers(final IResource resource) {
- final String method = "findAllMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_INFINITE));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return the selection of the package explorer
- */
- public static TreeSelection getTreeSelection() {
- final String method = "getTreeSelection";
- ICodeLogger.entering(CLASS, method);
- TreeSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TreeSelection) {
- toReturn = (TreeSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return selection of the package explorer
- */
- public static TextSelection getTextSelection() {
- final String method = "getTextSelection";
- ICodeLogger.entering(CLASS, method);
- TextSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TextSelection) {
- toReturn = (TextSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * @param marker Marker to add annotation
- * @param selection selection to add annotation on.
- * @param editor document editor to add annotation on.
- */
- public static void addAnnotation(final IMarker marker, final ITextSelection selection,
- final ITextEditor editor) {
- final String method = "addAnnotation";
- ICodeLogger.entering(CLASS, method, new Object[]{
- marker, selection, editor
- });
- // The DocumentProvider enables to get the document currently loaded in
- // the editor
- final IDocumentProvider idp = editor.getDocumentProvider();
-
- // This is the document we want to connect to. This is taken from the
- // current editor input.
- final IDocument document = idp.getDocument(editor.getEditorInput());
-
- // The IannotationModel enables to add/remove/change annoatation to a
- // Document loaded in an Editor
- final IAnnotationModel iamf = idp.getAnnotationModel(editor.getEditorInput());
-
- // Note: The annotation type id specify that you want to create one of
- // your annotations
- final SimpleMarkerAnnotation ma = new SimpleMarkerAnnotation(ANNOTATION, marker);
-
- // Finally add the new annotation to the model
- iamf.connect(document);
- iamf.addAnnotation(ma, new Position(selection.getOffset(), selection.getLength()));
- iamf.disconnect(document);
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationErrorMarker.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationErrorMarker.java
deleted file mode 100755
index ae63a1f5..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationErrorMarker.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.markers;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ViolationErrorMarker This class implements the creation of marker and the
- * listing of theses ones. This class is useful for the use of markers and also
- * the decorator. It allows also multiple lines selection.
- */
-public final class ViolationErrorMarker {
- /**
- * ID of the marker
- */
- public static final String MARKER = "fr.cnes.analysis.tools.ui.markers.ViolationErrorMarker";
-
- /**
- * ID of the annotation
- */
- public static final String ANNOTATION = "fr.cnes.analysis.tools.ui.ViolationError";
- /**
- * Class name
- */
- private static final String CLASS = ViolationErrorMarker.class.getName();
-
- /**
- * Default constructor removal to avoid instantiation.
- */
- private ViolationErrorMarker() {
-
- }
-
- /**
- * Create a new marker
- *
- * @param res The resource in which must be put the marker (file)
- * @param line Line number of the marker
- * @param description The description of the function
- * @param message The error message
- * @return the new marker
- * @throws CoreException when marker could not be created.
- */
- public static IMarker createMarker(final IResource res, final Integer line,
- final String description, final String message) throws CoreException {
- final String method = "createMarker";
- ICodeLogger.entering(CLASS, method, new Object[]{
- res, line, description, message
- });
- IMarker marker = null;
- // note: you use the id that is defined in your plugin.xml
- marker = res.createMarker(MARKER);
- marker.setAttribute(IMarker.MESSAGE, message);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
- ICodeLogger.exiting(CLASS, method, marker);
- return marker;
- }
-
- /**
- * Find all markers in a file.
- *
- * @param resource to find marker on.
- * @return list of a resources markers
- */
- public static List findMarkers(final IResource resource) {
- final String method = "findMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_ZERO));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns a list of markers that are linked to the resource or any sub
- * resource of the resource
- *
- * @param resource to find markers on.
- * @return list of markers that are linked to the resource or any
- * sub-resource or resource
- */
- public static List findAllMarkers(final IResource resource) {
- final String method = "findAllMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_INFINITE));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return the selection of the package explorer
- */
- public static TreeSelection getTreeSelection() {
- final String method = "getTreeSelection";
- ICodeLogger.entering(CLASS, method);
- TreeSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TreeSelection) {
- toReturn = (TreeSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return selection of the package explorer
- */
- public static TextSelection getTextSelection() {
- final String method = "getTextSelection";
- ICodeLogger.entering(CLASS, method);
- TextSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TextSelection) {
- toReturn = (TextSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * @param marker Marker to add annotation
- * @param selection selection to add annotation on.
- * @param editor document editor to add annotation on.
- */
- public static void addAnnotation(final IMarker marker, final ITextSelection selection,
- final ITextEditor editor) {
- final String method = "addAnnotation";
- ICodeLogger.entering(CLASS, method, new Object[]{
- marker, selection, editor
- });
- // The DocumentProvider enables to get the document currently loaded in
- // the editor
- final IDocumentProvider idp = editor.getDocumentProvider();
-
- // This is the document we want to connect to. This is taken from the
- // current editor input.
- final IDocument document = idp.getDocument(editor.getEditorInput());
-
- // The IannotationModel enables to add/remove/change annoatation to a
- // Document loaded in an Editor
- final IAnnotationModel iamf = idp.getAnnotationModel(editor.getEditorInput());
-
- // Note: The annotation type id specify that you want to create one of
- // your annotations
- final SimpleMarkerAnnotation ma = new SimpleMarkerAnnotation(ANNOTATION, marker);
-
- // Finally add the new annotation to the model
- iamf.connect(document);
- iamf.addAnnotation(ma, new Position(selection.getOffset(), selection.getLength()));
- iamf.disconnect(document);
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationWarningMarker.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationWarningMarker.java
deleted file mode 100755
index f4cbc4ab..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/ViolationWarningMarker.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.markers;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ViolationErrorMarker This class implements the creation of marker and the
- * listing of theses ones. This class is useful for the use of markers and also
- * the decorator. It allows also multiple lines selection.
- */
-public final class ViolationWarningMarker {
- /**
- * Marker ID pointing on the image.
- */
- public static final String MARKER = "fr.cnes.analysis.tools.ui.markers.ViolationWarningMarker";
-
- /**
- * Annotation ID
- */
- public static final String ANNOTATION = "fr.cnes.analysis.tools.ui.ViolationWarning";
- /**
- * Class name
- */
- private static final String CLASS = ViolationWarningMarker.class.getName();
-
- /**
- * Default constructor removal to avoid instantiation.
- */
- private ViolationWarningMarker() {
-
- }
-
- /**
- * Create a new marker
- *
- * @param res The resource in which must be put the marker (file)
- * @param line Line number of the marker
- * @param description The description of the function
- * @param message The error message
- * @return the new marker
- * @throws CoreException when marker could not be created.
- */
- public static IMarker createMarker(final IResource res, final Integer line,
- final String description, final String message) throws CoreException {
- final String method = "createMarker";
- ICodeLogger.entering(CLASS, method, new Object[]{
- res, line, description, message
- });
- IMarker marker = null;
- // note: you use the id that is defined in your plugin.xml
- marker = res.createMarker(MARKER);
- marker.setAttribute(IMarker.MESSAGE, message);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
- marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
- ICodeLogger.exiting(CLASS, method, marker);
- return marker;
- }
-
- /**
- * Find all markers in a file.
- *
- * @param resource to find marker on.
- * @return list of a resources markers
- */
- public static List findMarkers(final IResource resource) {
- final String method = "findMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_ZERO));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns a list of markers that are linked to the resource or any sub
- * resource of the resource
- *
- * @param resource to find marker on.
- * @return list of markers that are linked to the resource or any
- * sub-resource or resource
- */
- public static List findAllMarkers(final IResource resource) {
- final String method = "findAllMarkers";
- ICodeLogger.entering(CLASS, method, resource);
- List markers;
- try {
- markers = Arrays.asList(resource.findMarkers(MARKER, true, IResource.DEPTH_INFINITE));
- } catch (@SuppressWarnings("unused") CoreException e) {
- markers = new ArrayList();
- }
- ICodeLogger.exiting(CLASS, method, markers);
- return markers;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return the selection of the package explorer
- */
- public static TreeSelection getTreeSelection() {
- final String method = "getTreeSelection";
- ICodeLogger.entering(CLASS, method);
- TreeSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TreeSelection) {
- toReturn = (TreeSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * Returns the selection of the package explorer
- *
- * @return selection of the package explorer
- */
- public static TextSelection getTextSelection() {
- final String method = "getTextSelection";
- ICodeLogger.entering(CLASS, method);
- TextSelection toReturn = null;
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
- if (selection instanceof TextSelection) {
- toReturn = (TextSelection) selection;
- }
- ICodeLogger.exiting(CLASS, method, toReturn);
- return toReturn;
- }
-
- /**
- * @param marker Marker to add annotation
- * @param selection selection to add annotation on.
- * @param editor document editor to add annotation on.
- */
- public static void addAnnotation(final IMarker marker, final ITextSelection selection,
- final ITextEditor editor) {
- final String method = "addAnnotation";
- ICodeLogger.entering(CLASS, method, new Object[]{
- marker, selection, editor
- });
- // The DocumentProvider enables to get the document currently loaded in
- // the editor
- final IDocumentProvider idp = editor.getDocumentProvider();
-
- // This is the document we want to connect to. This is taken from the
- // current editor input.
- final IDocument document = idp.getDocument(editor.getEditorInput());
-
- // The IannotationModel enables to add/remove/change annoatation to a
- // Document loaded in an Editor
- final IAnnotationModel iamf = idp.getAnnotationModel(editor.getEditorInput());
-
- // Note: The annotation type id specify that you want to create one of
- // your annotations
- final SimpleMarkerAnnotation ma = new SimpleMarkerAnnotation(ANNOTATION, marker);
-
- // Finally add the new annotation to the model
- iamf.connect(document);
- iamf.addAnnotation(ma, new Position(selection.getOffset(), selection.getLength()));
- iamf.disconnect(document);
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/package-info.java
deleted file mode 100644
index 9210fa1a..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/markers/package-info.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Package containing i-Code CNES Markers of UI Plug-in.
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-
-/**
- * Package containing i-Code CNES Markers of UI Plug-in.
- */
-package fr.cnes.analysis.tools.ui.markers;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/CheckerPreferencesContainer.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/CheckerPreferencesContainer.java
deleted file mode 100644
index ea10ba6f..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/CheckerPreferencesContainer.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- * Container for Checker preferences used by {@link UserPreferencesService}
- */
-public class CheckerPreferencesContainer {
-
- /**
- * Class name
- */
- private static final String CLASS = CheckerPreferencesContainer.class.getName();
-
- /**
- * Checker's identifier
- */
- private String id;
- /**
- * Checker's name
- */
- private String name;
- /**
- * Checker's enabling
- */
- private boolean checked;
- /**
- * Checker's severity
- */
- private String severity;
- /**
- * Checker's max value
- */
- private Float maxValue;
- /**
- * Checker's min value
- */
- private Float minValue;
- /**
- * Checker is a metric
- */
- private boolean isMetric;
- /**
- * Checker language's name
- */
- private String languageName;
- /**
- * Checker language's id
- */
- private String languageId;
-
- /**
- * @param pLanguageId Checker language's id
- * @param pLanguageName Checker language's name
- * @param pId Checker's identifier
- * @param pName Checker's name
- * @param pChecked Checker's enabling
- * @param pSeverity Checker's severity
- * @param pIsMetric Checker is a metric
- */
- public CheckerPreferencesContainer(final String pLanguageId, final String pLanguageName,
- final String pId, final String pName, final boolean pChecked,
- final String pSeverity, final boolean pIsMetric) {
- final String method = "CheckerPreferencesContainer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pLanguageId, pLanguageName, pId, pName, Boolean.valueOf(pChecked), pSeverity,
- Boolean.valueOf(pIsMetric)
- });
- this.languageId = pLanguageId;
- this.languageName = pLanguageName;
- this.id = pId;
- this.name = pName;
- this.checked = pChecked;
- this.severity = pSeverity;
- this.minValue = Float.valueOf(Float.NaN);
- this.maxValue = Float.valueOf(Float.NaN);
- this.isMetric = pIsMetric;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pLanguageId Checker language's id
- * @param pLanguageName Checker language's name
- * @param pId Checker's identifier
- * @param pName Checker's name
- * @param pChecked Checker's enabling
- * @param pSeverity Checker's severity
- * @param pMinValue Checker's min value
- * @param pMaxValue Checker's max value
- * @param pIsMetric Checker is a metric
- */
- public CheckerPreferencesContainer(final String pLanguageId, final String pLanguageName,
- final String pId, final String pName, final boolean pChecked,
- final String pSeverity, final Float pMinValue, final Float pMaxValue,
- final boolean pIsMetric) {
- final String method = "CheckerPreferencesContainer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pLanguageId, pLanguageName, pId, pName, Boolean.valueOf(pChecked), pSeverity, pMinValue,
- pMaxValue, Boolean.valueOf(pIsMetric)
- });
- this.languageId = pLanguageId;
- this.languageName = pLanguageName;
- this.id = pId;
- this.name = pName;
- this.checked = pChecked;
- this.severity = pSeverity;
- this.minValue = pMinValue;
- this.maxValue = pMaxValue;
- this.isMetric = pIsMetric;
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * @return the id
- */
- public final String getId() {
- final String method = "getId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, id);
- return id;
- }
-
- /**
- * @param pId the id to set
- */
- public final void setId(final String pId) {
- final String method = "setId";
- ICodeLogger.entering(CLASS, method, pId);
- this.id = pId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the name
- */
- public final String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, name);
- return name;
- }
-
- /**
- * @param pName the name to set
- */
- public final void setName(final String pName) {
- final String method = "setName";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the checked
- */
- public final boolean isChecked() {
- final String method = "isChecked";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(checked));
- return checked;
- }
-
- /**
- * @param pChecked the checked to set
- */
- public final void setChecked(final boolean pChecked) {
- final String method = "setChecked";
- ICodeLogger.entering(CLASS, method, Boolean.valueOf(pChecked));
- this.checked = pChecked;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the severity
- */
- public final String getSeverity() {
- final String method = "getSeverity";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, severity);
- return severity;
- }
-
- /**
- * @param pSeverity the severity to set
- */
- public final void setSeverity(final String pSeverity) {
- final String method = "setSeverity";
- ICodeLogger.entering(CLASS, method, pSeverity);
- this.severity = pSeverity;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the maxValue
- */
- public final Float getMaxValue() {
- final String method = "getMaxValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, maxValue);
- return maxValue;
- }
-
- /**
- * @param pMaxValue the maxValue to set
- */
- public final void setMaxValue(final float pMaxValue) {
- final String method = "setMaxValue";
- ICodeLogger.entering(CLASS, method);
- this.maxValue = Float.valueOf(pMaxValue);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the minValue
- */
- public final Float getMinValue() {
- final String method = "getMinValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, minValue);
- return minValue;
- }
-
- /**
- * @param pMinValue the minValue to set
- */
- public final void setMinValue(final float pMinValue) {
- final String method = "setMinValue";
- ICodeLogger.entering(CLASS, method, Float.valueOf(pMinValue));
- this.minValue = Float.valueOf(pMinValue);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param languageId
- */
- public void savePreferences() {
- final String method = "savePreferences";
- ICodeLogger.entering(CLASS, method);
- final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- store.setValue(this.getId(), checked);
- store.setValue(this.getId() + UserPreferencesService.PREF_SEVERITY_KEY, this.severity);
- if (!this.maxValue.isNaN()) {
- store.setValue(this.getId() + UserPreferencesService.PREF_MAX_VALUE_KEY,
- this.maxValue.floatValue());
- }
- if (!this.minValue.isNaN()) {
- store.setValue(this.getId() + UserPreferencesService.PREF_MIN_VALUE_KEY,
- this.minValue.floatValue());
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Set preferences to default.
- */
- public void setToDefault() {
- final String method = "setToDefault";
- ICodeLogger.entering(CLASS, method);
- final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- this.checked = store.getDefaultBoolean(this.getId());
- store.setToDefault(this.getId());
- this.severity = store
- .getDefaultString(this.getId() + UserPreferencesService.PREF_SEVERITY_KEY);
- store.setToDefault(this.getId() + UserPreferencesService.PREF_SEVERITY_KEY);
-
- if (this.isMetric) {
- this.maxValue = Float.valueOf(store.getDefaultFloat(
- this.getId() + UserPreferencesService.PREF_MAX_VALUE_KEY));
- store.setToDefault(this.getId() + UserPreferencesService.PREF_MAX_VALUE_KEY);
- }
- if (this.isMetric) {
- this.minValue = Float.valueOf(store.getDefaultFloat(
- this.getId() + UserPreferencesService.PREF_MAX_VALUE_KEY));
- store.setToDefault(this.getId() + UserPreferencesService.PREF_MIN_VALUE_KEY);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Update preferences store with current values of attributes.
- */
- public void update() {
- final String method = "update";
- ICodeLogger.entering(CLASS, method);
- final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- if (!store.contains(this.getId())) {
- this.checked = true;
- } else {
- this.checked = store.getBoolean(this.getId());
- }
- if (!store.contains(this.getId() + UserPreferencesService.PREF_SEVERITY_KEY)) {
- this.severity = UserPreferencesService.PREF_SEVERITY_ERROR_VALUE;
- } else {
- this.severity = store
- .getString(this.getId() + UserPreferencesService.PREF_SEVERITY_KEY);
- }
-
- if (this.isMetric) {
- this.maxValue = Float.valueOf(store
- .getFloat(this.getId() + UserPreferencesService.PREF_MAX_VALUE_KEY));
- }
- if (this.isMetric) {
- this.minValue = Float.valueOf(store
- .getFloat(this.getId() + UserPreferencesService.PREF_MIN_VALUE_KEY));
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the isMetric
- */
- public final boolean isMetric() {
- final String method = "isMetric";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isMetric));
- return isMetric;
- }
-
- /**
- * @param pIsMetric the isMetric to set
- */
- public final void setMetric(final boolean pIsMetric) {
- final String method = "setMetric";
- ICodeLogger.entering(CLASS, method, Boolean.valueOf(pIsMetric));
- this.isMetric = pIsMetric;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pMaxValue the maxValue to set
- */
- public final void setMaxValue(final Float pMaxValue) {
- final String method = "setMaxValue";
- ICodeLogger.entering(CLASS, method, pMaxValue);
- this.maxValue = pMaxValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pMinValue the minValue to set
- */
- public final void setMinValue(final Float pMinValue) {
- final String method = "setMinValue";
- ICodeLogger.entering(CLASS, method, pMinValue);
- this.minValue = pMinValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the languageId
- */
- public final String getLanguageId() {
- final String method = "getLanguageId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, languageId);
- return languageId;
- }
-
- /**
- * @param pLanguageId the languageId to set
- */
- public final void setLanguageId(final String pLanguageId) {
- final String method = "setLanguageId";
- ICodeLogger.entering(CLASS, method, pLanguageId);
- this.languageId = pLanguageId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pLanguageName the languageName to set
- */
- public final void setLanguageName(final String pLanguageName) {
- final String method = "setLanguageName";
- ICodeLogger.entering(CLASS, method, pLanguageName);
- this.languageName = pLanguageName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the languageName
- */
- public final String getLanguageName() {
- final String method = "getLanguageName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, languageName);
- return languageName;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/ConfigurationPreferencePage.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/ConfigurationPreferencePage.java
deleted file mode 100644
index 4bfb561d..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/ConfigurationPreferencePage.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.analysis.tools.ui.configurations.ConfigurationContainer;
-import fr.cnes.analysis.tools.ui.configurations.ConfigurationService;
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.preferences.checkerstables.CheckersComposite;
-import fr.cnes.analysis.tools.ui.preferences.checkerstables.MetricsComposite;
-import fr.cnes.icode.exception.NullContributionException;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * i-Code CNES Preferences page.
- */
-public class ConfigurationPreferencePage extends PreferencePage
- implements IWorkbenchPreferencePage {
-
- /**
- * Composite containing the configuration preference page
- */
- private Composite composite;
- /**
- * List of {@link CheckerPreferencesContainer} displayed on the page
- */
- private List preferences;
- /**
- * Configuration identifier selected
- */
- private String configurationId;
- /**
- * Combo box to set the configuration
- */
- private Combo configurationSelection;
- /**
- * Table viewer containing the rules
- */
- private CheckersComposite rulesExpandBarContainer;
- /**
- * Table viewer containing the metrics
- */
- private MetricsComposite metricsExpandBarContainer;
-
- @Override
- public void init(final IWorkbench workbench) {
- final String method = "init";
- ICodeLogger.entering(this.getClass().getName(), method, workbench);
- // Page description
- setImageDescriptor(ImageFactory.getDescriptor(ImageFactory.ERROR_BIG));
- setDescription("This preference page is dedicated to i-SCode analysis. On this page,"
- + " you can enable/disable language and checker that should be "
- + "run during the analysis.");
-
- // Associate preference store
- final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- setPreferenceStore(store);
- ICodeLogger.exiting(this.getClass().getName(), method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.
- * swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- final String method = "createContents";
- ICodeLogger.entering(this.getClass().getName(), method, parent);
- final Label info = new Label(parent, SWT.NONE);
- info.setText("Do you wish to choose an existing configuration ?");
- configurationSelection = new Combo(parent, SWT.READ_ONLY);
- configurationSelection.add(UserPreferencesService.PREF_CONFIGURATION_CUSTOMVALUE);
- configurationId = UserPreferencesService.getConfigurationName();
- final List configs = ConfigurationService.getConfigurations();
- for (final ConfigurationContainer config : configs) {
- configurationSelection.add(config.getName());
- }
- if (configurationSelection.indexOf(UserPreferencesService.getConfigurationName()) != -1) {
- configurationSelection.select(configurationSelection
- .indexOf(UserPreferencesService.getConfigurationName()));
- }
-
- composite = new Composite(parent, SWT.LEFT);
-
- // Sets the layout data for the top composite's
- // place in its parent's layout.
-
- // Sets the layout for the top composite's
- // children to populate.
- composite.setLayout(new FillLayout());
- composite.setBackground(parent.getBackground());
-
- try {
- preferences = UserPreferencesService.getCheckersPreferences();
- preferences.sort(new Comparator() {
-
- @Override
- public int compare(CheckerPreferencesContainer arg0,
- CheckerPreferencesContainer arg1) {
- return arg0.getName().compareTo(arg1.getName());
- }
- });
- } catch (NullContributionException | CoreException e) {
- MessageDialog.openError(getShell(), Activator.PLUGIN_ID, e.getMessage());
- }
- final ExpandBar expandBar = new ExpandBar(composite, SWT.V_SCROLL);
- expandBar.setToolTipText("Choose rules and languages that should be enabled.");
- final GridLayout layout = new GridLayout();
- layout.makeColumnsEqualWidth = true;
- final Color expandBarColor = new Color(parent.getBackground().getDevice(),
- parent.getBackground().getRed() - 10,
- parent.getBackground().getGreen() - 10,
- parent.getBackground().getBlue() - 10);
-
- expandBar.setBackground(expandBarColor);
-
- final List metrics = new ArrayList<>();
- final List rules = new ArrayList<>();
- for (final CheckerPreferencesContainer checker : preferences) {
- if (checker.isMetric()) {
- metrics.add(checker);
- } else {
- rules.add(checker);
- }
- }
-
- // Expand item for Rules :
- rulesExpandBarContainer = new CheckersComposite(expandBar, rules, SWT.EMBEDDED);
- rulesExpandBarContainer.setLayout(layout);
-
- final ExpandItem ruleExpandItem = new ExpandItem(expandBar, SWT.NONE, 0);
- ruleExpandItem.setText("Rules");
- ruleExpandItem.setImage(ImageFactory.getImage(ImageFactory.ERROR_SMALL));
- ruleExpandItem.setHeight(rulesExpandBarContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
- ruleExpandItem.setControl(rulesExpandBarContainer);
- // We build the expandItem Metrics;
- metricsExpandBarContainer = new MetricsComposite(expandBar, metrics, SWT.EMBEDDED);
- metricsExpandBarContainer.setLayout(layout);
-
- final ExpandItem metricExpandItem = new ExpandItem(expandBar, SWT.NONE, 0);
- metricExpandItem.setText("Metric");
- metricExpandItem.setImage(ImageFactory.getImage(ImageFactory.ERROR_SMALL));
- metricExpandItem.setHeight(
- metricsExpandBarContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
- metricExpandItem.setControl(metricsExpandBarContainer);
-
- // Then the expandItem Rules
- // Color of the background of the expandbar taking the one of the main
- // window
- configurationSelection.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(final SelectionEvent e) {
- final String methodName = "widgetSelected";
- ICodeLogger.entering(this.getClass().getName(), methodName, e);
- configurationId = configurationSelection
- .getItem(configurationSelection.getSelectionIndex());
- refresh();
- ICodeLogger.exiting(this.getClass().getName(), methodName);
- }
-
- });
- parent.getParent().pack();
- parent.getParent().redraw();
- this.refresh();
- ICodeLogger.exiting(this.getClass().getName(), method, composite);
- return composite;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performApply()
- */
- @Override
- public void performApply() {
- final String method = "performApply";
- ICodeLogger.entering(this.getClass().getName(), method);
- if (configurationId.equals(UserPreferencesService.PREF_CONFIGURATION_CUSTOMVALUE)) {
- UserPreferencesService.setDefaultConfiguration();
- for (final CheckerPreferencesContainer checker : metricsExpandBarContainer
- .getInputs()) {
- checker.savePreferences();
- }
- for (final CheckerPreferencesContainer checker : rulesExpandBarContainer.getInputs()) {
- checker.savePreferences();
- }
- } else {
- for (final CheckerPreferencesContainer checker : metricsExpandBarContainer
- .getInputs()) {
- checker.setToDefault();
- }
- for (final CheckerPreferencesContainer checker : rulesExpandBarContainer.getInputs()) {
- checker.setToDefault();
- }
- try {
- UserPreferencesService.setConfiguration(configurationId);
- } catch (NullContributionException e) {
- MessageDialog.openError(getShell(), Activator.PLUGIN_ID, e.getMessage());
- ICodeLogger.error(this.getClass().getName(), method, e);
- }
- for (final CheckerPreferencesContainer checker : metricsExpandBarContainer
- .getInputs()) {
- checker.update();
- }
- for (final CheckerPreferencesContainer checker : rulesExpandBarContainer.getInputs()) {
- checker.update();
- }
- }
- this.refresh();
- ICodeLogger.exiting(this.getClass().getName(), method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- @Override
- public void performDefaults() {
- final String method = "performDefaults";
- ICodeLogger.entering(this.getClass().getName(), method);
-
- for (final CheckerPreferencesContainer checker : metricsExpandBarContainer.getInputs()) {
- checker.setToDefault();
- }
- for (final CheckerPreferencesContainer checker : rulesExpandBarContainer.getInputs()) {
- checker.setToDefault();
- }
- UserPreferencesService.setDefaultConfiguration();
- configurationSelection.select(configurationSelection
- .indexOf(UserPreferencesService.getConfigurationName()));
- this.refresh();
- ICodeLogger.exiting(this.getClass().getName(), method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- final String method = "performOk";
- ICodeLogger.entering(this.getClass().getName(), method);
- this.performApply();
- ICodeLogger.exiting(this.getClass().getName(), method);
- return super.performOk();
- }
-
- /**
- * Redraw every elements of the view.
- */
- public void refresh() {
- final String method = "refresh";
- ICodeLogger.entering(this.getClass().getName(), method);
- this.composite.getParent().getParent().redraw();
- this.composite.layout();
- this.composite.redraw();
- metricsExpandBarContainer.refresh();
- rulesExpandBarContainer.refresh();
- ICodeLogger.exiting(this.getClass().getName(), method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/LanguagePreferencesContainer.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/LanguagePreferencesContainer.java
deleted file mode 100644
index 29c6edc5..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/LanguagePreferencesContainer.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.icode.logger.ICodeLogger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Container for languages used {@link UserPreferencesService}
- */
-public class LanguagePreferencesContainer {
-
- /**
- * Class name
- */
- private static final String CLASS = LanguagePreferencesContainer.class.getName();
-
- /**
- * Language's identifier
- */
- private String id;
- /**
- * Language's name
- */
- private String name;
- /**
- * Language selection
- */
- private boolean checked;
- /**
- * Language's checkers
- */
- private List checkers;
-
- /**
- * @param pId Language's identifier
- * @param pChecked Language's checkers
- */
- public LanguagePreferencesContainer(final String pId, final boolean pChecked) {
- final String method = "LanguagePreferencesContainer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pId, Boolean.valueOf(pChecked)
- });
- this.id = pId;
- this.checked = pChecked;
- this.checkers = new ArrayList<>();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pId Language's identifier
- * @param pName Language's name
- * @param pChecked Language selection
- */
- public LanguagePreferencesContainer(final String pId, final String pName,
- final boolean pChecked) {
- final String method = "LanguagePreferencesContainer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pId, pName, Boolean.valueOf(pChecked)
- });
- this.id = pId;
- this.name = pName;
- this.checked = pChecked;
- this.checkers = new ArrayList<>();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pId Language's identifier
- * @param pName Language's name
- * @param pChecked Language selection
- * @param pCheckers Language's checkers
- */
- public LanguagePreferencesContainer(final String pId, final String pName,
- final boolean pChecked, final List pCheckers) {
- final String method = "LanguagePreferencesContainer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pId, pName, Boolean.valueOf(pChecked), pCheckers
- });
- this.id = pId;
- this.name = pName;
- this.checked = pChecked;
- this.checkers = pCheckers;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pChecked selection to set.
- */
- public void setChecked(final Boolean pChecked) {
- final String method = "setChecked";
- ICodeLogger.entering(CLASS, method, pChecked);
- checked = pChecked.booleanValue();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method set checked to the default value found in the preference
- * store. It also set the preference store value to default. This method
- * uses setChecked method, thus the button is also updated.
- */
- public void setToDefault() {
- final String method = "setToDefault";
- ICodeLogger.entering(CLASS, method);
- Activator.getDefault().getPreferenceStore().setToDefault(id);
- for (final CheckerPreferencesContainer checker : checkers) {
- checker.setToDefault();
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method save preferences in i-Code UI preferences stores with
- * containers values.
- */
- public void savePreferences() {
- final String method = "savePreferences";
- ICodeLogger.entering(CLASS, method);
- for (final CheckerPreferencesContainer checker : checkers) {
- checker.savePreferences();
- }
- Activator.getDefault().getPreferenceStore().setValue(id, checked);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the id
- */
- public final String getId() {
- final String method = "getId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, id);
- return id;
- }
-
- /**
- * @param pId the id to set
- */
- public final void setId(final String pId) {
- final String method = "setId";
- ICodeLogger.entering(CLASS, method, pId);
- this.id = pId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the name
- */
- public final String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, name);
- return name;
- }
-
- /**
- * @param pName the name to set
- */
- public final void setName(final String pName) {
- final String method = "setName";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the checked
- */
- public final boolean isChecked() {
- final String method = "isChecked";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(checked));
- return checked;
- }
-
- /**
- * @param pChecked the checked to set
- */
- public final void setChecked(final boolean pChecked) {
- final String method = "setChecked";
- ICodeLogger.entering(CLASS, method, Boolean.valueOf(pChecked));
- this.checked = pChecked;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the checkers
- */
- public final List getCheckers() {
- final String method = "getCheckers";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, checkers);
- return checkers;
- }
-
- /**
- * @param pCheckers the checkers to set
- */
- public final void setCheckers(final List pCheckers) {
- final String method = "setCheckers";
- ICodeLogger.entering(CLASS, method, pCheckers);
- this.checkers = pCheckers;
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/UserPreferencesService.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/UserPreferencesService.java
deleted file mode 100644
index d8942a78..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/UserPreferencesService.java
+++ /dev/null
@@ -1,528 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences;
-
-import fr.cnes.analysis.tools.ui.Activator;
-import fr.cnes.analysis.tools.ui.configurations.CheckConfigurationContainer;
-import fr.cnes.analysis.tools.ui.configurations.ConfigurationContainer;
-import fr.cnes.analysis.tools.ui.configurations.ConfigurationService;
-import fr.cnes.icode.exception.NullContributionException;
-import fr.cnes.icode.logger.ICodeLogger;
-import fr.cnes.icode.services.checkers.CheckerContainer;
-import fr.cnes.icode.services.checkers.CheckerService;
-import fr.cnes.icode.services.languages.ILanguage;
-import fr.cnes.icode.services.languages.LanguageService;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public class UserPreferencesService extends AbstractPreferenceInitializer {
-
- /**
- * Preference key to access severity of a checker
- */
- public static final String PREF_SEVERITY_KEY = ".Severity";
- /**
- * Preference value of SEVERITY for Error
- */
- public static final String PREF_SEVERITY_ERROR_VALUE = "Error";
- /**
- * Preference value of SEVERITY for Warning
- */
- public static final String PREF_SEVERITY_WARNING_VALUE = "Warning";
- /**
- * Preference value of SEVERITY for Info
- */
- public static final String PREF_SEVERITY_INFO_VALUE = "Info";
- /**
- * Preference key to access Min of a checker
- */
- public static final String PREF_MIN_VALUE_KEY = ".Min";
- /**
- * Preference key to access Max of a checker
- */
- public static final String PREF_MAX_VALUE_KEY = ".Max";
- /**
- * Preference key to access severity of a checker
- */
- public static final String PREF_CONFIGURATION_KEY = "Configuration";
- /**
- * Preference key to access severity of a checker
- */
- public static final String PREF_CONFIGURATION_CUSTOMVALUE = "Custom";
- /**
- * Class name
- */
- private static final String CLASS = UserPreferencesService.class.getName();
-
- /**
- * This method retrieves all contributor of analyzer using
- * {@link LanguageService} and {@link CheckerService} and set each languages
- * and checker, then sets :
- *
- *
Checked : true
- *
Severity : Error
- *
maxValue, minValue: Pending the
- * {@link CheckerPreferencesContainer}
- *
- *
- * @throws NullContributionException when a contribution couldn't be reached in one of the
- * extension points being used to initiate preferences.
- * @throws CoreException when an eclipse related method couldn't be executed
- */
- public static void initPreferences() throws NullContributionException, CoreException {
- final String method = "initPreferences";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.error(CLASS, method, new Exception("avant"));
- for (final String languageId : LanguageService.getLanguagesIds()) {
- ICodeLogger.error(CLASS, method, new Exception("Language de benoit: " + languageId));
- Activator.getDefault().getPreferenceStore().setDefault(languageId, true);
- for (final CheckerContainer checker : CheckerService.getCheckers(languageId)) {
- Activator.getDefault().getPreferenceStore().setDefault(checker.getId(), true);
- Activator.getDefault().getPreferenceStore().setDefault(
- checker.getId() + PREF_SEVERITY_KEY, PREF_SEVERITY_ERROR_VALUE);
- if (checker.isMetric()) {
- Activator.getDefault().getPreferenceStore()
- .setDefault(checker.getId() + PREF_MAX_VALUE_KEY, Float.NaN);
- Activator.getDefault().getPreferenceStore()
- .setDefault(checker.getId() + PREF_MIN_VALUE_KEY, Float.NaN);
- }
- }
- }
- Activator.getDefault().getPreferenceStore().setDefault(PREF_CONFIGURATION_KEY,
- PREF_CONFIGURATION_CUSTOMVALUE);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
- * initializeDefaultPreferences()
- */
- @Override
- public void initializeDefaultPreferences() {
- final String method = "initializeDefaultPreferences";
- ICodeLogger.entering(CLASS, method);
- try {
- initPreferences();
- } catch (NullContributionException | CoreException e) {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Activator.PLUGIN_ID, e.getMessage());
- ICodeLogger.error(this.getClass().getName(), method, e);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param languageId Identifier of the language to enable.
- * @return Language enabling success.
- */
- public static boolean enableLanguage(final String languageId) {
- final String method = "enableLanguage";
- ICodeLogger.entering(CLASS, method, languageId);
- boolean success = false;
- if (languageExists(languageId)) {
- Activator.getDefault().getPreferenceStore().setValue(languageId, true);
- success = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(success));
- return success;
- }
-
- /**
- * @param languageId Language identifier to verify.
- * @return Whether or not the language is enabled.
- */
- public static boolean isEnabledLanguage(final String languageId) {
- final String method = "isEnabledLanguage";
- ICodeLogger.entering(CLASS, method, languageId);
- final boolean isEnabledLanguage = Activator.getDefault().getPreferenceStore()
- .getBoolean(languageId);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEnabledLanguage));
- return isEnabledLanguage;
- }
-
- /**
- * @param checkerId Identifier of the checker.
- * @return Whether or not the language is enabled.
- */
- public static boolean isEnabledChecker(final String checkerId) {
- final String method = "isEnabledChecker";
- ICodeLogger.entering(CLASS, method, checkerId);
- final boolean isEnabledChecker = Activator.getDefault().getPreferenceStore()
- .getBoolean(checkerId);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEnabledChecker));
- return isEnabledChecker;
- }
-
- /**
- * @param languageId Language identifier of language to disable.
- * @return Language disabling success.
- */
- public static boolean disableLanguage(final String languageId) {
- final String method = "disableLanguage";
- ICodeLogger.entering(CLASS, method, languageId);
- boolean success = false;
- if (languageExists(languageId)) {
- Activator.getDefault().getPreferenceStore().setValue(languageId, false);
- success = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(success));
- return success;
- }
-
- /**
- * Enable a checker pending it's language. In case the language is disabled
- * it will be enabled too.
- *
- * @param languageId language identifier of the checker
- * @param checkerId identifier of the checker to enable
- * @return checker enabling success
- */
- public static boolean enableChecker(final String languageId, final String checkerId) {
- final String method = "enableChecker";
- ICodeLogger.entering(CLASS, method, new Object[]{
- languageId, checkerId
- });
- boolean success = false;
- if (checkerExists(languageId, checkerId)) {
- Activator.getDefault().getPreferenceStore().setValue(languageId, true);
- Activator.getDefault().getPreferenceStore().setValue(checkerId, true);
- success = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(success));
- return success;
- }
-
- /**
- * Disable a checker pending it's language.
- *
- * @param languageId language identifier of the checker
- * @param checkerId identifier of the checker to enable
- * @return checker disabling success
- */
- public static boolean disableChecker(final String languageId, final String checkerId) {
- final String method = "disableChecker";
- ICodeLogger.entering(CLASS, method, new Object[]{
- languageId, checkerId
- });
- boolean success = false;
- if (checkerExists(languageId, checkerId)) {
- Activator.getDefault().getPreferenceStore().setValue(checkerId, false);
- success = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(success));
- return success;
- }
-
- /**
- * This method verify and return for each languages contributing the
- * analyzer that is enabled in the preferences.
- *
- * @return Language identifier of languages enabled in the
- * {@link PreferenceStore}.
- */
- public static List getEnabledLanguagesIds() {
- final String method = "getEnabledLanguagesIds";
- ICodeLogger.entering(CLASS, method);
- final List languages = new ArrayList<>();
- for (final String language : LanguageService.getLanguagesIds()) {
- if (isEnabledLanguage(language)) {
- languages.add(language);
- }
- }
- ICodeLogger.exiting(CLASS, method, languages);
- return languages;
- }
-
- /**
- * @return identifiers of checkers disabled
- */
- public static List getDisabledCheckersIds() {
- final String method = "getDisabledCheckersIds";
- ICodeLogger.entering(CLASS, method);
- final List checkers = new ArrayList<>();
- for (final String languageId : getEnabledLanguagesIds()) {
- for (final String checkerId : CheckerService.getCheckersIds(languageId)) {
- if (!isEnabledChecker(checkerId)) {
- checkers.add(checkerId);
- }
- }
- }
- ICodeLogger.exiting(CLASS, method, checkers);
- return checkers;
- }
-
- /**
- * This method verify and return for each languages contributing the
- * analyzer and it's checkers.
- *
- * @return Language identifier of languages enabled in the
- * {@link PreferenceStore}.
- * @throws CoreException on execution failure
- * @throws NullContributionException when no contribution can be found
- */
- public static List getLanguagesPreferences()
- throws NullContributionException, CoreException {
- final String method = "getLanguagesPreferences";
- ICodeLogger.entering(CLASS, method);
- final List languagesPrefs = new ArrayList<>();
- for (final ILanguage language : LanguageService.getLanguages()) {
- if (languageExists(language.getId())) {
- final boolean languageEnabled = isEnabledLanguage(language.getId());
- final List checkersPrefs = new ArrayList<>();
- for (final CheckerContainer checker : CheckerService
- .getCheckers(language.getId())) {
- if (checkerExists(language.getId(), checker.getId())) {
- checkersPrefs.add(new CheckerPreferencesContainer(language.getId(),
- language.getName(), checker.getId(), checker.getName(),
- isEnabledChecker(checker.getId()),
- getCheckerSeverity(checker.getId()), checker.isMetric()));
- }
- }
- languagesPrefs.add(new LanguagePreferencesContainer(language.getId(),
- language.getName(), languageEnabled, checkersPrefs));
-
- }
- }
- ICodeLogger.exiting(CLASS, method, languagesPrefs);
- return languagesPrefs;
- }
-
- /**
- * @return checkers with value set in preferences
- * @throws NullContributionException if a checker can't be reached because not existing
- * @throws CoreException when a checker can be reached for some runtime reasons.
- */
- public static List getCheckersPreferences()
- throws NullContributionException, CoreException {
- final String method = "getCheckersPreferences";
- ICodeLogger.entering(CLASS, method);
- final List checkPrefs = new ArrayList<>();
- for (final CheckerContainer checker : CheckerService.getCheckers()) {
- final String languageId = checker.getLanguage().getId();
- final String languageName = checker.getLanguage().getName();
- final String severity = getCheckerSeverity(checker.getId());
- final boolean isEnabled = isEnabledChecker(checker.getId());
- if (checker.isMetric()) {
- final Float minValue;
- if (hasMinValue(checker.getId())) {
- minValue = getMinValue(checker.getId());
- } else {
- minValue = Float.valueOf(Float.NaN);
- }
- final Float maxValue;
- if (hasMaxValue(checker.getId())) {
- maxValue = getMaxValue(checker.getId());
- } else {
- maxValue = Float.valueOf(Float.NaN);
- }
- checkPrefs.add(new CheckerPreferencesContainer(languageId, languageName,
- checker.getId(), checker.getName(), isEnabled, severity, minValue,
- maxValue, true));
- } else {
- checkPrefs.add(new CheckerPreferencesContainer(languageId, languageName,
- checker.getId(), checker.getName(), isEnabled, severity, false));
- }
- }
- ICodeLogger.exiting(CLASS, method, checkPrefs);
- return checkPrefs;
- }
-
- /**
- * @param checkerId identifier of the checker
- * @return severity of the checker
- */
- public static String getCheckerSeverity(String checkerId) {
- final String method = "getCheckerSeverity";
- ICodeLogger.entering(CLASS, method, checkerId);
- final String checkerSeverity = Activator.getDefault().getPreferenceStore()
- .getString(checkerId + PREF_SEVERITY_KEY);
- ICodeLogger.exiting(CLASS, method, checkerSeverity);
- return checkerSeverity;
- }
-
- /**
- * @param languageId language of the checker
- * @param checkerId identifier of the checker
- * @param severity severity chosen for the checker
- * @return set of the severity success
- */
- public static boolean setCheckerSeverity(final String languageId, final String checkerId,
- final String severity) {
- final String method = "setCheckerSeverity";
- ICodeLogger.entering(CLASS, method, new Object[]{
- languageId, checkerId, severity
- });
- boolean success = false;
- if (checkerExists(languageId, checkerId)) {
- Activator.getDefault().getPreferenceStore().setValue(checkerId + PREF_SEVERITY_KEY,
- severity);
- success = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(success));
- return success;
- }
-
- /**
- * @param languageId language identifier of the checker
- * @param checkerId identifier of the checker
- * @return whether or not the preferences store contains this checker.
- */
- public static boolean checkerExists(final String languageId, final String checkerId) {
- final String method = "checkerExists";
- ICodeLogger.entering(CLASS, method, new Object[]{
- languageId, checkerId
- });
- final boolean checkerExists = Activator.getDefault().getPreferenceStore()
- .contains(checkerId);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(checkerExists));
- return checkerExists;
- }
-
- /**
- * @param configurationName Configuration name to set in preferences.
- * @throws NullContributionException when a contribution could not be reached.
- */
- public static void setConfiguration(final String configurationName)
- throws NullContributionException {
- final String method = "setConfiguration";
- ICodeLogger.entering(CLASS, method, configurationName);
- Activator.getDefault().getPreferenceStore().setValue(PREF_CONFIGURATION_KEY,
- configurationName);
- final ConfigurationContainer config = ConfigurationService
- .getConfigurations(configurationName);
- for (CheckConfigurationContainer checker : config.getCheckConfigurations()) {
- Activator.getDefault().getPreferenceStore().setValue(
- checker.getCheckId() + PREF_MAX_VALUE_KEY,
- checker.getMaxValue().floatValue());
- Activator.getDefault().getPreferenceStore().setValue(
- checker.getCheckId() + PREF_MIN_VALUE_KEY,
- checker.getMinValue().floatValue());
- Activator.getDefault().getPreferenceStore().setValue(checker.getCheckId(),
- checker.isEnabled());
- }
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * Set back the active configuration to
- * {@link #PREF_CONFIGURATION_CUSTOMVALUE}.
- */
- public static void setDefaultConfiguration() {
- final String method = "setDefaultConfiguration";
- ICodeLogger.entering(CLASS, method);
- Activator.getDefault().getPreferenceStore().setToDefault(PREF_CONFIGURATION_KEY);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return active configuration
- */
- public static String getConfigurationName() {
- final String method = "getConfigurationName";
- ICodeLogger.entering(CLASS, method);
- final String configurationName = Activator.getDefault().getPreferenceStore()
- .getString(PREF_CONFIGURATION_KEY);
- ICodeLogger.exiting(CLASS, method, configurationName);
- return configurationName;
- }
-
- /**
- * @return active configuration
- */
- public static boolean isDefaultConfigurationActive() {
- final String method = "isDefaultConfigurationActive";
- ICodeLogger.entering(CLASS, method);
- final boolean defaultConfigurationActive = Activator.getDefault().getPreferenceStore()
- .getString(PREF_CONFIGURATION_KEY).equals(PREF_CONFIGURATION_CUSTOMVALUE);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(defaultConfigurationActive));
- return defaultConfigurationActive;
- }
-
- /**
- * @param languageId that must be checked
- * @return whether or not the preference store contains this language.
- */
- public static boolean languageExists(final String languageId) {
- final String method = "languageExists";
- ICodeLogger.entering(CLASS, method, languageId);
- final boolean languageExists = Activator.getDefault().getPreferenceStore()
- .contains(languageId);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(languageExists));
- return languageExists;
- }
-
- /**
- * @param checkerId identifier of the checker
- * @return the maxValue allowed for the checkerId, if it's set.
- */
- public static Float getMaxValue(final String checkerId) {
- final String method = "getMaxValue";
- ICodeLogger.entering(CLASS, method, checkerId);
- final Float maxValue = Float.valueOf(Activator.getDefault().getPreferenceStore()
- .getFloat(checkerId + PREF_MAX_VALUE_KEY));
- ICodeLogger.exiting(CLASS, method, maxValue);
- return maxValue;
- }
-
- /**
- * @param checkerId identifier of the checker
- * @return whether or not a max value was set in preference for the
- * checkerId.
- */
- public static boolean hasMaxValue(final String checkerId) {
- final String method = "hasMaxValue";
- ICodeLogger.entering(CLASS, method, checkerId);
- final boolean hasMaxValue = Activator.getDefault().getPreferenceStore()
- .contains(checkerId + PREF_MAX_VALUE_KEY)
- && !Float.isNaN(Activator.getDefault().getPreferenceStore()
- .getFloat(checkerId + PREF_MAX_VALUE_KEY));
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(hasMaxValue));
- return hasMaxValue;
- }
-
- /**
- * @param checkerId identifier of the checker
- * @return the minimum value set for the checkerId, if one is
- * set.
- */
- public static Float getMinValue(final String checkerId) {
- final String method = "getMinValue";
- ICodeLogger.entering(CLASS, method, checkerId);
- final Float minValue = Float.valueOf(Activator.getDefault().getPreferenceStore()
- .getFloat(checkerId + PREF_MIN_VALUE_KEY));
- ICodeLogger.exiting(CLASS, method, minValue);
- return minValue;
- }
-
- /**
- * @param checkerId identifier of the checker
- * @return whether or not a minimum value was set of this
- * checkedId.
- */
- public static boolean hasMinValue(final String checkerId) {
- final String method = "hasMinValue";
- ICodeLogger.entering(CLASS, method, checkerId);
- final boolean hasMinValue = Activator.getDefault().getPreferenceStore()
- .contains(checkerId + PREF_MIN_VALUE_KEY)
- && !Float.isNaN(Activator.getDefault().getPreferenceStore()
- .getFloat(checkerId + PREF_MIN_VALUE_KEY));
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(hasMinValue));
- return hasMinValue;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersComposite.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersComposite.java
deleted file mode 100644
index e067d24e..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersComposite.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.LanguagePreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import java.util.List;
-
-/**
- * This viewer can show {@link CheckerPreferencesContainer} in a Table,
- * editable.
- */
-public class CheckersComposite extends Composite {
- /**
- * Enable or disable checkers column's index.
- */
- private static final int COLUMN_ENABLED_INDEX = 0;
- /**
- * Enable or disable checkers column's bound.
- */
- private static final int COLUMN_ENABLED_BOUND = 30;
- /**
- * Checker's name column's name.
- */
- private static final String COLUMN_CHECKER_NAME = "Checker";
- /**
- * Checker's name checkers column's index.
- */
- private static final int COLUMN_CHECKER_INDEX = 1;
- /**
- * Checker's name checkers column's bound.
- */
- private static final int COLUMN_CHECKER_BOUND = 200;
- /**
- * Checker's languages column's name.
- */
- private static final String COLUMN_LANGUAGE_NAME = "Language";
- /**
- * Checker's languages checkers column's index.
- */
- private static final int COLUMN_LANGUAGE_INDEX = 2;
- /**
- * Checker's languages checkers column's bound.
- */
- private static final int COLUMN_LANGUAGE_BOUND = 80;
- /**
- * Checker's severity column's name.
- */
- private static final String COLUMN_SEVERITY_NAME = "Severity";
- /**
- * Checker's severity column's index.
- */
- private static final int COLUMN_SEVERITY_INDEX = 3;
- /**
- * Checker's severity column's bound.
- */
- private static final int COLUMN_SEVERITY_BOUND = 80;
-
- /**
- * Class name
- **/
- private static final String CLASS = CheckersComposite.class.getName();
-
- /**
- * Image of information severity level
- */
- private Image infoImage;
- /**
- * Image of warning severity level
- */
- private Image warningImage;
- /**
- * Image of error severity level
- */
- private Image errorImage;
- /**
- * Image of information enabled checker
- */
- private Image enabledImage;
- /**
- * Image of disabled checker
- */
- private Image disabledImage;
- /**
- * Enabled column
- */
- private TableViewerColumn enabledColumn;
- /**
- * All checkers are enabled
- */
- private boolean allEnabledChecked;
-
- /**
- * The TableViewer
- */
- private TableViewer checkersTableViewer;
- /**
- * Language preference container
- */
- private LanguagePreferencesContainer language;
- /**
- * Checkers to configure in the table
- */
- private List inputs;
- /**
- * Listener for all checker enabling/disabling
- */
- private Listener enableAllListerner;
-
- /**
- * @param pParent Composite containing the Table Viewer.
- * @param checkers Table viewer's inputs.
- * @param style SWT Composite style.
- */
- public CheckersComposite(final Composite pParent,
- final List checkers, final int style) {
- super(pParent, style);
- final String method = "CheckerTableViewer";
-
- ICodeLogger.entering(CLASS, method, new Object[]{
- pParent, checkers
- });
- this.inputs = checkers;
- infoImage = ImageFactory.getImage(ImageFactory.INFO_SMALL);
- warningImage = ImageFactory.getImage(ImageFactory.WARNING_SMALL);
- errorImage = ImageFactory.getImage(ImageFactory.ERROR_SMALL);
- enabledImage = ImageFactory.getImage(ImageFactory.ENABLED);
- disabledImage = ImageFactory.getImage(ImageFactory.DISABLED);
- final GridLayout layout = new GridLayout(2, false);
- this.setLayout(layout);
- final Label searchLabel = new Label(this, SWT.NONE);
- searchLabel.setText("Search: ");
- final Text searchText = new Text(this, SWT.BORDER | SWT.SEARCH);
- searchText.setLayoutData(
- new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
-
- this.createViewer(this);
- final CheckersFilter filter = new CheckersFilter();
- searchText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(final ModifyEvent e) {
- filter.setSearchText(searchText.getText());
- checkersTableViewer.refresh();
- }
- });
- checkersTableViewer.addFilter(filter);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pParent Composite containing the Table Viewer
- */
- private void createViewer(final Composite pParent) {
- final String method = "createViewer";
- ICodeLogger.entering(CLASS, method, pParent);
- checkersTableViewer = new TableViewer(pParent,
- SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
- createColumns(this, checkersTableViewer);
- final Table table = checkersTableViewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- checkersTableViewer.setContentProvider(new ArrayContentProvider());
- // get the content for the viewer, setInput will call getElements in the
- // contentProvider
- checkersTableViewer.setInput(inputs);
- // make the selection available to other views
-
- // define layout for the viewer
- final GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = 2;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- checkersTableViewer.getControl().setLayoutData(gridData);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pParent Composite containing the Table Viewer
- * @param pCheckersTableViewer TableViewer containing the columns.
- */
- protected void createColumns(final Composite pParent, final TableViewer pCheckersTableViewer) {
- final String method = "createColumns";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pParent, pCheckersTableViewer
- });
- enabledColumn = createEnabledViewerColumn(COLUMN_ENABLED_BOUND, COLUMN_ENABLED_INDEX);
- enabledColumn.setEditingSupport(new EnabledEditingSupport(pCheckersTableViewer, this));
- enabledColumn.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(final Object element) {
- return null;
- }
-
- @Override
- public Image getImage(final Object element) {
- final Image image;
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- if (checker.isChecked()) {
- image = enabledImage;
- } else {
- image = disabledImage;
- }
-
- return image;
- }
- });
- TableViewerColumn col = createTableViewerColumn(COLUMN_CHECKER_NAME, COLUMN_CHECKER_BOUND,
- COLUMN_CHECKER_INDEX);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- return checker.getName();
- }
- });
- col = createTableViewerColumn(COLUMN_LANGUAGE_NAME, COLUMN_LANGUAGE_BOUND,
- COLUMN_LANGUAGE_INDEX);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- return checker.getLanguageName();
- }
- });
-
- col = createTableViewerColumn(COLUMN_SEVERITY_NAME, COLUMN_SEVERITY_BOUND,
- COLUMN_SEVERITY_INDEX);
- col.setEditingSupport(new SeverityEditingSupport(pCheckersTableViewer));
- col.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(final Object element) {
- return ((CheckerPreferencesContainer) element).getSeverity();
- }
-
- @Override
- public Image getImage(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- final Image severityImage;
- switch (checker.getSeverity()) {
- case UserPreferencesService.PREF_SEVERITY_ERROR_VALUE:
- severityImage = errorImage;
- break;
- case UserPreferencesService.PREF_SEVERITY_WARNING_VALUE:
- severityImage = warningImage;
- break;
- case UserPreferencesService.PREF_SEVERITY_INFO_VALUE:
- default:
- severityImage = infoImage;
- break;
- }
- ICodeLogger.exiting(CLASS, method, severityImage);
- return severityImage;
-
- }
-
- });
-
- }
-
- /**
- * @param title Column's title.
- * @param bound Column's bound
- * @param colNumber Column's index.
- * @return {@link TableViewerColumn} created.
- */
- protected TableViewerColumn createTableViewerColumn(final String title, final int bound,
- final int colNumber) {
- final String method = "createTableViewerColumn";
- ICodeLogger.entering(CLASS, method, new Object[]{
- title, Integer.valueOf(bound), Integer.valueOf(colNumber)
- });
- final TableViewerColumn viewerColumn = new TableViewerColumn(this.checkersTableViewer,
- SWT.NONE);
- final TableColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(true);
- ICodeLogger.exiting(CLASS, method, viewerColumn);
- return viewerColumn;
- }
-
- /**
- * @param bound Column's bound.
- * @param colNumber Column's index.
- * @return A column with an Image to set checker enabled or disabled.
- */
- protected TableViewerColumn createEnabledViewerColumn(final int bound, final int colNumber) {
- final String method = "createEnabledViewerColumn";
- ICodeLogger.entering(CLASS, method, new Object[]{
- Integer.valueOf(bound), Integer.valueOf(colNumber)
- });
- final TableViewerColumn viewerColumn = new TableViewerColumn(this.checkersTableViewer,
- SWT.CENTER);
- final TableColumn column = viewerColumn.getColumn();
- column.setImage(ImageFactory.getImage(ImageFactory.DISABLED));
- column.setToolTipText("Check to select or unselect every rules in the table.");
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(true);
- enableAllListerner = new Listener() {
-
- @Override
- public void handleEvent(final Event event) {
- /*
- * If the event is a selection one, then we have to set inputs
- * to get all of them checked or unchecked.
- */
- if (event.type == SWT.Selection) {
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- if (!allEnabledChecked) {
- column.setImage(ImageFactory.getImage(ImageFactory.ENABLED));
- for (final CheckerPreferencesContainer checker : inputs) {
- checker.setChecked(true);
- }
- allEnabledChecked = true;
- } else {
- column.setImage(ImageFactory.getImage(ImageFactory.DISABLED));
- for (final CheckerPreferencesContainer checker : inputs) {
- checker.setChecked(false);
- }
- allEnabledChecked = false;
- }
- } else {
- column.setImage(null);
- }
- }
- /*
- * Image must be set pending the inputs and the configuration.
- */
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- allEnabledChecked = isAllEnabled();
- if (allEnabledChecked) {
- column.setImage(ImageFactory.getImage(ImageFactory.ENABLED));
- } else {
- column.setImage(ImageFactory.getImage(ImageFactory.DISABLED));
- }
- } else {
- column.setImage(null);
- }
-
- checkersTableViewer.refresh();
- }
-
- private boolean isAllEnabled() {
- int inputCounter = 0;
- boolean allEnabled = true;
- while (inputCounter < inputs.size() && allEnabled) {
- if (!inputs.get(inputCounter).isChecked()) {
- allEnabled = false;
- }
- inputCounter++;
- }
- return allEnabled;
- }
- };
- column.addListener(SWT.Selection, enableAllListerner);
- this.refresh();
- ICodeLogger.exiting(CLASS, method, viewerColumn);
- return viewerColumn;
-
- }
-
- /**
- * Refresh the TableViewer and it's components.
- */
- public void refresh() {
- final String method = "refresh";
- ICodeLogger.entering(CLASS, method);
- this.checkersTableViewer.getControl().redraw();
- this.enableAllListerner.handleEvent(new Event());
- this.checkersTableViewer.refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the infoImage
- */
- protected Image getInfoImage() {
- final String method = "getInfoImage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, infoImage);
- return infoImage;
- }
-
- /**
- * @param pInfoImage the infoImage to set
- */
- protected void setInfoImage(final Image pInfoImage) {
- final String method = "setInfoImage";
- ICodeLogger.entering(CLASS, method, pInfoImage);
- this.infoImage = pInfoImage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the warningImage
- */
- protected Image getWarningImage() {
- final String method = "getWarningImage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, warningImage);
- return warningImage;
- }
-
- /**
- * @param pWarningImage the warningImage to set
- */
- protected void setWarningImage(final Image pWarningImage) {
- final String method = "setWarningImage";
- ICodeLogger.entering(CLASS, method, pWarningImage);
- this.warningImage = pWarningImage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the errorImage
- */
- protected Image getErrorImage() {
- final String method = "getErrorImage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, errorImage);
- return errorImage;
- }
-
- /**
- * @param pErrorImage the errorImage to set
- */
- protected void setErrorImage(final Image pErrorImage) {
- final String method = "setErrorImage";
- ICodeLogger.entering(CLASS, method, pErrorImage);
- this.errorImage = pErrorImage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the enabledImage
- */
- protected Image getEnabledImage() {
- final String method = "getEnabledImage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, enabledImage);
- return enabledImage;
- }
-
- /**
- * @param pEnabledImage the enabledImage to set
- */
- protected void setEnabledImage(final Image pEnabledImage) {
- final String method = "setEnabledImage";
- ICodeLogger.entering(CLASS, method, pEnabledImage);
- this.enabledImage = pEnabledImage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the disabledImage
- */
- protected Image getDisabledImage() {
- final String method = "getDisabledImage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, disabledImage);
- return disabledImage;
- }
-
- /**
- * @param pDisabledImage the disabledImage to set
- */
- protected void setDisabledImage(final Image pDisabledImage) {
- final String method = "setDisabledImage";
- ICodeLogger.entering(CLASS, method, pDisabledImage);
- this.disabledImage = pDisabledImage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the enabledColumn
- */
- protected TableViewerColumn getEnabledColumn() {
- final String method = "getEnabledColumn";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, enabledColumn);
- return enabledColumn;
- }
-
- /**
- * @param pEnabledColumn the enabledColumn to set
- */
- protected void setEnabledColumn(final TableViewerColumn pEnabledColumn) {
- final String method = "setEnabledColumn";
- ICodeLogger.entering(CLASS, method, pEnabledColumn);
- this.enabledColumn = pEnabledColumn;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the allEnabledChecked
- */
- protected boolean isAllEnabledChecked() {
- final String method = "isAllEnabledChecked";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(allEnabledChecked));
- return allEnabledChecked;
- }
-
- /**
- * @param pAllEnabledChecked the allEnabledChecked to set
- */
- protected void setAllEnabledChecked(final boolean pAllEnabledChecked) {
- final String method = "setAllEnabledChecked";
- ICodeLogger.entering(CLASS, method, Boolean.valueOf(pAllEnabledChecked));
- this.allEnabledChecked = pAllEnabledChecked;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the language
- */
- public final LanguagePreferencesContainer getLanguage() {
- final String method = "getLanguage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, language);
- return language;
- }
-
- /**
- * @param pLanguage the language to set
- */
- public final void setLanguage(final LanguagePreferencesContainer pLanguage) {
- final String method = "setLanguage";
- ICodeLogger.entering(CLASS, method, pLanguage);
- this.language = pLanguage;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the inputs
- */
- public final List getInputs() {
- final String method = "getInputs";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, inputs);
- return inputs;
- }
-
- /**
- * @param pInputs the inputs to set
- */
- public final void setInputs(final List pInputs) {
- final String method = "setInputs";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param isEnabled Set enabled or disabled all checker of the TableViewer.
- */
- public void setAllEnabledChecker(final boolean isEnabled) {
- final String method = "setAllEnabledChecker";
- ICodeLogger.entering(CLASS, method, Boolean.valueOf(isEnabled));
- if (allEnabledChecked && !isEnabled) {
- allEnabledChecked = false;
- enabledColumn.getColumn().setImage(disabledImage);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersFilter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersFilter.java
deleted file mode 100644
index 5bb13954..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/CheckersFilter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-/**
- * Filter for {@link CheckerPreferencesContainer}
- */
-public class CheckersFilter extends ViewerFilter {
-
- /**
- * Class name
- **/
- private static final String CLASS = CheckersFilter.class.getName();
-
- /**
- * Search string
- */
- private String searchString;
-
- /**
- * Adding pattern to s parameter.
- *
- * @param str Searched string.
- */
- public void setSearchText(final String str) {
- final String method = "setSearchText";
- ICodeLogger.entering(CLASS, method, str);
- // ensure that the value can be used for matching
- this.searchString = "(?i:.*" + str + ".*)";
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.
- * Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
- final String method = "select";
- ICodeLogger.entering(CLASS, method, new Object[]{
- viewer, parentElement, element
- });
- boolean select = false;
- if (searchString == null || searchString.length() == 0) {
- select = true;
- } else {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- if (checker.getName().matches(searchString)
- || checker.getLanguageName().matches(searchString)) {
- select = true;
- }
- }
-
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(select));
-
- return select;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/EnabledEditingSupport.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/EnabledEditingSupport.java
deleted file mode 100644
index d86f7012..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/EnabledEditingSupport.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-
-/**
- * Editing support for Enabled cells.
- */
-public class EnabledEditingSupport extends EditingSupport {
- /**
- * Class name
- **/
- private static final String CLASS = EnabledEditingSupport.class.getName();
-
- /**
- * Column viewer containing the cell
- */
- private final ColumnViewer viewer;
- /**
- * TableViewer containing the column
- */
- private final CheckersComposite checkerTableViewer;
-
- /**
- * @param pViewer Column viewer containing the cell
- * @param pCheckerTableViewer TableViewer containing the column
- */
- public EnabledEditingSupport(final TableViewer pViewer,
- final CheckersComposite pCheckerTableViewer) {
- super(pViewer);
- final String method = "EnabledEditingSupport";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pViewer, pCheckerTableViewer
- });
- this.viewer = pViewer;
- this.checkerTableViewer = pCheckerTableViewer;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
- */
- @Override
- protected CellEditor getCellEditor(Object element) {
- final String method = "getCellEditor";
- ICodeLogger.entering(CLASS, method, element);
- final CellEditor editor = new CheckboxCellEditor(null, SWT.CHECK | SWT.READ_ONLY);
- ICodeLogger.exiting(CLASS, method, editor);
- return editor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
- */
- @Override
- protected boolean canEdit(Object element) {
- final String method = "canEdit";
- ICodeLogger.entering(CLASS, method, element);
- return UserPreferencesService.isDefaultConfigurationActive();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
- */
- @Override
- protected Object getValue(Object element) {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method, element);
- final Object value;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- value = Boolean.valueOf(((CheckerPreferencesContainer) element).isChecked());
- } else {
- value = Boolean.valueOf(UserPreferencesService
- .isEnabledChecker(((CheckerPreferencesContainer) element).getId()));
- }
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object,
- * java.lang.Object)
- */
- @Override
- protected void setValue(Object element, Object value) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, new Object[]{
- element, value
- });
- ((CheckerPreferencesContainer) element).setChecked(((Boolean) value).booleanValue());
-
- if (!((Boolean) value).booleanValue()) {
- this.checkerTableViewer.setAllEnabledChecker(false);
- }
- viewer.refresh();
- ICodeLogger.exiting(CLASS, method);
-
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MaxValueEditingSupport.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MaxValueEditingSupport.java
deleted file mode 100644
index bb0530ad..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MaxValueEditingSupport.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-
-/**
- * Editing support for Maximum columns.
- */
-public class MaxValueEditingSupport extends EditingSupport {
- /**
- * Class name
- **/
- private static final String CLASS = MaxValueEditingSupport.class.getName();
- /**
- * Cell editor
- */
- private final CellEditor editor;
-
- /**
- * @param pViewer Column viewer containing the cell
- */
- public MaxValueEditingSupport(final TableViewer pViewer) {
- super(pViewer);
- final String method = "MaxValueEditingSupport";
- ICodeLogger.entering(CLASS, method, pViewer);
- this.editor = new TextCellEditor(pViewer.getTable());
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
- */
- @Override
- protected CellEditor getCellEditor(final Object element) {
- final String method = "getCellEditor";
- ICodeLogger.entering(CLASS, method, element);
- ICodeLogger.exiting(CLASS, method, editor);
- return editor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
- */
- @Override
- protected boolean canEdit(final Object element) {
- final String method = "canEdit";
- ICodeLogger.entering(CLASS, method, element);
- final boolean canEdit = UserPreferencesService.isDefaultConfigurationActive()
- && ((CheckerPreferencesContainer) element).isMetric();
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(canEdit));
- return canEdit;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
- */
- @Override
- protected Object getValue(final Object element) {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method, element);
- final Object value;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- value = Float.toString(
- ((CheckerPreferencesContainer) element).getMaxValue().floatValue());
- } else {
- value = UserPreferencesService
- .getMaxValue(((CheckerPreferencesContainer) element).getId());
- }
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object,
- * java.lang.Object)
- */
- @Override
- protected void setValue(final Object element, final Object value) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, new Object[]{
- element, value
- });
- try {
- ((CheckerPreferencesContainer) element).setMaxValue(Float.parseFloat((String) value));
- } catch (@SuppressWarnings("unused") NullPointerException | NumberFormatException e) {
- ((CheckerPreferencesContainer) element).setMaxValue(Float.NaN);
- }
- this.getViewer().refresh();
- ICodeLogger.exiting(CLASS, method);
-
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MetricsComposite.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MetricsComposite.java
deleted file mode 100644
index 11493b36..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MetricsComposite.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-import java.util.List;
-
-/**
- * This {@link CheckersComposite} is implemented to show and edit configuration
- * of i-Code Checker which are set as metrics.
- *
- * @version 3.0
- * @since 3.0
- */
-public class MetricsComposite extends CheckersComposite {
- /**
- * Enable or disable checkers column's index.
- */
- private static final int COLUMN_ENABLED_INDEX = 0;
- /**
- * Enable or disable checkers column's bound.
- */
- private static final int COLUMN_ENABLED_BOUND = 30;
- /**
- * Checker's name column's name.
- */
- private static final String COLUMN_CHECKER_NAME = "Checker";
- /**
- * Checker's name checkers column's index.
- */
- private static final int COLUMN_CHECKER_INDEX = 1;
- /**
- * Checker's name checkers column's bound.
- */
- private static final int COLUMN_CHECKER_BOUND = 200;
- /**
- * Checker's languages column's name.
- */
- private static final String COLUMN_LANGUAGE_NAME = "Language";
- /**
- * Checker's languages checkers column's index.
- */
- private static final int COLUMN_LANGUAGE_INDEX = 2;
- /**
- * Checker's languages checkers column's bound.
- */
- private static final int COLUMN_LANGUAGE_BOUND = 80;
- /**
- * Checker's minimum value column's name.
- */
- private static final String COLUMN_MINIMUM_NAME = "Minimum";
- /**
- * Checker's minimum value column's index.
- */
- private static final int COLUMN_MINIMUM_INDEX = 3;
- /**
- * Checker's minimum value column's bound.
- */
- private static final int COLUMN_MINIMUM_BOUND = 80;
- /**
- * Checker's maximum value column's name.
- */
- private static final String COLUMN_MAXIMUM_NAME = "Maximum";
- /**
- * Checker's maximum value column's index.
- */
- private static final int COLUMN_MAXIMUM_INDEX = 4;
- /**
- * Checker's maximum value column's bound.
- */
- private static final int COLUMN_MAXIMUM_BOUND = 80;
- /**
- * Checker's severity column's name.
- */
- private static final String COLUMN_SEVERITY_NAME = "Severity";
- /**
- * Checker's severity column's index.
- */
- private static final int COLUMN_SEVERITY_INDEX = 5;
- /**
- * Checker's severity column's bound.
- */
- private static final int COLUMN_SEVERITY_BOUND = 80;
-
- /**
- * Float NaN display.
- */
- private static final String FLOAT_NAN_DISPLAY = "-";
-
- /**
- * Class name
- **/
- private static final String CLASS = MetricsComposite.class.getName();
-
- /**
- * @param parent composite containing the table.
- * @param checkers to show and configure in the table.
- * @param style SWT style
- */
- public MetricsComposite(final Composite parent,
- final List checkers, final int style) {
- super(parent, checkers, style);
- final String method = "MetricsComposite";
- ICodeLogger.entering(CLASS, method, new Object[]{
- parent, checkers, Integer.valueOf(style)
- });
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.preferences.checkerstables.CheckerTableViewer#
- * createColumns(org.eclipse.swt.widgets.Composite,
- * org.eclipse.jface.viewers.TableViewer)
- */
- @Override
- protected void createColumns(final Composite parent, final TableViewer pCheckersTableViewer) {
- final String method = "createColumns";
- ICodeLogger.entering(CLASS, method, new Object[]{
- parent, pCheckersTableViewer
- });
-
- setEnabledColumn(createEnabledViewerColumn(COLUMN_ENABLED_BOUND, COLUMN_ENABLED_INDEX));
- getEnabledColumn().setEditingSupport(new EnabledEditingSupport(pCheckersTableViewer, this));
- getEnabledColumn().setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- return null;
- }
-
- @Override
- public Image getImage(final Object element) {
- final Image image;
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- if (checker.isChecked()) {
- image = getEnabledImage();
- } else {
- image = getDisabledImage();
- }
- return image;
- }
- });
- TableViewerColumn col = createTableViewerColumn(COLUMN_CHECKER_NAME, COLUMN_CHECKER_BOUND,
- COLUMN_CHECKER_INDEX);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- return checker.getName();
- }
- });
- col = createTableViewerColumn(COLUMN_LANGUAGE_NAME, COLUMN_LANGUAGE_BOUND,
- COLUMN_LANGUAGE_INDEX);
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- return checker.getLanguageName();
- }
- });
-
- col = createTableViewerColumn(COLUMN_MINIMUM_NAME, COLUMN_MINIMUM_BOUND,
- COLUMN_MINIMUM_INDEX);
- col.setEditingSupport(new MinValueEditingSupport(pCheckersTableViewer));
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- String floatValue = FLOAT_NAN_DISPLAY;
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- if (!checker.getMinValue().isNaN()) {
- floatValue = Float.toString(checker.getMinValue().floatValue());
- } else if (UserPreferencesService.hasMinValue(checker.getId())) {
- floatValue = Float.toString(UserPreferencesService
- .getMinValue(checker.getId()).floatValue());
- }
- } else {
- if (UserPreferencesService.hasMinValue(checker.getId())) {
- floatValue = Float.toString(UserPreferencesService
- .getMinValue(checker.getId()).floatValue());
- }
- }
- return floatValue;
- }
- });
-
- col = createTableViewerColumn(COLUMN_MAXIMUM_NAME, COLUMN_MAXIMUM_BOUND,
- COLUMN_MAXIMUM_INDEX);
- col.setEditingSupport(new MaxValueEditingSupport(pCheckersTableViewer));
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- String floatValue = FLOAT_NAN_DISPLAY;
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- if (!checker.getMaxValue().isNaN()) {
- floatValue = Float.toString(checker.getMaxValue().floatValue());
- } else if (UserPreferencesService.hasMaxValue(checker.getId())) {
- floatValue = Float.toString(UserPreferencesService
- .getMaxValue(checker.getId()).floatValue());
- }
- } else {
- if (UserPreferencesService.hasMaxValue(checker.getId())) {
- floatValue = Float.toString(UserPreferencesService
- .getMaxValue(checker.getId()).floatValue());
- }
- }
- return floatValue;
- }
- });
- col = createTableViewerColumn(COLUMN_SEVERITY_NAME, COLUMN_SEVERITY_BOUND,
- COLUMN_SEVERITY_INDEX);
- col.setEditingSupport(new SeverityEditingSupport(pCheckersTableViewer));
- col.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(final Object element) {
- return ((CheckerPreferencesContainer) element).getSeverity();
- }
-
- @Override
- public Image getImage(final Object element) {
- final CheckerPreferencesContainer checker = (CheckerPreferencesContainer) element;
- final Image severityImage;
- switch (checker.getSeverity()) {
- case UserPreferencesService.PREF_SEVERITY_ERROR_VALUE:
- severityImage = getErrorImage();
- break;
- case UserPreferencesService.PREF_SEVERITY_WARNING_VALUE:
- severityImage = getWarningImage();
- break;
- case UserPreferencesService.PREF_SEVERITY_INFO_VALUE:
- default:
- severityImage = getInfoImage();
- break;
- }
-
- return severityImage;
-
- }
-
- });
- ICodeLogger.exiting(CLASS, method);
-
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MinValueEditingSupport.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MinValueEditingSupport.java
deleted file mode 100644
index 0c4de72e..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/MinValueEditingSupport.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-
-/**
- * Editing support for minimum
- */
-public class MinValueEditingSupport extends EditingSupport {
-
- /**
- * Class name
- **/
- private static final String CLASS = MinValueEditingSupport.class.getName();
-
- /**
- * Cell editor
- */
- private final CellEditor editor;
-
- /**
- * @param pViewer Table viewer containing the cell
- */
- public MinValueEditingSupport(final TableViewer pViewer) {
- super(pViewer);
- final String method = "MinValueEditingSupport";
- ICodeLogger.entering(CLASS, method, pViewer);
- this.editor = new TextCellEditor(pViewer.getTable());
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
- */
- @Override
- protected CellEditor getCellEditor(final Object element) {
- final String method = "getCellEditor";
- ICodeLogger.entering(CLASS, method, element);
- ICodeLogger.exiting(CLASS, method, editor);
- return editor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
- */
- @Override
- protected boolean canEdit(final Object element) {
- final String method = "canEdit";
- ICodeLogger.entering(CLASS, method, element);
- final boolean canEdit = UserPreferencesService.isDefaultConfigurationActive()
- && ((CheckerPreferencesContainer) element).isMetric();
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(canEdit));
- return canEdit;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
- */
- @Override
- protected Object getValue(final Object element) {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method, element);
- final Object value;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- value = Float.toString(
- ((CheckerPreferencesContainer) element).getMinValue().floatValue());
- } else {
- value = UserPreferencesService
- .getMinValue(((CheckerPreferencesContainer) element).getId());
- }
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object,
- * java.lang.Object)
- */
- @Override
- protected void setValue(final Object element, final Object value) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, element);
- try {
- ((CheckerPreferencesContainer) element).setMinValue(Float.parseFloat((String) value));
- } catch (@SuppressWarnings("unused") NullPointerException | NumberFormatException e) {
- ((CheckerPreferencesContainer) element).setMinValue(Float.NaN);
- }
- this.getViewer().refresh();
- ICodeLogger.exiting(CLASS, method);
-
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/SeverityEditingSupport.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/SeverityEditingSupport.java
deleted file mode 100644
index 10f6e48d..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/SeverityEditingSupport.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
-
-import fr.cnes.analysis.tools.ui.preferences.CheckerPreferencesContainer;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.TableViewer;
-
-/**
- * Editing support for Severity.
- */
-public class SeverityEditingSupport extends EditingSupport {
-
- /**
- * Class name
- **/
- private static final String CLASS = SeverityEditingSupport.class.getName();
-
- /**
- * TableViewer containing the column
- */
- private final TableViewer viewer;
-
- /**
- * @param pViewer TableViewer containing the column
- */
- public SeverityEditingSupport(final TableViewer pViewer) {
- super(pViewer);
- final String method = "";
- ICodeLogger.entering(CLASS, method, pViewer);
- this.viewer = pViewer;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
- */
- @Override
- protected CellEditor getCellEditor(final Object element) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, element);
- final int options = 3;
- final String[] severity = new String[options];
- severity[0] = UserPreferencesService.PREF_SEVERITY_INFO_VALUE;
- severity[1] = UserPreferencesService.PREF_SEVERITY_WARNING_VALUE;
- severity[2] = UserPreferencesService.PREF_SEVERITY_ERROR_VALUE;
- final ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(viewer.getTable(), severity);
- ICodeLogger.exiting(CLASS, method, cellEditor);
- return cellEditor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
- */
- @Override
- protected boolean canEdit(final Object element) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, element);
- final boolean canEdit = UserPreferencesService.isDefaultConfigurationActive();
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(canEdit));
- return canEdit;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
- */
- @Override
- protected Object getValue(final Object element) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, element);
- final Integer severityCode;
- final String severity;
- if (UserPreferencesService.isDefaultConfigurationActive()) {
- severity = ((CheckerPreferencesContainer) element).getSeverity();
- } else {
- severity = UserPreferencesService
- .getCheckerSeverity(((CheckerPreferencesContainer) element).getId());
- }
- switch (severity) {
- case UserPreferencesService.PREF_SEVERITY_ERROR_VALUE:
- severityCode = Integer.valueOf(2);
- break;
- case UserPreferencesService.PREF_SEVERITY_WARNING_VALUE:
- severityCode = Integer.valueOf(1);
- break;
- case UserPreferencesService.PREF_SEVERITY_INFO_VALUE:
- default:
- severityCode = Integer.valueOf(0);
- break;
- }
- ICodeLogger.exiting(CLASS, method, severity);
- return severityCode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object,
- * java.lang.Object)
- */
- @Override
- protected void setValue(final Object element, final Object value) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- element, value
- });
- final int severityCode = ((Integer) value).intValue();
- final String severity;
- switch (severityCode) {
- case 2:
- severity = UserPreferencesService.PREF_SEVERITY_ERROR_VALUE;
- break;
- case 1:
- severity = UserPreferencesService.PREF_SEVERITY_WARNING_VALUE;
- break;
- case 0:
- default:
- severity = UserPreferencesService.PREF_SEVERITY_INFO_VALUE;
- break;
- }
- ((CheckerPreferencesContainer) element).setSeverity(severity);
- viewer.refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/package-info.java
deleted file mode 100644
index 463a16d2..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/checkerstables/package-info.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Package containing i-Code CNES Checkers table viewers for preferences pages
- * of UI Plug-in.
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-
-/**
- * Package containing i-Code CNES Checkers table viewers for preferences pages
- * of UI Plug-in.
- */
-package fr.cnes.analysis.tools.ui.preferences.checkerstables;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/package-info.java
deleted file mode 100644
index 407fa927..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/preferences/package-info.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Package containing Preference page and Preference service of i-Code CNES UI
- * Plug-in
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Package containing Preference page and Preference service of i-Code CNES UI
- * Plug-in
- */
-
-package fr.cnes.analysis.tools.ui.preferences;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/utils/AnalysisHandlerUIUtils.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/utils/AnalysisHandlerUIUtils.java
deleted file mode 100755
index ead2bb76..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/utils/AnalysisHandlerUIUtils.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.utils;
-
-import fr.cnes.analysis.tools.ui.exception.*;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Contains tools methods for handler purpose.
- */
-public final class AnalysisHandlerUIUtils {
- /**
- * Logger
- **/
- private final static Logger LOGGER = Logger.getLogger(AnalysisHandlerUIUtils.class.getName());
-
- /**
- * Protected constructor. This method should not be instantiated.
- */
- private AnalysisHandlerUIUtils() {
- // do nothing
- }
-
- /**
- * Check if the selection is not empty.
- *
- * @param selection the current selection.
- * @throws EmptySelectionException if the selection is empty.
- */
- public static void checkSelection(final IStructuredSelection selection)
- throws EmptySelectionException {
- LOGGER.finest("Begin checkSelection method");
-
- if (selection == null) {
- throw new EmptySelectionException("Selection is null.");
- } else if (selection.isEmpty()) {
- throw new EmptySelectionException("Selection is empty.");
- } else if (selection.getFirstElement() == null) {
- throw new EmptySelectionException("Selection element is null.");
- }
-
- LOGGER.finest("End checkSelection method");
- }
-
- /**
- * Retrieve the files on the corresponding language from the selection.
- *
- * @param selection the selection
- * @param pFileExtension file's possible extensions
- * @return the retrieved files.
- * @throws EmptyResourceException if the resource is empty.
- * @throws UnknownResourceTypeException if the resource type is unknown.
- * @throws InvalidResourceTypeException if the resource type is invalid.
- * @throws NonAccessibleResourceException if the resource is not accessible.
- * @throws EmptySelectionException if the selection is empty.
- */
- public static List retrieveFiles(final IStructuredSelection selection,
- final String[] pFileExtension) throws EmptyResourceException,
- UnknownResourceTypeException, InvalidResourceTypeException,
- NonAccessibleResourceException, EmptySelectionException {
- LOGGER.finest("Begin retrieveFiles method");
-
- final List files = browseSelection(selection, pFileExtension);
- if (files.isEmpty()) {
- throw new EmptyResourceException(
- "Please select at least one file before launching the analyse.");
- }
-
- LOGGER.finest("End retrieveFiles method");
- return files;
- }
-
- /**
- * Retrieve the selected files for all files in a selection.
- *
- * @param selection The current selection
- * @param fileExtension list of file's possible extensions
- * @return The selected files list
- * @throws EmptyResourceException A project or a folder has no members.
- * @throws UnknownResourceTypeException Resource has unknown type
- * @throws InvalidResourceTypeException Resource has invalid type (a project's member or a folder's
- * member cannot have ROOT type)
- * @throws NonAccessibleResourceException Resource is not accessible
- * @throws EmptySelectionException Root has no projects
- */
- public static List browseSelection(final IStructuredSelection selection,
- final String[] fileExtension) throws EmptyResourceException,
- UnknownResourceTypeException, InvalidResourceTypeException,
- NonAccessibleResourceException, EmptySelectionException {
- LOGGER.finest("Begin browseSelection method");
-
- final List files = new LinkedList();
-
- for (int i = 0; i < selection.size(); i++) {
- if (selection.toList().get(i) instanceof IResource) {
- files.addAll(retrieveSelectedFiles((IResource) selection.toList().get(i),
- fileExtension));
- }
- }
-
- LOGGER.finest("End browseSelection method");
- return files;
- }
-
- /**
- * Retrieve the selected files.
- *
- * @param resource The input resource.
- * @param fileExtension list of file's possible extensions
- * @return The selected files list.
- * @throws EmptyResourceException A project or a folder has no members.
- * @throws UnknownResourceTypeException Resource has unknown type.
- * @throws InvalidResourceTypeException Resource has invalid type (a project's member or a folder's
- * member cannot have ROOT type).
- * @throws NonAccessibleResourceException Resource is not accessible.
- * @throws EmptySelectionException Root has no projects.
- */
- public static List retrieveSelectedFiles(final IResource resource,
- final String[] fileExtension) throws EmptyResourceException,
- UnknownResourceTypeException, InvalidResourceTypeException,
- NonAccessibleResourceException, EmptySelectionException {
- LOGGER.finest("Begin retrieveSelectedFiles method");
-
- final List files = new LinkedList();
-
- switch (resource.getType()) {
- case IResource.ROOT:
- files.addAll(retrieveFilesFromRoot((IWorkspaceRoot) resource, fileExtension));
- break;
- case IResource.PROJECT:
- files.addAll(retrieveFilesFromProject((IProject) resource, fileExtension));
- break;
- case IResource.FOLDER:
- files.addAll(retrieveFilesFromFolder((IFolder) resource, fileExtension));
- break;
- case IResource.FILE:
- if (checkFileExtension(resource, fileExtension)) {
- files.add(resource.getLocation());
- }
- break;
- default:
- final UnknownResourceTypeException exception = new UnknownResourceTypeException(
- "Resource " + resource.getName() + " has type " + resource.getType() + ".");
- LOGGER.log(Level.FINER, exception.getClass() + " : " + exception.getMessage(),
- exception);
- throw exception;
- }
-
- LOGGER.finest("End retrieveSelectedFiles method");
- return files;
- }
-
- /**
- * Retrieve selected files from Root.
- *
- * @param resource the selection, as workspace root.
- * @param fileExtension list of file's possible extensions
- * @return all the files from root.
- * @throws EmptyResourceException A project or a folder has no members.
- * @throws UnknownResourceTypeException Resource has unknown type.
- * @throws InvalidResourceTypeException Resource has invalid type (a project's member or a folder's
- * member cannot have ROOT type).
- * @throws NonAccessibleResourceException Resource is not accessible.
- * @throws EmptySelectionException Root has not projects.
- */
- public static List retrieveFilesFromRoot(final IWorkspaceRoot resource,
- final String[] fileExtension) throws EmptyResourceException,
- UnknownResourceTypeException, InvalidResourceTypeException,
- NonAccessibleResourceException, EmptySelectionException {
- LOGGER.finest("Begin retrieveFilesFromRoot method");
-
- final List files = new LinkedList();
- final IProject[] projects = resource.getProjects();
- if (projects == null) {
- throw new EmptySelectionException("Selected root has no projects.");
- } else {
- for (final IProject project : projects) {
- files.addAll(retrieveFilesFromProject(project, fileExtension));
- }
- }
-
- LOGGER.finest("End retrieveFilesFromRoot method");
- return files;
- }
-
- /**
- * Retrieve all project's files.
- *
- * @param project the current project.
- * @param fileExtension list of file's possible extensions
- * @return The project's files.
- * @throws EmptyResourceException A project or a folder has no members.
- * @throws UnknownResourceTypeException Resource has unknown type.
- * @throws InvalidResourceTypeException Resource has invalid type (a project's member or a folder's
- * member cannot have ROOT type).
- * @throws NonAccessibleResourceException Resource is not accessible.
- */
- public static List retrieveFilesFromProject(final IProject project,
- final String[] fileExtension)
- throws EmptyResourceException, UnknownResourceTypeException,
- InvalidResourceTypeException, NonAccessibleResourceException {
- LOGGER.finest("Begin retrieveFilesFromProject method");
-
- final List files = new LinkedList();
- if (project.isAccessible()) {
- try {
- final IResource[] members = project.members();
- if (members == null) {
- throw new EmptyResourceException("Project " + project.getName() + " is empty.");
- } else {
- for (final IResource member : members) {
- switch (member.getType()) {
- case IResource.PROJECT:
- files.addAll(
- retrieveFilesFromProject((IProject) member, fileExtension));
- break;
- case IResource.FOLDER:
- files.addAll(retrieveFilesFromFolder((IFolder) member, fileExtension));
- break;
- case IResource.FILE:
- if (checkFileExtension(member, fileExtension)) {
- files.add(member.getLocation());
- }
- break;
- case IResource.ROOT:
- final InvalidResourceTypeException invalidException = new InvalidResourceTypeException(
- "Resource " + member.getName() + " has type "
- + member.getType() + ".");
- LOGGER.log(Level.FINER,
- invalidException.getClass() + " : "
- + invalidException.getMessage(),
- invalidException);
- throw invalidException;
- default:
- final UnknownResourceTypeException unknownException = new UnknownResourceTypeException(
- "Resource " + member.getName() + " has type "
- + member.getType() + ".");
- LOGGER.log(Level.FINER,
- unknownException.getClass() + " : "
- + unknownException.getMessage(),
- unknownException);
- throw unknownException;
- }
- }
- }
- } catch (final CoreException e) {
- throw new NonAccessibleResourceException(
- "Project " + project.getName() + " is not accessible or is closed.", e);
- }
- } else {
- throw new NonAccessibleResourceException(
- "Project " + project.getName() + " is not accessible or is closed.");
- }
-
- LOGGER.finest("End retrieveFilesFromProject method");
- return files;
- }
-
- /**
- * Retrieve all folder's files.
- *
- * @param folder the current folder.
- * @param fileExtension list of file's possible extensions
- * @return The folder's files.
- * @throws EmptyResourceException A project or a folder has no members.
- * @throws UnknownResourceTypeException Resource has unknown type.
- * @throws InvalidResourceTypeException Resource has invalid type (a project's member or a folder's
- * member cannot have ROOT type).
- * @throws NonAccessibleResourceException Resource is not accessible.
- */
- public static List retrieveFilesFromFolder(final IFolder folder,
- final String[] fileExtension)
- throws EmptyResourceException, UnknownResourceTypeException,
- InvalidResourceTypeException, NonAccessibleResourceException {
- LOGGER.finest("Begin retrieveFilesFromFolder method");
-
- try {
- final List files = new LinkedList();
- final IResource[] members = folder.members();
- if (members == null) {
- throw new EmptyResourceException("Folder " + folder.getName() + " is empty.");
- } else {
- for (final IResource member : members) {
- switch (member.getType()) {
- case IResource.PROJECT:
- files.addAll(retrieveFilesFromProject((IProject) member, fileExtension));
- break;
- case IResource.FOLDER:
- files.addAll(retrieveFilesFromFolder((IFolder) member, fileExtension));
- break;
- case IResource.FILE:
- if (checkFileExtension(member, fileExtension)) {
- files.add(member.getLocation());
- }
- break;
- case IResource.ROOT:
- final InvalidResourceTypeException exception = new InvalidResourceTypeException(
- "Resource " + member.getName() + " has type " + member.getType()
- + ".");
- LOGGER.log(Level.FINER,
- exception.getClass() + " : " + exception.getMessage(),
- exception);
- throw exception;
- default:
- final UnknownResourceTypeException unknownException = new UnknownResourceTypeException(
- "Resource " + member.getName() + " has type " + member.getType()
- + ".");
- LOGGER.log(Level.FINER, unknownException.getClass() + " : "
- + unknownException.getMessage(), unknownException);
- throw unknownException;
- }
- }
- }
-
- LOGGER.finest("End retrieveFilesFromFolder method");
- return files;
- } catch (final CoreException e) {
- throw new NonAccessibleResourceException(
- "Folder " + folder.getName() + " does not exist.", e);
- }
- }
-
- /**
- * Check file extension.
- *
- * @param file the file to be checked.
- * @param fileExtension list of file's possible extensions
- * @return true if the file extension is f, f77 (non case sensitive).
- */
- public static boolean checkFileExtension(final IResource file, final String[] fileExtension) {
- LOGGER.finest("Begin checkFileExtension method");
-
- boolean rightExtension = false;
- final boolean isRightFile = (file.getName() != null) && !(file.getName().startsWith("."));
- if (isRightFile && (file.getFileExtension() != null)) {
- for (final String extension : fileExtension) {
- rightExtension = rightExtension
- | extension.equalsIgnoreCase(file.getFileExtension());
- }
- }
-
- LOGGER.finest("End checkFileExtension method");
- return rightExtension;
-
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractAnalysisTreeViewer.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractAnalysisTreeViewer.java
deleted file mode 100755
index a9aea6ef..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractAnalysisTreeViewer.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * AbstractviolationsTreeViewer is an abstract class containing most useful
- * method to create a TreeViewer showing result of a static analysis.
- */
-public abstract class AbstractAnalysisTreeViewer extends TreeViewer {
- /**
- * Class name
- **/
- private final static String CLASS = AbstractAnalysisTreeViewer.class.getName();
- /**
- * Titles of the columns
- */
- private String[] titles;
-
- /**
- * Bounds of the TreeViewer
- */
- private int[] bounds;
-
- /**
- * @param parent Composite containing the TreeViewer
- * @param style Style parameters of the TreeViewer
- * @param pTitles Columns titles
- * @param pBounds Bounds of the TreeViewer.
- */
- public AbstractAnalysisTreeViewer(Composite parent, int style, String[] pTitles,
- int[] pBounds) {
- super(parent, style);
- final String method = "AbstractAnalysisTreeViewer";
- ICodeLogger.entering(CLASS, method);
- this.titles = pTitles;
- this.bounds = pBounds;
- this.createColumns();
- this.addDoubleClickAction();
- }
-
- /**
- * This method must be implemented to define the content provider for the
- * columns of the viewer
- */
- protected abstract void createColumns();
-
- /**
- * This method must be implemented in order to open a file selected by the
- * user by double clicking one of the TreeViewer content.
- *
- * {@link #openFileInEditor(IResource, int)}
- */
- protected abstract void addDoubleClickAction();
-
- /**
- * Method that open a file in the editor when double-clicked, on a specific
- * line.
- *
- * @param res the file to open
- * @param line the line on which the file has to be opened
- */
- protected void openFileInEditor(final IResource res, final int line) {
- final String method = "openFileInEditor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- res, Integer.valueOf(line)
- });
- final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- try {
- // Before creating the marker
- res.deleteMarkers(IMarker.MARKER, false, 1);
- final IMarker marker = res.createMarker(IMarker.MARKER);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- IDE.openEditor(page, marker);
- } catch (final CoreException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Marker problem", exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the titles
- */
- public String[] getTitles() {
- final String method = "getTitles";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, titles);
- return titles;
- }
-
- /**
- * @param pTitles the titles to set
- */
- public void setTitles(String[] pTitles) {
- final String method = "setTitles";
- ICodeLogger.entering(CLASS, method, pTitles);
-
- this.titles = pTitles;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the bounds
- */
- public int[] getBounds() {
- final String method = "getBounds";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, bounds);
- return bounds;
- }
-
- /**
- * @param pBounds the bounds to set
- */
- public void setBounds(int[] pBounds) {
- final String method = "setBounds";
- ICodeLogger.entering(CLASS, method, pBounds);
- this.bounds = pBounds;
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractLabelProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractLabelProvider.java
deleted file mode 100755
index 0d6e0832..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/AbstractLabelProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-
-/**
- * Label provider for columns of viewers
- */
-public abstract class AbstractLabelProvider extends ColumnLabelProvider {
-
- /**
- * Class name
- */
- private static final String CLASS = AbstractLabelProvider.class.getName();
- /**
- * An integer to determine which column has to be provide.
- **/
- private int type;
-
- /**
- * Constructor with integer parameter which represents the column created.
- *
- * @param pType the column to create
- */
- public AbstractLabelProvider(final int pType) {
- super();
- final String method = "AbstractLabelProvider";
- ICodeLogger.entering(CLASS, method, Integer.valueOf(pType));
- this.type = pType;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the type.
- *
- * @return the type
- */
- public int getType() {
- final String method = "getType";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Integer.valueOf(this.type));
- return this.type;
- }
-
- /**
- * Setter for the type.
- *
- * @param pType the type to set
- */
- public void setType(final int pType) {
- final String method = "setType";
- ICodeLogger.entering(CLASS, method, Integer.valueOf(pType));
- this.type = pType;
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/MetricsView.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/MetricsView.java
deleted file mode 100755
index 6917c07f..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/MetricsView.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view;
-
-import fr.cnes.analysis.tools.ui.exception.EmptyProviderException;
-import fr.cnes.analysis.tools.ui.view.metrics.FunctionMetricDescriptor;
-import fr.cnes.analysis.tools.ui.view.metrics.MetricContentProvider;
-import fr.cnes.analysis.tools.ui.view.metrics.MetricLabelProvider;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.ViewPart;
-
-import java.util.*;
-
-/**
- * View displaying the metrics computation results.
- *
- * @see fr.cnes.analysis.tools.ui.view.AbstractAnalysisView
- */
-public class MetricsView extends ViewPart {
-
- /**
- * View ID.
- **/
- public static final String VIEW_ID = MetricsView.class.getName();
- /**
- * Markers
- */
- public static final List MARKERS = new ArrayList();
-
- /**
- * Class name
- */
- private static final String CLASS = MetricsView.class.getName();
-
- /**
- * This attribute store all the analysis results files.
- */
- private static Set analysisResult = new HashSet();
- /**
- * Columns titles
- **/
- private final String[] titles = {
- "Metric", "Total", "Mean", "Minimum", "Maximum"
- };
- /**
- * Bounds value.
- **/
- private final int[] bounds = {
- 200, 75, 75, 75, 75, 200, 200
- };
- /**
- * The viewer which display results.
- **/
- private TreeViewer viewer;
-
- /**
- * Empty constructor.
- */
- public MetricsView() {
- super();
- final String method = "MetricsView";
- ICodeLogger.entering(CLASS, method);
- analysisResult = new TreeSet<>(new Comparator() {
-
- @Override
- public int compare(final CheckResult value1, final CheckResult value2) {
-
- int res = value1.getId().compareTo(value2.getId());
- if (res == 0) {
- res = value1.getFile().getAbsolutePath()
- .compareTo(value2.getFile().getAbsolutePath());
- }
- return res;
- }
- });
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.
- * widgets .Composite)
- */
- @Override
- public void createPartControl(final Composite parent) {
- final String method = "createPartControl";
- ICodeLogger.entering(CLASS, method, parent);
- final GridLayout layout = new GridLayout(this.titles.length, false);
- parent.setLayout(layout);
- this.createViewer(parent);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method create the viewer, which is a tree table.
- *
- * @param parent the parent composite
- */
- private void createViewer(final Composite parent) {
- final String method = "createViewer";
- ICodeLogger.entering(CLASS, method, parent);
- // Defining overall style for TreeViewer
- final int scrollStyle = SWT.H_SCROLL | SWT.V_SCROLL;
- final int selecStyle = SWT.MULTI | SWT.FULL_SELECTION;
- final int style = scrollStyle | selecStyle;
- this.viewer = new TreeViewer(parent, style | SWT.FILL);
- // Make headers and lines of the tree visible
- final Tree tree = this.viewer.getTree();
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- // Setting the content provider and creating columns
- this.createColumns();
-
- // Expand the tree
- this.viewer.setAutoExpandLevel(1);
-
- // Add selection provider which allows to listen to each
- // selection made on this viewer.
- this.getSite().setSelectionProvider(this.viewer);
-
- // Add a DoubleClickListener
- this.addDoubleClickAction();
-
- // Layout the viewer
- final GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = this.titles.length;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- this.viewer.getTree().setLayoutData(gridData);
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Create TreeViewer columns
- */
- protected void createColumns() {
- final String method = "createColumns";
- ICodeLogger.entering(CLASS, method);
- viewer.setContentProvider(new MetricContentProvider());
- TreeViewerColumn col;
- for (int i = 0; i < this.getTitles().length; i++) {
- // Create the column
- col = this.createTreeViewerColumn(this.getTitles()[i], this.getBounds()[i]);
-
- // Add a label provider
- col.setLabelProvider(new MetricLabelProvider(i));
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method creates a tree viewer column.
- *
- * @param title title of the column
- * @param bound size of the column
- * @return a table viewer's column
- */
- protected TreeViewerColumn createTreeViewerColumn(final String title, final int bound) {
- final String method = "createTreeViewerColumn";
- ICodeLogger.entering(CLASS, method, new Object[]{
- title, Integer.valueOf(bound)
- });
- final TreeViewerColumn viewerColumn = new TreeViewerColumn(this.viewer, SWT.NONE);
- final TreeColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(false);
-
- ICodeLogger.exiting(CLASS, method, viewerColumn);
- return viewerColumn;
- }
-
- /**
- * Action to do when a double click over the item is done
- */
- protected void addDoubleClickAction() {
- final String method = "addDoubleClickAction";
- ICodeLogger.entering(CLASS, method);
- viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(final DoubleClickEvent event) {
- final IStructuredSelection thisSelection = (IStructuredSelection) event
- .getSelection();
- final Object selectedNode = thisSelection.getFirstElement();
-
- viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
- // if it is a leaf -> open the file
- if (!viewer.isExpandable(selectedNode)
- && selectedNode instanceof FunctionMetricDescriptor) {
-
- // get Path of the file & Line of the
- // File containing the
- // Metric
- final IPath path = ((FunctionMetricDescriptor) selectedNode).getFilePath();
- final int line = ((FunctionMetricDescriptor) selectedNode).getLine().intValue();
-
- // get resource
- final IFile fileToOpen = ResourcesPlugin.getWorkspace().getRoot()
- .getFileForLocation(path);
- final IResource res = fileToOpen;
-
- // open file in editor
- MetricsView.this.openFileInEditor(res, line);
-
- }
- }
-
- });
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Open the file containing the metric at the metric's function line.
- *
- * @param res the file to open
- * @param line the line where the file should open
- */
- private void openFileInEditor(final IResource res, final int line) {
- final String method = "openFileInEditor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- res, Integer.valueOf(line)
- });
- final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- try {
- // Before creating the marker
- res.deleteMarkers(IMarker.MARKER, false, 1);
- final IMarker marker = res.createMarker(IMarker.MARKER);
- marker.setAttribute(IMarker.LINE_NUMBER, line);
- marker.setAttribute("Class", "Metric");
-
- IDE.openEditor(page, marker);
- } catch (final CoreException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Marker problem", exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Displays the analyze results on the view.
- *
- * @param values the descriptors to show on the view
- * @return
- * @throws EmptyProviderException when source provider to determine view type is not found (not
- * necessarily used)
- */
- public void display(final List values) throws EmptyProviderException {
- final String method = "display";
- ICodeLogger.entering(CLASS, method, values);
- synchronized (this) {
- final Set listInputs = new TreeSet(
- new Comparator() {
-
- @Override
- public int compare(final CheckResult value1,
- final CheckResult value2) {
-
- int res = 0;
- res = value1.getId().compareTo(value2.getId());
- if (res == 0) {
- res = value1.getFile().getAbsolutePath().compareTo(
- value2.getFile().getAbsolutePath());
- if (res == 0) {
- /*
- * We don't compare location if the
- * location is a file's one.
- */
- if ((value1.getLocation() == null
- || value1.getLocation().isEmpty())
- && (value2.getLocation() == null
- || value2.getLocation()
- .isEmpty())) {
- res = 0;
- } else if ((value1.getLocation() == null
- || value1.getLocation().isEmpty())
- && (value2.getLocation() != null
- || value2.getLocation()
- .isEmpty())) {
- return -1;
- } else if ((value1.getLocation() != null
- || value1.getLocation().isEmpty())
- && (value2.getLocation() == null
- || value2.getLocation()
- .isEmpty())) {
- return 1;
- } else {
- res = value1.getLocation()
- .compareTo(value2.getLocation());
- }
- }
- }
- return res;
- }
- });
-
- if (viewer.getInput() != null) {
- for (final CheckResult input : (CheckResult[]) viewer.getInput()) {
- listInputs.add(input);
- }
- }
-
- for (final CheckResult value : values) {
- listInputs.add(value);
- }
- analysisResult = listInputs;
- viewer.setInput(listInputs.toArray(new CheckResult[listInputs.size()]));
- }
-
- viewer.refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method will clear the message and make it appear on the view.
- *
- * @throws EmptyProviderException when source provider to determine view type is not found (not
- * necessarily used)
- */
- public void clear() throws EmptyProviderException {
- final String method = "clear";
- ICodeLogger.entering(CLASS, method);
- analysisResult.clear();
- viewer.setInput(new CheckResult[0]);
- viewer.refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the analysisResult
- */
- public Set getAnalysisResult() {
- final String method = "getAnalysisResult";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, analysisResult);
- return analysisResult;
- }
-
- /**
- * Getter for the bounds.
- *
- * @return the bounds
- */
- public int[] getBounds() {
- final String method = "getBounds";
- ICodeLogger.entering(CLASS, method);
- final int[] clonedBounds = this.bounds.clone();
- ICodeLogger.exiting(CLASS, method, clonedBounds);
- return clonedBounds;
- }
-
- /**
- * Getter for the titles.
- *
- * @return the titles
- */
- public String[] getTitles() {
- final String method = "getTitles";
- ICodeLogger.entering(CLASS, method);
- final String[] clonedTitles = this.titles.clone();
- ICodeLogger.exiting(CLASS, method, clonedTitles);
- return clonedTitles;
- }
-
- /**
- * Getter for the viewer.
- *
- * @return the viewer
- */
- public TreeViewer getViewer() {
- final String method = "getViewer";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.viewer);
- return this.viewer;
- }
-
- /**
- * Setter for the viewer.
- *
- * @param pViewer this.descriptors.clone() set
- */
- public void setViewer(final TreeViewer pViewer) {
- final String method = "setViewer";
- ICodeLogger.entering(CLASS, method, pViewer);
- this.viewer = pViewer;
- ICodeLogger.exiting(CLASS, method);
- }
-
- @Override
- public void setFocus() {
- final String method = "setFocus";
- ICodeLogger.entering(CLASS, method);
- this.viewer.getControl().setFocus();
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/ViolationsView.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/ViolationsView.java
deleted file mode 100644
index f1b2a251..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/ViolationsView.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view;
-
-import fr.cnes.analysis.tools.ui.exception.EmptyProviderException;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.IUpdatableAnalysisFilter;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewer;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewerContentProvider;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.filter.FileTreeViewerFilter;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.RuleTreeViewer;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.RuleTreeViewerContentProvider;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.filter.RuleViewerFilter;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.part.ViewPart;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-public class ViolationsView extends ViewPart {
-
- /**
- * View identifier
- */
- public static final String VIEW_ID = ViolationsView.class.getName();
-
- public static final String RULE_TREE_VIEWER_TYPE = "RuleTreeViewer";
-
- /**
- * FILE_TREE_VIEWER_TYPE
- */
- public static final String FILE_TREE_VIEWER_TYPE = "FileTreeViewer";
- /**
- * Class name
- */
- private static final String CLASS = MetricsView.class.getName();
- /**
- * The string to filter results in the TreeViewer
- */
- private String searchString = "";
-
- /**
- * Indicate if violation of level warning must be shown
- */
- private boolean showWarning = true;
- /**
- * Indicate if violation of level error must be shown
- */
- private boolean showError = true;
- /**
- * Whether or not to show violation of Info severity
- */
- private boolean showInfo;
- /**
- * Contain the identifier of the type of TreeViewer currently being
- * displayed in the view. By default, the view show a RuleTreeViewer one
- */
- private String treeViewerType = RULE_TREE_VIEWER_TYPE;
-
- /**
- * The list of all violation used by the TreeViewer of the view, useful to
- * make an export of the view
- */
- private Set analysisResults = new TreeSet<>(new Comparator() {
-
- @Override
- public int compare(final CheckResult value1, final CheckResult value2) {
-
- int res = value1.getId().compareTo(value2.getId());
- if (res == 0) {
- res = value1.getFile().getAbsoluteFile()
- .compareTo(value2.getFile().getAbsoluteFile());
- }
- return res;
- }
- });
-
- /**
- * The viewer which display results.
- **/
- private TreeViewer viewer;
-
- /**
- * Composite contained in the view and displaying it's elements
- */
- private Composite parent;
-
- /**
- * Constructor with an integer array for table bounds and string array for
- * the titles, as parameters.
- */
- public ViolationsView() {
- super();
- final String method = "ViolationsView";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the viewer.
- *
- * @return the viewer
- */
- public TreeViewer getViewer() {
- final String method = "getViewer";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method);
- return this.viewer;
- }
-
- /**
- * Setter for the viewer.
- *
- * @param pViewer this.descriptors.clone() set
- */
- public void setViewer(final TreeViewer pViewer) {
- final String method = "setViewer";
- ICodeLogger.entering(CLASS, method, pViewer);
- this.viewer = pViewer;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.
- * widgets.Composite)
- */
- @Override
- public void createPartControl(final Composite pParent) {
- final String method = "createPartControl";
- ICodeLogger.entering(CLASS, method, pParent);
- this.parent = pParent;
- final GridLayout layout = new GridLayout();
-
- pParent.setLayout(layout);
- /*
- * Adding the filter field
- */
- final Text search = new Text(pParent, SWT.SEARCH | SWT.CANCEL | SWT.ICON_SEARCH);
- search.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- search.setMessage("Filter : Enter part of file path, name, rule name or function's name... "
- + "(not case sensitive)");
-
- /*
- * Updating search attribute every time the search field is being
- * modified.
- */
- search.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(final ModifyEvent event) {
- final Text source = (Text) event.getSource();
- searchString = source.getText();
- update();
- }
-
- });
-
- /*
- * Add a selection adapter for the button SWT.CANCEL of the search field
- * that set the searching field to null when the user click on the
- * button. Note : SWT.CANCEL do not exist in Windows 7.
- */
- search.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetDefaultSelected(final SelectionEvent event) {
- if (event.detail == SWT.CANCEL) {
- final Text text = (Text) event.getSource();
- text.setText("");
- update();
- }
- }
- });
-
- final Button infoBtn = new Button(pParent, SWT.CHECK | SWT.SELECTED);
- infoBtn.setText("Info");
- infoBtn.setSelection(true);
- final Button warningBtn = new Button(pParent, SWT.CHECK | SWT.SELECTED);
- warningBtn.setText("Warning");
- warningBtn.setSelection(true);
- final Button errorBtn = new Button(pParent, SWT.CHECK | SWT.CHECK);
- errorBtn.setText("Error");
- errorBtn.setSelection(true);
-
- infoBtn.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(final SelectionEvent event) {
- final Button btn = (Button) event.getSource();
- showInfo = btn.getSelection();
- update();
- }
-
- });
-
- warningBtn.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(final SelectionEvent event) {
- final Button btn = (Button) event.getSource();
- showWarning = btn.getSelection();
- update();
- }
-
- });
-
- errorBtn.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(final SelectionEvent event) {
- final Button btn = (Button) event.getSource();
- showError = btn.getSelection();
- update();
- }
- });
-
- this.createRuleTreeViewer(pParent);
- layout.numColumns = this.getViewer().getTree().getColumnCount();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- *
- */
- public void update() {
- final String method = "update";
- ICodeLogger.entering(CLASS, method);
- for (final ViewerFilter filter : this.viewer.getFilters()) {
- if (filter instanceof IUpdatableAnalysisFilter) {
- ((IUpdatableAnalysisFilter) filter).update(searchString, showInfo, showWarning,
- showError);
- }
- }
- viewer.refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method create the viewer, which is a tree table.
- *
- * @param pParent the parent composite
- */
- private void createRuleTreeViewer(final Composite pParent) {
- final String method = "createRuleTreeViewer";
- ICodeLogger.entering(CLASS, method, pParent);
- // Defining overall style for TreeViewer
- final int scrollStyle = SWT.H_SCROLL | SWT.V_SCROLL;
- final int selecStyle = SWT.MULTI | SWT.FULL_SELECTION;
- final int style = scrollStyle | selecStyle;
- this.viewer = new RuleTreeViewer(pParent, style | SWT.FILL);
- // Make headers and lines of the tree visible
- final Tree tree = this.viewer.getTree();
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- // Expand the tree
- this.viewer.setAutoExpandLevel(1);
-
- // Add selection provider which allows to listen to each
- // selection made on this viewer.
- this.getSite().setSelectionProvider(this.viewer);
-
- // Layout the viewer
- final GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = this.viewer.getTree().getColumnCount();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- this.viewer.getTree().setLayoutData(gridData);
-
- /*
- * Creating a filter using field search & check buttons Warning and
- * Error.
- *
- * Show only element selected by the user.
- */
- final RuleViewerFilter ruleFilter = new RuleViewerFilter();
- viewer.addFilter(ruleFilter);
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method create the viewer, which is a tree table.
- *
- * @param pParent the parent composite
- */
- private void createFileTreeViewer(final Composite pParent) {
- final String method = "createFileTreeViewer";
- ICodeLogger.entering(CLASS, method, pParent);
- // Defining overall style for TreeViewer
- final int scrollStyle = SWT.H_SCROLL | SWT.V_SCROLL;
- final int selecStyle = SWT.MULTI | SWT.FULL_SELECTION;
- final int style = scrollStyle | selecStyle;
- this.viewer = new FileTreeViewer(pParent, style | SWT.FILL);
- // Make headers and lines of the tree visible
- final Tree tree = this.viewer.getTree();
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- // Expand the tree
- this.viewer.setAutoExpandLevel(1);
-
- // Add selection provider which allows to listen to each
- // selection made on this viewer.
- this.getSite().setSelectionProvider(this.viewer);
-
- // Layout the viewer
- final GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = this.viewer.getTree().getColumnCount();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalAlignment = GridData.FILL;
- this.viewer.getTree().setLayoutData(gridData);
-
- /*
- * Creating a filter using field search & check buttons Warning and
- * Error.
- *
- * Show only element selected by the user.
- */
- final FileTreeViewerFilter fileFilter = new FileTreeViewerFilter();
- this.viewer.addFilter(fileFilter);
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Display violations found during analysis in the violations view.
- *
- * @param violations the violations to display
- */
- public void display(final List violations) {
- final String method = "display";
- ICodeLogger.entering(CLASS, method, violations);
- synchronized (this) {
- final Set listInputs = new TreeSet(
- new Comparator() {
-
- @Override
- public int compare(final CheckResult check1,
- final CheckResult check2) {
- int res = check1.getName().compareTo(check2.getName());
- if (res == 0) {
- res = check1.getFile().getAbsolutePath().compareTo(
- check2.getFile().getAbsolutePath());
- if (res == 0) {
- res = check1.getLine().compareTo(check2.getLine());
- if (res == 0) {
- res = check1.getLocation()
- .compareTo(check2.getLocation());
- if (res == 0) {
- res = check1.getMessage()
- .compareTo(check2.getMessage());
- }
- }
- }
- }
- return res;
- }
-
- });
-
- if (this.treeViewerType.equals(FILE_TREE_VIEWER_TYPE)
- && ((FileTreeViewerContentProvider) this.viewer.getContentProvider())
- .getConverter().getInputs() != null) {
- for (final CheckResult value : ((FileTreeViewerContentProvider) this.getViewer()
- .getContentProvider()).getConverter().getInputs()) {
- listInputs.add(value);
- }
- }
- if (this.treeViewerType.equals(RULE_TREE_VIEWER_TYPE)
- && ((RuleTreeViewerContentProvider) this.viewer.getContentProvider())
- .getConverter().getInputs() != null) {
- for (final CheckResult value : ((RuleTreeViewerContentProvider) this.getViewer()
- .getContentProvider()).getConverter().getInputs()) {
- listInputs.add(value);
- }
- }
- for (final CheckResult value : violations) {
- listInputs.add(value);
- }
-
- this.analysisResults = listInputs;
-
- this.getViewer().setInput(listInputs.toArray(new CheckResult[listInputs.size()]));
- }
- this.getViewer().refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- @Override
- public void setFocus() {
- final String method = "setFocus";
- ICodeLogger.entering(CLASS, method);
- this.viewer.getControl().setFocus();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method will clear the message and make it appear on the view.
- *
- * @throws EmptyProviderException when source provider to determine view type is not found (not
- * necessarily used)
- */
- public void clear() throws EmptyProviderException {
- final String method = "clear";
- ICodeLogger.entering(CLASS, method);
- this.analysisResults.clear();
- this.getViewer().setInput(new CheckResult[0]);
- this.getViewer().refresh();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the Treeviewer type
- */
- public String getTreeViewerType() {
- final String method = "getTreeViewerType";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.treeViewerType);
- return this.treeViewerType;
- }
-
- /**
- * Set the TreeViewerType by modifying the attribute and also processing to
- * dispose if necessary the old TreeViewer and create a new one with the
- * type requested.
- *
- * @param name Name or identifier of the TreeViewerType requested.
- */
- public void setTreeViewerType(final String name) {
- final String method = "setTreeViewerType";
- ICodeLogger.entering(CLASS, method, name);
- if (!this.treeViewerType.equals(name)) {
- // Disposal of the old TreeViewer
- this.viewer.getControl().dispose();
- if (name.equals(FILE_TREE_VIEWER_TYPE)) {
- this.createFileTreeViewer(this.parent);
- // We reinsert inputs from previous TreeViewer in the current
- // one
- this.getViewer().setInput(this.analysisResults
- .toArray(new CheckResult[this.analysisResults.size()]));
- this.treeViewerType = name;
-
- } else if (name.equals(RULE_TREE_VIEWER_TYPE)) {
- this.createRuleTreeViewer(this.parent);
- // We reinsert inputs from previous TreeViewer in the current
- // one
- this.getViewer().setInput(this.analysisResults
- .toArray(new CheckResult[this.analysisResults.size()]));
- this.treeViewerType = name;
-
- }
- // This call is necessary to refresh the table in the parent
- // Composite.
- this.parent.layout();
- }
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * @return analysis results
- */
- public Set getAnalysisResults() {
- final String method = "getAnalysisResults";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, analysisResults);
- return analysisResults;
- }
-
- /**
- * @param pAnalysisResults results to set.
- */
- public void setAnalysisResults(Set pAnalysisResults) {
- final String method = "setAnalysisResults";
- ICodeLogger.entering(CLASS, method, pAnalysisResults);
- this.analysisResults = pAnalysisResults;
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FileMetricDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FileMetricDescriptor.java
deleted file mode 100755
index cd43248b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FileMetricDescriptor.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Class descriptor for metric value in a file.
- */
-public class FileMetricDescriptor implements IMetricDescriptor, Cloneable {
-
- /**
- * Class name
- */
- private static final String CLASS = FileMetricDescriptor.class.getName();
-
- /**
- * File's path.
- **/
- private IPath filePath;
- /**
- * Value for the file.
- **/
- private Float value;
- /**
- * List of descriptors for the function in the file.
- **/
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public FileMetricDescriptor() {
- final String method = "FileMetricDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.value = Float.valueOf(0.0f);
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with file's path and the value.
- *
- * @param pFilePath the file's path
- * @param pValue the value
- */
- public FileMetricDescriptor(final IPath pFilePath, final Float pValue) {
- final String method = "FileMetricDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pFilePath, pValue
- });
- this.filePath = pFilePath;
- this.value = pValue;
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the file's path.
- *
- * @return the file's path
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.filePath);
- return this.filePath;
- }
-
- /**
- * Getter for the descriptors.
- *
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.descriptors);
- return this.descriptors;
- }
-
- /**
- * Setter for the file's path.
- *
- * @param pFilePath the file's path to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the descriptors.
- *
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = new ArrayList<>(pDescriptors);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the value
- *
- * @param pValue the value to set
- */
- public void setValue(final Float pValue) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, pValue);
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- final String name = this.filePath.toFile().getName();
- ICodeLogger.exiting(CLASS, method, name);
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getValue()
- */
- @Override
- public Float getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.value);
- return this.value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMean()
- */
- @Override
- public Float getMean() {
- final String method = "getMean";
- ICodeLogger.entering(CLASS, method);
- Float mean = Float.valueOf(0.0f);
- for (final FunctionMetricDescriptor descriptor : this.descriptors) {
- mean = Float.valueOf((mean.floatValue() + descriptor.getValue().floatValue()));
- }
- mean = Float.valueOf(mean.floatValue() / this.descriptors.size());
- ICodeLogger.exiting(CLASS, method, mean);
- return mean;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinimum()
- */
- @Override
- public Float getMinimum() {
- final String method = "getMinimum";
- ICodeLogger.entering(CLASS, method);
- float min = Float.NaN;
- for (final FunctionMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getValue().floatValue() < min || Float.isNaN(min)) {
- min = descriptor.getValue().floatValue();
- }
- }
- ICodeLogger.exiting(CLASS, method, Float.valueOf(min));
- return Float.valueOf(min);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaximum()
- */
- @Override
- public Float getMaximum() {
- final String method = "getMaximum";
- ICodeLogger.entering(CLASS, method);
- float max = Float.NaN;
- for (final FunctionMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getValue().floatValue() > max || Float.isNaN(max)) {
- max = descriptor.getValue().floatValue();
- }
- }
- ICodeLogger.exiting(CLASS, method, Float.valueOf(max));
- return Float.valueOf(max);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinCause()
- */
- @Override
- public String getMinCause() {
- final String method = "getMinCause";
- ICodeLogger.entering(CLASS, method);
- final float min = Float.NaN;
- String minCause = "";
- for (final FunctionMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getValue().floatValue() < min || Float.isNaN(min)) {
- minCause = descriptor.getName();
- }
- }
- ICodeLogger.exiting(CLASS, method, minCause);
- return minCause;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaxCause()
- */
- @Override
- public String getMaxCause() {
- final String method = "getMaxCause";
- ICodeLogger.entering(CLASS, method);
- final float max = Float.NaN;
- String maxCause = "";
- for (final FunctionMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getValue().floatValue() > max || Float.isNaN(max)) {
- maxCause = descriptor.getName();
- }
- }
- ICodeLogger.exiting(CLASS, method, maxCause);
- return maxCause;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#hasRightValue()
- */
- @Override
- public boolean hasRightValue() {
- final String method = "hasRightValue";
- ICodeLogger.entering(CLASS, method);
- boolean result = true;
- int counter = 0;
- while (result && this.descriptors.size() > counter) {
- result = this.descriptors.get(counter).hasRightValue();
- counter++;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof FileMetricDescriptor) {
- isEqual = this.filePath.equals(((FileMetricDescriptor) object).getFilePath());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- assert false : "hashCode not designed";
- ICodeLogger.exiting(CLASS, method, this.value);
- return this.value.intValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FileMetricDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FileMetricDescriptor clone = (FileMetricDescriptor) super.clone();
- clone.setValue(this.value);
- clone.setFilePath(this.filePath);
- clone.setDescriptors(new LinkedList(this.descriptors));
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FunctionMetricDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FunctionMetricDescriptor.java
deleted file mode 100755
index 173d1c75..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/FunctionMetricDescriptor.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Descriptor for metric's value of a function.
- */
-public class FunctionMetricDescriptor implements IMetricDescriptor, Cloneable {
- /**
- * Class name
- */
- private static final String CLASS = FunctionMetricDescriptor.class.getName();
-
- /**
- * Metric's id, used to find associated preferences.
- **/
- private String metricId;
-
- /**
- * Metric's value's location.
- **/
- private String location;
-
- /**
- * Metric's value
- **/
- private Float value;
-
- /**
- * Path of the file containing the Metric
- **/
- private IPath filePath;
-
- /**
- * Line of the metric.
- **/
- private Integer line;
-
- /**
- * Empty constructor.
- */
- public FunctionMetricDescriptor() {
- final String method = "FunctionMetricDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.metricId = "";
- this.location = "";
- this.value = Float.valueOf(0.0f);
- this.line = Integer.valueOf(0);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with all attributes initialized.
- *
- * @param pId the id
- * @param pLocation the location
- * @param pValue the value
- * @param pFilePath the file containing the metric Path
- * @param pLine metric's line
- */
- public FunctionMetricDescriptor(final String pId, final String pLocation, final Float pValue,
- final IPath pFilePath, final Integer pLine) {
- final String method = "FunctionMetricDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pId, pLocation, pValue, pFilePath, pLine
- });
- this.metricId = pId;
- this.filePath = pFilePath;
- this.location = pLocation;
- this.value = pValue;
- this.line = pLine;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for line.
- *
- * @return line of the metric
- */
- public Integer getLine() {
- final String method = "getLine";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, line);
- return line;
- }
-
- /**
- * Setter for line.
- *
- * @param pLine new line
- */
- public void setLine(final Integer pLine) {
- final String method = "setLine";
- ICodeLogger.entering(CLASS, method, pLine);
- this.line = pLine;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the path of the file containing the Metric
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, filePath);
- return filePath;
- }
-
- /**
- * Set the filePath of the file containing the Metric
- *
- * @param pFilePath the new Path to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the id.
- *
- * @return the id
- */
- public String getMetricId() {
- final String method = "getMetricId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.metricId);
- return this.metricId;
- }
-
- /**
- * Getter for the location.
- *
- * @return the location
- */
- public String getLocation() {
- final String method = "getLocation";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.location);
- return this.location;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getValue()
- */
- @Override
- public Float getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.value);
- return this.value;
- }
-
- /**
- * Setter for the id.
- *
- * @param pId the id to set
- */
- public void setMetricId(final String pId) {
- final String method = "setMetricId";
- ICodeLogger.entering(CLASS, method, pId);
- this.metricId = pId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the location.
- *
- * @param pLocation the location to set
- */
- public void setLocation(final String pLocation) {
- final String method = "setLocation";
- ICodeLogger.entering(CLASS, method, pLocation);
- this.location = pLocation;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the value.
- *
- * @param pValue the value to set
- */
- public void setValue(final Float pValue) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, pValue);
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.location);
- return this.location;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMean()
- */
- @Override
- public Float getMean() {
- final String method = "getMean";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Float.valueOf(Float.NaN));
- return Float.valueOf(Float.NaN);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinimum()
- */
- @Override
- public Float getMinimum() {
- final String method = "getMinimum";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Float.valueOf(Float.NaN));
- return Float.valueOf(Float.NaN);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaximum()
- */
- @Override
- public Float getMaximum() {
- final String method = "getMaximum";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, Float.valueOf(Float.NaN));
- return Float.valueOf(Float.NaN);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinCause()
- */
- @Override
- public String getMinCause() {
- final String method = "getMinCause";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, "");
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaxCause()
- */
- @Override
- public String getMaxCause() {
- final String method = "getMaxCause";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, "");
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#hasRightValue()
- */
- @Override
- public boolean hasRightValue() {
- final String method = "hasRightValue";
- ICodeLogger.entering(CLASS, method);
- boolean result = true;
- if (UserPreferencesService.hasMaxValue(this.getMetricId())) {
- final Float exceptedValue = UserPreferencesService.getMaxValue(this.getMetricId());
- result = this.getValue().compareTo(exceptedValue) < 0 || exceptedValue.isNaN();
- }
- if (UserPreferencesService.hasMinValue(this.getMetricId()) && result) {
- final Float exceptedValue = UserPreferencesService.getMinValue(this.getMetricId());
- result = this.getValue().compareTo(exceptedValue) > 0 || exceptedValue.isNaN();
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof FunctionMetricDescriptor) {
- isEqual = this.location.equals(((FunctionMetricDescriptor) object).getLocation())
- && this.metricId.equals(
- ((FunctionMetricDescriptor) object).getMetricId());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- assert false : "hashCode not designed";
- ICodeLogger.exiting(CLASS, method, this.value);
- return this.value.intValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FunctionMetricDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FunctionMetricDescriptor clone = (FunctionMetricDescriptor) super.clone();
- clone.setMetricId(this.metricId);
- clone.setLocation(this.location);
- clone.setValue(this.value);
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/IMetricDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/IMetricDescriptor.java
deleted file mode 100755
index 10da963a..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/IMetricDescriptor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-/**
- * Interface which represents any level of a metric description. It could
- * describe the metric, a file or a value. This interface is mainly used to
- * display results in the MetricsView.
- */
-public interface IMetricDescriptor {
-
- /**
- * Returns the name of this descriptor.
- *
- * @return the name
- */
- String getName();
-
- /**
- * Returns the value of this descriptor.
- *
- * @return the value
- */
- Float getValue();
-
- /**
- * Returns the mean value calculated for this descriptor.
- *
- * @return the mean
- */
- Float getMean();
-
- /**
- * Returns the minimum value calculated for this descriptor.
- *
- * @return the minimum
- */
- Float getMinimum();
-
- /**
- * Returns the maximum value calculated for this descriptor.
- *
- * @return the maximum
- */
- Float getMaximum();
-
- /**
- * Returns the resource causing the minimum value calculated for this
- * descriptor.
- *
- * @return the minCause
- */
- String getMinCause();
-
- /**
- * Returns the resource causing the maximum value calculated for this
- * descriptor.
- *
- * @return the maxCause
- */
- String getMaxCause();
-
- /**
- * Returns true if the value is between thresholds defined in preferences,
- * false otherwise.
- *
- * @return whether the value is good
- */
- boolean hasRightValue();
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricContentProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricContentProvider.java
deleted file mode 100755
index 600123f2..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricContentProvider.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.List;
-
-/**
- * This class provides a content provider for the tree viewer in the metric
- * view.
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider
- */
-public class MetricContentProvider implements ITreeContentProvider {
- /**
- * Class name
- **/
- private static final String CLASS = MetricContentProvider.class.getName();
-
- /**
- * A value container which has all values of metrics.
- **/
- private MetricConverter converter;
-
- /**
- * Getter for the converter
- *
- * @return the converter
- */
- public MetricConverter getConverter() {
- final String method = "getConverter";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, converter);
- return this.converter;
- }
-
- /**
- * Setter for the converter
- *
- * @param pConverter the converter to set
- */
- public void setConverter(final MetricConverter pConverter) {
- final String method = "setConverter";
- ICodeLogger.entering(CLASS, method, pConverter);
- this.converter = pConverter;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
- * Object)
- */
- @Override
- public boolean hasChildren(final Object element) {
- final String method = "hasChildren";
- ICodeLogger.entering(CLASS, method, element);
-
- // Every type has a child except for FunctionValue type
- final boolean result;
- if (element instanceof FunctionMetricDescriptor) {
- result = false;
- } else if (element instanceof FileMetricDescriptor) {
- if (((FileMetricDescriptor) element).getDescriptors().isEmpty()) {
- result = false;
- } else {
- result = true;
- }
- } else {
- result = true;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
- * )
- */
- @Override
- public Object getParent(final Object element) {
- final String method = "getParent";
- ICodeLogger.entering(CLASS, method, element);
- ICodeLogger.exiting(CLASS, method, null);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.
- * jface .viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- final String method = "inputChanged";
- ICodeLogger.entering(CLASS, method, new Object[]{
- viewer, oldInput, newInput
- });
-
- try {
- if (newInput instanceof CheckResult[]) {
- this.converter = new MetricConverter(((CheckResult[]) newInput).clone());
- // run analysis
- this.converter.setUser(true);
- this.converter.schedule();
- this.converter.join();
-
- } else if (newInput != null) {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "inputChanged method of AbstractContentProvider has a "
- + newInput.getClass().getName()
- + " type instead of a Descriptor>[] instance");
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- } catch (final InterruptedException exception) {
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
- * Object)
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- final String method = "getElements";
- ICodeLogger.entering(CLASS, method, inputElement);
- final Object[] elements = this.converter.getContainer();
- ICodeLogger.exiting(CLASS, method, elements);
- return elements;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
- * Object)
- */
- @Override
- public Object[] getChildren(final Object parentElement) {
- final String method = "getChildren";
- ICodeLogger.entering(CLASS, method, parentElement);
- Object[] values = new FunctionMetricDescriptor[0];
- if (parentElement instanceof FileMetricDescriptor) {
- // The parent element can be a FileValue : we find array of
- // function values depending
- final List mVals = ((FileMetricDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new FunctionMetricDescriptor[mVals.size()]);
-
- } else if (parentElement instanceof MetricDescriptor) {
- // A Descriptor : we find array of file values depending
- final List mVals = ((MetricDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new FileMetricDescriptor[mVals.size()]);
-
- } else if (parentElement instanceof MetricDescriptor[]) {
- // An array of descriptors : we find each descriptor depending
- values = (MetricDescriptor[]) parentElement;
-
- } else if (!(parentElement instanceof FunctionMetricDescriptor)) {
- // Otherwise, an error is thrown on the interface
- final UnknownInstanceException exception = new UnknownInstanceException(
- "Unknow type in getChildren method of AbstractContentProvider : "
- + parentElement.getClass().getName());
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- ICodeLogger.exiting(CLASS, method, values);
- return values;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- @Override
- public void dispose() {
- final String method = "dispose";
- ICodeLogger.entering(CLASS, method);
- if (this.converter != null) {
- this.converter.setContainer(new MetricDescriptor[0]);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricConverter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricConverter.java
deleted file mode 100755
index 7ffbae8b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricConverter.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Job used to converter inputs from analysis to valuable inputs for the
- * MetricView.
- */
-public class MetricConverter extends Job {
- /**
- * Class name
- **/
- private static final String CLASS = MetricConverter.class.getName();
-
- /**
- * Job message
- */
- private static final String CONVERT_JOB_MESSAGE = "Converting results...";
-
- /**
- * The original inputs.
- **/
- private CheckResult[] inputs;
- /**
- * A value container which has all values of rules.
- **/
- private MetricDescriptor[] container;
-
- /**
- * Empty constructor for this Job.
- */
- public MetricConverter() {
- super(CONVERT_JOB_MESSAGE);
- final String method = "MetricConverter";
- ICodeLogger.entering(CLASS, method);
- this.inputs = new CheckResult[0];
- this.container = new MetricDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * Constructor for this Job with an array of violations.
- *
- * @param checkResults the inputs
- */
- public MetricConverter(final CheckResult[] checkResults) {
- super(CONVERT_JOB_MESSAGE);
- final String method = "MetricConverter";
- ICodeLogger.entering(CLASS, method, checkResults);
- this.inputs = checkResults.clone();
- this.container = new MetricDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the inputs id.
- *
- * @return the inputs
- */
- public CheckResult[] getInputs() {
- final String method = "CheckResult";
- ICodeLogger.entering(CLASS, method);
- final CheckResult[] clonedInputs = this.inputs.clone();
- ICodeLogger.exiting(CLASS, method, clonedInputs);
- return clonedInputs;
- }
-
- /**
- * Getter for the container
- *
- * @return the container
- */
- public MetricDescriptor[] getContainer() {
- final String method = "MetricDescriptor";
- ICodeLogger.entering(CLASS, method);
- final MetricDescriptor[] clonedContainer = this.container.clone();
- ICodeLogger.exiting(CLASS, method, clonedContainer);
- return clonedContainer;
- }
-
- /**
- * Setter for the inputs.
- *
- * @param pInputs the inputs to set
- */
- public void setInputs(final CheckResult[] pInputs) {
- final String method = "setInputs";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the container
- *
- * @param pContainer the container to set
- */
- public void setContainer(final MetricDescriptor[] pContainer) {
- final String method = "setContainer";
- ICodeLogger.entering(CLASS, method, pContainer);
- this.container = pContainer.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
- * IProgressMonitor)
- */
- @Override
- public IStatus run(final IProgressMonitor monitor) {
- final String method = "run";
- ICodeLogger.entering(CLASS, method, monitor);
- // Instantiate return variable
- final IStatus status = Status.OK_STATUS;
- final int totalWork = this.inputs.length;
-
- // Instantiate descriptors
- final List descriptors = new LinkedList();
- // final FileMetricDescriptor file = new FileMetricDescriptor();
- // final FunctionMetricDescriptor function = new
- // FunctionMetricDescriptor();
-
- // Start converting
- monitor.beginTask("Converting...", totalWork);
-
- for (final CheckResult checker : this.inputs) {
- /*
- * 1. Defining which informations of the checker already have been
- * fulfilled in the descriptors.
- */
- int metricIndex = 0;
- int fileIndex = 0;
- boolean metricDefined = false;
- boolean fileDefined = false;
- while (metricIndex < descriptors.size() && !metricDefined) {
- final MetricDescriptor metric = descriptors.get(metricIndex);
- if (checker.getName().equals(metric.getName())) {
- metricDefined = true;
- while (fileIndex < metric.getDescriptors().size() && !fileDefined) {
- final FileMetricDescriptor file = metric.getDescriptors().get(fileIndex);
- if (file.getFilePath().toFile().getAbsolutePath()
- .equals(checker.getFile().getAbsolutePath())) {
- fileDefined = true;
- } else {
- fileIndex++;
- }
- }
- } else {
- metricIndex++;
- }
- }
- /*
- * 2. Writing information into the descriptors
- */
- /*
- * 2.1 Defining the metric if not defined
- */
- final MetricDescriptor metric;
- if (!metricDefined) {
- metric = new MetricDescriptor(checker.getName());
- descriptors.add(metric);
- } else {
- metric = descriptors.get(metricIndex);
- }
- final FileMetricDescriptor file;
- /*
- * 2.2 If the checker is defined for a file. The job is done once
- * FileMetricDescriptor is updated or created.
- */
- if (checker.getLocation() == null || checker.getLocation().isEmpty()) {
- if (!fileDefined) {
- file = new FileMetricDescriptor(new Path(checker.getFile().getAbsolutePath()),
- checker.getValue());
- metric.getDescriptors().add(file);
- } else {
- file = metric.getDescriptors().get(fileIndex);
- file.setValue(checker.getValue());
- }
- } else {
- /*
- * 2.3 If the checker is not defined for a file, then,
- * FileMetricDescriptor must be created without value and
- * FunctionMetricDescriptor added to it.
- */
- if (!fileDefined) {
- file = new FileMetricDescriptor();
- file.setFilePath(new Path(checker.getFile().getAbsolutePath()));
- metric.getDescriptors().add(file);
- } else {
- file = metric.getDescriptors().get(fileIndex);
- }
- file.getDescriptors().add(new FunctionMetricDescriptor(checker.getId(),
- checker.getLocation(), checker.getValue(),
- new Path(checker.getFile().getAbsolutePath()), checker.getLine()));
- }
- }
- this.container = descriptors.toArray(new MetricDescriptor[descriptors.size()]);
- ICodeLogger.exiting(CLASS, method, status);
- return status;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricDescriptor.java
deleted file mode 100755
index 2d5bd52a..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricDescriptor.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.icode.logger.ICodeLogger;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Class for general description of a metric.
- */
-public class MetricDescriptor implements IMetricDescriptor, Cloneable {
-
- /**
- * Class name
- **/
- private static final String CLASS = MetricDescriptor.class.getName();
-
- /**
- * Name of the metric.
- **/
- private String name;
- /**
- * List of descriptor for the files.
- **/
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public MetricDescriptor() {
- final String method = "MetricDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.name = "";
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with metric's name.
- *
- * @param pName metric's name
- */
- public MetricDescriptor(final String pName) {
- final String method = "MetricDescriptor";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, name);
- return this.name;
- }
-
- /**
- * Getter for descriptors.
- *
- * @return the descriptors.
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, descriptors);
- return this.descriptors;
- }
-
- /**
- * Setter for the name.
- *
- * @param pName the name to set
- */
- public void setName(final String pName) {
- final String method = "setName";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the descriptors.
- *
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getValue()
- */
- @Override
- public Float getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- Float value = Float.valueOf(0.0f);
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- value = Float.valueOf(value.floatValue() + descriptor.getValue().floatValue());
- }
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMean()
- */
- @Override
- public Float getMean() {
- final String method = "getMean";
- ICodeLogger.entering(CLASS, method);
- float mean = 0.0f;
- float totalSize = 0.0f;
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- mean = mean + descriptor.getMean().floatValue() * descriptor.getDescriptors().size();
- totalSize = totalSize + descriptor.getDescriptors().size();
- }
- mean = mean / totalSize;
- ICodeLogger.exiting(CLASS, method, Float.valueOf(mean));
- return Float.valueOf(mean);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinimum()
- */
- @Override
- public Float getMinimum() {
- final String method = "getMinimum";
- ICodeLogger.entering(CLASS, method);
- float min = Float.NaN;
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getMinimum().floatValue() < min || Float.isNaN(min)) {
- min = descriptor.getMinimum().floatValue();
- }
- }
- ICodeLogger.exiting(CLASS, method, Float.valueOf(min));
- return Float.valueOf(min);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaximum()
- */
- @Override
- public Float getMaximum() {
- final String method = "getMaximum";
- ICodeLogger.entering(CLASS, method);
- float max = Float.NaN;
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getMaximum().floatValue() > max || Float.isNaN(max)) {
- max = descriptor.getMaximum().floatValue();
- }
- }
- ICodeLogger.exiting(CLASS, method, Float.valueOf(max));
- return Float.valueOf(max);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMinCause()
- */
- @Override
- public String getMinCause() {
- final String method = "getMinCause";
- ICodeLogger.entering(CLASS, method);
- final float min = Float.NaN;
- String minCause = "";
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getMinimum().floatValue() < min || Float.isNaN(min)) {
- minCause = descriptor.getName();
- }
- }
- ICodeLogger.exiting(CLASS, method, minCause);
- return minCause;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getMaxCause()
- */
- @Override
- public String getMaxCause() {
- final String method = "getMaxCause";
- ICodeLogger.entering(CLASS, method);
- final float max = Float.NaN;
- String maxCause = "";
- for (final FileMetricDescriptor descriptor : this.descriptors) {
- if (descriptor.getMaximum().floatValue() > max || Float.isNaN(max)) {
- maxCause = descriptor.getName();
- }
- }
- ICodeLogger.exiting(CLASS, method, maxCause);
- return maxCause;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#hasRightValue()
- */
- @Override
- public boolean hasRightValue() {
- final String method = "hasRightValue";
- ICodeLogger.entering(CLASS, method);
- boolean result = true;
- int counter = 0;
- while (result && this.descriptors.size() > counter) {
- result = this.descriptors.get(counter).hasRightValue();
- counter++;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof MetricDescriptor) {
- isEqual = this.name.equals(((MetricDescriptor) object).getName());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- assert false : "hashCode not designed";
- ICodeLogger.exiting(CLASS, method);
- return this.descriptors.size();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public MetricDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final MetricDescriptor clone = (MetricDescriptor) super.clone();
- clone.setName(this.name);
- clone.setDescriptors(new LinkedList(this.descriptors));
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricLabelProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricLabelProvider.java
deleted file mode 100755
index c4fc8208..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/metrics/MetricLabelProvider.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.metrics;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.analysis.tools.ui.view.AbstractLabelProvider;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This class provides column for the metric tree viewer.
- */
-public class MetricLabelProvider extends AbstractLabelProvider {
-
- /** Static values that determines column types. **/
- /**
- * This value is for metric name column.
- **/
- public static final int METRIC_NAME = 0;
- /**
- * This value is for metric value column.
- **/
- public static final int METRIC_VALUE = 1;
- /**
- * This value is for mean value column.
- **/
- public static final int MEAN = 2;
- /**
- * This value is for minimum value column.
- **/
- public static final int MINIMUM = 3;
- /**
- * This value is for maximum value column.
- **/
- public static final int MAXIMUM = 4;
- /**
- * This value is for minimum resource cause column.
- **/
- public static final int MIN_CAUSE = 5;
- /**
- * This value is for maximum resource cause column.
- **/
- public static final int MAX_CAUSE = 6;
-
- /**
- * Class name
- **/
- private static final String CLASS = MetricLabelProvider.class.getName();
-
- /** Logger **/
- /**
- * Nan value displaying
- */
- private static final String NAN_VALUE_DISPLAY = "--";
-
- /**
- * Constructor with integer parameter which represents the column created.
- *
- * @param pType the column to create
- */
- public MetricLabelProvider(final int pType) {
- super(pType);
- final String method = "MetricLabelProvider";
- ICodeLogger.entering(CLASS, method, Integer.valueOf(pType));
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ColumnLabelProvider#getForeground(java.lang
- * .Object)
- */
- @Override
- public Color getForeground(final Object element) {
- final String method = "getForeground";
- ICodeLogger.entering(CLASS, method, element);
- Color color = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
- if (element instanceof IMetricDescriptor) {
- if (!((IMetricDescriptor) element).hasRightValue()) {
- color = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
- }
- } else {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "getForeground method of MetricLabelProvider class has a "
- + element.getClass().getName()
- + " element, but it should be a Viewable instance.");
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, color);
- return color;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(final Object element) {
- final String method = "getText";
- ICodeLogger.entering(CLASS, method, element);
- String text = "";
- if (element instanceof IMetricDescriptor) {
- switch (this.getType()) {
- case METRIC_NAME:
- text = ((IMetricDescriptor) element).getName();
- break;
- case METRIC_VALUE:
- if (((IMetricDescriptor) element).getValue().isInfinite()
- || ((IMetricDescriptor) element).getValue().isNaN()) {
- text = NAN_VALUE_DISPLAY;
- } else {
- text = ((IMetricDescriptor) element).getValue().toString();
- }
- break;
- case MEAN:
- if (((IMetricDescriptor) element).getValue().isInfinite()
- || ((IMetricDescriptor) element).getMean().isNaN()) {
- text = NAN_VALUE_DISPLAY;
- } else {
- text = ((IMetricDescriptor) element).getMean().toString();
- }
- break;
- case MINIMUM:
- if (((IMetricDescriptor) element).getValue().isInfinite()
- || ((IMetricDescriptor) element).getMinimum().isNaN()) {
- text = NAN_VALUE_DISPLAY;
- } else {
- text = ((IMetricDescriptor) element).getMinimum().toString();
- }
- break;
- case MAXIMUM:
- if (((IMetricDescriptor) element).getValue().isInfinite()
- || ((IMetricDescriptor) element).getMaximum().isNaN()) {
- text = NAN_VALUE_DISPLAY;
- } else {
- text = ((IMetricDescriptor) element).getMaximum().toString();
- }
- break;
- case MIN_CAUSE:
- text = ((IMetricDescriptor) element).getMinCause();
- break;
- case MAX_CAUSE:
- text = ((IMetricDescriptor) element).getMaxCause();
- break;
- default:
- final RuntimeException exception = new ArrayIndexOutOfBoundsException(
- "Wrong column value for MetricLabelProvider class : "
- + this.getType());
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- } else {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "getText method of MetricLabelProvider class has a "
- + element.getClass().getName()
- + " element, but it should be a Viewable instance.");
- ICodeLogger.throwing(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, text);
- return text;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/IUpdatableAnalysisFilter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/IUpdatableAnalysisFilter.java
deleted file mode 100755
index 3274d775..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/IUpdatableAnalysisFilter.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer;
-
-public interface IUpdatableAnalysisFilter {
-
- public void update(String searchString, boolean showInfo, boolean showWarning,
- boolean showError);
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewer.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewer.java
deleted file mode 100755
index 9c5cc2ef..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewer.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file;
-
-import fr.cnes.analysis.tools.ui.view.AbstractAnalysisTreeViewer;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FunctionDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.RuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.ViolationDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-
-/**
- * TreeViewer that show violations in {@link #getInput()} organized by their :
- *
- *
{@link FileRuleDescriptor}
- *
{@link FunctionDescriptor}
- *
{@link RuleDescriptor}
- *
All the {@link ViolationDescriptor} are contained inside
- * {@link RuleDescriptor}
- *
- *
- * It also contains information as the number of violations on each files,
- * functions or rules and can be ordered and filtered, using a
- * {@link FileTreeViewerComparator}.
- *
- * @version 2.1
- * @see fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.RuleTreeViewer
- * @since 2.0
- */
-public class FileTreeViewer extends AbstractAnalysisTreeViewer {
-
- /**
- * TITLES : Location => File > Function > Rules > Violations Line => Line of
- * the violation ! => Criticity Number of violation.
- */
- public static final String[] TITLES = new String[]{
- "Location", "Line", "!", "Number of violations"
- };
-
- /**
- * Bounds of the TreeViewer
- */
- public static final int[] BOUNDS = new int[]{
- 425, 50, 30, 200
- };
-
- /**
- * Class name
- */
- private static final String CLASS = FileTreeViewer.class.getName();
- /**
- * Kind of bitmap to know if the sorting should be up or down for each
- * column of the tree
- */
- private transient boolean[] columnSortUp = new boolean[]{
- true, true, false, true, true
- };
-
- /**
- * Index selected to sort the columns, by default 1
- */
- private transient int indexSort = 1;
-
- /**
- * Constructor for violations file treeviewer.
- *
- * @param parent The Composite containing the TreeViewer
- * @param style The SWT style
- */
- public FileTreeViewer(final Composite parent, final int style) {
- super(parent, style, TITLES, BOUNDS);
- final String method = "FileTreeViewer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- parent, Integer.valueOf(style)
- });
- final ViewerComparator comparator = new FileTreeViewerComparator();
- this.setComparator(comparator);
- ICodeLogger.exiting(CLASS, method);
- }
-
- @Override
- protected void createColumns() {
- final String method = "createColumns";
- ICodeLogger.entering(CLASS, method);
- this.setContentProvider(new FileTreeViewerContentProvider());
- TreeViewerColumn col;
- for (int i = 0; i < super.getTitles().length; i++) {
- // Create the column
- col = this.createTreeViewerColumn(this.getTitles()[i], this.getBounds()[i], i);
- // Add a label provider
- col.setLabelProvider(new FileTreeViewerLabelProvider(i));
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.AbstractAnalysisTreeViewer#
- * addDoubleClickAction()
- */
- @Override
- protected void addDoubleClickAction() {
- final String method = "addDoubleClickAction";
- ICodeLogger.entering(CLASS, method);
- this.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(final DoubleClickEvent event) {
- final TreeViewer tViewer = (TreeViewer) event.getViewer();
- final IStructuredSelection thisSelection = (IStructuredSelection) event
- .getSelection();
- final Object selectedNode = thisSelection.getFirstElement();
-
- // if it is a leaf -> open the file
- if (!tViewer.isExpandable(selectedNode)
- && selectedNode instanceof ViolationDescriptor) {
- final IPath path = ((ViolationDescriptor) selectedNode).getFilePath();
- final int number = ((ViolationDescriptor) selectedNode).getValue().intValue();
- // get resource
- final IFile fileToOpen = ResourcesPlugin.getWorkspace().getRoot()
- .getFileForLocation(path);
- final IResource res = fileToOpen;
-
- // open file in editor
- openFileInEditor(res, number);
- }
- }
- });
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * Create a column of the TreeViewer, customize it and assign it's index
- * number and action listener to be sorted.
- *
- * @param title The title of the head column.
- * @param bound The bound of the column.
- * @param colNumber The index number of the column in the TreeViewer.
- * @return The treeViewerColumn created.
- */
- private TreeViewerColumn createTreeViewerColumn(final String title, final int bound,
- final int colNumber) {
- final String method = "createTreeViewerColumn";
- ICodeLogger.entering(CLASS, method, new Object[]{
- title, Integer.valueOf(bound), Integer.valueOf(colNumber)
- });
- final TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE);
- final TreeColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(true);
-
- column.addSelectionListener(new SelectionAdapter() {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.
- * eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- columnSortUp[colNumber] = !columnSortUp[colNumber];
- indexSort = colNumber;
- final Tree tree = getTree();
- tree.setSortColumn(column);
- if (columnSortUp[colNumber]) {
- tree.setSortDirection(SWT.UP);
- } else {
- tree.setSortDirection(SWT.DOWN);
- }
- refresh();
- }
-
- });
- ICodeLogger.exiting(CLASS, method, viewerColumn);
- return viewerColumn;
- }
-
- /**
- * Comparator for class {@link FileTreeViewer}. Allow the user to order the
- * file using different column sort.
- */
- class FileTreeViewerComparator extends ViewerComparator {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.
- * viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- int rc = 0;
- if (e1 instanceof RuleDescriptor && e2 instanceof RuleDescriptor) {
- final RuleDescriptor rule1 = (RuleDescriptor) e1;
- final RuleDescriptor rule2 = (RuleDescriptor) e2;
-
- switch (indexSort) {
- case 2:
- rc = rule1.getSeverity().compareTo(rule2.getSeverity());
- break;
- case 0:
- rc = rule1.getName().compareToIgnoreCase(rule2.getName());
- break;
- case 3:
- rc = rule1.getValue().intValue() - rule2.getValue().intValue();
- break;
- default:
- rc = 0;
- break;
- }
- } else if (e1 instanceof FileRuleDescriptor && e2 instanceof FileRuleDescriptor) {
- final FileRuleDescriptor file1 = (FileRuleDescriptor) e1;
- final FileRuleDescriptor file2 = (FileRuleDescriptor) e2;
-
- switch (indexSort) {
- case 0:
- rc = file1.getName().compareToIgnoreCase(file2.getName());
- break;
- case 3:
- rc = file1.getValue().intValue() - file2.getValue().intValue();
- break;
- default:
- rc = 0;
- break;
- }
- } else if (e1 instanceof FunctionDescriptor && e2 instanceof FunctionDescriptor) {
-
- final FunctionDescriptor function1 = (FunctionDescriptor) e1;
- final FunctionDescriptor function2 = (FunctionDescriptor) e2;
-
- switch (indexSort) {
- case 0:
- rc = function1.getName().compareToIgnoreCase(function2.getName());
- break;
- case 3:
- rc = function1.getValue().intValue() - function2.getValue().intValue();
- break;
- default:
- rc = 0;
- break;
- }
- } else if (e1 instanceof ViolationDescriptor && e2 instanceof ViolationDescriptor) {
- final ViolationDescriptor violation1 = (ViolationDescriptor) e1;
- final ViolationDescriptor violation2 = (ViolationDescriptor) e2;
-
- switch (indexSort) {
- case 0:
- rc = violation1.getLocation().compareToIgnoreCase(violation2.getLocation());
- break;
- case 1:
- rc = violation1.getValue().intValue() - violation2.getValue().intValue();
- break;
- default:
- rc = 0;
- break;
- }
-
- }
- // If descending order, flip the direction
- if (columnSortUp[indexSort]) {
- rc = -rc;
- }
- return rc;
- }
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerContentProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerContentProvider.java
deleted file mode 100755
index c7c2dfc1..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerContentProvider.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FunctionDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.RuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.ViolationDescriptor;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.List;
-
-/**
- * @version 2.1
- * @see FileTreeViewer
- * @see org.eclipse.jface.viewers.ITreeContentProvider
- * @since 2.0
- */
-public class FileTreeViewerContentProvider implements ITreeContentProvider {
- /**
- * Class name
- */
- private static final String CLASS = FileTreeViewerContentProvider.class.getName();
- /**
- * The original inputs.
- **/
- private ViolationToFileTreeViewerConverter converter;
-
- /**
- * Empty constructor.
- */
- public FileTreeViewerContentProvider() {
- super();
- final String method = "FileTreeViewerContentProvider";
- ICodeLogger.entering(CLASS, method);
- this.converter = new ViolationToFileTreeViewerConverter();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the converter.
- *
- * @return the converter
- */
- public ViolationToFileTreeViewerConverter getConverter() {
- final String method = "ViolationToFileTreeViewerConverter";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.converter);
- return this.converter;
- }
-
- /**
- * Setter for the converter.
- *
- * @param pConverter the converter to set
- */
- public void setConverter(final ViolationToFileTreeViewerConverter pConverter) {
- final String method = "setConverter";
- ICodeLogger.entering(CLASS, method, pConverter);
- this.converter = pConverter;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.
- * jface .viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- final String method = "inputChanged";
- ICodeLogger.entering(CLASS, method, new Object[]{
- viewer, oldInput, newInput
- });
-
- try {
- if (newInput instanceof CheckResult[]) {
- this.converter.setInputs(((CheckResult[]) newInput).clone());
- // run analysis
- this.converter.setUser(true);
- this.converter.schedule();
- this.converter.join();
-
- } else if (newInput != null) {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "inputChanged method of AbstractContentProvider has a "
- + newInput.getClass().getName()
- + " type instead of a Descriptor>[] instance");
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- } catch (final InterruptedException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
- * Object)
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- final String method = "getElements";
- ICodeLogger.entering(CLASS, method);
-
- final Object[] elements = this.converter.getContainer();
- ICodeLogger.exiting(CLASS, method, elements);
- return elements;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- @Override
- public void dispose() {
- final String method = "dispose";
- ICodeLogger.entering(CLASS, method);
- if (this.converter != null) {
- this.converter.setContainer(new FileRuleDescriptor[0]);
- }
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
- * Object)
- */
- @Override
- public boolean hasChildren(final Object element) {
- final String method = "hasChildren";
- ICodeLogger.entering(CLASS, method, element);
- final boolean hasChildren = !(element instanceof ViolationDescriptor);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(hasChildren));
- return hasChildren;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
- * )
- */
- @Override
- public Object getParent(final Object element) {
- final String method = "getParent";
- ICodeLogger.entering(CLASS, method, element);
- ICodeLogger.exiting(CLASS, method, null);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
- * Object)
- */
- @Override
- public Object[] getChildren(final Object parentElement) {
- final String method = "getChildren";
- ICodeLogger.entering(CLASS, method, parentElement);
- Object[] values = null;
- if (parentElement instanceof FileRuleDescriptor) {
-
- // The parent element can be a FileValue : we find array of
- // function values depending
- final List mVals = ((FileRuleDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new FunctionDescriptor[mVals.size()]);
- } else if (parentElement instanceof FunctionDescriptor) {
-
- // A Descriptor : we find array of file values depending
- final List mVals = ((FunctionDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new RuleDescriptor[mVals.size()]);
- } else if (parentElement instanceof RuleDescriptor) {
- final List mVals = ((RuleDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new ViolationDescriptor[mVals.size()]);
-
- } else if (!(parentElement instanceof RuleDescriptor)) {
-
- // Otherwise, an error is thrown on the interface
- final UnknownInstanceException exception = new UnknownInstanceException(
- "Unknow type in getChildren method of AbstractContentProvider : "
- + parentElement.getClass().getName());
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, values);
- return values;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerLabelProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerLabelProvider.java
deleted file mode 100755
index fa633d5c..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/FileTreeViewerLabelProvider.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.analysis.tools.ui.view.AbstractLabelProvider;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.IFileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.RuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.ViolationDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Set the content of a {@link FileTreeViewer} using
- */
-public class FileTreeViewerLabelProvider extends AbstractLabelProvider {
- /** Static values that determines column types. **/
- /**
- * This value is for rule criticity column.
- **/
- public static final int SEVERITY = 2;
- /**
- * This value is for rule name column.
- **/
- public static final int LOCATION = 0;
- /**
- * This value is for error's line column.
- **/
- public static final int LINE = 1;
- /**
- * This value is for number of violations column.
- **/
- public static final int NB_VIOL = 3;
-
- /**
- * Class name
- */
- private static final String CLASS = FileTreeViewerLabelProvider.class.getName();
-
- /**
- * Constructor with integer parameter which represents the column created.
- *
- * @param pType the column to create
- */
- public FileTreeViewerLabelProvider(final int pType) {
- super(pType);
- final String method = "FileTreeViewerLabelProvider";
- ICodeLogger.entering(CLASS, method, Integer.valueOf(pType));
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This functions set the text for each element of a column.
- *
- * The text should be "--" is the element shouldn't contain information for
- * the column.
- *
- * @param element the element store in the column
- * @return the text to store in column case
- */
- @Override
- public String getText(final Object element) {
- final String method = "getText";
- ICodeLogger.entering(CLASS, method, element);
-
- String text = "";
- if (element instanceof IFileRuleDescriptor) {
- switch (this.getType()) {
- case SEVERITY:
- break;
- case LOCATION:
- text = ((IFileRuleDescriptor) element).getName();
- break;
- case LINE:
- if (element instanceof ViolationDescriptor) {
- text = ((IFileRuleDescriptor) element).getValue().toString();
- } else {
- text = "--";
- }
- break;
- case NB_VIOL:
- if (element instanceof ViolationDescriptor) {
- text = "--";
- } else {
- text = ((IFileRuleDescriptor) element).getValue().toString();
- }
- break;
- default:
- final RuntimeException exception = new ArrayIndexOutOfBoundsException(
- "Wrong column value for ViolationsLabelProvider class : "
- + this.getType());
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- break;
- }
- } else {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "getText method of ViolationsLabelProvider class has a "
- + element.getClass().getName()
- + " element, but it should be an IRuleDescriptor instance.");
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, text);
- return text;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(final Object element) {
- final String method = "getImage";
- ICodeLogger.entering(CLASS, method, element);
- Image image = null;
- if (this.getType() == SEVERITY && element instanceof RuleDescriptor) {
- switch (((RuleDescriptor) element).getSeverity()) {
- case UserPreferencesService.PREF_SEVERITY_ERROR_VALUE:
- image = ImageFactory.getImage(ImageFactory.ERROR_SMALL);
- break;
- case UserPreferencesService.PREF_SEVERITY_WARNING_VALUE:
- image = ImageFactory.getImage(ImageFactory.WARNING_SMALL);
- break;
- case UserPreferencesService.PREF_SEVERITY_INFO_VALUE:
- default:
- image = ImageFactory.getImage(ImageFactory.INFO_SMALL);
- break;
- }
- }
-
- ICodeLogger.exiting(CLASS, method, image);
- return image;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/ViolationToFileTreeViewerConverter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/ViolationToFileTreeViewerConverter.java
deleted file mode 100755
index e7848f2b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/ViolationToFileTreeViewerConverter.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file;
-
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FunctionDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.RuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.ViolationDescriptor;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Thread job converting all {@link Violation} in {@link #inputs} into a
- * {@link #container} of {@link FileRuleDescriptor}.
- *
- * The job consist in verifying different attributes of the {@link Violation}
- * and the {@link #container}, creating a new :
- *
- *
{@link FileRuleDescriptor} for {@link Violation#getFile()} not in the
- * container.
- *
{@link FunctionDescriptor} for {@link Violation#getLocation()} not in the
- * container, and associating it into it's related descriptors.
- *
{@link RuleDescriptor} for {@link Violation#getRuleName()} not in the
- * container,and associating it into it's related {@link FunctionDescriptor}'s
- * descriptors.
- *
{@link ViolationDescriptor} for each violation and putting it into the
- * right {@link RuleDescriptor}.
- *
- *
- * @version 2.1
- * @see Job
- * @see fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewer
- * @since 2.0
- */
-public class ViolationToFileTreeViewerConverter extends Job {
- /**
- * Class name
- */
- private static final String CLASS = ViolationToFileTreeViewerConverter.class.getName();
-
- /**
- * The original inputs.
- **/
- private CheckResult[] inputs;
- /**
- * A value container which has all values of rules.
- **/
- private FileRuleDescriptor[] container;
-
- /**
- * Empty constructor for this Job.
- */
- public ViolationToFileTreeViewerConverter() {
- super("Converting results...");
- final String method = "ViolationToFileTreeViewerConverter";
- ICodeLogger.entering(CLASS, method);
- this.inputs = new CheckResult[0];
- this.container = new FileRuleDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor for this Job with an array of violations.
- *
- * @param pInputs the inputs
- */
- public ViolationToFileTreeViewerConverter(final CheckResult[] pInputs) {
- super("Converting results...");
- final String method = "ViolationToFileTreeViewerConverter";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs.clone();
- this.container = new FileRuleDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the inputs id.
- *
- * @return the inputs
- */
- public CheckResult[] getInputs() {
- final String method = "getInputs";
- ICodeLogger.entering(CLASS, method);
- final CheckResult[] clonedInputs = this.inputs.clone();
- ICodeLogger.exiting(CLASS, method, clonedInputs);
- return clonedInputs;
- }
-
- /**
- * Getter for the container
- *
- * @return the container
- */
- public FileRuleDescriptor[] getContainer() {
- final String method = "getContainer";
- ICodeLogger.entering(CLASS, method);
- final FileRuleDescriptor[] clonedContainer = this.container.clone();
- ICodeLogger.exiting(CLASS, method, clonedContainer);
- return clonedContainer;
- }
-
- /**
- * Setter for the inputs.
- *
- * @param pInputs the inputs to set
- */
- public void setInputs(final CheckResult[] pInputs) {
- final String method = "setInputs";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the container
- *
- * @param pContainer the container to set
- */
- public void setContainer(final FileRuleDescriptor[] pContainer) {
- final String method = "setContainer";
- ICodeLogger.entering(CLASS, method, pContainer);
- this.container = pContainer.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
- * IProgressMonitor)
- */
- @Override
- public IStatus run(final IProgressMonitor monitor) {
- final String method = "run";
- ICodeLogger.entering(CLASS, method, monitor);
- // Instantiate return variable
- IStatus status = Status.OK_STATUS;
- final int totalWork = this.inputs.length;
-
- // Instantiate descriptors
- final List descriptors = new LinkedList<>();
-
- FileRuleDescriptor file = new FileRuleDescriptor();
- FunctionDescriptor function = new FunctionDescriptor();
- RuleDescriptor rule = new RuleDescriptor();
- ViolationDescriptor viold = new ViolationDescriptor();
-
- // Start converting
- monitor.beginTask("Converting...", totalWork);
- try {
- /*
- * For every violation contained in the TreeViewer inputs. We add
- * the violation to the descriptor list verifying that, for each
- * violation : -> If there is already one about the concerned file,
- * to add only information inside the FileRuleDescriptor -> Same for
- * element inside of the rule as FunctionDescriptor and
- * RuleDescriptor. -> If it's not included in the descriptor, then
- * to create required new descriptors.
- */
- for (final CheckResult value : this.inputs) {
- file = new FileRuleDescriptor(new Path(value.getFile().getAbsolutePath()));
-
- if (descriptors.contains(file)) {
- file = descriptors.get((descriptors.indexOf(file)));
- function = new FunctionDescriptor(value.getLocation(), Integer.valueOf(-1),
- new Path(value.getFile().getAbsolutePath()));
- if (file.getDescriptors().contains(function)) {
- function = file.getDescriptors()
- .get(file.getDescriptors().indexOf(function));
- rule = new RuleDescriptor(value.getId(), value.getName(),
- value.getLocation(), Integer.valueOf(-1),
- new Path(value.getFile().getAbsolutePath()));
- if (function.getDescriptors().contains(rule)) {
- rule = function.getDescriptors()
- .get(function.getDescriptors().indexOf(rule));
- viold = new ViolationDescriptor(value.getName(), value.getLocation(),
- value.getMessage(), value.getLine(),
- new Path(value.getFile().getAbsolutePath()));
- if (rule.getDescriptors().contains(viold)) {
- /*
- * This shouldn't happen, this mean the
- * violation was recorded two times.
- */
- } else {
- rule.getDescriptors().add(viold.clone());
- }
- } else {
- viold = new ViolationDescriptor(value.getName(), value.getLocation(),
- value.getMessage(), value.getLine(),
- new Path(value.getFile().getAbsolutePath()));
- rule.getDescriptors().add(viold.clone());
- function.getDescriptors().add(rule.clone());
- }
- } else {
- rule = new RuleDescriptor(value.getId(), value.getName(),
- value.getLocation(), Integer.valueOf(-1),
- new Path(value.getFile().getAbsolutePath()));
- viold = new ViolationDescriptor(value.getName(), value.getLocation(),
- value.getMessage(), value.getLine(),
- new Path(value.getFile().getAbsolutePath()));
- rule.getDescriptors().add(viold.clone());
- function.getDescriptors().add(rule.clone());
- file.getDescriptors().add(function.clone());
- }
- } else {
- rule = new RuleDescriptor(value.getId(), value.getName(), value.getLocation(),
- Integer.valueOf(-1),
- new Path(value.getFile().getAbsolutePath()));
- viold = new ViolationDescriptor(value.getName(), value.getLocation(),
- value.getMessage(), value.getLine(),
- new Path(value.getFile().getAbsolutePath()));
- function = new FunctionDescriptor(value.getLocation(), Integer.valueOf(-1),
- new Path(value.getFile().getAbsolutePath()));
- rule.getDescriptors().add(viold.clone());
- function.getDescriptors().add(rule.clone());
- file.getDescriptors().add(function.clone());
- descriptors.add(file.clone());
- }
-
- }
- this.container = descriptors.toArray(new FileRuleDescriptor[descriptors.size()]);
-
- } catch (final CloneNotSupportedException exception) {
- ICodeLogger.error(CLASS, method, exception);
- status = new Status(IStatus.ERROR, "fr.cnes.analysis.tools.ui", IStatus.ERROR,
- exception.getMessage(), exception);
- }
-
- ICodeLogger.exiting(CLASS, method, status);
- return status;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FileRuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FileRuleDescriptor.java
deleted file mode 100755
index 5e235be3..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FileRuleDescriptor.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Descriptor for a File that is intended to be shown.
- * This descriptor would return it's {@link #filePath} and the number of
- * violations that it contains when using {@link #getName()} and
- * {@link #getValue()} when instanced in a {@link IFileRuleDescriptor}.
- *
- * Descriptors of this file are {@link FunctionDescriptor} for all violations
- * contained in a function of the file described by the class.
- *
- * @version 2.1
- * @see IFileRuleDescriptor
- * @since 2.0
- */
-public class FileRuleDescriptor implements IFileRuleDescriptor, Cloneable {
- /**
- * Class name
- **/
- private static final String CLASS = FileRuleDescriptor.class.getName();
-
- /**
- * File's path.
- **/
- private IPath filePath;
- /**
- * List of violations in the file.
- **/
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public FileRuleDescriptor() {
- final String method = "FileRuleDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /**
- * Constructor with the file's path.
- *
- * @param pFilePath the file's path.
- */
- public FileRuleDescriptor(final IPath pFilePath) {
- final String method = "FileRuleDescriptor";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the file's path.
- *
- * @return file's path
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.filePath);
- return this.filePath;
- }
-
- /**
- * Getter for the descriptors.
- *
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.descriptors);
- return this.descriptors;
- }
-
- /**
- * Setter for the file's path.
- *
- * @param pFilePath the file's path to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the descriptors.
- *
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- final String name = this.filePath.toFile().getName();
- ICodeLogger.exiting(CLASS, method, name);
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getValue()
- */
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- int sum = 0;
- for (final FunctionDescriptor fd : this.descriptors) {
- sum += fd.getValue().intValue();
- }
- ICodeLogger.exiting(CLASS, method, Integer.valueOf(sum));
- return Integer.valueOf(sum);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof FileRuleDescriptor) {
- isEqual = this.filePath.equals(((FileRuleDescriptor) object).getFilePath());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- assert false : "hashCode not designed";
- ICodeLogger.exiting(CLASS, method);
- return this.descriptors.size();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FileRuleDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FileRuleDescriptor clone = (FileRuleDescriptor) super.clone();
- clone.setFilePath(this.filePath);
- clone.setDescriptors(new LinkedList(this.descriptors));
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FunctionDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FunctionDescriptor.java
deleted file mode 100755
index 6eab5363..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/FunctionDescriptor.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Descriptor for a Function that is intended to be shown.
- * This descriptor would return it's {@link #location} and the number of
- * violations that it contains while using {@link #getName()} and
- * {@link #getValue()} when instanced in a {@link IFileRuleDescriptor}.
- *
- * Descriptors of this file are {@link RuleDescriptor} for each rule violated in
- * the function described by this class.
- *
- * @version 2.1
- * @see IFileRuleDescriptor
- * @see FileRuleDescriptor
- * @see RuleDescriptor
- * @since 2.0
- */
-public class FunctionDescriptor implements IFileRuleDescriptor, Cloneable {
- /**
- * Class name
- **/
- private static final String CLASS = FunctionDescriptor.class.getName();
-
- /**
- * Function containing the violation.
- **/
- private String location;
- /**
- * Line of the violation.
- **/
- private Integer value;
- /**
- * File name
- */
- private IPath filePath;
- /**
- * List of all rules violated in the file
- */
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public FunctionDescriptor() {
- final String method = "FunctionDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.descriptors = new LinkedList<>();
- this.location = "";
- this.value = Integer.valueOf(-1);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pLocation Function's name.
- * @param pValue Value computed for the function.
- * @param pFilePath Function's file.
- */
- public FunctionDescriptor(final String pLocation, final Integer pValue, final IPath pFilePath) {
- super();
- final String method = "FunctionDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pLocation, pValue, pFilePath
- });
- this.descriptors = new LinkedList<>();
- this.location = pLocation;
- this.value = pValue;
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, location);
- return this.location;
- }
-
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- int sum = 0;
- for (RuleDescriptor r : this.descriptors) {
- sum += r.getValue().intValue();
- }
- ICodeLogger.exiting(CLASS, method, Integer.valueOf(sum));
- return Integer.valueOf(sum);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- final int prime = 31;
- int result = 1;
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- ICodeLogger.exiting(CLASS, method, Integer.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, obj);
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final FunctionDescriptor other = (FunctionDescriptor) obj;
- if (location == null) {
- if (other.location != null) {
- return false;
- }
- } else if (!location.equals(other.location)) {
- return false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.TRUE);
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FunctionDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FunctionDescriptor clone = (FunctionDescriptor) super.clone();
- clone.setDescriptors(new LinkedList(this.descriptors));
- clone.setFilePath(this.filePath);
- clone.setLocation(this.location);
- clone.setValue(this.value);
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
- /**
- * @return the location
- */
- public String getLocation() {
- final String method = "getLocation";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, location);
- return location;
- }
-
- /**
- * @param pLocation the location to set
- */
- public void setLocation(final String pLocation) {
- final String method = "setLocation";
- ICodeLogger.entering(CLASS, method, pLocation);
- this.location = pLocation;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the filePath
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, filePath);
- return filePath;
- }
-
- /**
- * @param pFilePath the filePath to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, descriptors);
- return descriptors;
- }
-
- /**
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pValue the value to set
- */
- public void setValue(Integer pValue) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, pValue);
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/IFileRuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/IFileRuleDescriptor.java
deleted file mode 100755
index 8949054b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/IFileRuleDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
-
-/**
- * Interface for the rule, a file or a violation. This interface is mainly used
- * to display results in the ViolationsView.
- *
- * @version 2.0
- * @see IFileRuleDescriptor
- * @see FileRuleDescriptor
- * @see RuleDescriptor
- * @see ViolationDescriptor
- * @since 2.0
- */
-public interface IFileRuleDescriptor {
- /**
- * Returns the name of this descriptor.
- *
- * @return the name
- */
- String getName();
-
- /**
- * Returns the value of this descriptor.
- *
- * @return the value
- */
- Integer getValue();
-
-}
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/RuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/RuleDescriptor.java
deleted file mode 100755
index a54a799c..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/RuleDescriptor.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Descriptor for a Rule that is intended to be shown.
- * This descriptor would return it's rules {@link #name} and the number of
- * violations that it contains while using {@link #getName()} and
- * {@link #getValue()} when instanced in a {@link IFileRuleDescriptor}.
- *
- * Descriptors contained by this descriptor are {@link ViolationDescriptor}.
- *
- * @version 2.1
- * @see IFileRuleDescriptor
- * @see FileRuleDescriptor
- * @see RuleDescriptor
- * @see ViolationDescriptor
- * @since 2.0
- */
-public class RuleDescriptor implements IFileRuleDescriptor, Cloneable {
- /**
- * Class name
- **/
- private static final String CLASS = RuleDescriptor.class.getName();
-
- /**
- * Rule's id.
- **/
- private String ruleId;
- /**
- * Rule's name.
- **/
- private String name;
- /**
- * Function containing the violation.
- **/
- private String location;
- /**
- * Number of violations stored for the rule
- */
- private Integer value;
- /**
- * The violations stored for the rule
- */
- private List descriptors;
- /**
- * File name
- */
- private IPath filePath;
-
- /**
- * Empty constructor.
- */
- public RuleDescriptor() {
- final String method = "";
- ICodeLogger.entering(CLASS, method);
- this.ruleId = "";
- this.name = "";
- this.location = "";
- this.value = Integer.valueOf(-1);
- this.descriptors = new LinkedList<>();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor for RuleDescriptor
- *
- * @param pRuleId The ID of the rule
- * @param pName Name of the Rule
- * @param pLocation Location of the function, program, method containing the
- * violation of the rule
- * @param pValue Number of Violation contained for this rule
- * @param pPath Path to the file containing the rule
- */
- public RuleDescriptor(final String pRuleId, final String pName, final String pLocation,
- final Integer pValue, final IPath pPath) {
- super();
- final String method = "RuleDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pRuleId, pName, pLocation, pValue, pPath
- });
- this.ruleId = pRuleId;
- this.name = pName;
- this.location = pLocation;
- this.value = pValue;
- this.descriptors = new LinkedList<>();
- this.filePath = pPath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method);
- return descriptors;
- }
-
- /**
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final LinkedList pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the id.
- *
- * @return rule's id
- */
- public String getRuleId() {
- final String method = "getRuleId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.ruleId);
- return this.ruleId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.name);
- return this.name;
- }
-
- /**
- * Setter for the id.
- *
- * @param pRuleId the id to set
- */
- public void setRuleId(final String pRuleId) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, pRuleId);
- this.ruleId = pRuleId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the name
- *
- * @param pName the name to set
- */
- public void setName(final String pName) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.rules.treeviewer.file.IFileRuleDescriptor#
- * getValue()
- */
- @Override
- public Integer getValue() {
- final String method = "";
- ICodeLogger.entering(CLASS, method);
- final Integer value = Integer.valueOf(this.descriptors.size());
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /**
- * @return The severity of the current Rule
- */
- public String getSeverity() {
- final String method = "getSeverity";
- ICodeLogger.entering(CLASS, method);
- final String severity = UserPreferencesService.getCheckerSeverity(this.ruleId);
- ICodeLogger.exiting(CLASS, method, severity);
- return severity;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final String method = "hashCode";
- ICodeLogger.entering(CLASS, method);
- final int prime = 31;
- int result = 1;
- result = prime * result + ((filePath == null) ? 0 : filePath.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((ruleId == null) ? 0 : ruleId.hashCode());
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- ICodeLogger.exiting(CLASS, method, Integer.valueOf(result));
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof RuleDescriptor) {
- isEqual = this.name.equals(((RuleDescriptor) object).getName());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public RuleDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final RuleDescriptor clone = (RuleDescriptor) super.clone();
- clone.setDescriptors(new LinkedList(this.descriptors));
- clone.setRuleId(this.ruleId);
- clone.setName(this.name);
- clone.setFilePath(this.filePath);
- clone.setLocation(this.location);
- clone.setValue(this.value);
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
- /**
- * @return the location
- */
- public String getLocation() {
- final String method = "getLocation";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, location);
- return location;
- }
-
- /**
- * @param pLocation the location to set
- */
- public void setLocation(final String pLocation) {
- final String method = "setLocation";
- ICodeLogger.entering(CLASS, method, pLocation);
- this.location = pLocation;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the filePath
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, filePath);
- return filePath;
- }
-
- /**
- * @param pFilePath the filePath to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pValue the value to set
- */
- public void setValue(final Integer pValue) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, pValue);
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/ViolationDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/ViolationDescriptor.java
deleted file mode 100755
index 8eed8b57..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/ViolationDescriptor.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Descriptor for a violation that is intended to be shown.
- * This descriptor would return the violation message {@link #name} and the line
- * of the violation in the file using {@link #getName()} and {@link #getValue()}
- * when instanced in a {@link IFileRuleDescriptor}.
- *
- * Descriptors contained by this descriptor are {@link ViolationDescriptor}.
- *
- * @version 2.1
- * @see IFileRuleDescriptor
- * @see FileRuleDescriptor
- * @see RuleDescriptor
- * @see ViolationDescriptor
- * @since 2.0
- */
-public class ViolationDescriptor implements IFileRuleDescriptor, Cloneable {
- /**
- * Class name
- **/
- private static final String CLASS = ViolationDescriptor.class.getName();
- /**
- * Rule's id.
- **/
- private String ruleId;
- /**
- * Violation's message.
- **/
- private String message;
- /**
- * Function containing the violation.
- **/
- private String location;
- /**
- * Line of the violation.
- **/
- private Integer line;
- /**
- * The path of the file containing the violation.
- */
- private IPath filePath;
-
- /**
- * Constructor for Violation Descriptor
- *
- * @param pRuleId The rule violated
- * @param pMessage The violation's message
- * @param pLocation The function where is violation is located
- * @param pLine The line of the violation
- * @param pFilePath The filePath to the violation
- */
- public ViolationDescriptor(final String pRuleId, final String pLocation, final String pMessage,
- final Integer pLine, final IPath pFilePath) {
- super();
- final String method = "ViolationDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pRuleId, pLocation, pMessage, pLocation, pLine, pFilePath
- });
- this.ruleId = pRuleId;
- this.message = pMessage;
- this.location = pLocation;
- this.line = pLine;
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Empty constructor
- */
- public ViolationDescriptor() {
- final String method = "ViolationDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.ruleId = "";
- this.message = "";
- this.location = "";
- this.line = Integer.valueOf(-1);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.
- * IFileRuleDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, message);
- return this.message;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.
- * IFileRuleDescriptor#getLine()
- */
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, line);
- return this.line;
- }
-
- /**
- * @return the ruleId
- */
- public String getRuleId() {
- final String method = "getRuleId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, ruleId);
- return ruleId;
- }
-
- /**
- * @param pRuleId the ruleId to set
- */
- public void setRuleId(final String pRuleId) {
- final String method = "setRuleId";
- ICodeLogger.entering(CLASS, method, pRuleId);
- this.ruleId = pRuleId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the location
- */
- public String getLocation() {
- final String method = "getLocation";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, location);
- return location;
- }
-
- /**
- * @param pLocation the location to set
- */
- public void setLocation(final String pLocation) {
- final String method = "setLocation";
- ICodeLogger.entering(CLASS, method, pLocation);
- this.location = pLocation;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the filePath
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, filePath);
- return filePath;
- }
-
- /**
- * @param pFilePath the filePath to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pName the name to set
- */
- public void setName(final String pName) {
- final String method = "setName";
- ICodeLogger.entering(CLASS, method, pName);
- this.message = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @param pLine the value to set
- */
- public void setLine(final Integer pLine) {
- final String method = "setLine";
- ICodeLogger.entering(CLASS, method, pLine);
- this.line = pLine;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public ViolationDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final ViolationDescriptor clone = (ViolationDescriptor) super.clone();
- clone.setRuleId(this.ruleId);
- clone.setName(this.message);
- clone.setMessage(this.message);
- clone.setFilePath(this.filePath);
- clone.setLocation(this.location);
- clone.setLine(this.line);
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
- /**
- * @return Violation message.
- */
- public String getMessage() {
- final String method = "getMessage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param pMessage Violation message to set.
- */
- public void setMessage(final String pMessage) {
- final String method = "setMessage";
- ICodeLogger.entering(CLASS, method, pMessage);
- this.message = pMessage;
- ICodeLogger.exiting(CLASS, method);
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/package-info.java
deleted file mode 100755
index 9d0e3d4b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/descriptor/package-info.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * This package contains all descriptors for the
- * {@link fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewer}
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * This package contains all descriptors for the
- * {@link fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewer}
- *
- */
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/FileTreeViewerFilter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/FileTreeViewerFilter.java
deleted file mode 100755
index 19370097..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/FileTreeViewerFilter.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.filter;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.IUpdatableAnalysisFilter;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.FunctionDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.RuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.descriptor.ViolationDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-/**
- * This class is a filter to apply on
- * {@link fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.FileTreeViewer}
- */
-public class FileTreeViewerFilter extends ViewerFilter implements IUpdatableAnalysisFilter {
- /**
- * Class name
- */
- private static final String CLASS = FileTreeViewerFilter.class.getName();
-
- /**
- * String filtered
- */
- private String searchString = "";
- /**
- * Is the filter focusing a file ?
- */
- private boolean filteringFile = false;
- /**
- * Is the filter focusing a function ?
- */
- private boolean filteringFunction = false;
- /**
- * Is the filter focusing a Rule ?
- */
- private boolean filteringRule = false;
- /**
- * Should we show violation of Warning criticity ?
- */
- private boolean showWarning = true;
- /**
- * Should we show violation of Error criticity ?
- */
- private boolean showError = true;
- /**
- * Should info severity violation be shown ?
- */
- private boolean showInfo = true;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.
- * Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(final Viewer pViewer, final Object pParentElement,
- final Object pElement) {
- final String method = "select";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pViewer, pParentElement, pElement
- });
- boolean show = false;
- boolean ruleBeingShown = false;
- /*
- * Setting filtering level
- */
- if (pElement instanceof FileRuleDescriptor) {
- final FileRuleDescriptor file = (FileRuleDescriptor) pElement;
- if (file.getName().toUpperCase().contains(searchString.toUpperCase())) {
- show = true;
- filteringFile = true;
- } else {
- for (final FunctionDescriptor function : file.getDescriptors()) {
- if (function.getName().toString().toUpperCase()
- .contains(searchString.toUpperCase())) {
- show = true;
- filteringFunction = true;
- } else {
- for (final RuleDescriptor rule : function.getDescriptors()) {
- if (rule.getName().toUpperCase().contains(searchString.toUpperCase())
- && checkSeverity(rule)) {
- show = true;
- filteringRule = true;
- ruleBeingShown = true;
- } else {
- for (ViolationDescriptor violation : rule.getDescriptors()) {
- if ((violation.getName().toString().toUpperCase()
- .contains(searchString.toUpperCase()))
- && checkSeverity(rule)) {
- show = true;
- ruleBeingShown = true;
- }
- }
- }
- }
- }
- }
- }
- } else if (pElement instanceof FunctionDescriptor) {
- final FunctionDescriptor function = (FunctionDescriptor) pElement;
- if (function.getName().toString().toUpperCase().contains(searchString.toUpperCase())
- || filteringFile) {
- show = true;
- } else {
- for (final RuleDescriptor rule : function.getDescriptors()) {
- if (rule.getName().toUpperCase().contains(searchString.toUpperCase())
- && checkSeverity(rule)) {
- show = true;
- ruleBeingShown = true;
- } else {
- for (final ViolationDescriptor violation : rule.getDescriptors()) {
- if (violation.getName().toString().toUpperCase()
- .contains(searchString.toUpperCase())) {
- show = true;
- ruleBeingShown = true;
- }
- }
- }
- }
- }
- } else if (pElement instanceof RuleDescriptor) {
- final RuleDescriptor rule = (RuleDescriptor) pElement;
- if ((rule.getName().toUpperCase().contains(searchString.toUpperCase()) || filteringFile
- || filteringFunction) && checkSeverity(rule)) {
- show = true;
- } else {
- for (final ViolationDescriptor violation : rule.getDescriptors()) {
- if (violation.getName().toString().toUpperCase()
- .contains(searchString.toUpperCase()) && checkSeverity(rule)) {
- show = true;
- }
- }
- }
- } else if (pElement instanceof ViolationDescriptor) {
- final ViolationDescriptor violation = (ViolationDescriptor) pElement;
- show = violation.getName().toString().toUpperCase().contains(searchString.toUpperCase())
- || filteringFile || filteringFunction || filteringRule;
- }
- if (pElement instanceof FileRuleDescriptor || pElement instanceof FunctionDescriptor) {
- show = (show || ruleBeingShown);
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(show));
- return show;
-
- }
-
- /**
- * @param rule Rule to verify.
- * @return whether or not the CheckerResult should be shown pending it's
- * severity configuration.
- */
- private boolean checkSeverity(final RuleDescriptor rule) {
- final String method = "checkSeverity";
- ICodeLogger.entering(CLASS, method);
- final boolean checked = (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_WARNING_VALUE) && showWarning)
- || (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_ERROR_VALUE)
- && showError)
- || (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_INFO_VALUE)
- && showInfo);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(checked));
- return checked;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * fr.cnes.analysis.tools.ui.view.rules.treeviewer.IUpdatableAnalysisFilter#
- * update(java.lang.String, boolean, boolean)
- */
- @Override
- public void update(final String pSearchString, final boolean pShowInfo,
- final boolean pShowWarning, final boolean pShowError) {
- final String method = "update";
- ICodeLogger.entering(CLASS, method);
- this.searchString = pSearchString;
- this.showError = pShowError;
- this.showWarning = pShowWarning;
- this.showInfo = pShowInfo;
- filteringRule = false;
- filteringFile = false;
- filteringFunction = false;
- ICodeLogger.exiting(CLASS, method);
-
- }
-}
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/package-info.java
deleted file mode 100755
index 1d4b0fdd..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/file/filter/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * This package contains all filter for the FileTreeViewer
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * This package contains all filter for the FileTreeViewer
- */
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.file.filter;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/CheckResultToRuleTreeViewerConverter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/CheckResultToRuleTreeViewerConverter.java
deleted file mode 100755
index 4f994792..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/CheckResultToRuleTreeViewerConverter.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule;
-
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FunctionRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.RuleDescriptor;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Job used to converter inputs from analysis to valuable inputs for the
- * ViolationView.
- */
-public class CheckResultToRuleTreeViewerConverter extends Job {
-
- /**
- * Class name
- */
- private static final String CLASS = CheckResultToRuleTreeViewerConverter.class.getName();
-
- /**
- * The original inputs.
- **/
- private CheckResult[] inputs;
- /**
- * A value container which has all values of rules.
- **/
- private RuleDescriptor[] container;
-
- /**
- * Empty constructor for this Job.
- */
- public CheckResultToRuleTreeViewerConverter() {
- super("Converting results...");
- final String method = "CheckResultToRuleTreeViewerConverter";
- ICodeLogger.entering(CLASS, method);
- this.inputs = new CheckResult[0];
- this.container = new RuleDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor for this Job with an array of violations.
- *
- * @param pInputs the inputs
- */
- public CheckResultToRuleTreeViewerConverter(final CheckResult[] pInputs) {
- super("Converting results...");
- final String method = "CheckResultToRuleTreeViewerConverter";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs.clone();
- this.container = new RuleDescriptor[0];
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the inputs id.
- *
- * @return the inputs
- */
- public CheckResult[] getInputs() {
- final String method = "getInputs";
- ICodeLogger.entering(CLASS, method);
- final CheckResult[] clonedResults = this.inputs.clone();
- ICodeLogger.exiting(CLASS, method, clonedResults);
- return clonedResults;
- }
-
- /**
- * Getter for the container
- *
- * @return the container
- */
- public RuleDescriptor[] getContainer() {
- final String method = "getContainer";
- ICodeLogger.entering(CLASS, method);
- final RuleDescriptor[] clonedContainer = this.container.clone();
- ICodeLogger.exiting(CLASS, method, clonedContainer);
- return clonedContainer;
- }
-
- /**
- * Setter for the inputs.
- *
- * @param pInputs the inputs to set
- */
- public void setInputs(final CheckResult[] pInputs) {
- final String method = "setInputs";
- ICodeLogger.entering(CLASS, method, pInputs);
- this.inputs = pInputs.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the container
- *
- * @param pContainer the container to set
- */
- public void setContainer(final RuleDescriptor[] pContainer) {
- final String method = "setContainer";
- ICodeLogger.entering(CLASS, method, pContainer);
- this.container = pContainer.clone();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
- * IProgressMonitor)
- */
- @Override
- public IStatus run(final IProgressMonitor monitor) {
- final String method = "run";
- ICodeLogger.entering(CLASS, method, monitor);
- // Instantiate return variable
- IStatus status = Status.OK_STATUS;
- final int totalWork = this.inputs.length;
-
- // Instantiate descriptors
- final List descriptors = new LinkedList();
- final RuleDescriptor rule = new RuleDescriptor();
- final FileRuleDescriptor file = new FileRuleDescriptor();
- final FunctionRuleDescriptor function = new FunctionRuleDescriptor();
-
- // Start converting
- monitor.beginTask("Converting...", totalWork);
- try {
- for (final CheckResult value : this.inputs) {
- if (descriptors.isEmpty() || !descriptors.get(descriptors.size() - 1).getName()
- .equals(value.getName())) {
- rule.getDescriptors().clear();
- rule.setRuleId(value.getId());
- rule.setName(value.getName());
- descriptors.add(rule.clone());
-
- }
- if (descriptors.get(descriptors.size() - 1).getDescriptors().isEmpty()
- || !descriptors.get(descriptors.size() - 1).getDescriptors()
- .get(descriptors.get(descriptors.size() - 1)
- .getDescriptors().size() - 1)
- .getFilePath().equals(new Path(value.getFile()
- .getAbsolutePath()))) {
- file.getDescriptors().clear();
- file.setFilePath(new Path(value.getFile().getAbsolutePath()));
- descriptors.get(descriptors.size() - 1).getDescriptors().add(file.clone());
- }
- function.setRuleId(value.getId());
- function.setFilePath(new Path(value.getFile().getAbsolutePath()));
- function.setMessage(value.getMessage());
- function.setLocation(value.getLocation());
- function.setValue(value.getLine());
- descriptors.get(descriptors.size() - 1).getDescriptors().get(
- descriptors.get(descriptors.size() - 1).getDescriptors().size() - 1)
- .getDescriptors().add(function.clone());
- monitor.worked(1);
- }
- this.container = descriptors.toArray(new RuleDescriptor[descriptors.size()]);
- } catch (final CloneNotSupportedException exception) {
- ICodeLogger.error(CLASS, method, exception);
- status = new Status(IStatus.ERROR, "fr.cnes.analysis.tools.fortran.analyzer",
- IStatus.ERROR, exception.getMessage(), exception);
- }
-
- ICodeLogger.exiting(CLASS, method, status);
- return status;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewer.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewer.java
deleted file mode 100755
index dc7ccbab..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewer.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule;
-
-import fr.cnes.analysis.tools.ui.view.AbstractAnalysisTreeViewer;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FunctionRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.RuleDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-
-/**
- * ViolationsRuleTreeViewer This class implements an AbstractAnalysisTreeViewer
- * with {@link RuleDescriptor} {@link }
- */
-public class RuleTreeViewer extends AbstractAnalysisTreeViewer {
-
- /**
- * Class name
- */
- private static final String CLASS = RuleTreeViewer.class.getName();
-
- /**
- * Titles of the columns
- */
- private static final String[] TITLES = new String[]{
- " ! ", "Rule", "Line", "Number of violations", "Message"
- };
-
- /**
- * Bounds of the TreeViewer
- */
- private static final int[] BOUNDS = new int[]{
- 50, 200, 50, 50, 200
- };
- /**
- * Kind of bitmap to know if the sorting should be up or down for each
- * column of the tree
- */
- private boolean[] columnSortUp = new boolean[]{
- true, true, false, true, true
- };
-
- /**
- * Index selected to sort the columns, by default 1
- */
- private int indexSort = 1;
-
- /** Bounds of the columns */
-
- /**
- * Constructor for violations rule treeviewer.
- *
- * @param parent The Composite containing the TreeViewer
- * @param style The SWT style
- */
- public RuleTreeViewer(final Composite parent, final int style) {
- super(parent, style, TITLES, BOUNDS);
- final String method = "RuleTreeViewer";
- ICodeLogger.entering(CLASS, method, new Object[]{
- parent, Integer.valueOf(style)
- });
- final ViewerComparator comparator = new RuleTreeViewerComparator();
- this.setComparator(comparator);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This method creates all columns of the tree table viewer.
- */
- protected void createColumns() {
- final String method = "createColumns";
- ICodeLogger.entering(CLASS, method);
-
- this.setContentProvider(new RuleTreeViewerContentProvider());
- TreeViewerColumn col;
- for (int i = 0; i < super.getTitles().length; i++) {
- // Create the column
- col = this.createTreeViewerColumn(this.getTitles()[i], this.getBounds()[i], i);
- // Add a label provider
- col.setLabelProvider(new RuleTreeViewerLabelProvider(i));
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Create a column of the TreeViewer, customize it and assign it's index
- * number and action listener to be sorted.
- *
- * @param title The title of the head column.
- * @param bound The bound of the column.
- * @param colNumber The index number of the column in the TreeViewer.
- * @return The treeViewerColumn created.
- */
- private TreeViewerColumn createTreeViewerColumn(final String title, final int bound,
- final int colNumber) {
- final String method = "createTreeViewerColumn";
- ICodeLogger.entering(CLASS, method);
- final TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE);
- final TreeColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(true);
-
- column.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- columnSortUp[colNumber] = !columnSortUp[colNumber];
- indexSort = colNumber;
- final Tree tree = getTree();
- tree.setSortColumn(column);
- if (columnSortUp[colNumber]) {
- tree.setSortDirection(SWT.UP);
- } else {
- tree.setSortDirection(SWT.DOWN);
- }
- refresh();
- }
-
- });
- ICodeLogger.exiting(CLASS, method, viewerColumn);
- return viewerColumn;
- }
-
- /**
- * Action to do when a double click over the item is done
- */
- protected void addDoubleClickAction() {
- final String method = "addDoubleClickAction";
- ICodeLogger.entering(CLASS, method);
- this.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(final DoubleClickEvent event) {
- final TreeViewer tViewer = (TreeViewer) event.getViewer();
- final IStructuredSelection thisSelection = (IStructuredSelection) event
- .getSelection();
- final Object selectedNode = thisSelection.getFirstElement();
-
- tViewer.setExpandedState(selectedNode, !tViewer.getExpandedState(selectedNode));
-
- // if it is a leaf -> open the file
- if (!tViewer.isExpandable(selectedNode)
- && selectedNode instanceof FunctionRuleDescriptor) {
- final IPath path = ((FunctionRuleDescriptor) selectedNode).getFilePath();
- final int number = ((FunctionRuleDescriptor) selectedNode).getValue()
- .intValue();
- // get resource
- final IFile fileToOpen = ResourcesPlugin.getWorkspace().getRoot()
- .getFileForLocation(path);
- final IResource res = fileToOpen;
-
- // open file in editor
- openFileInEditor(res, number);
- }
- }
- });
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * @return the columnSortUp
- */
- public boolean[] getColumnSortUp() {
- final String method = "getColumnSortUp";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, columnSortUp);
- return columnSortUp;
- }
-
- /**
- * @param columnSortUp the columnSortUp to set
- */
- public void setColumnSortUp(boolean[] columnSortUp) {
- final String method = "setColumnSortUp";
- ICodeLogger.entering(CLASS, method, columnSortUp);
- this.columnSortUp = columnSortUp;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This internal class compose the ViewerComparator of the TreeViewer. The
- * compare method is being called everytime a refresh is being called.
- */
- class RuleTreeViewerComparator extends ViewerComparator {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.
- * viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- int rc = 0;
- if (e1 instanceof RuleDescriptor && e2 instanceof RuleDescriptor) {
- final RuleDescriptor rule1 = (RuleDescriptor) e1;
- final RuleDescriptor rule2 = (RuleDescriptor) e2;
-
- switch (indexSort) {
- case 0:
- rc = rule1.getSeverity().compareTo(rule2.getSeverity());
- break;
- case 1:
- rc = rule1.getName().compareToIgnoreCase(rule2.getName());
- break;
- case 3:
- rc = rule1.getValue().intValue() - rule2.getValue().intValue();
- break;
- default:
- rc = 0;
- }
- } else if (e1 instanceof FileRuleDescriptor && e2 instanceof FileRuleDescriptor) {
- final FileRuleDescriptor file1 = (FileRuleDescriptor) e1;
- final FileRuleDescriptor file2 = (FileRuleDescriptor) e2;
-
- switch (indexSort) {
- case 1:
- rc = file1.getName().compareToIgnoreCase(file2.getName());
- break;
- case 3:
- rc = file1.getValue().intValue() - file2.getValue().intValue();
- break;
- default:
- rc = 0;
- }
- } else if (e1 instanceof FunctionRuleDescriptor
- && e2 instanceof FunctionRuleDescriptor) {
- final FunctionRuleDescriptor function1 = (FunctionRuleDescriptor) e1;
- final FunctionRuleDescriptor function2 = (FunctionRuleDescriptor) e2;
-
- switch (indexSort) {
- case 1:
- rc = function1.getLocation().compareToIgnoreCase(function2.getLocation());
- break;
- case 2:
- rc = function1.getValue().intValue() - function2.getValue().intValue();
- break;
- case 4:
- rc = function1.getName().compareToIgnoreCase(function2.getName());
- break;
- default:
- rc = 0;
- }
- }
- // If descending order, flip the direction
- if (columnSortUp[indexSort]) {
- rc = -rc;
- }
- return rc;
- }
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerContentProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerContentProvider.java
deleted file mode 100755
index afb924e4..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerContentProvider.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FunctionRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.RuleDescriptor;
-import fr.cnes.icode.data.CheckResult;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.List;
-
-/**
- * This class provides a content provider for the tree viewer in the metric
- * view.
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider
- */
-public class RuleTreeViewerContentProvider implements ITreeContentProvider {
- /**
- * Class name
- */
- private static final String CLASS = RuleTreeViewerContentProvider.class.getName();
- /**
- * The original inputs.
- **/
- private CheckResultToRuleTreeViewerConverter converter;
-
- /**
- * Empty constructor.
- */
- public RuleTreeViewerContentProvider() {
- super();
- final String method = "RuleTreeViewerContentProvider";
- ICodeLogger.entering(CLASS, method);
- this.converter = new CheckResultToRuleTreeViewerConverter();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the converter.
- *
- * @return the converter
- */
- public CheckResultToRuleTreeViewerConverter getConverter() {
- final String method = "getConverter";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.converter);
- return this.converter;
- }
-
- /**
- * Setter for the converter.
- *
- * @param pConverter the converter to set
- */
- public void setConverter(final CheckResultToRuleTreeViewerConverter pConverter) {
- final String method = "setConverter";
- ICodeLogger.entering(CLASS, method, pConverter);
- this.converter = pConverter;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.
- * jface .viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
- final String method = "inputChanged";
- ICodeLogger.entering(CLASS, method, new Object[]{
- viewer, oldInput, newInput
- });
-
- try {
- if (newInput instanceof CheckResult[]) {
- this.converter.setInputs(((CheckResult[]) newInput).clone());
- // run analysis
- this.converter.setUser(true);
- this.converter.schedule();
- this.converter.join();
-
- } else if (newInput != null) {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "inputChanged method of AbstractContentProvider has a "
- + newInput.getClass().getName()
- + " type instead of a Descriptor>[] instance");
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
- } catch (final InterruptedException exception) {
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
- * Object)
- */
- @Override
- public Object[] getElements(final Object inputElement) {
- final String method = "getElements";
- ICodeLogger.entering(CLASS, method, inputElement);
- final Object[] elements = this.converter.getContainer();
-
- ICodeLogger.exiting(CLASS, method, elements);
- return elements;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- @Override
- public void dispose() {
- final String method = "dispose";
- ICodeLogger.entering(CLASS, method);
- if (this.converter != null) {
- this.converter.setContainer(new RuleDescriptor[0]);
- }
-
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
- * Object)
- */
- @Override
- public boolean hasChildren(final Object element) {
- final String method = "hasChildren";
- ICodeLogger.entering(CLASS, method, element);
- final boolean hasChildren = !(element instanceof FunctionRuleDescriptor);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(hasChildren));
- return hasChildren;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
- * )
- */
- @Override
- public Object getParent(final Object element) {
- final String method = "getParent";
- ICodeLogger.entering(CLASS, method, element);
- ICodeLogger.exiting(CLASS, method, null);
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
- * Object)
- */
- @Override
- public Object[] getChildren(final Object parentElement) {
- final String method = "getChildren";
- ICodeLogger.entering(CLASS, method, parentElement);
- Object[] values = null;
- if (parentElement instanceof FileRuleDescriptor) {
-
- // The parent element can be a FileValue : we find array of
- // function values depending
- final List mVals = ((FileRuleDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new FunctionRuleDescriptor[mVals.size()]);
- } else if (parentElement instanceof RuleDescriptor) {
-
- // A Descriptor : we find array of file values depending
- final List mVals = ((RuleDescriptor) parentElement)
- .getDescriptors();
- values = mVals.toArray(new FileRuleDescriptor[mVals.size()]);
- } else if (parentElement instanceof RuleDescriptor[]) {
-
- // An array of descriptors : we find each descriptor depending
- values = (RuleDescriptor[]) parentElement;
- } else if (!(parentElement instanceof FunctionRuleDescriptor)) {
-
- // Otherwise, an error is thrown on the interface
- final UnknownInstanceException exception = new UnknownInstanceException(
- "Unknow type in getChildren method of AbstractContentProvider : "
- + parentElement.getClass().getName());
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, values);
- return values;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerLabelProvider.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerLabelProvider.java
deleted file mode 100755
index c9003f1e..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/RuleTreeViewerLabelProvider.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule;
-
-import fr.cnes.analysis.tools.ui.exception.UnknownInstanceException;
-import fr.cnes.analysis.tools.ui.images.ImageFactory;
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.analysis.tools.ui.view.AbstractLabelProvider;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FunctionRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.IRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.RuleDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This class provides column for the table viewer.
- */
-public class RuleTreeViewerLabelProvider extends AbstractLabelProvider {
- /** Static values that determines column types. **/
- /**
- * This value is for rule criticity column.
- **/
- public final static int SEVERITY = 0;
- /**
- * This value is for rule name column.
- **/
- public final static int NAME = 1;
- /**
- * This value is for error's line column.
- **/
- public final static int LINE = 2;
- /**
- * This value is for number of violations column.
- **/
- public final static int NB_VIOL = 3;
- /**
- * This value is for location column.
- **/
- public final static int MESSAGE = 4;
- /**
- * Class name
- */
- private static final String CLASS = RuleTreeViewerLabelProvider.class.getName();
-
- /**
- * Constructor with integer parameter which represents the column created.
- *
- * @param pType the column to create
- */
- public RuleTreeViewerLabelProvider(final int pType) {
- super(pType);
- final String method = "RuleTreeViewerLabelProvider";
- ICodeLogger.entering(CLASS, method, Integer.valueOf(pType));
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * This functions set the text for each element of a column.
- *
- * @param element the element store in the column
- * @return the text to store in column case
- */
- @Override
- public String getText(final Object element) {
- final String method = "getText";
- ICodeLogger.entering(CLASS, method, element);
- String text = "";
- if (element instanceof IRuleDescriptor) {
- switch (this.getType()) {
- case SEVERITY:
- break;
- case NAME:
- if (element instanceof FunctionRuleDescriptor) {
- text = ((FunctionRuleDescriptor) element).getLocation();
- } else {
- text = ((IRuleDescriptor) element).getName();
- }
- break;
- case LINE:
- if (element instanceof FunctionRuleDescriptor) {
- text = ((IRuleDescriptor) element).getValue().toString();
- } else {
- text = "--";
- }
- break;
- case NB_VIOL:
- if (element instanceof FunctionRuleDescriptor) {
- text = "--";
- } else {
- text = ((IRuleDescriptor) element).getValue().toString();
- }
- break;
- case MESSAGE:
- if (element instanceof FunctionRuleDescriptor) {
- text = ((FunctionRuleDescriptor) element).getMessage();
- }
- break;
- default:
- final RuntimeException exception = new ArrayIndexOutOfBoundsException(
- "Wrong column value for ViolationsLabelProvider class : "
- + this.getType());
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- break;
- }
- } else {
- final UnknownInstanceException exception = new UnknownInstanceException(
- "getText method of ViolationsLabelProvider class has a "
- + element.getClass().getName()
- + " element, but it should be an IRuleDescriptor instance.");
- ICodeLogger.error(CLASS, method, exception);
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Internal Error",
- "Contact support service : \n" + exception.getMessage());
- }
-
- ICodeLogger.exiting(CLASS, method, text);
- return text;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(final Object element) {
- final String method = "getImage";
- ICodeLogger.entering(CLASS, method, element);
- Image image = null;
- if (this.getType() == SEVERITY && element instanceof RuleDescriptor) {
- switch (((RuleDescriptor) element).getSeverity()) {
- case UserPreferencesService.PREF_SEVERITY_ERROR_VALUE:
- image = ImageFactory.getImage(ImageFactory.ERROR_SMALL);
- break;
- case UserPreferencesService.PREF_SEVERITY_WARNING_VALUE:
- image = ImageFactory.getImage(ImageFactory.WARNING_SMALL);
- break;
- case UserPreferencesService.PREF_SEVERITY_INFO_VALUE:
- default:
- image = ImageFactory.getImage(ImageFactory.INFO_SMALL);
- break;
- }
- }
-
- ICodeLogger.exiting(CLASS, method, image);
- return image;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FileRuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FileRuleDescriptor.java
deleted file mode 100755
index 1759608b..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FileRuleDescriptor.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Class descriptor for rule's violations in a file.
- */
-public class FileRuleDescriptor implements IRuleDescriptor, Cloneable {
-
- /**
- * Class name
- */
- private static final String CLASS = FileRuleDescriptor.class.getName();
- /**
- * File's path.
- **/
- private IPath filePath;
- /**
- * List of violations in the file.
- **/
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public FileRuleDescriptor() {
- final String method = "FileRuleDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with the file's path.
- *
- * @param pFilePath the file's path.
- */
- public FileRuleDescriptor(final IPath pFilePath) {
- final String method = "FileRuleDescriptor";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the file's path.
- *
- * @return file's path
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.filePath);
- return this.filePath;
- }
-
- /**
- * Getter for the descriptors.
- *
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.descriptors);
- return this.descriptors;
- }
-
- /**
- * Setter for the file's path.
- *
- * @param pFilePath the file's path to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the descriptors.
- *
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.metrics.IMetricDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- final String name = this.filePath.toFile().getName();
- ICodeLogger.exiting(CLASS, method, name);
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getValue()
- */
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- final Integer value = Integer.valueOf(this.descriptors.size());
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getCriticity()
- */
- @Override
- public String getSeverity() {
- final String method = "getSeverity";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, "");
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof FileRuleDescriptor) {
- isEqual = this.filePath.equals(((FileRuleDescriptor) object).getFilePath());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- assert false : "hashCode not designed";
- return this.descriptors.size();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FileRuleDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FileRuleDescriptor clone = (FileRuleDescriptor) super.clone();
- clone.setFilePath(this.filePath);
- clone.setDescriptors(new LinkedList(this.descriptors));
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FunctionRuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FunctionRuleDescriptor.java
deleted file mode 100755
index ddc16d33..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/FunctionRuleDescriptor.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Descriptor for rule's violations in a function.
- */
-public class FunctionRuleDescriptor implements IRuleDescriptor, Cloneable {
-
- /**
- * Class name
- */
- private static final String CLASS = FunctionRuleDescriptor.class.getName();
- /**
- * Function containing the violation.
- **/
- private String location;
- /**
- * Violation's message
- */
- private String message;
- /**
- * Line of the violation.
- **/
- private Integer value;
- /**
- * Path of the file containing the violation.
- **/
- private IPath filePath;
- /**
- * Id of the violated rule.
- **/
- private String ruleId;
-
- /**
- * Empty constructor.
- */
- public FunctionRuleDescriptor() {
- final String method = "FunctionRuleDescriptor";
- ICodeLogger.entering(CLASS, method);
- this.ruleId = "";
- this.location = "";
- this.message = "";
- this.value = Integer.valueOf(-1);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with every attribute as parameter.
- *
- * @param pRuleId rule's id
- * @param pFilePath file's path
- * @param pLocation violation's location
- * @param pMessage violation's message
- * @param pValue violation's line
- */
- public FunctionRuleDescriptor(final String pRuleId, final IPath pFilePath,
- final String pLocation, final String pMessage, final Integer pValue) {
- final String method = "";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pRuleId, pFilePath, pLocation, pMessage, pValue
- });
- this.ruleId = pRuleId;
- this.filePath = pFilePath;
- this.location = pLocation;
- this.message = pMessage;
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the location.
- *
- * @return the location
- */
- public String getLocation() {
- final String method = "getLocation";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.location);
- return this.location;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getValue()
- */
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.value);
- return this.value;
- }
-
- /**
- * Getter for file's path.
- *
- * @return the file's path
- */
- public IPath getFilePath() {
- final String method = "getFilePath";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.filePath);
- return this.filePath;
- }
-
- /**
- * Getter for the id.
- *
- * @return the id
- */
- public String getRuleId() {
- final String method = "getRuleId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.ruleId);
- return this.ruleId;
- }
-
- /**
- * Setter for the location.
- *
- * @param pLocation the location to set
- */
- public void setLocation(final String pLocation) {
- final String method = "setLocation";
- ICodeLogger.entering(CLASS, method, pLocation);
- this.location = pLocation;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the line.
- *
- * @param pValue line's violation
- */
- public void setValue(final Integer pValue) {
- final String method = "setValue";
- ICodeLogger.entering(CLASS, method, pValue);
- this.value = pValue;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the file's path.
- *
- * @param pFilePath the file's path to set
- */
- public void setFilePath(final IPath pFilePath) {
- final String method = "setFilePath";
- ICodeLogger.entering(CLASS, method, pFilePath);
- this.filePath = pFilePath;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for rule's id.
- *
- * @param pRuleId the id to set
- */
- public void setRuleId(final String pRuleId) {
- final String method = "setRuleId";
- ICodeLogger.entering(CLASS, method, pRuleId);
- this.ruleId = pRuleId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.location);
- return this.location;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getCriticity()
- */
- @Override
- public String getSeverity() {
- final String method = "getSeverity";
- ICodeLogger.entering(CLASS, method);
- final String severity = UserPreferencesService.getCheckerSeverity(this.getRuleId());
- ICodeLogger.exiting(CLASS, method, severity);
- return severity;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public FunctionRuleDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final FunctionRuleDescriptor clone = (FunctionRuleDescriptor) super.clone();
- clone.setRuleId(this.ruleId);
- clone.setFilePath(this.filePath);
- clone.setLocation(this.location);
- clone.setMessage(this.message);
- clone.setValue(this.value);
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-
- /**
- * @return function rule message
- */
- public String getMessage() {
- final String method = "getMessage";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, message);
- return message;
- }
-
- /**
- * @param message
- */
- public void setMessage(final String message) {
- final String method = "setMessage";
- ICodeLogger.entering(CLASS, method, message);
- this.message = message;
- ICodeLogger.exiting(CLASS, method);
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/IRuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/IRuleDescriptor.java
deleted file mode 100755
index 5cb138f2..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/IRuleDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor;
-
-/**
- * Interface which represents any level of a rule description. It could describe
- * the rule, a file or a violation. This interface is mainly used to display
- * results in the ViolationsView.
- */
-public interface IRuleDescriptor {
- /**
- * Returns the name of this descriptor.
- *
- * @return the name
- */
- String getName();
-
- /**
- * Returns the value of this descriptor.
- *
- * @return the value
- */
- Integer getValue();
-
- /**
- * Returns the criticity of the rule associated to this descriptor.
- *
- * @return the criticity
- */
- String getSeverity();
-}
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/RuleDescriptor.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/RuleDescriptor.java
deleted file mode 100755
index 20f53db6..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/RuleDescriptor.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.icode.logger.ICodeLogger;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Class for general description of a rule for a
- * {@link fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.RuleTreeViewer}
- * .
- */
-public class RuleDescriptor implements IRuleDescriptor, Cloneable {
-
- /**
- * Class name
- */
- private static final String CLASS = RuleDescriptor.class.getName();
- /**
- * Rule's id.
- **/
- private String ruleId;
- /**
- * Rule's name.
- **/
- private String name;
- /**
- * List of analyzed files with their violations.
- **/
- private List descriptors;
-
- /**
- * Empty constructor.
- */
- public RuleDescriptor() {
- final String method = "RuleDescriptor";
- ICodeLogger.entering(CLASS, method);
-
- this.ruleId = "";
- this.name = "";
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Constructor with the id and the name.
- *
- * @param pRuleId rule's id
- * @param pName rule's name
- */
- public RuleDescriptor(final String pRuleId, final String pName) {
- final String method = "RuleDescriptor";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pRuleId, pName
- });
- this.ruleId = pRuleId;
- this.name = pName;
- this.descriptors = new LinkedList();
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Getter for the id.
- *
- * @return rule's id
- */
- public String getRuleId() {
- final String method = "getRuleId";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.ruleId);
- return this.ruleId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getName()
- */
- @Override
- public String getName() {
- final String method = "getName";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.name);
- return this.name;
- }
-
- /**
- * Getter for the descriptors.
- *
- * @return the descriptors
- */
- public List getDescriptors() {
- final String method = "getDescriptors";
- ICodeLogger.entering(CLASS, method);
- ICodeLogger.exiting(CLASS, method, this.descriptors);
- return this.descriptors;
- }
-
- /**
- * Setter for the id.
- *
- * @param pRuleId the id to set
- */
- public void setRuleId(final String pRuleId) {
- final String method = "setRuleId";
- ICodeLogger.entering(CLASS, method, pRuleId);
- this.ruleId = pRuleId;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the name
- *
- * @param pName the name to set
- */
- public void setName(final String pName) {
- final String method = "setName";
- ICodeLogger.entering(CLASS, method, pName);
- this.name = pName;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /**
- * Setter for the descriptors
- *
- * @param pDescriptors the descriptors to set
- */
- public void setDescriptors(final List pDescriptors) {
- final String method = "setDescriptors";
- ICodeLogger.entering(CLASS, method, pDescriptors);
- this.descriptors = pDescriptors;
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getValue()
- */
- @Override
- public Integer getValue() {
- final String method = "getValue";
- ICodeLogger.entering(CLASS, method);
- Integer value = Integer.valueOf(0);
- for (final FileRuleDescriptor descriptor : this.descriptors) {
- value = Integer.valueOf(value.intValue() + descriptor.getValue().intValue());
- }
- ICodeLogger.exiting(CLASS, method, value);
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.rules.IRuleDescriptor#getCriticity()
- */
- @Override
- public String getSeverity() {
- final String method = "getSeverity";
- ICodeLogger.entering(CLASS, method);
- final String severity = UserPreferencesService.getCheckerSeverity(this.ruleId);
- ICodeLogger.exiting(CLASS, method, severity);
- return severity;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object object) {
- final String method = "equals";
- ICodeLogger.entering(CLASS, method, object);
- final boolean isEqual;
- if (object instanceof RuleDescriptor) {
- isEqual = this.name.equals(((RuleDescriptor) object).getName());
- } else {
- isEqual = false;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(isEqual));
- return isEqual;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- assert false : "hashCode not designed";
- return this.descriptors.size();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#clone()
- */
- @Override
- public RuleDescriptor clone() throws CloneNotSupportedException {
- final String method = "clone";
- ICodeLogger.entering(CLASS, method);
- final RuleDescriptor clone = (RuleDescriptor) super.clone();
- clone.setRuleId(this.ruleId);
- clone.setName(this.name);
- clone.setDescriptors(new LinkedList(this.descriptors));
- ICodeLogger.exiting(CLASS, method, clone);
- return clone;
- }
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/package-info.java
deleted file mode 100755
index 27478b45..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/descriptor/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Descriptor for the {@link RuleTreeViewer}
- */
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- * Descriptor for the {@link RuleTreeViewer}
- */
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor;
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/RuleViewerFilter.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/RuleViewerFilter.java
deleted file mode 100755
index 2d489ce4..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/RuleViewerFilter.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.filter;
-
-import fr.cnes.analysis.tools.ui.preferences.UserPreferencesService;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.IUpdatableAnalysisFilter;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FileRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.FunctionRuleDescriptor;
-import fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.descriptor.RuleDescriptor;
-import fr.cnes.icode.logger.ICodeLogger;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-/**
- * This class is a filter to apply on RuleTreeViewers.
- */
-public class RuleViewerFilter extends ViewerFilter implements IUpdatableAnalysisFilter {
-
- /**
- * Class name
- */
- private static final String CLASS = RuleViewerFilter.class.getName();
- /**
- * String filtered
- */
- private String searchString = "";
- /**
- * Is the filter focusing a file ?
- */
- private boolean filteringFile = false;
- /**
- * Is the filter focusing a Rule ?
- */
- private boolean filteringRule = false;
- /**
- * Should we show violation of Warning criticity ?
- */
- private boolean showWarning = true;
- /**
- * Should we show violation of Error criticity ?
- */
- private boolean showError = true;
- /**
- * Should we show violation of Info criticity ?
- */
- private boolean showInfo = true;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.
- * Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(final Viewer pViewer, final Object pParentElement,
- final Object pElement) {
- final String method = "select";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pViewer, pParentElement, pElement
- });
- boolean show = false;
- /*
- * Setting filtering level
- */
- if (pElement instanceof RuleDescriptor) {
- final RuleDescriptor rule = (RuleDescriptor) pElement;
- if (checkSeverity(rule)) {
-
- if (rule.getName().toUpperCase().contains(searchString.toUpperCase())) {
- show = true;
- filteringRule = true;
- } else {
- show = false;
- for (FileRuleDescriptor file : rule.getDescriptors()) {
- if (file.getFilePath().toString().toUpperCase()
- .contains(searchString.toUpperCase())) {
- show = true;
- filteringFile = true;
-
- } else {
- for (FunctionRuleDescriptor function : file.getDescriptors()) {
- if (function.getName().toUpperCase()
- .contains(searchString.toUpperCase())) {
- show = true;
- }
- }
- }
- }
- }
- }
- } else if (pElement instanceof FileRuleDescriptor) {
- final FileRuleDescriptor file = (FileRuleDescriptor) pElement;
- if (file.getFilePath().toString().toUpperCase().contains(searchString.toUpperCase())
- || filteringRule) {
- show = true;
- } else {
- for (FunctionRuleDescriptor function : file.getDescriptors()) {
- if (function.getName().toUpperCase().contains(searchString.toUpperCase())) {
- show = true;
- }
- }
- }
- } else if (pElement instanceof FunctionRuleDescriptor) {
- final FunctionRuleDescriptor function = (FunctionRuleDescriptor) pElement;
- show = function.getName().toUpperCase().contains(searchString.toUpperCase())
- || filteringFile || filteringRule;
- }
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(show));
- return show;
-
- }
-
- /**
- * @param rule to verify severity compliance
- * @return severity compliance of the rule.
- */
- private boolean checkSeverity(RuleDescriptor rule) {
- final String method = "checkSeverity";
- ICodeLogger.entering(CLASS, method, rule);
- final boolean checked = (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_WARNING_VALUE) && showWarning)
- || (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_ERROR_VALUE)
- && showError)
- || (rule.getSeverity()
- .equals(UserPreferencesService.PREF_SEVERITY_INFO_VALUE)
- && showInfo);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(checked));
- return checked;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see fr.cnes.analysis.tools.ui.view.violation.treeviewer.
- * IUpdatableAnalysisFilter#update(java.lang.String, boolean, boolean,
- * boolean)
- */
- @Override
- public void update(final String pSearchString, final boolean pShowInfo,
- final boolean pShowWarning, final boolean pShowError) {
- final String method = "update";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pSearchString, Boolean.valueOf(pShowInfo), Boolean.valueOf(pShowWarning),
- Boolean.valueOf(pShowError)
- });
- this.searchString = pSearchString;
- this.showError = pShowError;
- this.showWarning = pShowWarning;
- this.showInfo = pShowInfo;
- filteringRule = false;
- filteringFile = false;
- ICodeLogger.exiting(CLASS, method);
-
- }
-
-}
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/package-info.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/package-info.java
deleted file mode 100755
index eba3146e..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/view/violation/treeviewer/rule/filter/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-/**
- *
- */
-package fr.cnes.analysis.tools.ui.view.violation.treeviewer.rule.filter;
\ No newline at end of file
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizard.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizard.java
deleted file mode 100755
index 9a56d5be..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizard.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.wizard.export;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import fr.cnes.icode.services.export.ExportService;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * This Wizard contains and handle the different Wizard Page to export analysis
- * data of the Violations view. When {@link #performFinish()} is called, the
- * {@link CheckerFileCreationExportWizardPage} export the result in the format
- * chosen by the user.
- *
- *
- * Available formats are defined by the
- * {@link fr.cnes.analysis.tools.export.ExportService} service using
- * {@link ExportService#getAvailableFormats()}.
- *
- *
- *
- * To add a new format to export, it's necessary to contribute to the
- * {@link ExportService} service.
- *
- *
- * @version 3.0
- * @since 2.0
- */
-public class CheckerExportWizard extends Wizard implements IExportWizard, INewWizard {
-
- /**
- * Class name
- */
- private static final String CLASS = CheckerExportWizard.class.getName();
- /**
- * The main page containing the radio to choose the export's format.
- */
- private CheckerExportWizardPage mainPage;
- /**
- * The class that will be used to export the file
- **/
- private CheckerFileCreationExportWizardPage fileCreationPage;
- /**
- * The selection of elements to build the NewFileWizardPage classes
- */
- private IStructuredSelection selection;
- /**
- * Exporter service
- */
- private ExportService exporter;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
- * org.eclipse.jface.viewers.IStructuredSelection)
- */
- @Override
- public void init(IWorkbench pWorkbench, IStructuredSelection pSelection) {
- final String method = "init";
- ICodeLogger.entering(CLASS, method, new Object[]{
- pWorkbench, pSelection
- });
- this.selection = pSelection;
- this.exporter = new ExportService();
- /*
- * We force previous and next buttons as we don't use the default order
- * of page selection that is the one in which each page were added and
- * also because we willn't use all pages that we've added to the Wizard.
- */
- this.setForcePreviousAndNextButtons(true);
-
- ICodeLogger.exiting(CLASS, method);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- final String method = "performFinish";
- ICodeLogger.entering(CLASS, method);
- final IFile file = ((WizardNewFileCreationPage) this.getContainer().getCurrentPage())
- .createNewFile();
- final boolean performFinish = (file != null);
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(performFinish));
- return performFinish;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- @Override
- public void addPages() {
- final String method = "addPages";
- ICodeLogger.entering(CLASS, method);
- mainPage = new CheckerExportWizardPage(selection, exporter);
- if (exporter.getAvailableFormats().size() > 0) {
- fileCreationPage = new CheckerFileCreationExportWizardPage(selection, "unknown");
- }
- this.addPage(mainPage);
- this.addPage(fileCreationPage);
- ICodeLogger.exiting(CLASS, method);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- @Override
- public boolean canFinish() {
- final String method = "canFinish";
- ICodeLogger.entering(CLASS, method);
- final boolean canFinish = this.getContainer().getCurrentPage().isPageComplete();
- ICodeLogger.exiting(CLASS, method, Boolean.valueOf(canFinish));
- return canFinish;
- }
-
-}
diff --git a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizardPage.java b/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizardPage.java
deleted file mode 100755
index 3eab183e..00000000
--- a/icode-ide/fr.cnes.analysis.tools.ui/src/fr/cnes/analysis/tools/ui/wizard/export/CheckerExportWizardPage.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/************************************************************************************************/
-/* i-Code CNES is a static code analyzer. */
-/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
-/* http://www.eclipse.org/legal/epl-v10.html */
-/************************************************************************************************/
-package fr.cnes.analysis.tools.ui.wizard.export;
-
-import fr.cnes.icode.logger.ICodeLogger;
-import fr.cnes.icode.services.export.ExportService;
-import fr.cnes.icode.services.export.exception.NoContributorMatchingException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-import java.util.*;
-import java.util.Map.Entry;
-
-/**
- * This class is the main page of the {@link CheckerExportWizard}. It's
- * responsible of suggesting available formats for export to the user using
- * {@link ExportService#getAvailableFormats()} and indicating the chosen format to the
- * next page {@link CheckerFileCreationExportWizardPage}.
- *
- * @version 3.0
- * @since 2.0
- */
-public class CheckerExportWizardPage extends WizardPage {
-
- /**
- * Class name
- */
- private static final String CLASS = CheckerExportWizard.class.getName();
-
- /**
- * Exporter service in charge of the analysis
- */
- private ExportService exporter;
-
- /**
- * Buttons list of all buttons offering available format for exportation.
- */
- private List