Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
59cf6ce4
Commit
59cf6ce4
authored
13 years ago
by
Daniel Ratiu
Browse files
Options
Downloads
Patches
Plain Diff
small improvements
parent
d4b5b035
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
+44
-1
44 additions, 1 deletion
...c/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
with
44 additions
and
1 deletion
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
+
44
−
1
View file @
59cf6ce4
...
...
@@ -17,11 +17,16 @@ $Id$
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.base.ui.utils
;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ColumnLabelProvider
;
import
org.eclipse.jface.viewers.ColumnViewer
;
import
org.eclipse.jface.viewers.EditingSupport
;
import
org.eclipse.jface.viewers.ICellEditorValidator
;
import
org.eclipse.jface.viewers.TableViewer
;
import
org.eclipse.jface.viewers.TableViewerColumn
;
import
org.eclipse.jface.viewers.TextCellEditor
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Composite
;
/**
* Utility methods for JFace {@link TableViewer}s.
...
...
@@ -29,7 +34,7 @@ import org.eclipse.swt.SWT;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
0F5344CC790350F28E412502C6A79557
* @ConQAT.Rating YELLOW Hash:
D72A875CBFB2BC8DFAB51FCCEE910F0A
*/
public
class
TableViewerUtils
{
...
...
@@ -84,4 +89,42 @@ public class TableViewerUtils {
column
.
setEditingSupport
(
editingSupport
);
return
column
;
}
/** Editing support for integers. */
public
static
abstract
class
IntegerEditingSupport
extends
EditingSupport
{
/** The parent where the editing support is needed. */
private
Composite
parent
;
/** Constructor. */
public
IntegerEditingSupport
(
ColumnViewer
viewer
,
Composite
parent
)
{
super
(
viewer
);
this
.
parent
=
parent
;
}
/** {@inheritDoc} */
@Override
protected
CellEditor
getCellEditor
(
Object
element
)
{
CellEditor
ce
=
new
TextCellEditor
(
parent
);
ce
.
setValidator
(
new
ICellEditorValidator
()
{
@Override
public
String
isValid
(
Object
value
)
{
try
{
Integer
.
parseInt
(
value
.
toString
());
}
catch
(
NumberFormatException
nfe
)
{
return
"Not a valid integer"
;
}
return
null
;
}
});
return
ce
;
}
/** {@inheritDoc} */
@Override
protected
boolean
canEdit
(
Object
element
)
{
return
true
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment