[openrtm-commit:00670] r256 - in trunk/rtmtools/jp.go.aist.rtm.systemeditor: META-INF src/jp/go/aist/rtm/systemeditor/ui/editor/editpart src/jp/go/aist/rtm/systemeditor/ui/editor/figure
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 2月 7日 (火) 23:29:43 JST
Author: sakamoto
Date: 2012-02-07 23:29:42 +0900 (Tue, 07 Feb 2012)
New Revision: 256
Modified:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/META-INF/MANIFEST.MF
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AbstractEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ServicePortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java
Log:
Display Port Name #2292
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/META-INF/MANIFEST.MF
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/META-INF/MANIFEST.MF 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/META-INF/MANIFEST.MF 2012-02-07 14:29:42 UTC (rev 256)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: jp.go.aist.rtm.systemeditor;singleton:=true
-Bundle-Version: 1.1.0.rc2v20110725
+Bundle-Version: 1.1.0.rc3v20120207
Bundle-Activator: jp.go.aist.rtm.systemeditor.RTSystemEditorPlugin
Bundle-Localization: plugin
Require-Bundle:
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AbstractEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AbstractEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AbstractEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -3,6 +3,8 @@
import jp.go.aist.rtm.toolscommon.model.core.ModelElement;
import jp.go.aist.rtm.toolscommon.util.AdapterUtil;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
@@ -28,23 +30,17 @@
this.actionRegistry = actionRegistry;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Notifier getTarget() {
return defaultAdapterDelegate.getTarget();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean isAdapterForType(Object type) {
return defaultAdapterDelegate.isAdapterForType(type);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void setTarget(Notifier newTarget) {
defaultAdapterDelegate.setTarget(newTarget);
}
@@ -59,30 +55,22 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public void activate() {
super.activate();
((ModelElement) getModel()).eAdapters().add(this);
}
@Override
- /**
- * {@inheritDoc}
- */
public void deactivate() {
super.deactivate();
((ModelElement) getModel()).eAdapters().remove(this);
}
- @SuppressWarnings("unchecked")
- @Override
/**
- * {@inheritDoc}
- * <p>
* モデルのオブジェクトに委譲している
*/
+ @SuppressWarnings("unchecked")
+ @Override
public Object getAdapter(Class key) {
Object result = AdapterUtil.getAdapter(getModel(), key);
if (result == null) {
@@ -91,4 +79,37 @@
return result;
}
+
+ /**
+ * 図に付与されるラベル
+ */
+ public static class FloatingLabel extends Label {
+
+ public FloatingLabel(IFigure parentFigure) {
+ setParent(parentFigure);
+ parentFigure.add(this);
+ }
+
+ /**
+ * 削除する場合に呼び出されることを意図する
+ */
+ public void deactivate() {
+ getParent().remove(this);
+ }
+
+ @Override
+ public boolean isFocusTraversable() {
+ return false;
+ }
+
+ @Override
+ public boolean isRequestFocusEnabled() {
+ return false;
+ }
+
+ @Override
+ protected boolean isMouseEventTarget() {
+ return false;
+ }
+ }
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -37,7 +37,6 @@
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.MouseListener;
import org.eclipse.draw2d.Panel;
@@ -72,7 +71,7 @@
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
this);
- private ComponentFloatingLabel componentLabel;
+ FloatingLabel componentLabel;
NameDirectEditManager directManager = null;
@@ -87,26 +86,18 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected IFigure createFigure() {
Figure result = new Panel() {
@Override
- /**
- * {@inheritDoc}
- */
protected boolean useLocalCoordinates() {
return true;
}
- @Override
/**
- * {@inheritDoc}
- * <p>
* コンポーネントの外にポートが出ているように見せるために、コンポーネントのボディのドローイングの範囲を狭めている
*/
+ @Override
protected void paintFigure(Graphics graphics) {
if (isOpaque()) {
ComponentLayout cl = (ComponentLayout)this.getLayoutManager();
@@ -124,23 +115,19 @@
}
}
- @Override
/**
- * {@inheritDoc}
- * <p>
* コンポーネントの外にポートが出ているように見せるため、空実装
*/
+ @Override
protected void paintBorder(Graphics graphics) {
// void
}
- @Override
/**
- * {@inheritDoc}
- * <p>
* コンポーネントの制約が変更されるたびに、ラベルも移動させる。
* (責務の分離からすればあまりよくないが、ファイル内に閉じているのでここに実装にした)
*/
+ @Override
public void setBounds(Rectangle rect) {
super.setBounds(rect);
@@ -154,16 +141,13 @@
propertyChangeSupport.firePropertyChange("Bounds", null, rect);
}
-
};
result.addMouseListener(new MouseListener.Stub() {
- @Override
/**
- * {@inheritDoc}
- * <p>
* コンポーネントを右クリック(+Shift)して、方向を変換する機能の実装
*/
+ @Override
public void mousePressed(MouseEvent me) {
if (me.button == 3) { // right click
IAction action = null;
@@ -188,7 +172,7 @@
result.setBackgroundColor(ColorConstants.orange);
// 注意:ComponentLabelの親はSystemDiagram
- componentLabel = new ComponentFloatingLabel(
+ componentLabel = new FloatingLabel(
((AbstractGraphicalEditPart) getParent()).getFigure());
componentLabel.setText(getModel().getInstanceNameL());
componentLabel.setSize(30, 10);
@@ -209,9 +193,6 @@
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
public void activate() {
super.activate();
if (getModel().isCompositeComponent()) {
@@ -227,9 +208,6 @@
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
public void deactivate() {
componentLabel.deactivate();
super.deactivate();
@@ -245,9 +223,6 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected void createEditPolicies() {
installEditPolicy(EditPolicy.COMPONENT_ROLE,
new ComponentComponentEditPolicy());
@@ -258,9 +233,6 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected void refreshVisuals() {
getFigure().setBackgroundColor(getNewBodyColor());
@@ -306,8 +278,6 @@
SystemEditorPreferenceManager.COLOR_RTC_STATE_UNKNOWN);
}
}
-
-
return exexucitonContextColor;
}
@@ -356,7 +326,6 @@
SystemEditorPreferenceManager.COLOR_RTC_STATE_INACTIVE);
}
}
-
return stateColor;
}
@@ -386,16 +355,10 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public Component getModel() {
return (Component) super.getModel();
}
- /**
- * {@inheritDoc}component.eAdapters().add(this);
- */
@SuppressWarnings("unchecked")
public void notifyChanged(Notification notification) {
if (ComponentPackage.eINSTANCE.getComponent_Components().equals(
@@ -440,6 +403,7 @@
private void refreshComponent() {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
@@ -452,6 +416,7 @@
private void refreshComponent2() {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
@@ -461,6 +426,7 @@
}
}
+ @SuppressWarnings("unchecked")
private void refreshChildren2() {
int i;
EditPart editPart;
@@ -486,7 +452,6 @@
continue;
}
-
//Look to see if the EditPart is already around but in the wrong location
editPart = (EditPart)modelToEditPart.get(model);
@@ -507,7 +472,7 @@
}
}
-
+ @SuppressWarnings("unchecked")
private void refreshChildDiagram() {
// 複合RTCエディタ内の子RTCのポート再描画
SystemDiagram diagram = getModel().getChildSystemDiagram();
@@ -533,7 +498,6 @@
editor.refresh();
}
}
-
});
}
@@ -552,6 +516,7 @@
setFocus(true);
}
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
setFocus(false);
}
@@ -560,9 +525,6 @@
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
protected List getModelChildren() {
List result = new ArrayList();
// 複合コンポーネントに直接属するポートだけを表示させる 2008.11.26
@@ -591,54 +553,6 @@
propertyChangeSupport.removePropertyChangeListener(listener);
}
- /**
- * システムダイアグラムのコンポーネントに表示されるラベル
- */
- public class ComponentFloatingLabel extends Label {
-
- /**
- * コンストラクタ
- *
- * @param parentFigure
- * 親フィギュア
- */
- public ComponentFloatingLabel(IFigure parentFigure) {
- setParent(parentFigure);
- parentFigure.add(this);
- }
-
- /**
- * 削除する場合に呼び出されることを意図する
- */
- public void deactivate() {
- getParent().remove(this);
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public boolean isFocusTraversable() {
- return false;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public boolean isRequestFocusEnabled() {
- return false;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- protected boolean isMouseEventTarget() {
- return false;
- }
- }
-
@Override
public void performRequest(Request req) {
if (req.getType().equals(RequestConstants.REQ_OPEN)) {
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -11,6 +11,7 @@
import org.eclipse.draw2d.Panel;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.ui.actions.ActionRegistry;
@@ -33,18 +34,14 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public InPort getModel() {
return (InPort) super.getModel();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void notifyChanged(Notification notification) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
@@ -56,12 +53,27 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected IFigure createFigure() {
- IFigure result = isExported() ? new ExportedInPortFigure(getModel())
- : new InPortFigure(getModel());
+ super.createFigure();
+
+ IFigure result = null;
+ if (isExported()) {
+ result = new ExportedInPortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ } else {
+ result = new InPortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ }
result.setLocation(new Point(0, 0));
OutPortEditPart.supportAutoCreateConnectorToolMode(getViewer(), result);
@@ -70,9 +82,6 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected void refreshVisuals() {
Color color = SystemEditorPreferenceManager.getInstance().getColor(
SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -11,6 +11,7 @@
import org.eclipse.draw2d.MouseListener;
import org.eclipse.draw2d.MouseMotionListener;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.EditPartViewer;
@@ -26,8 +27,6 @@
*/
public class OutPortEditPart extends PortEditPart {
-// private Notification notification;
-
/**
* コンストラクタ
*
@@ -39,19 +38,14 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public OutPort getModel() {
return (OutPort) super.getModel();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void notifyChanged(Notification notification) {
-// this.notification = notification;
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
@@ -63,12 +57,27 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected IFigure createFigure() {
- IFigure result = isExported() ? new ExportedOutPortFigure(getModel())
- : new OutPortFigure(getModel());
+ super.createFigure();
+
+ IFigure result = null;
+ if (isExported()) {
+ result = new ExportedOutPortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ } else {
+ result = new OutPortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ }
result.setLocation(new Point(0, 0));
supportAutoCreateConnectorToolMode(getViewer(), result);
@@ -85,15 +94,18 @@
final AutoConnectorCreationTool connectionCreationTool = new AutoConnectorCreationTool();
figure.addMouseMotionListener(new MouseMotionListener() {
+ @Override
public void mouseDragged(MouseEvent me) {
}
+ @Override
public void mouseEntered(MouseEvent me) {
connectionCreationTool.setFactory(new SimpleFactory(
PortConnectorImpl.class));
domain.setActiveTool(connectionCreationTool);
}
+ @Override
public void mouseExited(MouseEvent me) {
if (domain.getActiveTool() == connectionCreationTool
&& connectionCreationTool.isStartedState() == false) {
@@ -101,14 +113,16 @@
}
}
+ @Override
public void mouseHover(MouseEvent me) {
}
+ @Override
public void mouseMoved(MouseEvent me) {
}
});
+
figure.addMouseListener(new MouseListener.Stub(){
-
@Override
public void mousePressed(MouseEvent me) {
// right click
@@ -116,7 +130,6 @@
domain.setActiveTool(domain.getDefaultTool());
}
}
-
});
}
@@ -137,9 +150,6 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected void refreshVisuals() {
Color color = SystemEditorPreferenceManager.getInstance().getColor(
SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
@@ -151,8 +161,7 @@
getFigure().setBackgroundColor(color);
- getFigure().setToolTip(
- InPortEditPart.getDataPortToolTip(getModel()));
+ getFigure().setToolTip(InPortEditPart.getDataPortToolTip(getModel()));
((GraphicalEditPart) getParent()).setLayoutConstraint(this,
getFigure(), getFigure().getBounds());
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -13,6 +13,7 @@
import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortAnchor;
import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortFigure;
import jp.go.aist.rtm.systemeditor.ui.util.ComponentUtil;
+import jp.go.aist.rtm.toolscommon.model.component.Component;
import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
import jp.go.aist.rtm.toolscommon.model.component.ComponentSpecification;
import jp.go.aist.rtm.toolscommon.model.component.Port;
@@ -21,6 +22,8 @@
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.gef.ConnectionEditPart;
@@ -28,6 +31,7 @@
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gef.Request;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.ui.PlatformUI;
@@ -37,6 +41,8 @@
public abstract class PortEditPart extends AbstractEditPart implements
NodeEditPart {
+ FloatingLabel portLabel;
+
/**
* コンストラクタ
*
@@ -48,50 +54,81 @@
}
@Override
- /**
- * {@inheritDoc}
- */
+ protected IFigure createFigure() {
+ portLabel = new FloatingLabel(((AbstractGraphicalEditPart) getParent()
+ .getParent()).getFigure());
+ portLabel.setText(getPortBaseName());
+ portLabel.setSize(30, 10);
+ return null;
+ }
+
+ String getPortBaseName() {
+ String name = getModel().getNameL();
+ if (name == null) {
+ return "";
+ }
+ int index = name.lastIndexOf(".");
+ if (index != -1) {
+ name = name.substring(index + 1);
+ }
+ return name;
+ }
+
+ public void setLabelBounds(Rectangle baseRect, Rectangle rect,
+ String direction) {
+ if (portLabel == null) {
+ return;
+ }
+ Rectangle labelRect = portLabel.getTextBounds().getCopy();
+ if (Component.OUTPORT_DIRECTION_RIGHT_LITERAL.equals(direction)) {
+ Point p = rect.getTopRight();
+ labelRect.x = baseRect.x + p.x;
+ labelRect.y = baseRect.y + p.y - labelRect.height;
+ } else if (Component.OUTPORT_DIRECTION_LEFT_LITERAL.equals(direction)) {
+ Point p = rect.getTopLeft();
+ labelRect.x = baseRect.x + p.x - labelRect.width;
+ labelRect.y = baseRect.y + p.y - labelRect.height;
+ } else if (Component.OUTPORT_DIRECTION_UP_LITERAL.equals(direction)) {
+ Point p = rect.getTop();
+ labelRect.x = baseRect.x + p.x - labelRect.width / 2;
+ labelRect.y = baseRect.y + p.y - labelRect.height;
+ } else if (Component.OUTPORT_DIRECTION_DOWN_LITERAL.equals(direction)) {
+ Point p = rect.getBottom();
+ labelRect.x = baseRect.x + p.x - labelRect.width / 2;
+ labelRect.y = baseRect.y + p.y;
+ }
+ portLabel.setBounds(labelRect);
+ }
+
+ @Override
protected void createEditPolicies() {
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
new PortGraphicalNodeEditPolicy());
}
- /**
- * {@inheritDoc}
- */
+ @Override
public ConnectionAnchor getSourceConnectionAnchor(
ConnectionEditPart connection) {
-// System.out.println("getSourceConnectionAnchor on " + this);
return new PortAnchor(getFigure());
}
- /**
- * {@inheritDoc}
- */
+ @Override
public ConnectionAnchor getTargetConnectionAnchor(
ConnectionEditPart connection) {
-// System.out.println("getTargetConnectionAnchor on " + this);
return new PortAnchor(getFigure());
}
- /**
- * {@inheritDoc}
- */
+ @Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
return new PortAnchor(getFigure());
}
- /**
- * {@inheritDoc}
- */
+ @Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
return new PortAnchor(getFigure());
}
@Override
- /**
- * {@inheritDoc}
- */
public PortFigure getFigure() {
if (invalid) {
setInvalid(false);
@@ -107,24 +144,16 @@
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
protected List getModelTargetConnections() {
return CompositeFilter.getModelTargetConnections(getModel());
}
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
protected List getModelSourceConnections() {
-// debugPrint(getModel());
return CompositeFilter.getModelSourceConnections(getModel());
}
-
@Override
public Port getModel() {
return (Port) super.getModel();
@@ -134,16 +163,15 @@
* 設定マネージャを監視するリスナ
*/
PropertyChangeListener preferenceChangeListener = new PropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
refreshVisuals();
}
};
+
private boolean invalid = false;
@Override
- /**
- * {@inheritDoc}
- */
public void activate() {
super.activate();
@@ -155,10 +183,8 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public void deactivate() {
+ portLabel.deactivate();
super.deactivate();
SystemEditorPreferenceManager.getInstance()
@@ -175,7 +201,6 @@
}
private class Adapter extends AdapterImpl {
- @SuppressWarnings("unchecked")
@Override
public void notifyChanged(Notification msg) {
if (ComponentPackage.eINSTANCE.getPort_ConnectorProfiles()
@@ -214,6 +239,7 @@
}
// ターゲットのポートのEditPartが存在しない時に走るときがある。
+ @Override
protected void addSourceConnection(ConnectionEditPart connection, int index) {
// ターゲット側の設定も行う
@@ -244,6 +270,7 @@
// System.out.println("addSourceConnection from " + connection.getSource() + " to " + connection.getTarget());
}
+ @Override
protected void addTargetConnection(ConnectionEditPart connection, int index) {
// ソース側の設定も行う
PortConnector connectionModel = (PortConnector) connection.getModel();
@@ -274,6 +301,7 @@
}
@SuppressWarnings("unchecked")
+ @Override
protected void refreshSourceConnections() {
int i;
ConnectionEditPart editPart;
@@ -313,6 +341,7 @@
}
@SuppressWarnings("unchecked")
+ @Override
protected void refreshTargetConnections() {
int i;
ConnectionEditPart editPart;
@@ -351,5 +380,4 @@
removeTargetConnection((ConnectionEditPart)trash.get(i));
}
-
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ServicePortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ServicePortEditPart.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ServicePortEditPart.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -7,6 +7,7 @@
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.ui.actions.ActionRegistry;
@@ -29,18 +30,14 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public ServicePort getModel() {
return (ServicePort) super.getModel();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void notifyChanged(Notification notification) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
@@ -51,12 +48,27 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected IFigure createFigure() {
- IFigure result = isExported() ? new ExportedServicePortFigure(
- getModel()) : new ServicePortFigure(getModel());
+ super.createFigure();
+
+ IFigure result = null;
+ if (isExported()) {
+ result = new ExportedServicePortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ } else {
+ result = new ServicePortFigure(getModel()) {
+ @Override
+ public void setBounds(Rectangle rect) {
+ super.setBounds(rect);
+ setLabelBounds(getBaseBounds(), rect, getDirection());
+ }
+ };
+ }
result.setLocation(new Point(0, 0));
OutPortEditPart.supportAutoCreateConnectorToolMode(getViewer(), result);
@@ -65,9 +77,6 @@
}
@Override
- /**
- * {@inheritDoc}
- */
protected void refreshVisuals() {
Color color = SystemEditorPreferenceManager.getInstance().getColor(
SystemEditorPreferenceManager.COLOR_SERVICEPORT_NO_CONNECT);
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -44,18 +44,14 @@
@SuppressWarnings("unchecked")
@Override
- /**
- * {@inheritDoc}
- */
public void layout(IFigure parent) {
Iterator children = parent.getChildren().iterator();
IFigure child;
while (children.hasNext()) {
child = (IFigure) children.next();
-
Rectangle bounds = getLocation(parent, child);
child.setLocation(new Point(bounds.x, bounds.y));
-
+ child.setBounds(child.getBounds());
parent.setBounds(parent.getBounds());
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java 2012-02-02 13:53:51 UTC (rev 255)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java 2012-02-07 14:29:42 UTC (rev 256)
@@ -8,6 +8,7 @@
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
/**
* PortのFigure
@@ -75,12 +76,14 @@
}
@Override
- /**
- * {@inheritDoc}
- */
public void setLocation(Point p) {
super.setLocation(p);
fireFigureMoved();
}
+ public Rectangle getBaseBounds() {
+ return (getParent() != null) ? getParent().getBounds()
+ : new Rectangle();
+ }
+
}
openrtm-commit メーリングリストの案内