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
60d952fb
Commit
60d952fb
authored
10 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
fixed parent calculation in connection
parent
90c2844b
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/editpart/command/ConnectCommand.java
+20
-8
20 additions, 8 deletions
...tiss/tooling/base/ui/editpart/command/ConnectCommand.java
with
20 additions
and
8 deletions
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/command/ConnectCommand.java
+
20
−
8
View file @
60d952fb
...
...
@@ -33,7 +33,7 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
19A76A681820E49F4E8397BA1AB5358
E
* @ConQAT.Rating
YELLOW
Hash:
56AD20144F81EC2E610E4B0DAFE7FCD
E
*/
public
class
ConnectCommand
extends
Command
{
...
...
@@ -59,9 +59,13 @@ public class ConnectCommand extends Command {
if
(
context
.
getSource
().
getModel
()
instanceof
EObject
&&
context
.
getTarget
().
getModel
()
instanceof
EObject
&&
context
.
getSource
().
getParent
().
getModel
()
instanceof
EObject
)
{
EObject
commonParent
=
getCommonParent
();
if
(
commonParent
==
null
)
{
return
false
;
}
return
IConnectionCompositorService
.
INSTANCE
.
canConnect
((
EObject
)
context
.
getSource
()
.
getModel
(),
(
EObject
)
context
.
getTarget
().
getModel
(),
(
EObject
)
context
.
getSource
().
getParent
().
getModel
(),
context
);
.
getModel
(),
(
EObject
)
context
.
getTarget
().
getModel
(),
getCommonParent
(),
context
);
}
return
false
;
}
...
...
@@ -69,12 +73,20 @@ public class ConnectCommand extends Command {
/** {@inheritDoc} */
@Override
public
void
execute
()
{
EObject
sourceParent
=
(
EObject
)
context
.
getSource
().
getParent
().
getModel
();
EObject
targetParent
=
(
EObject
)
context
.
getTarget
().
getParent
().
getModel
();
EObject
commonParent
=
findCommonParent
(
sourceParent
,
targetParent
);
IConnectionCompositorService
.
INSTANCE
.
connect
((
EObject
)
context
.
getSource
().
getModel
(),
(
EObject
)
context
.
getTarget
().
getModel
(),
commonParent
,
context
);
(
EObject
)
context
.
getTarget
().
getModel
(),
getCommonParent
(),
context
);
}
/** Returns the common parent. */
private
EObject
getCommonParent
()
{
Object
srcEObject
=
context
.
getSource
().
getParent
().
getModel
();
Object
targetEObject
=
context
.
getTarget
().
getParent
().
getModel
();
if
(!(
srcEObject
instanceof
EObject
&&
targetEObject
instanceof
EObject
))
{
return
null
;
}
EObject
sourceParent
=
(
EObject
)
srcEObject
;
EObject
targetParent
=
(
EObject
)
targetEObject
;
return
findCommonParent
(
sourceParent
,
targetParent
);
}
/** Finds the common parent of two elements. */
...
...
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