Skip to content
Snippets Groups Projects
Commit a7ba29d8 authored by Levi Lucio's avatar Levi Lucio
Browse files

YELLOW

parent e0ea05c5
No related branches found
No related tags found
No related merge requests found
AdvancedTreeViewerEditorBase.java 3bb67c52886069379765289885df3b23790b88c9 GREEN AdvancedTreeViewerEditorBase.java 3bb67c52886069379765289885df3b23790b88c9 GREEN
AllocationDiagramEditorBase.java 3c03b9220f1c342ded673d6d1b2fd2c01b57fba6 GREEN AllocationDiagramEditorBase.java 3c03b9220f1c342ded673d6d1b2fd2c01b57fba6 GREEN
CommonDiagramEditorBase.java 438babd95dd7a185bd32246cb8180b00bb53f18a GREEN CommonDiagramEditorBase.java 438babd95dd7a185bd32246cb8180b00bb53f18a GREEN
ConstraintBasedProcessEditor.java ff7253ad26f25f681e09a36d0527b0214df08d30 RED ConstraintBasedProcessEditor.java 5d29c95bb69762814e1e0f3065a15f76155fac40 YELLOW
DiagramEditorBase.java 3d2bb40e18548ebca0dfdd78f094598e5ee298d1 GREEN DiagramEditorBase.java 3d2bb40e18548ebca0dfdd78f094598e5ee298d1 GREEN
DiagramKeyHandler.java 8b64048b966e6e8cacfa7fb78edebef2a4981fc4 GREEN DiagramKeyHandler.java 8b64048b966e6e8cacfa7fb78edebef2a4981fc4 GREEN
FormsEditorBase.java 50934d36124dea9b16ac45fe3621d878afb48bc7 GREEN FormsEditorBase.java 50934d36124dea9b16ac45fe3621d878afb48bc7 GREEN
......
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.editor;
import org.eclipse.jface.resource.FontDescriptor;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.widgets.Display;
import org.fortiss.tooling.base.model.element.ConstraintConfiguration;
import org.fortiss.tooling.kernel.extension.IConstraint;
/**
*
* @author ss
*/
public class ConstraintBasedProcessEditorHelper {
/** Color Array for at least seven groups. */
static int[] colorArray = {SWT.COLOR_DARK_GREEN, SWT.COLOR_DARK_BLUE, SWT.COLOR_DARK_YELLOW,
SWT.COLOR_BLACK, SWT.COLOR_DARK_RED, SWT.COLOR_GREEN, SWT.COLOR_CYAN};
/** Counter for the colorArray */
public static int colorCtr = 0;
/** Reference to a constraint configuration. */
public static class WithContextualConfiguration {
/** Contextual constraint configuration. */
ConstraintConfiguration config;
/** Constructor. */
public WithContextualConfiguration(ConstraintConfiguration config) {
this.config = config;
}
}
/** Constraint accompanied with a configuration providing the context. */
public static class ConstraintWithContextualConfiguration extends WithContextualConfiguration {
/** Constraint. */
Class<? extends IConstraint> cstr;
/** Constructor. */
public ConstraintWithContextualConfiguration(Class<? extends IConstraint> cstr,
ConstraintConfiguration config) {
super(config);
this.cstr = cstr;
}
}
/**
* Configuration accompanied with another configuration providing the context.
* Intent is that the contained configuration is a dependency of the context one.
*/
public static class ConfigurationRefWithContextualConfiguration extends
WithContextualConfiguration {
/** Constraint. */
ConstraintConfiguration target;
/** Constructor. */
public ConfigurationRefWithContextualConfiguration(ConstraintConfiguration configRef,
ConstraintConfiguration config) {
super(config);
this.target = configRef;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
if(obj instanceof ConfigurationRefWithContextualConfiguration) {
return this.target.getName().equalsIgnoreCase(
((ConfigurationRefWithContextualConfiguration)obj).target.getName()) &&
this.config.getName()
.equalsIgnoreCase(
((ConfigurationRefWithContextualConfiguration)obj).config
.getName());
}
return false;
}
/** {@inheritDoc} */
@Override
public int hashCode() {
return target.hashCode();
}
}
/**
* the class to manipulate and store parent of elements
*
* @author salman
*/
public static class TreeStructureNode {
/** parent object variable */
Object parent;
/** data object variable */
Object data;
/**
* @param parent
* the parent element
* @param children
*/
public TreeStructureNode(Object parent, Object children) {
this.parent = parent;
this.data = children;
}
/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
if(obj instanceof TreeStructureNode) {
return this.data.toString().equalsIgnoreCase(
((TreeStructureNode)obj).data.toString()) &&
this.parent.toString().equalsIgnoreCase(
((TreeStructureNode)obj).parent.toString());
}
return false;
}
/** {@inheritDoc} */
@Override
public int hashCode() {
return parent.hashCode();
}
}
/**
* styler class to create colored bold labels for constraint group name
*
* @author ss
*/
public static class NormalFontStyler extends Styler {
/** counter to keep track of currently used color in color array */
int colorIndex = 0;
/**
* constructor
* index the index for color ickup in color array
*/
public NormalFontStyler() {
this.colorIndex = colorCtr;
}
/** {@inheritDoc} */
@Override
public void applyStyles(final TextStyle textStyle) {
FontDescriptor boldDescriptor =
FontDescriptor.createFrom(new FontData()).setStyle(SWT.BOLD);
Font boldFont = boldDescriptor.createFont(Display.getCurrent());
textStyle.font = boldFont;
textStyle.foreground = Display.getCurrent().getSystemColor(colorArray[colorIndex]);
}
}
/**
*
* @author ss
*/
public static class RedFontStyler extends Styler {
/** {@inheritDoc} */
@Override
public void applyStyles(final TextStyle textStyle) {
FontDescriptor boldDescriptor =
FontDescriptor.createFrom(new FontData()).setStyle(SWT.BOLD);
Font boldFont = boldDescriptor.createFont(Display.getCurrent());
textStyle.font = boldFont;
textStyle.foreground = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
}
}
/**
* styler class to create green color labels
*
* @author ss
*/
public static class GreenFontStyler extends Styler {
/** {@inheritDoc} */
@Override
public void applyStyles(final TextStyle textStyle) {
FontDescriptor boldDescriptor =
FontDescriptor.createFrom(new FontData()).setStyle(SWT.BOLD);
Font boldFont = boldDescriptor.createFont(Display.getCurrent());
textStyle.font = boldFont;
textStyle.foreground = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
}
}
/**
* @param groupSize
* the size of the groups present
*/
public static void adjustColorIndex(int groupSize) {
if(ConstraintBasedProcessEditorHelper.colorCtr != ConstraintBasedProcessEditorHelper.colorCtr - 1) {
if(groupSize == ConstraintBasedProcessEditorHelper.colorCtr + 1) {
ConstraintBasedProcessEditorHelper.colorCtr = 0;
} else {
ConstraintBasedProcessEditorHelper.colorCtr++;
}
}
}
}
...@@ -8,7 +8,7 @@ LayoutDataUIUtils.java 0b2d3d1f47eef070c11b56fb7b332e0e49fa5a52 GREEN ...@@ -8,7 +8,7 @@ LayoutDataUIUtils.java 0b2d3d1f47eef070c11b56fb7b332e0e49fa5a52 GREEN
PropertiesViewUtils.java 009d390b8aa41bb79b45b1e09a3375d0374fa139 GREEN PropertiesViewUtils.java 009d390b8aa41bb79b45b1e09a3375d0374fa139 GREEN
RectangleLayoutUIUtils.java b64f2f86b8254363689bf0809f681fc59a87a04a GREEN RectangleLayoutUIUtils.java b64f2f86b8254363689bf0809f681fc59a87a04a GREEN
SnapToGridUtils.java 0ee536d1c1028aec313c59d533d6717b68febc85 GREEN SnapToGridUtils.java 0ee536d1c1028aec313c59d533d6717b68febc85 GREEN
StatusUtils.java a5bf0a9d6a9e35b191ec23b753ed71fafae46c96 RED StatusUtils.java f81d4c9a2ac359712844753f4dc4b9a896776673 YELLOW
TableViewerUtils.java 7b72baa029b4a8a5371464f78fe6f2829e2e87eb GREEN TableViewerUtils.java 7b72baa029b4a8a5371464f78fe6f2829e2e87eb GREEN
TreeViewerUtils.java 296ae7efad3a472c00522be723d7853710069177 GREEN TreeViewerUtils.java 296ae7efad3a472c00522be723d7853710069177 GREEN
ZoomUIUtils.java 0e04976d43076e7e4b3f2d244a303463c71390f5 GREEN ZoomUIUtils.java 0e04976d43076e7e4b3f2d244a303463c71390f5 GREEN
...@@ -43,8 +43,7 @@ public class StatusUtils { ...@@ -43,8 +43,7 @@ public class StatusUtils {
IConstraintInstanceContainer instanceContainer, EList<String> currentActiveConstraints) { IConstraintInstanceContainer instanceContainer, EList<String> currentActiveConstraints) {
for(ConstraintInstance ci : instanceContainer.getConstraintInstances()) { for(ConstraintInstance ci : instanceContainer.getConstraintInstances()) {
// TODO(HP) why using toString()? constraintToFind is already a string. if(constraintToFind.equalsIgnoreCase(ci.getConstraintName())) {
if(constraintToFind.toString().equalsIgnoreCase(ci.getConstraintName())) {
if(currentActiveConstraints.contains(constraintToFind.toString())) { if(currentActiveConstraints.contains(constraintToFind.toString())) {
if(ci.getConstraintName().equalsIgnoreCase(constraintToFind.toString())) { if(ci.getConstraintName().equalsIgnoreCase(constraintToFind.toString())) {
// If the constraint instance has a "failed status" // If the constraint instance has a "failed status"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment