CPD Results

The following document contains the results of PMD's CPD 5.6.1.

Duplications

File Project Line
jp/sourceforge/tmdmaker/ui/editor/gef3/editparts/node/AbstractModelEditPart.java TMD-Maker Plugin 220
jp/sourceforge/tmdmaker/ui/editor/gef3/treeeditparts/AbstractEntityModelTreeEditPart.java TMD-Maker Plugin 247
		return getModel().getModelTargetConnections();
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
	 */
	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		logger.debug(getClass() + "." + evt.getPropertyName());

		if (evt.getPropertyName().equals(ModelElement.PROPERTY_NAME)) {
			handleNameChange(evt);
		} else if (evt.getPropertyName().equals(ModelElement.PROPERTY_CONSTRAINT)) {
			handleConstraintChange(evt);
		} else if (evt.getPropertyName().equals(AbstractEntityModel.PROPERTY_ATTRIBUTE)) {
			handleAttributeChange(evt);
		} else if (evt.getPropertyName().equals(ConnectableElement.P_SOURCE_CONNECTION)) {
			handleSourceConnectionChange(evt);
		} else if (evt.getPropertyName().equals(ConnectableElement.P_TARGET_CONNECTION)) {
			handleTargetConnectionChange(evt);
		} else if (evt.getPropertyName().equals(AbstractEntityModel.PROPERTY_REUSED)) {
			handleReUseKeyChange(evt);
		} else if (evt.getPropertyName().equals(AbstractEntityModel.PROPERTY_IDENTIFIER)) {
			handleIdentifierChange(evt);
		} else if (evt.getPropertyName().equals(AbstractEntityModel.PROPERTY_ATTRIBUTE_REORDER)) {
			logger.warn("Handle Reorder Occured.");
			refreshChildren();
		} else {
			logger.warn("Not Handle Event Occured.");
		}
	}

	/**
	 * 名称変更イベント処理
	 * 
	 * @param evt
	 *            発生したイベント情報
	 */
	protected void handleNameChange(PropertyChangeEvent evt) {
		refreshVisuals();
	}

	/**
	 * 制約変更イベント処理
	 * 
	 * @param evt
	 *            発生したイベント情報
	 */
	protected void handleConstraintChange(PropertyChangeEvent evt) {
		refreshVisuals();
	}

	/**
	 * 属性変更イベント処理
	 * 
	 * @param evt
	 *            発生したイベント情報
	 */
	protected void handleAttributeChange(PropertyChangeEvent evt) {
		refreshVisuals();
		refreshChildren();
	}

	/**
	 * 個体指定子変更イベント処理
	 * 
	 * @param evt
	 *            発生したイベント情報
	 */
	protected void handleIdentifierChange(PropertyChangeEvent evt) {
		refreshVisuals();
	}

	/**
	 * 接続元コネクション変更イベント処理
	 * 
	 * @param evt
	 *            発生したイベント情報
	 */
	protected void handleSourceConnectionChange(PropertyChangeEvent evt) {
File Project Line
jp/sourceforge/tmdmaker/ui/dialogs/MultivalueAndSupersetEditDialog.java TMD-Maker Plugin 58
jp/sourceforge/tmdmaker/ui/dialogs/SupersetEditDialog.java TMD-Maker Plugin 58
	public MultivalueAndSupersetEditDialog(Shell parentShell, AbstractEntityModel original) {
		super(parentShell);
		entity = new EditTable(original);
		entity.addPropertyChangeListener(this);
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
	 */
	@Override
	public void propertyChange(PropertyChangeEvent arg0) {
		// panel.updateValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		getShell().setText(Messages.EditVirtualSuperset);

		Composite composite = new Composite(parent, SWT.NULL);
		composite.setLayout(new GridLayout(2, false));
		GridData gridData = new GridData(GridData.FILL_BOTH);
		composite.setLayoutData(gridData);
		Label label = new Label(composite, SWT.NULL);
		label.setText(Messages.ModelName);
		inputNameText = new Text(composite, SWT.BORDER);
		inputNameText.setText(entity.getName());
		inputNameText.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				entity.setName(inputNameText.getText());
			}
		});
		gridData_1 = new GridData(GridData.FILL_BOTH);
		gridData_1.grabExcessVerticalSpace = false;
		gridData_1.widthHint = 200;
File Project Line
jp/sourceforge/tmdmaker/ui/preferences/appearance/ColorAppearancePreferencePage.java TMD-Maker Plugin 60
jp/sourceforge/tmdmaker/ui/preferences/appearance/FontAppearancePreferencePage.java TMD-Maker Plugin 60
	public ColorAppearancePreferencePage() {
		super(GRID);
		setPreferenceStore(TMDPlugin.getDefault().getPreferenceStore());
		getPreferenceStore().addPropertyChangeListener(listener);
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
	 */
	@Override
	public void init(IWorkbench workbench) {
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
	 */
	@Override
	protected void initialize() {
		super.initialize();
		setColorFieldsEnabled(getPreferenceStore()
				.getBoolean(AppearancePreferenceConstants.P_ENTITY_COLOR_ENABLED));
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
	 */
	@Override
	protected void createFieldEditors() {
		Composite parent = getFieldEditorParent();
		Group colorGroup = new Group(parent, SWT.NONE);
		colorGroup.setText(Messages.ColorSettings);
		colorGroup.setLayout(new GridLayout(1, true));

		colorFields = new Composite(colorGroup, SWT.NONE);
		new Label(colorFields, SWT.NONE);
		Label l = new Label(colorFields, SWT.NONE);
		l.setText(Messages.BackgroundColors);
File Project Line
jp/sourceforge/tmdmaker/ui/editor/gef3/editpolicies/SubsetEntityComponentEditPolicy.java TMD-Maker Plugin 45
jp/sourceforge/tmdmaker/ui/editor/gef3/editpolicies/VirtualEntityComponentEditPolicy.java TMD-Maker Plugin 42
		return new TableEditDialog<SubsetEntity>(getControllShell(), Messages.EditSubset,
				getModel());
	}

	
	/**
	 * 自分自身が実装対象でない場合に実行するコマンドを生成する。
	 * 
	 * @param editedValue
	 * @return
	 */
	private Command getDeleteCommand(AbstractEntityModel editedValue) {
		AbstractEntityModel table = getModel();
		if (table.isNotImplement() && !editedValue.isNotImplement()) {
			AbstractEntityModel original = ImplementRule.findOriginalImplementModel(table);
			return new ImplementDerivationModelsDeleteCommand(table, original);
		}
		return null;
	}
	
	@Override
	protected Command createEditCommand(List<EditAttribute> editAttributeList,
			AbstractEntityModel editedValue) {
		CompoundCommand ccommand = new CompoundCommand();
		ccommand.add(super.createEditCommand(editAttributeList, editedValue));
		Command deleteCommand = getDeleteCommand(editedValue);
		if (deleteCommand != null) {
			ccommand.add(deleteCommand);
		}
		return ccommand.unwrap();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.gef.editpolicies.ComponentEditPolicy#createDeleteCommand(org.eclipse.gef.requests.GroupRequest)
	 */
	@Override
	protected Command createDeleteCommand(GroupRequest deleteRequest) {
		CompoundCommand ccommand = new CompoundCommand();
File Project Line
jp/sourceforge/tmdmaker/model/TransfarReuseKeysToTargetRelationship.java TMD-Maker Core Plugin 49
jp/sourceforge/tmdmaker/model/TurboFileRelationship.java TMD-Maker Core Plugin 48
		if (EntityTypeRule.isResource(source)) {
			from = source;
			to = target;
		} else {
			from = target;
			to = source;
		}
		setSource(from);
		setTarget(to);
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.AbstractConnectionModel#attachTarget()
	 */
	@Override
	public void attachTarget() {
		super.attachTarget();
		if (targetReusedIdentifier == null) {
			getTarget().addReusedIdentifier(getSource());
		} else {
			getTarget()
					.addReusedIdentifier(getSource(), targetReusedIdentifier);
			targetReusedIdentifier = null;
		}
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.AbstractConnectionModel#detachTarget()
	 */
	@Override
	public void detachTarget() {
		targetReusedIdentifier = getTarget()
				.removeReusedIdentifier(getSource());
		super.detachTarget();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.AbstractRelationship#isDeletable()
	 */
	@Override
	public boolean isDeletable() {
		// return getTarget().isDeletable();
		return true;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.AbstractRelationship#identifierChanged()
	 */
	@Override
	public void identifierChanged() {
		// getTarget().firePropertyChange(AbstractEntityModel.PROPERTY_REUSED,
		// null, null);
		getTarget().fireIdentifierChanged(this);
	}
}
File Project Line
jp/sourceforge/tmdmaker/model/IdentifierRef.java TMD-Maker Core Plugin 100
jp/sourceforge/tmdmaker/model/SurrogateKeyRef.java TMD-Maker Core Plugin 100
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.Attribute#getDataTypeDeclaration()
	 */
	@Override
	public DataTypeDeclaration getDataTypeDeclaration() {
		DataTypeDeclaration returnValue = super.getDataTypeDeclaration();
		if (returnValue == null) {
			returnValue = original.getDataTypeDeclaration();
		}
		return returnValue;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.model.Attribute#copyTo(jp.sourceforge.tmdmaker.model.IAttribute)
	 */
	@Override
	public void copyTo(IAttribute to) {
		to.setDerivationRule(getDerivationRule());
		to.setDescription(getDescription());
		to.setLock(getLock());
		to.setValidationRule(getValidationRule());
		if (getDataTypeDeclaration() != null) {
			to.setDataTypeDeclaration(getDataTypeDeclaration().getCopy());
		} else {
			to.setDataTypeDeclaration(null);
		}
		to.setImplementName(getImplementName());
		to.setNullable(isNullable());
		// to.setName(getName());

	}
File Project Line
jp/sourceforge/tmdmaker/ui/editor/gef3/editparts/relationship/RelatedRelationshipEditPart.java TMD-Maker Plugin 40
jp/sourceforge/tmdmaker/ui/editor/gef3/editparts/relationship/VirtualSupersetType2VirtualSupersetRelationshipEditPart.java TMD-Maker Plugin 41
	public RelatedRelationshipEditPart(RelatedRelationship relationship) {
		super();
		setModel(relationship);
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure()
	 */
	@Override
	protected IFigure createFigure() {
		RelatedRelationshipFigure connection = new RelatedRelationshipFigure();

		return connection;
	}

	/**
	 * 
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
	 */
	@Override
	protected void createEditPolicies() {
		installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
		installEditPolicy(EditPolicy.CONNECTION_ROLE, new RelationshipEditPolicy());
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see jp.sourceforge.tmdmaker.ui.editor.gef3.editparts.relationship.AbstractRelationshipEditPart#refreshVisuals()
	 */
	@Override
	protected void refreshVisuals() {
		super.refreshVisuals();
		calculateAnchorLocation();
	}

	/**
	 * {@inheritDoc}
	 *
	 * @see jp.sourceforge.tmdmaker.ui.editor.gef3.editparts.relationship.AbstractRelationshipEditPart#propertyChange(java.beans.PropertyChangeEvent)
	 */
	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		if (evt.getPropertyName().equals(AbstractConnectionModel.PROPERTY_CONNECTION)) {
			refreshVisuals();
		} else {
			super.propertyChange(evt);
		}
	}
}
File Project Line
jp/sourceforge/tmdmaker/ui/dialogs/components/EntityEditSettingPanel.java TMD-Maker Plugin 112
jp/sourceforge/tmdmaker/ui/dialogs/components/EntityNameAndTypeSettingPanel.java TMD-Maker Plugin 102
		nameAutoCreateCheckBox = new Button(this, SWT.CHECK);
		nameAutoCreateCheckBox.setText(Messages.AutomaticGenerateEntityName);
		nameAutoCreateCheckBox.setLayoutData(gridData9);
		new Label(this, SWT.NONE);
		nameLabel = new Label(this, SWT.NONE);
		nameLabel.setText(Messages.EntityName);
		nameText = new Text(this, SWT.BORDER);
		nameText.setLayoutData(gridData1);
		nameText.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
			public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
				Text t = (Text) e.widget;
				entity.setName(t.getText());
File Project Line
jp/sourceforge/tmdmaker/ui/views/properties/AttributePropertySource.java TMD-Maker Plugin 47
jp/sourceforge/tmdmaker/ui/views/properties/IdentifierPropertySource.java TMD-Maker Plugin 47
	}

	static private IPropertyDescriptor[] propertyFields;
	static {
		propertyFields = new IPropertyDescriptor[] {
				new TextPropertyDescriptor(NAME, Messages.ModelName),
				new TextPropertyDescriptor(IMPLEMENT_NAME, Messages.ImplementationName),
				new TextPropertyDescriptor(DATA_TYPE_DECLARATION, Messages.DataType),
				new TextPropertyDescriptor(SIZE, Messages.Size),
				new TextPropertyDescriptor(SCALE, Messages.Scale) };
	}

	@Override
	public IPropertyDescriptor[] getPropertyDescriptors() {
		return propertyFields;
	}

	@Override
	public Object getPropertyValue(Object id) {
		if (id.equals(NAME)) {
			return canonicalize(attribute.getName());