X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fcolor%2FColorGradientCellEditor.java;fp=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fcolor%2FColorGradientCellEditor.java;h=00a1c92da8dab1070c0d05dc92cc733e1ccb197a;hp=08ff08cfd4643d68f8a16a43d7b0013e2a37932e;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorGradientCellEditor.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorGradientCellEditor.java index 08ff08cfd..00a1c92da 100644 --- a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorGradientCellEditor.java +++ b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/color/ColorGradientCellEditor.java @@ -1,65 +1,65 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -/* - * - * @author Toni Kalajainen - */ -package org.simantics.utils.ui.color; - -import org.eclipse.jface.viewers.DialogCellEditor; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class ColorGradientCellEditor extends DialogCellEditor { - - public ColorGradientCellEditor(Composite parent) { - super(parent); - } - - /** - * The composite showing the gradient - */ - private ColorGradientCanvas canvas; - - /* (non-Javadoc) - * Method declared on DialogCellEditor. - */ - protected Control createContents(Composite cell) { - Color bg = cell.getBackground(); - canvas = new ColorGradientCanvas(cell, getStyle()); - canvas.setBackground(bg); - return canvas; - } - - /* (non-Javadoc) - * Method declared on DialogCellEditor. - */ - protected Object openDialogBox(Control cellEditorWindow) { - ColorGradient value = (ColorGradient)getValue(); - ColorGradientDialog dialog = new ColorGradientDialog(cellEditorWindow.getShell(), value); - if (dialog.open() == Window.OK) - return dialog.getGradient(); - return value; - } - - /* (non-Javadoc) - * Method declared on DialogCellEditor. - */ - protected void updateContents(Object value) { - ColorGradient cg = (ColorGradient) value; - canvas.setGradient(cg); - } - - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +/* + * + * @author Toni Kalajainen + */ +package org.simantics.utils.ui.color; + +import org.eclipse.jface.viewers.DialogCellEditor; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class ColorGradientCellEditor extends DialogCellEditor { + + public ColorGradientCellEditor(Composite parent) { + super(parent); + } + + /** + * The composite showing the gradient + */ + private ColorGradientCanvas canvas; + + /* (non-Javadoc) + * Method declared on DialogCellEditor. + */ + protected Control createContents(Composite cell) { + Color bg = cell.getBackground(); + canvas = new ColorGradientCanvas(cell, getStyle()); + canvas.setBackground(bg); + return canvas; + } + + /* (non-Javadoc) + * Method declared on DialogCellEditor. + */ + protected Object openDialogBox(Control cellEditorWindow) { + ColorGradient value = (ColorGradient)getValue(); + ColorGradientDialog dialog = new ColorGradientDialog(cellEditorWindow.getShell(), value); + if (dialog.open() == Window.OK) + return dialog.getGradient(); + return value; + } + + /* (non-Javadoc) + * Method declared on DialogCellEditor. + */ + protected void updateContents(Object value) { + ColorGradient cg = (ColorGradient) value; + canvas.setGradient(cg); + } + + +}