Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
611693c3
Commit
611693c3
authored
Jan 13, 2016
by
Romain Bioteau
Browse files
Minor fixes
* Templating connector ui & wording * Improve code completion in REST API extension editor
parent
28d451d4
Changes
10
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.connectors.model.edit/src/org/bonitasoft/studio/connector/model/definition/wizard/PageComponentSwitchBuilder.java
View file @
611693c3
...
...
@@ -425,9 +425,7 @@ public class PageComponentSwitchBuilder {
}
else
{
viewer
.
setLayoutData
(
GridDataFactory
.
fillDefaults
().
grab
(
true
,
true
).
create
());
}
for
(
int
i
=
0
;
i
<
array
.
getCols
().
intValue
();
i
++)
{
viewer
.
addFilter
(
connectorExpressionContentTypeFilter
);
}
configureArrayColumnFilters
(
array
,
viewer
);
if
(
input
.
isMandatory
())
{
viewer
.
setMandatoryField
(
getLabel
(
array
.
getId
()),
context
);
}
...
...
@@ -465,6 +463,12 @@ public class PageComponentSwitchBuilder {
return
null
;
}
protected
void
configureArrayColumnFilters
(
final
Array
array
,
final
ExpressionCollectionViewer
viewer
)
{
for
(
int
i
=
0
;
i
<
array
.
getCols
().
intValue
();
i
++)
{
viewer
.
addFilter
(
connectorExpressionContentTypeFilter
);
}
}
public
Section
createGroupControl
(
final
Composite
composite
,
final
Group
object
)
{
final
String
desc
=
getDescription
(
object
.
getId
());
int
style
=
Section
.
NO_TITLE_FOCUS_BOX
|
Section
.
TWISTIE
|
Section
.
CLIENT_INDENT
;
...
...
bundles/plugins/org.bonitasoft.studio.data/src/org/bonitasoft/studio/data/provider/JavaExpressionEditor.java
View file @
611693c3
...
...
@@ -21,6 +21,7 @@ import java.util.List;
import
java.util.Set
;
import
org.bonitasoft.studio.common.ExpressionConstants
;
import
org.bonitasoft.studio.common.NamingUtils
;
import
org.bonitasoft.studio.common.jface.DataStyledTreeLabelProvider
;
import
org.bonitasoft.studio.common.jface.TableColumnSorter
;
import
org.bonitasoft.studio.common.log.BonitaStudioLog
;
...
...
@@ -96,6 +97,10 @@ public class JavaExpressionEditor extends SelectionAwareExpressionEditor impleme
private
boolean
isPageFlowContext
=
false
;
private
MultiValidator
validationStatusProvider
;
private
EMFDataBindingContext
dataBindingContext
;
@Override
public
Control
createExpressionEditor
(
final
Composite
parent
,
final
EMFDataBindingContext
ctx
)
{
mainComposite
=
new
Composite
(
parent
,
SWT
.
NONE
);
...
...
@@ -245,7 +250,7 @@ public class JavaExpressionEditor extends SelectionAwareExpressionEditor impleme
public
void
bindExpression
(
final
EMFDataBindingContext
dataBindingContext
,
final
EObject
context
,
final
Expression
inputExpression
,
final
ViewerFilter
[]
filters
,
final
ExpressionViewer
expressionViewer
)
{
this
.
dataBindingContext
=
dataBindingContext
;
editorInputExpression
=
inputExpression
;
setContentProvider
(
new
PojoBrowserContentProvider
());
javaTreeviewer
.
setContentProvider
(
getContentProvider
());
...
...
@@ -273,10 +278,11 @@ public class JavaExpressionEditor extends SelectionAwareExpressionEditor impleme
@Override
public
Object
convert
(
final
Object
data
)
{
if
(
data
instanceof
Data
)
{
return
((
Data
)
data
).
getName
()
+
" - "
+
((
JavaObjectData
)
data
).
getClassName
()
+
"#"
+
editorInputExpression
.
getContent
();
return
((
Data
)
data
).
getName
()
+
" - "
+
NamingUtils
.
getSimpleName
(((
JavaObjectData
)
data
).
getClassName
())
+
"#"
+
editorInputExpression
.
getContent
();
}
else
if
(
data
instanceof
IMethod
)
{
final
JavaObjectData
data2
=
(
JavaObjectData
)
editorInputExpression
.
getReferencedElements
().
get
(
0
);
return
data2
.
getName
()
+
" - "
+
data2
.
getClassName
()
+
"#"
+
((
IMethod
)
data
).
getElementName
();
return
data2
.
getName
()
+
" - "
+
NamingUtils
.
getSimpleName
(
data2
.
getClassName
()
)
+
"#"
+
((
IMethod
)
data
).
getElementName
();
}
return
null
;
}
...
...
@@ -396,13 +402,27 @@ public class JavaExpressionEditor extends SelectionAwareExpressionEditor impleme
dataBindingContext
.
bindValue
(
javaViewerSingleSelection
,
returnTypeObservable
,
selectionToReturnType
,
new
UpdateValueStrategy
(
UpdateValueStrategy
.
POLICY_NEVER
));
dataBindingContext
.
bindValue
(
SWTObservables
.
observeText
(
typeText
,
SWT
.
Modify
),
returnTypeObservable
);
dataBindingContext
.
addV
alidationStatusProvider
(
new
MultiValidator
()
{
v
alidationStatusProvider
=
new
MultiValidator
()
{
@Override
protected
IStatus
validate
()
{
return
javaViewerSingleSelection
.
getValue
()
instanceof
IMethod
?
ValidationStatus
.
ok
()
:
ValidationStatus
.
error
(
""
);
}
});
};
dataBindingContext
.
addValidationStatusProvider
(
validationStatusProvider
);
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.expression.editor.provider.SelectionAwareExpressionEditor#dispose()
*/
@Override
public
void
dispose
()
{
if
(
validationStatusProvider
!=
null
)
{
dataBindingContext
.
removeValidationStatusProvider
(
validationStatusProvider
);
validationStatusProvider
.
dispose
();
}
super
.
dispose
();
}
private
boolean
acceptExpression
(
final
ExpressionViewer
viewer
,
final
Expression
e
,
final
EObject
context
,
final
ViewerFilter
[]
filters
)
{
...
...
bundles/plugins/org.bonitasoft.studio.expression.editor/src/org/bonitasoft/studio/expression/editor/viewer/CellExpressionViewer.java
View file @
611693c3
...
...
@@ -28,6 +28,7 @@ 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.Display
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.ToolBar
;
import
org.eclipse.swt.widgets.ToolItem
;
...
...
@@ -53,6 +54,7 @@ public class CellExpressionViewer extends ExpressionViewer {
protected
void
createToolbar
(
final
int
style
,
final
TabbedPropertySheetWidgetFactory
widgetFactory
)
{
toolbar
=
new
ToolBar
(
control
,
SWT
.
FLAT
|
SWT
.
NO_FOCUS
);
toolbar
.
setLayoutData
(
GridDataFactory
.
fillDefaults
().
align
(
SWT
.
FILL
,
SWT
.
CENTER
).
grab
(
false
,
false
).
create
());
toolbar
.
setBackground
(
Display
.
getDefault
().
getSystemColor
(
SWT
.
COLOR_WHITE
));
final
ToolItem
editControl
=
new
ToolItem
(
toolbar
,
SWT
.
FLAT
);
editControl
.
setImage
(
Pics
.
getImage
(
PicsConstants
.
edit
));
editControl
.
setData
(
SWTBOT_WIDGET_ID_KEY
,
SWTBOT_ID_EDITBUTTON
);
...
...
bundles/plugins/org.bonitasoft.studio.expression.editor/src/org/bonitasoft/studio/expression/editor/viewer/EditExpressionDialog.java
View file @
611693c3
...
...
@@ -325,13 +325,15 @@ public class EditExpressionDialog extends TrayDialog implements IBonitaVariableC
if
(
currentExpressionEditor
!=
null
)
{
currentExpressionEditor
.
dispose
();
}
if
(
dataBindingContext
!=
null
)
{
dataBindingContext
.
dispose
();
}
currentExpressionEditor
=
provider
.
getExpressionEditor
(
inputExpression
,
context
);
currentExpressionEditor
.
setIsPageFlowContext
(
isPageFlowContext
);
if
(
currentExpressionEditor
!=
null
)
{
if
(
dataBindingContext
!=
null
)
{
dataBindingContext
.
dispose
();
}
//
if (dataBindingContext != null) {
//
dataBindingContext.dispose();
//
}
dataBindingContext
=
new
EMFDataBindingContext
();
currentExpressionEditor
.
createExpressionEditor
(
contentComposite
,
dataBindingContext
,
isPassword
);
contentComposite
.
layout
(
true
,
true
);
...
...
@@ -389,6 +391,9 @@ public class EditExpressionDialog extends TrayDialog implements IBonitaVariableC
if
(
getTray
()
!=
null
)
{
closeTray
();
}
if
(
dataBindingContext
!=
null
)
{
dataBindingContext
.
dispose
();
}
if
(
currentExpressionEditor
!=
null
)
{
currentExpressionEditor
.
dispose
();
}
...
...
bundles/plugins/org.bonitasoft.studio.expression.editor/src/org/bonitasoft/studio/expression/editor/viewer/ExpressionCollectionViewer.java
View file @
611693c3
...
...
@@ -15,6 +15,7 @@
package
org.bonitasoft.studio.expression.editor.viewer
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.bonitasoft.studio.common.IBonitaVariableContext
;
...
...
@@ -134,6 +135,7 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
private
EMFDataBindingContext
validationContext
;
private
String
mandatoryLabel
;
private
Binding
bindValue
;
private
final
List
<
IAddLineListener
>
addLineLineListeners
=
new
ArrayList
<>();
public
void
setEditingDomain
(
final
EditingDomain
editingDomain
)
{
this
.
editingDomain
=
editingDomain
;
...
...
@@ -297,7 +299,8 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
}
else
{
buttonComposite
=
new
Composite
(
parent
,
SWT
.
NONE
);
}
buttonComposite
.
setLayoutData
(
GridDataFactory
.
fillDefaults
().
grab
(
false
,
false
).
align
(
SWT
.
FILL
,
SWT
.
TOP
).
create
());
final
int
topIndent
=
captions
.
isEmpty
()
?
0
:
15
;
buttonComposite
.
setLayoutData
(
GridDataFactory
.
fillDefaults
().
grab
(
false
,
false
).
align
(
SWT
.
FILL
,
SWT
.
TOP
).
indent
(
0
,
topIndent
).
create
());
final
RowLayout
rl
=
new
RowLayout
(
SWT
.
VERTICAL
);
rl
.
spacing
=
3
;
...
...
@@ -533,14 +536,22 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
AbstractExpression
newExpression
=
null
;
if
(
expressionInput
instanceof
ListExpression
)
{
newExpression
=
addElementInListExpression
(
expressionInput
);
fireLineAdded
(
Collections
.<
Expression
>
singletonList
((
Expression
)
newExpression
));
}
else
if
(
expressionInput
instanceof
TableExpression
)
{
newExpression
=
addLineInTableExpression
(
expressionInput
);
fireLineAdded
(((
ListExpression
)
newExpression
).
getExpressions
());
}
refresh
();
putCursorOnNewElement
(
colIndexToEdit
,
newExpression
);
}
protected
void
fireLineAdded
(
List
<
Expression
>
expressions
)
{
for
(
final
IAddLineListener
listener
:
addLineLineListeners
)
{
listener
.
newLinedAdded
(
expressions
);
}
}
private
AbstractExpression
addElementInListExpression
(
final
Object
expressionInput
)
{
AbstractExpression
newExpression
;
newExpression
=
ExpressionFactory
.
eINSTANCE
.
createExpression
();
...
...
@@ -548,8 +559,7 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
return
newExpression
;
}
private
AbstractExpression
addLineInTableExpression
(
final
Object
expressionInput
)
{
AbstractExpression
newExpression
;
private
ListExpression
addLineInTableExpression
(
final
Object
expressionInput
)
{
final
ListExpression
rowExp
=
createListExpressionForNewLineInTable
();
if
(
editingDomain
==
null
)
{
editingDomain
=
TransactionUtil
.
getEditingDomain
(
expressionInput
);
...
...
@@ -566,8 +576,8 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
}
else
{
((
TableExpression
)
expressionInput
).
getExpressions
().
add
(
rowExp
);
}
newExpression
=
rowExp
;
return
ne
wExp
ression
;
return
ro
wExp
;
}
private
ListExpression
createListExpressionForNewLineInTable
()
{
...
...
@@ -1192,4 +1202,8 @@ public class ExpressionCollectionViewer implements IBonitaVariableContext {
}
public
void
addLineListener
(
IAddLineListener
listener
)
{
addLineLineListeners
.
add
(
listener
);
}
}
bundles/plugins/org.bonitasoft.studio.expression.editor/src/org/bonitasoft/studio/expression/editor/viewer/ExpressionViewer.java
View file @
611693c3
...
...
@@ -489,7 +489,7 @@ public class ExpressionViewer extends ContentViewer implements ExpressionConstan
if
((
style
&
SWT
.
BORDER
)
!=
0
)
{
indent
=
16
;
}
contentAssistText
.
setLayoutData
(
GridDataFactory
.
swtDefaults
().
align
(
SWT
.
FILL
,
SWT
.
CENTER
).
indent
(
indent
,
0
)
contentAssistText
.
setLayoutData
(
GridDataFactory
.
swtDefaults
().
align
(
SWT
.
FILL
,
SWT
.
FILL
).
indent
(
indent
,
0
)
.
grab
(
true
,
false
).
create
());
}
...
...
bundles/plugins/org.bonitasoft.studio.expression.editor/src/org/bonitasoft/studio/expression/editor/viewer/IAddLineListener.java
0 → 100644
View file @
611693c3
/**
* Copyright (C) 2016 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.bonitasoft.studio.expression.editor.viewer
;
import
java.util.List
;
import
org.bonitasoft.studio.model.expression.Expression
;
public
interface
IAddLineListener
{
void
newLinedAdded
(
List
<
Expression
>
expressions
);
}
bundles/plugins/org.bonitasoft.studio.groovy.ui/plugin.xml
View file @
611693c3
...
...
@@ -7,7 +7,7 @@
point=
"org.codehaus.groovy.eclipse.ui.syntaxHighlightingExtension"
>
<highlightingExtender
extender=
"org.bonitasoft.studio.groovy.ui.contentassist.BonitaSyntaxHighlighting"
natureID=
"org.
eclipse.jdt.groovy.core.groovy
Nature"
>
natureID=
"org.
bonitasoft.studio.common.repository.bonita
Nature"
>
</highlightingExtender>
</extension>
<extension
...
...
@@ -84,10 +84,7 @@
<proposalFilter
proposalFilter=
"org.bonitasoft.studio.groovy.ui.contentassist.BonitaProposalFilter"
>
<appliesTo
projectNature=
"org.eclipse.jdt.groovy.core.groovyNature"
>
</appliesTo>
<appliesTo
projectNature=
"org.eclipse.jdt.core.javanature"
>
projectNature=
"org.bonitasoft.studio.common.repository.bonitaNature"
>
</appliesTo>
</proposalFilter>
</extension>
...
...
@@ -123,7 +120,7 @@
</extension>
<extension
point=
"org.eclipse.jdt.groovy.core.typeLookup"
>
<lookup
lookup=
"org.bonitasoft.studio.groovy.ui.contentassist.BonitaConstantsTypeLookup"
>
<appliesTo
projectNature=
"org.
eclipse.jdt.groovy.core.groovy
Nature"
/>
<appliesTo
projectNature=
"org.
bonitasoft.studio.common.repository.bonita
Nature"
/>
</lookup>
</extension>
...
...
bundles/plugins/org.bonitasoft.studio.groovy.ui/src/org/bonitasoft/studio/groovy/ui/contentassist/VariablesCompletionProposalProvider.java
View file @
611693c3
...
...
@@ -59,6 +59,9 @@ public class VariablesCompletionProposalProvider implements IJavaCompletionPropo
if
(
unit
instanceof
GroovyCompilationUnit
)
{
final
ITextViewer
viewer
=
context
.
getViewer
();
final
List
<
ScriptVariable
>
variables
=
getScriptVariables
(
viewer
);
if
(
variables
.
isEmpty
())
{
return
list
;
}
if
(((
GroovyCompilationUnit
)
unit
).
getModuleNode
()
==
null
)
{
return
Collections
.
emptyList
();
}
...
...
bundles/plugins/org.bonitasoft.studio.groovy.ui/src/org/bonitasoft/studio/groovy/ui/contentassist/VariablesTypeCompletionProposal.java
View file @
611693c3
...
...
@@ -79,6 +79,9 @@ public class VariablesTypeCompletionProposal implements IJavaCompletionProposalC
if
(
unit
instanceof
GroovyCompilationUnit
)
{
final
ITextViewer
viewer
=
context
.
getViewer
();
final
List
<
ScriptVariable
>
scriptVariables
=
getScriptVariables
(
viewer
);
if
(
scriptVariables
.
isEmpty
())
{
return
list
;
}
if
(((
GroovyCompilationUnit
)
unit
).
getModuleNode
()
==
null
)
{
return
Collections
.
emptyList
();
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment