Skip to content

Commit fa65bfe

Browse files
committed
[GEF] Remove excessive EditPart.updateModel() method
This method is only overridden by the `JTabbedPaneTabEditPart` in order to update the local model variable. Instead of keeping two "model" fields, we can override the `getModel()` method to cast the `Object` to `JTabbedPaneTabInfo`, in order to get access to its methods.
1 parent 4beda83 commit fa65bfe

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

org.eclipse.wb.core/src-gef/org/eclipse/wb/gef/core/EditPart.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ public EditPart getParent() {
5656
//
5757
////////////////////////////////////////////////////////////////////////////
5858

59-
/**
60-
* When existing {@link EditPart} reused for new model, this method will be invoked.
61-
*/
62-
protected void updateModel() {
63-
}
64-
6559
/**
6660
* Returns a <code>List</code> containing the children model objects. If this {@link EditPart}'s
6761
* model is a container, this method should be overridden to returns its children. This is what
@@ -153,7 +147,6 @@ protected void refreshChildren() {
153147
childPart.unregister();
154148
childPart.setModel(model);
155149
childPart.register();
156-
childPart.updateModel();
157150
}
158151
// reorder child EditPart
159152
removeChildVisual(childPart);

org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/gef/part/JTabbedPaneTabEditPart.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@
3232
* @coverage swing.gef.part
3333
*/
3434
public final class JTabbedPaneTabEditPart extends DesignEditPart {
35-
private JTabbedPaneTabInfo m_component;
3635

3736
////////////////////////////////////////////////////////////////////////////
3837
//
3938
// Constructor
4039
//
4140
////////////////////////////////////////////////////////////////////////////
4241
public JTabbedPaneTabEditPart(JTabbedPaneTabInfo component) {
43-
m_component = component;
44-
setModel(m_component);
42+
setModel(component);
4543
}
4644

4745
////////////////////////////////////////////////////////////////////////////
@@ -50,8 +48,8 @@ public JTabbedPaneTabEditPart(JTabbedPaneTabInfo component) {
5048
//
5149
////////////////////////////////////////////////////////////////////////////
5250
@Override
53-
protected void updateModel() {
54-
m_component = (JTabbedPaneTabInfo) getModel();
51+
public JTabbedPaneTabInfo getModel() {
52+
return (JTabbedPaneTabInfo) super.getModel();
5553
}
5654

5755
////////////////////////////////////////////////////////////////////////////
@@ -66,7 +64,7 @@ protected IFigure createFigure() {
6664

6765
@Override
6866
protected void refreshVisuals() {
69-
Rectangle bounds = m_component.getBounds();
67+
Rectangle bounds = getModel().getBounds();
7068
getFigure().setBounds(bounds);
7169
}
7270

@@ -83,7 +81,7 @@ protected void createEditPolicies() {
8381
@Override
8482
public void performRequest(Request request) {
8583
if (request.getType() == RequestConstants.REQ_OPEN) {
86-
m_component.getPane().setActiveComponent(m_component.getComponent());
84+
getModel().getPane().setActiveComponent(getModel().getComponent());
8785
}
8886
}
8987
}

0 commit comments

Comments
 (0)