Skip to content

Commit

Permalink
TEIIDDES-2399 removed copy description when transforming source to view
Browse files Browse the repository at this point in the history
model. Prevents copying source connection annotation properties and
prevents orphaning the annotation
  • Loading branch information
blafond committed Jul 17, 2015
1 parent 4e6d976 commit 66e20b6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
Expand Up @@ -19,6 +19,7 @@
import org.teiid.designer.transformation.ui.UiConstants;
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities;
import org.teiid.designer.ui.common.widget.INodeDescendantsDeselectionHandler;
import org.teiid.designer.ui.viewsupport.ModelIdentifier;
import org.teiid.designer.ui.viewsupport.ModelUtilities;
import org.teiid.designer.ui.wizards.IStructuralCopyTreePopulator;

Expand All @@ -39,6 +40,7 @@ public class TransformationLinkWizardPage extends WizardPage implements UiConsta
private MetamodelDescriptor metamodelDescriptor;
private TransformationTreeViewerWizardPanel panel;
protected boolean targetIsVirtual;
protected boolean sourceIsPhysical;

////////////////////////////////////////////////////////////////////////////////
// Constructors
Expand Down Expand Up @@ -82,9 +84,13 @@ public void createControl(Composite parent) {
}
}
}

if( selectedResource != null ) {
sourceIsPhysical = ModelIdentifier.isPhysicalModelType(selectedResource);
}

panel = new TransformationTreeViewerWizardPanel(parent, this,
metamodelDescriptor, selectedResource, targetIsVirtual);
metamodelDescriptor, selectedResource, sourceIsPhysical, targetIsVirtual );
super.setControl(panel);
}

Expand Down
Expand Up @@ -57,8 +57,9 @@ public TransformationTreeViewerWizardPanel( Composite parent,
WizardPage wizardPage,
MetamodelDescriptor metamodelDescriptor,
ModelResource selection,
boolean sourceIsPhysical,
boolean targetIsVirtual ) {
super(parent, wizardPage, metamodelDescriptor, selection, targetIsVirtual);
super(parent, wizardPage, metamodelDescriptor, selection, sourceIsPhysical, targetIsVirtual );

// add types whose checked state can't be changed
unsupportedClasses = new ArrayList();
Expand Down
Expand Up @@ -21,6 +21,7 @@
import org.teiid.designer.ui.UiConstants;
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities;
import org.teiid.designer.ui.common.widget.INodeDescendantsDeselectionHandler;
import org.teiid.designer.ui.viewsupport.ModelIdentifier;
import org.teiid.designer.ui.viewsupport.ModelUtilities;


Expand All @@ -44,6 +45,7 @@ public class StructuralCopyWizardPage extends WizardPage implements UiConstants,
private TreeViewerWizardPanel panel;
private MetamodelDescriptor metamodelDescriptor;
protected boolean targetIsVirtual;
protected boolean sourceIsPhysical;

//////////////////////////////////////////////////////////////////////////////////////
// Constructors
Expand Down Expand Up @@ -90,8 +92,11 @@ public void createControl(Composite parent) {
}
}

if( selectedResource != null ) {
sourceIsPhysical = ModelIdentifier.isPhysicalModelType(selectedResource);
}
panel = new TreeViewerWizardPanel(parent, this, metamodelDescriptor,
selectedResource, targetIsVirtual);
selectedResource, sourceIsPhysical, targetIsVirtual);
setControl(panel);
}

Expand Down
Expand Up @@ -62,6 +62,7 @@ public class TreeViewerWizardPanel extends Composite implements UiConstants {
private TreeViewer treeViewer;
private MetamodelDescriptor metamodelDescriptor;
private ModelResource selectorDialogResult = null;
protected boolean sourceIsPhysical;
protected boolean targetIsVirtual;
private boolean firstTimeVisible = true;
private boolean copyEntire;
Expand All @@ -70,11 +71,13 @@ public TreeViewerWizardPanel( Composite parent,
WizardPage wizardPage,
MetamodelDescriptor metamodelDescriptor,
ModelResource selection,
boolean sourceIsPhysical,
boolean targetIsVirtual ) {
super(parent, SWT.NULL);
this.wizardPage = wizardPage;
this.metamodelDescriptor = metamodelDescriptor;
this.selectorDialogResult = selection;
this.sourceIsPhysical = sourceIsPhysical;
this.targetIsVirtual = targetIsVirtual;
initialize();
}
Expand Down Expand Up @@ -139,12 +142,14 @@ public void widgetSelected( SelectionEvent ev ) {
* @since 5.0
*/
protected void addOptions( Composite parent ) {

// add a checkbox to copy descriptions (annotations).
copyAllDescriptions = new Button(this, SWT.CHECK);
copyAllDescriptions.setSelection(true);
copyAllDescriptions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
copyAllDescriptions.setText(COPY_ALL_DESCRIPTIONS);

if( !targetIsVirtual || (targetIsVirtual && !sourceIsPhysical) ) {
// add a checkbox to copy descriptions (annotations).
copyAllDescriptions = new Button(this, SWT.CHECK);
copyAllDescriptions.setSelection(true);
copyAllDescriptions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
copyAllDescriptions.setText(COPY_ALL_DESCRIPTIONS);
}

if( targetIsVirtual ) {
generateDefaultSQLCheckBox = new Button(this, SWT.CHECK);
Expand Down Expand Up @@ -174,7 +179,11 @@ public boolean isCopyEntireModel() {
* @since 5.0
*/
public boolean isCopyAllDescriptions() {
return copyAllDescriptions.getSelection();
if( copyAllDescriptions != null ) {
return copyAllDescriptions.getSelection();
}

return false;
}

public boolean doGenerateDefaultSQL() {
Expand Down

0 comments on commit 66e20b6

Please sign in to comment.