|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Dialog
roneditor.dialogs.AbstractMatchDialog
public abstract class AbstractMatchDialog
This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI Builder, which is free for non-commercial use. If Jigloo is being used commercially (ie, by a corporation, company or business for any purpose whatever) then you should purchase a license for each developer using Jigloo. Please visit www.cloudgarden.com for details. Use of Jigloo implies acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter |
---|
org.eclipse.emf.common.notify.Adapter.Internal |
Field Summary | |
---|---|
private org.eclipse.gef.ui.actions.ActionRegistry |
actionRegistry
An action registry mainly for holding undo and redo action. |
private org.eclipse.swt.widgets.Button |
buttonAllCompletions
|
private org.eclipse.swt.widgets.Button |
buttonApplyRule
|
private org.eclipse.swt.widgets.Button |
buttonCancel
|
private org.eclipse.swt.widgets.Button |
buttonNextMatch
|
private org.eclipse.swt.widgets.Button |
buttonNextNet
|
private org.eclipse.swt.widgets.Button |
buttonNextRule
|
private org.eclipse.swt.widgets.Button |
buttonPreviousMatch
|
private org.eclipse.swt.widgets.Button |
buttonPreviousNet
|
private org.eclipse.swt.widgets.Button |
buttonPreviousRule
|
private boolean |
canceled
A switch to determine whether this dialog has been canceled. |
private org.eclipse.gef.GraphicalViewer |
codomainViewer
A viewer showing a copy of the current object net. |
private org.eclipse.gef.commands.CommandStack |
commandStack
A command stack for this dialog to perform undo and redo. |
private org.eclipse.swt.widgets.Composite |
compositeApplyLower
|
private org.eclipse.swt.widgets.Composite |
compositeMatchMiddle
|
private org.eclipse.swt.widgets.Composite |
compositeMiddle
|
private org.eclipse.swt.widgets.Composite |
compositeNetMiddle
|
private org.eclipse.swt.widgets.Composite |
compositeRulesUpper
|
private ronmodel.Rule |
containerRule
A rule that has a copy of the currentRule's LHS as LHS
and the CurrentObjectNetCopy as RHS . |
(package private) int |
currentCompletionPos
The position of the current match completion in the matchCompletions list. |
private ronmodel.RHS |
currentObjectNetCopy
A copy of the currently selected object net. |
private int |
currentObjectNetPos
The position of the current object net in the objectNets list. |
private ronmodel.Rule |
currentRule
The rule of whose LHS a copy is being shown in the lhsViewer. |
private org.eclipse.swt.widgets.Shell |
dialogShell
|
private org.eclipse.gef.EditDomain |
editDomain
The edit domain handling the mapping tool and the graphical viewers. |
private org.eclipse.gef.EditPartFactory |
editPartFactory
|
private ronmodel.HLPlace |
hlPlace
The high level place which hosts the current object net. |
private boolean |
isAllCompletionsMode
A switch to determine if computed completions that do not respect the actual partial match are being filtered out. |
private org.eclipse.gef.GraphicalViewer |
lhsViewer
A viewer showing a copy of the current rule's LHS . |
private java.util.List<java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode>> |
matchCompletions
If this is null we are in match completion mode! |
private java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> |
matchToApply
A cache for the match between the current rule and object net that has been set in the viewers. |
private java.util.ArrayList<ronmodel.ObjectNet> |
objectNets
The object nets that can be selected to apply rules on in this dialog. |
private java.util.ArrayList<ronmodel.Rule> |
rules
The rules that can be selected to be applied in this dialog. |
private org.eclipse.swt.custom.SashForm |
sashForm
|
private org.eclipse.emf.common.notify.Notifier |
target
Needed for Adapter implementation. |
private org.eclipse.swt.widgets.Text |
textMessage
|
private org.eclipse.swt.widgets.ToolBar |
toolBar
|
private org.eclipse.jface.action.ToolBarManager |
toolBarManager
|
Constructor Summary | |
---|---|
AbstractMatchDialog(java.util.ArrayList<ronmodel.Rule> rules,
java.util.ArrayList<ronmodel.ObjectNet> objectNets)
Main constructor for this dialog. |
Method Summary | |
---|---|
private void |
applyMatchCompletion(int newCompletionPos)
|
protected abstract org.eclipse.gef.commands.Command |
buildCreateMappingCommand(ronmodel.Codomain codomain,
ronmodel.ONNode source,
ronmodel.ONNode target)
|
protected abstract org.eclipse.gef.commands.Command |
buildDeleteMappingCommand(ronmodel.Mapping mapping)
|
(package private) void |
buttonAllCompletionsMouseUp()
Handler method for setting "All completions" switch. |
(package private) void |
buttonApplyRuleMouseUp()
|
(package private) void |
buttonCancelMouseUp()
|
(package private) void |
buttonNextMatchMouseUp()
|
(package private) void |
buttonNextNetMouseUp(org.eclipse.swt.events.MouseEvent evt)
|
(package private) void |
buttonNextRuleMouseUp(org.eclipse.swt.events.MouseEvent evt)
|
(package private) void |
buttonPreviousMatchMouseUp()
|
(package private) void |
buttonPreviousNetMouseUp(org.eclipse.swt.events.MouseEvent evt)
|
(package private) void |
buttonPreviousRuleMouseUp(org.eclipse.swt.events.MouseEvent evt)
|
private void |
cacheCurrentMatch()
|
private boolean |
checkCurrentMatch()
|
private void |
closeDialog()
|
private java.util.Vector<java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode>> |
computeMatchCompletions()
|
private boolean |
containsCurrentMatch(java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> completion)
|
protected abstract org.eclipse.jface.action.MenuManager |
createContextMenuProvider(org.eclipse.gef.GraphicalViewer viewer,
org.eclipse.gef.ui.actions.ActionRegistry actionRegistry2)
|
protected abstract org.eclipse.gef.EditPartFactory |
createEditPartFactory()
|
private org.eclipse.gef.GraphicalViewer |
createGraphicalViewer()
|
protected abstract org.eclipse.gef.Tool |
createMappingTool()
|
private void |
createToolBar()
This method creates a tool bar with special undo and redo actions working on te dialog's command stack. |
(package private) org.eclipse.gef.commands.CommandStack |
getCommandStack()
|
ronmodel.Rule |
getCurrentRule()
|
private org.eclipse.gef.EditDomain |
getEditDomain()
|
private org.eclipse.gef.EditPartFactory |
getEditPartFactory()
|
ronmodel.HLPlace |
getHLPlace()
|
java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> |
getMatchToApply()
|
ronmodel.ObjectNet |
getObjectNet()
|
ronmodel.Codomain |
getObjectNetCopy()
|
org.eclipse.emf.common.notify.Notifier |
getTarget()
|
private void |
init()
Initialize some fields, create graphical viewers and container rule, set first rule and object net, configure buttons' status and reset match completion related stuff. |
boolean |
isAdapterForType(java.lang.Object type)
|
boolean |
isCanceled()
|
private boolean |
isMatchToApplyComplete()
Helper method for checkCurrentMatch() . |
void |
notifyChanged(org.eclipse.emf.common.notify.Notification notification)
If a change of mappings happens on the current object net copy the "Apply" button will be set according to the current match and the match completion mechanism will be reset. |
void |
open()
Builds the dialog by creating the widget hierarchy and calling init() . |
private void |
resetMatchCompletion()
|
private void |
setCurrentCodomain(int objectNetPos)
|
private void |
setCurrentRule(int rulePos)
|
void |
setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
|
void |
stackChanged(org.eclipse.gef.commands.CommandStackEvent event)
Updates all actions if the command stack changes. |
private void |
undoCommandStack()
Undoes all actions on the command stack, flushes it and updates all actions. |
private void |
updateActions()
Updates all actions in the action registry, mainly undo and redo. |
Methods inherited from class org.eclipse.swt.widgets.Dialog |
---|
checkSubclass, getParent, getStyle, getText, setText |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean canceled
private boolean isAllCompletionsMode
private final java.util.ArrayList<ronmodel.Rule> rules
private final java.util.ArrayList<ronmodel.ObjectNet> objectNets
private org.eclipse.gef.EditDomain editDomain
private org.eclipse.gef.ui.actions.ActionRegistry actionRegistry
private org.eclipse.gef.commands.CommandStack commandStack
private org.eclipse.gef.GraphicalViewer lhsViewer
LHS
.
private org.eclipse.gef.GraphicalViewer codomainViewer
private java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> matchToApply
private ronmodel.Rule currentRule
LHS
a copy is being shown in the lhsViewer.
private ronmodel.RHS currentObjectNetCopy
private int currentObjectNetPos
private java.util.List<java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode>> matchCompletions
null
we are in match completion mode! Otherwise
it hold the (filtered) completions returned by AGG.
int currentCompletionPos
private ronmodel.HLPlace hlPlace
private ronmodel.Rule containerRule
LHS
as LHS
and the CurrentObjectNetCopy as RHS
. Its purpose is to ease the
integration of the MatchDialog to existing RONEditor
s,
especially to display mappings like in an ordinary rule view.
private org.eclipse.swt.widgets.Shell dialogShell
private org.eclipse.swt.widgets.Text textMessage
private org.eclipse.swt.widgets.Button buttonAllCompletions
private org.eclipse.swt.widgets.Button buttonCancel
private org.eclipse.swt.widgets.Button buttonApplyRule
private org.eclipse.swt.widgets.Composite compositeApplyLower
private org.eclipse.swt.widgets.Button buttonNextMatch
private org.eclipse.swt.widgets.Button buttonPreviousMatch
private org.eclipse.swt.widgets.Composite compositeMatchMiddle
private org.eclipse.swt.widgets.Button buttonNextNet
private org.eclipse.swt.widgets.Button buttonPreviousNet
private org.eclipse.swt.widgets.Composite compositeNetMiddle
private org.eclipse.swt.widgets.Composite compositeMiddle
private org.eclipse.swt.custom.SashForm sashForm
private org.eclipse.swt.widgets.Button buttonNextRule
private org.eclipse.swt.widgets.Button buttonPreviousRule
private org.eclipse.swt.widgets.Composite compositeRulesUpper
private org.eclipse.swt.widgets.ToolBar toolBar
private org.eclipse.jface.action.ToolBarManager toolBarManager
private org.eclipse.gef.EditPartFactory editPartFactory
private org.eclipse.emf.common.notify.Notifier target
Adapter
implementation.
Constructor Detail |
---|
public AbstractMatchDialog(java.util.ArrayList<ronmodel.Rule> rules, java.util.ArrayList<ronmodel.ObjectNet> objectNets)
rules
- The rules that can be switched through for match-setting. Must
contain at least 1 rule.objectNets
- The target object nets that can be switched through for
match-setting. Must contain at least 1 object net.Method Detail |
---|
public void open()
init()
.
init()
private void createToolBar()
private void init()
private boolean checkCurrentMatch()
true
if the match currently defined between the
actually shown LHS
and ObjectNet
is complete and
applicable.cacheCurrentMatch()
,
isMatchToApplyComplete()
private boolean isMatchToApplyComplete()
checkCurrentMatch()
.
true
if for each ONNode
in the current
LHS
a Mapping
exists.private org.eclipse.gef.GraphicalViewer createGraphicalViewer()
ScrollingGraphicalViewer
on the sashForm.getEditDomain()
,
getEditPartFactory()
protected abstract org.eclipse.jface.action.MenuManager createContextMenuProvider(org.eclipse.gef.GraphicalViewer viewer, org.eclipse.gef.ui.actions.ActionRegistry actionRegistry2)
viewer
- actionRegistry2
-
private org.eclipse.gef.EditDomain getEditDomain()
EditDomain
that works on this dialog's
command stack with a Tool
for creating Mappings as
default tool.getCommandStack()
protected abstract org.eclipse.gef.Tool createMappingTool()
private org.eclipse.gef.EditPartFactory getEditPartFactory()
EditPartFactory
for the
GraphicalViewer
s created in
createGraphicalViewer()
.protected abstract org.eclipse.gef.EditPartFactory createEditPartFactory()
org.eclipse.gef.commands.CommandStack getCommandStack()
CommandStack
to which the dialog is
listening.stackChanged(CommandStackEvent)
private void setCurrentRule(int rulePos)
rulePos
- private void setCurrentCodomain(int objectNetPos)
objectNet
- private void undoCommandStack()
private void updateActions()
private void resetMatchCompletion()
void buttonPreviousMatchMouseUp()
void buttonNextMatchMouseUp()
private java.util.Vector<java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode>> computeMatchCompletions()
private void cacheCurrentMatch()
private boolean containsCurrentMatch(java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> completion)
private void applyMatchCompletion(int newCompletionPos)
matchCompletion
- protected abstract org.eclipse.gef.commands.Command buildDeleteMappingCommand(ronmodel.Mapping mapping)
mapping
-
protected abstract org.eclipse.gef.commands.Command buildCreateMappingCommand(ronmodel.Codomain codomain, ronmodel.ONNode source, ronmodel.ONNode target)
codomain
- source
- target
-
void buttonPreviousRuleMouseUp(org.eclipse.swt.events.MouseEvent evt)
evt
- void buttonNextRuleMouseUp(org.eclipse.swt.events.MouseEvent evt)
evt
- void buttonPreviousNetMouseUp(org.eclipse.swt.events.MouseEvent evt)
evt
- void buttonNextNetMouseUp(org.eclipse.swt.events.MouseEvent evt)
evt
- void buttonCancelMouseUp()
void buttonApplyRuleMouseUp()
private void closeDialog()
void buttonAllCompletionsMouseUp()
public void stackChanged(org.eclipse.gef.commands.CommandStackEvent event)
stackChanged
in interface org.eclipse.gef.commands.CommandStackEventListener
CommandStackEventListener.stackChanged(org.eclipse.gef.commands.CommandStackEvent)
,
updateActions()
public java.util.HashMap<ronmodel.ONNode,ronmodel.ONNode> getMatchToApply()
cacheCurrentMatch()
public ronmodel.Codomain getObjectNetCopy()
setCurrentCodomain(int)
public ronmodel.ObjectNet getObjectNet()
public ronmodel.Rule getCurrentRule()
setCurrentRule(int)
public ronmodel.HLPlace getHLPlace()
public boolean isCanceled()
true
if this dialog has been canceled.public void notifyChanged(org.eclipse.emf.common.notify.Notification notification)
notifyChanged
in interface org.eclipse.emf.common.notify.Adapter
Adapter.notifyChanged(org.eclipse.emf.common.notify.Notification)
,
checkCurrentMatch()
,
resetMatchCompletion()
public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
setTarget
in interface org.eclipse.emf.common.notify.Adapter
public org.eclipse.emf.common.notify.Notifier getTarget()
getTarget
in interface org.eclipse.emf.common.notify.Adapter
public boolean isAdapterForType(java.lang.Object type)
isAdapterForType
in interface org.eclipse.emf.common.notify.Adapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |