Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
c9a8d301
Commit
c9a8d301
authored
Jul 17, 2012
by
Christoph Döbber
Browse files
YELLOW - further ui polishing
refs 916
parent
6cf39ada
Changes
3
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.expression.ui/trunk/src/org/fortiss/af3/expression/ui/editor/DataDictionaryEvaluator.java
→
org.fortiss.af3.expression.ui/trunk/src/org/fortiss/af3/expression/ui/editor/DataDictionaryEvaluator
Backend
.java
View file @
c9a8d301
...
...
@@ -21,13 +21,18 @@ import static org.eclipse.swt.SWT.ARROW_DOWN;
import
static
org
.
eclipse
.
swt
.
SWT
.
ARROW_UP
;
import
static
org
.
eclipse
.
swt
.
SWT
.
CR
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.custom.StyledText
;
import
org.eclipse.swt.events.KeyAdapter
;
import
org.eclipse.swt.events.KeyEvent
;
import
org.eclipse.swt.graphics.Font
;
import
org.eclipse.swt.graphics.FontData
;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Display
;
import
org.eclipse.swt.widgets.Label
;
import
org.eclipse.swt.widgets.Text
;
import
org.fortiss.af3.expression.language.ParseException
;
...
...
@@ -40,6 +45,7 @@ import org.fortiss.af3.expression.model.types.impl.TBoolStaticImpl;
import
org.fortiss.af3.expression.model.types.impl.TDoubleStaticImpl
;
import
org.fortiss.af3.expression.model.types.impl.TIntStaticImpl
;
import
org.fortiss.af3.expression.ui.AF3ExpressionUIActivator
;
import
org.fortiss.af3.expression.ui.utils.ExpressionFieldAssistUtils
;
import
org.fortiss.af3.project.model.typesystem.ITerm
;
import
org.fortiss.af3.project.model.typesystem.IType
;
import
org.fortiss.af3.project.services.ITypeSystemService
;
...
...
@@ -47,6 +53,8 @@ import org.fortiss.af3.project.typesystem.IEvaluationContext;
import
org.fortiss.af3.project.typesystem.ITermEvaluator
;
import
org.fortiss.af3.project.typesystem.ITypeSystemCompiler
;
import
org.fortiss.af3.project.typesystem.evaluation.Term
;
import
org.fortiss.tooling.base.ui.fieldassist.FieldAssist
;
import
org.fortiss.tooling.base.ui.fieldassist.ProposalProviderBase
;
import
org.fortiss.tooling.kernel.ui.extension.base.EditorBase
;
/**
...
...
@@ -56,12 +64,12 @@ import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
* @author eder
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
A0A2AC6CE7B4A8406DA40E00BB01C8DA
* @ConQAT.Rating YELLOW Hash:
81E7EE25091AEB6B95875DC2E12C44EC
*/
public
final
class
DataDictionaryEvaluator
extends
EditorBase
<
DataDictionary
>
{
public
final
class
DataDictionaryEvaluator
Backend
extends
EditorBase
<
DataDictionary
>
{
/** Stores the evaluator output text area. */
private
Text
evaluatorOutput
;
private
Styled
Text
evaluatorOutput
;
/** Stores the evaluator help output label. */
private
Label
evaluatorHelp
;
...
...
@@ -76,7 +84,7 @@ public final class DataDictionaryEvaluator extends EditorBase<DataDictionary> {
private
int
stackPointer
;
/** Constructor. */
public
DataDictionaryEvaluator
()
{
public
DataDictionaryEvaluator
Backend
()
{
evaluatorStack
=
new
LinkedList
<
String
>();
stackPointer
=
0
;
}
...
...
@@ -107,12 +115,26 @@ public final class DataDictionaryEvaluator extends EditorBase<DataDictionary> {
gui
=
new
DataDictionaryEvaluatorGUI
(
parent
,
SWT
.
NONE
);
evaluatorOutput
=
gui
.
getEvalOutputText
();
evaluatorOutput
.
setFont
(
new
Font
(
Display
.
getCurrent
(),
getOSSpecificCodeFont
()));
evaluatorHelp
=
gui
.
getEvalInfoText
();
evaluatorInput
=
gui
.
getEvalInputText
();
evaluatorHelpIcon
=
gui
.
getEvalInfoIcon
();
evaluatorHelpIcon
.
setImage
(
INFO
);
new
FieldAssist
(
evaluatorInput
,
new
ProposalProviderBase
()
{
@Override
public
String
[]
getProposals
(
String
currentWord
)
{
ArrayList
<
String
>
proposals
=
new
ArrayList
<
String
>();
proposals
.
addAll
(
ExpressionFieldAssistUtils
.
getAllConstructors
(
editedObject
,
true
));
proposals
.
addAll
(
ExpressionFieldAssistUtils
.
getFunctions
(
editedObject
));
proposals
.
addAll
(
ExpressionFieldAssistUtils
.
getPrimitiveValues
());
return
proposals
.
toArray
(
new
String
[
0
]);
}
});
evaluatorInput
.
addKeyListener
(
new
KeyAdapter
()
{
@Override
public
void
keyReleased
(
KeyEvent
e
)
{
...
...
@@ -231,4 +253,19 @@ public final class DataDictionaryEvaluator extends EditorBase<DataDictionary> {
public
boolean
enableLibraryView
()
{
return
false
;
}
/** Returns the font specific for the used operation system. */
private
FontData
getOSSpecificCodeFont
()
{
String
os
=
System
.
getProperty
(
"os.name"
);
String
font
=
"Courier"
;
if
(
os
.
toLowerCase
().
contains
(
"mac"
))
{
font
=
"Monaco"
;
}
else
if
(
os
.
toLowerCase
().
contains
(
"windows"
))
{
font
=
"Consolas"
;
}
else
if
(
os
.
toLowerCase
().
contains
(
"linux"
))
{
font
=
"Monospace"
;
}
return
new
FontData
(
font
,
11
,
SWT
.
NORMAL
);
}
}
org.fortiss.af3.expression.ui/trunk/src/org/fortiss/af3/expression/ui/editor/DataDictionaryEvaluatorBinding.java
View file @
c9a8d301
...
...
@@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.ui.extension.IModelEditorBinding;
* @author eder
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash:
04FAA43F01E970769E1C1AC2233B8B7E
* @ConQAT.Rating GREEN Hash:
388BFC03481871C76144C8568DB1B2B4
*/
public
final
class
DataDictionaryEvaluatorBinding
implements
IModelEditorBinding
<
DataDictionary
>
{
...
...
@@ -35,7 +35,7 @@ public final class DataDictionaryEvaluatorBinding implements
/** {@inheritDoc} */
@Override
public
Class
<?
extends
IEditorPart
>
getEditorClass
()
{
return
DataDictionaryEvaluator
.
class
;
return
DataDictionaryEvaluator
Backend
.
class
;
}
/** {@inheritDoc} */
...
...
org.fortiss.af3.expression.ui/trunk/src/org/fortiss/af3/expression/ui/editor/DataDictionaryEvaluatorGUI.java
View file @
c9a8d301
...
...
@@ -18,6 +18,7 @@ $Id$
package
org.fortiss.af3.expression.ui.editor
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.custom.StyledText
;
import
org.eclipse.swt.layout.FillLayout
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
...
...
@@ -33,11 +34,11 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* @author doebber
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 9
030CD726C1420BA07951EF845FCCBF1
* @ConQAT.Rating GREEN Hash: 9
5D5CF60BDF32A4FDE1F569186465C87
*/
public
class
DataDictionaryEvaluatorGUI
extends
Composite
{
private
final
FormToolkit
formToolkit
=
new
FormToolkit
(
Display
.
getDefault
());
private
Text
text
;
private
Styled
Text
text
;
private
Text
text_1
;
private
Composite
composite
;
private
Label
lblIcon
;
...
...
@@ -60,9 +61,9 @@ public class DataDictionaryEvaluatorGUI extends Composite {
frmEvaluator
.
getBody
().
setLayout
(
new
GridLayout
(
1
,
false
));
text
=
new
Text
(
frmEvaluator
.
getBody
(),
SWT
.
BORDER
|
SWT
.
READ_ONLY
|
SWT
.
H_SCROLL
|
new
Styled
Text
(
frmEvaluator
.
getBody
(),
SWT
.
BORDER
|
SWT
.
READ_ONLY
|
SWT
.
H_SCROLL
|
SWT
.
V_SCROLL
|
SWT
.
CANCEL
|
SWT
.
MULTI
);
text
.
setText
(
"
>
"
);
text
.
setText
(
""
);
text
.
setLayoutData
(
new
GridData
(
SWT
.
FILL
,
SWT
.
FILL
,
true
,
true
,
1
,
1
));
formToolkit
.
adapt
(
text
,
true
,
true
);
...
...
@@ -73,16 +74,18 @@ public class DataDictionaryEvaluatorGUI extends Composite {
formToolkit
.
paintBordersFor
(
composite
);
lblIcon
=
new
Label
(
composite
,
SWT
.
NONE
);
lblIcon
.
setLayoutData
(
new
GridData
(
SWT
.
LEFT
,
SWT
.
TOP
,
false
,
false
,
1
,
1
));
formToolkit
.
adapt
(
lblIcon
,
true
,
true
);
lblIcon
.
setText
(
"ICON"
);
lblErrors
=
new
Label
(
composite
,
SWT
.
NONE
);
lblErrors
.
setLayoutData
(
new
GridData
(
SWT
.
FILL
,
SWT
.
FILL
,
true
,
false
,
1
,
1
));
formToolkit
.
adapt
(
lblErrors
,
true
,
true
);
lblErrors
.
setText
(
"Enter expression below and hit return ..."
);
lblErrors
.
setText
(
"Enter expression below and hit return. \nUse up and down arrow keys to cycle through previous inputs."
);
text_1
=
new
Text
(
frmEvaluator
.
getBody
(),
SWT
.
BORDER
);
text_1
.
setLayoutData
(
new
GridData
(
SWT
.
FILL
,
SWT
.
FILL
,
true
,
tru
e
,
1
,
1
));
text_1
.
setLayoutData
(
new
GridData
(
SWT
.
FILL
,
SWT
.
FILL
,
true
,
fals
e
,
1
,
1
));
formToolkit
.
adapt
(
text_1
,
true
,
true
);
}
...
...
@@ -92,7 +95,7 @@ public class DataDictionaryEvaluatorGUI extends Composite {
// Disable the check that prevents subclassing of SWT components
}
public
Text
getEvalOutputText
()
{
public
Styled
Text
getEvalOutputText
()
{
return
text
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment