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
bonita
bonita-studio
Commits
b2f1b9dc
Commit
b2f1b9dc
authored
Oct 30, 2014
by
Romain Bioteau
Browse files
code quality
parent
b9f9c12d
Changes
3
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.common/src-test/java/org/bonitasoft/studio/common/palette/FormPaletteLabelProviderTest.java
View file @
b2f1b9dc
...
...
@@ -70,11 +70,6 @@ public class FormPaletteLabelProviderTest {
labelProvider
.
getFormPaletteDescription
(
ProcessPackage
.
Literals
.
FLOW_ELEMENT
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
should_getFormPaletteDescription_throw_IllegalArgumentException_for_combo_eClass
()
throws
Exception
{
labelProvider
.
getFormPaletteDescription
(
FormPackage
.
Literals
.
COMBO_FORM_FIELD
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
should_getFormPaletteText_throw_IllegalArgumentException_for_combo_eClass
()
throws
Exception
{
labelProvider
.
getFormPaletteText
(
FormPackage
.
Literals
.
COMBO_FORM_FIELD
);
...
...
bundles/plugins/org.bonitasoft.studio.common/src/org/bonitasoft/studio/common/palette/FormPaletteLabelProvider.java
View file @
b2f1b9dc
...
...
@@ -116,22 +116,22 @@ public class FormPaletteLabelProvider {
}
public
String
getFormPaletteDescription
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
FormPackage
.
Literals
.
WIDGET
.
isSuperTypeOf
(
eClass
),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
final
int
id
=
eClass
.
getClassifierID
();
final
String
label
=
classifierIDToDescription
.
get
(
id
);
Assert
.
isLegal
(
label
!=
null
,
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
return
label
;
final
int
id
=
getEClassifierId
(
eClass
);
return
classifierIDToDescription
.
get
(
id
);
}
public
String
getFormPaletteText
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
FormPackage
.
Literals
.
WIDGET
.
isSuperTypeOf
(
eClass
),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
final
int
id
=
eClass
.
getClassifierID
();
final
int
id
=
getEClassifierId
(
eClass
);
final
String
label
=
classifierIDToTitle
.
get
(
id
);
Assert
.
isLegal
(
label
!=
null
,
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
return
label
;
}
protected
int
getEClassifierId
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
FormPackage
.
Literals
.
WIDGET
.
isSuperTypeOf
(
eClass
),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
return
eClass
.
getClassifierID
();
}
}
bundles/plugins/org.bonitasoft.studio.common/src/org/bonitasoft/studio/common/palette/ProcessPaletteLabelProvider.java
View file @
b2f1b9dc
...
...
@@ -155,16 +155,12 @@ public class ProcessPaletteLabelProvider {
}
public
String
getProcessPaletteDescription
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
ProcessPackage
.
eINSTANCE
.
equals
(
eClass
.
getEPackage
()),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
final
int
id
=
eClass
.
getClassifierID
();
final
int
id
=
getEClassifierId
(
eClass
);
return
classifierIDToDescription
.
get
(
id
);
}
public
String
getProcessPaletteText
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
ProcessPackage
.
eINSTANCE
.
equals
(
eClass
.
getEPackage
()),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
final
int
id
=
eClass
.
getClassifierID
();
final
int
id
=
getEClassifierId
(
eClass
);
final
String
label
=
classifierIDToTitle
.
get
(
id
);
if
(
label
==
null
)
{
return
eClass
.
getName
();
...
...
@@ -172,6 +168,12 @@ public class ProcessPaletteLabelProvider {
return
label
;
}
protected
int
getEClassifierId
(
final
EClass
eClass
)
{
Assert
.
isLegal
(
eClass
!=
null
);
Assert
.
isLegal
(
ProcessPackage
.
eINSTANCE
.
equals
(
eClass
.
getEPackage
()),
"EClass "
+
eClass
.
getName
()
+
" is not supported."
);
return
eClass
.
getClassifierID
();
}
}
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