diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java | 116 |
1 files changed, 37 insertions, 79 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java index 257bc5f1ee..e0375b877d 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * Copyright (c) 2007, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -9,103 +9,61 @@ ******************************************************************************/ package org.eclipse.jpt.jpa.ui.internal.details; +import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jpt.common.ui.internal.widgets.DialogPane; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; +import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; +import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -/** - * This dialog is used to either create or edit a primary key joing column that - * is within a secondary table. - * - * @see PrimaryKeyJoinColumn - * @see SecondaryTable - * @see BaseJoinColumnDialogPane - * @see PrimaryKeyJoinColumnInSecondaryTableStateObject - * - * @version 2.0 - * @since 2.0 - */ -public class PrimaryKeyJoinColumnInSecondaryTableDialog extends BaseJoinColumnDialog<PrimaryKeyJoinColumnInSecondaryTableStateObject> { +public class PrimaryKeyJoinColumnInSecondaryTableDialog + extends BaseJoinColumnDialog<ReadOnlySecondaryTable, ReadOnlyPrimaryKeyJoinColumn, PrimaryKeyJoinColumnInSecondaryTableStateObject> +{ + /** + * Use this constructor to create a <em>new</em> join column. + */ + protected PrimaryKeyJoinColumnInSecondaryTableDialog( + Shell parentShell, + ResourceManager resourceManager, + ReadOnlySecondaryTable secondaryTable) { + this(parentShell, resourceManager, secondaryTable, null); + } /** - * Creates a new <code>PrimaryKeyJoinColumnInSecondaryTableDialog</code>. - * - * @param parent The parent shell - * @param secondaryTable The owner of the join column to create or where it - * is located - * @param joinColumn Either the join column to edit or <code>null</code> if - * this state object is used to create a new one + * Use this constructor to edit an <em>existing</em> join column. */ - public PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent, - SecondaryTable secondaryTable, - PrimaryKeyJoinColumn joinColumn) { + protected PrimaryKeyJoinColumnInSecondaryTableDialog( + Shell parentShell, + ResourceManager resourceManager, + ReadOnlySecondaryTable secondaryTable, + ReadOnlyPrimaryKeyJoinColumn joinColumn) { + super(parentShell, resourceManager, secondaryTable, joinColumn, buildTitle(joinColumn)); + } - super(parent, secondaryTable, joinColumn); + private static String buildTitle(ReadOnlyPrimaryKeyJoinColumn joinColumn) { + return (joinColumn == null) ? + JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_addTitle : + JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_editTitle; } - /* - * (non-Javadoc) - */ @Override protected DialogPane<PrimaryKeyJoinColumnInSecondaryTableStateObject> buildLayout(Composite container) { return new BaseJoinColumnDialogPane<PrimaryKeyJoinColumnInSecondaryTableStateObject>( - getSubjectHolder(), - container - ); + this.getSubjectHolder(), + container, + this.resourceManager + ); } - /* - * (non-Javadoc) - */ @Override protected PrimaryKeyJoinColumnInSecondaryTableStateObject buildStateObject() { - return new PrimaryKeyJoinColumnInSecondaryTableStateObject( - getOwner(), - getJoinColumn() - ); + return new PrimaryKeyJoinColumnInSecondaryTableStateObject(this.getOwner(), this.getJoinColumn()); } - /* - * (non-Javadoc) - */ @Override protected String getDescriptionTitle() { - - if (getJoinColumn() == null) { - return JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_addDescriptionTitle; - } - - return JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_editDescriptionTitle; - } - - /* - * (non-Javadoc) - */ - @Override - public PrimaryKeyJoinColumn getJoinColumn() { - return (PrimaryKeyJoinColumn) super.getJoinColumn(); - } - - /* - * (non-Javadoc) - */ - @Override - protected SecondaryTable getOwner() { - return (SecondaryTable) super.getOwner(); - } - - /* - * (non-Javadoc) - */ - @Override - protected String getTitle() { - - if (getJoinColumn() == null) { - return JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_addTitle; - } - - return JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_editTitle; + return (this.getJoinColumn() == null) ? + JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_addDescriptionTitle : + JptUiDetailsMessages.PrimaryKeyJoinColumnInSecondaryTableDialog_editDescriptionTitle; } -}
\ No newline at end of file +} |