Index: pom.xml =================================================================== --- pom.xml (revision 1310) +++ pom.xml (working copy) @@ -11,4 +11,19 @@ org.teiid.designer.transformation.ui 7.2.0-SNAPSHOT eclipse-plugin + + + + org.sonatype.tycho + maven-osgi-compiler-plugin + ${tychoVersion} + + + 1.6 + 1.6 + + + + Index: src/com/metamatrix/modeler/transformation/ui/editors/TransformationObjectEditorPage.java =================================================================== --- src/com/metamatrix/modeler/transformation/ui/editors/TransformationObjectEditorPage.java (revision 1310) +++ src/com/metamatrix/modeler/transformation/ui/editors/TransformationObjectEditorPage.java (working copy) @@ -58,6 +58,9 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.IWorkbenchWindow; +import org.teiid.query.sql.lang.Command; +import org.teiid.query.sql.lang.QueryCommand; +import org.teiid.query.sql.lang.SetQuery; import com.metamatrix.core.event.EventObjectListener; import com.metamatrix.metamodels.diagram.Diagram; import com.metamatrix.metamodels.transformation.InputSet; @@ -102,9 +105,6 @@ import com.metamatrix.query.internal.ui.builder.criteria.QueryCriteriaStrategy; import com.metamatrix.query.internal.ui.builder.util.ElementViewerFactory; import com.metamatrix.query.internal.ui.sqleditor.actions.ToggleOptimizer; -import org.teiid.query.sql.lang.Command; -import org.teiid.query.sql.lang.QueryCommand; -import org.teiid.query.sql.lang.SetQuery; import com.metamatrix.query.ui.sqleditor.SqlEditorEvent; import com.metamatrix.query.ui.sqleditor.SqlEditorPanel; import com.metamatrix.query.ui.sqleditor.SqlEditorPanelWrapper; @@ -1120,10 +1120,7 @@ // If the tab is NOT SELECT TAB, then get the status of that command type so we can pass it to the SQL Editor Panel if (cmdType != QueryValidator.SELECT_TRNS) { - existingStatus = SqlMappingRootCache.getSqlTransformationStatus(currentMappingRoot, - cmdType, - true, - null); + existingStatus = SqlMappingRootCache.getSqlTransformationStatus(currentMappingRoot, cmdType, true, null); } boolean statusExists = selectStatus != null; @@ -1568,10 +1565,10 @@ // changed and we need to re-set the Editor from the SQL T-Root object and it's SQL UiUtil.runInSwtThread(new Runnable() { public void run() { - setEditorContent(getSelectedItem(), reconcileTarget, txnSource, overwriteDirty, true); + setEditorContent(getSelectedItem(), reconcileTarget, txnSource, overwriteDirty, true); } }, true); - + didSetText = true; } } @@ -1804,35 +1801,9 @@ * @param theMenuMgr the context menu being contributed to */ public void contributeExportedActions( IMenuManager theMenuMgr ) { - // ----------------------------------------- - // Contribute the AddToSqlFrom Action - // ----------------------------------------- IAction action = null; IWorkbenchWindow window = UiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); DiagramActionService service = (DiagramActionService)DiagramUiPlugin.getDefault().getActionService(window.getActivePage()); - try { - IEditorPart editorPart = window.getActivePage().getActiveEditor(); - if (editorPart instanceof ModelEditor) { - ModelEditorPage editorPage = (ModelEditorPage)((ModelEditor)editorPart).getCurrentPage(); - String actionKey = DiagramActionService.constructKey(DiagramActions.ADD_TO_SQL_FROM, editorPage); - if (service.isRegistered(actionKey)) { - action = service.getAction(actionKey); - } - } - } catch (final CoreException err) { - Util.log(err); - } - - if (action != null) { - // check to see if menu is edit menu or just a context menu - if (theMenuMgr.find(ModelerActionBarIdManager.getMenuAdditionsMarkerId()) == null) { - // must be a context menu. just add to end. - theMenuMgr.add(action); - } else { - // edit menu. add before end marker. - theMenuMgr.appendToGroup(ModelerActionBarIdManager.getMenuAdditionsMarkerId(), action); - } - } // ----------------------------------------- // Contribute the AddToSqlSelect Action @@ -1895,33 +1866,13 @@ */ public List getAdditionalModelingActions( ISelection selection ) { List addedActions = new ArrayList(); - // ----------------------------------------- - // Contribute the AddToSqlFrom Action - // ----------------------------------------- IAction action = null; IWorkbenchWindow window = UiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); DiagramActionService service = (DiagramActionService)DiagramUiPlugin.getDefault().getActionService(window.getActivePage()); - try { - IEditorPart editorPart = window.getActivePage().getActiveEditor(); - if (editorPart instanceof ModelEditor) { - ModelEditorPage editorPage = (ModelEditorPage)((ModelEditor)editorPart).getCurrentPage(); - String actionKey = DiagramActionService.constructKey(DiagramActions.ADD_TO_SQL_FROM, editorPage); - if (service.isRegistered(actionKey)) { - action = service.getAction(actionKey); - } - } - } catch (final CoreException err) { - Util.log(err); - } - - if (action != null && action.isEnabled()) { - addedActions.add(action); - } // ----------------------------------------- // Contribute the AddToSqlSelect Action // ----------------------------------------- - action = null; try { IEditorPart editorPart = window.getActivePage().getActiveEditor(); if (editorPart instanceof ModelEditor) { @@ -2117,7 +2068,7 @@ setTargetAllowsUpdates(getCheckBoxContributionForSupportsUpdates().getSelection()); getCheckBoxContributionForSupportsUpdates().getControl().update(); - + // refresh content as select editor was clearing the first time button was checked refreshEditorContent(); } Index: src/com/metamatrix/modeler/transformation/ui/actions/ITransformationDiagramActionConstants.java =================================================================== --- src/com/metamatrix/modeler/transformation/ui/actions/ITransformationDiagramActionConstants.java (revision 1310) +++ src/com/metamatrix/modeler/transformation/ui/actions/ITransformationDiagramActionConstants.java (working copy) @@ -16,7 +16,6 @@ interface DiagramActions { String RECONCILE_TRANSFORMATION = ReconcileTransformationAction.class.getName(); - String ADD_TO_SQL_FROM = AddToSqlFromAction.class.getName(); String ADD_TO_SQL_SELECT = AddToSqlSelectAction.class.getName(); String ADD_JOIN_EXPRESSION = AddJoinExpressionAction.class.getName(); Index: src/com/metamatrix/modeler/transformation/ui/actions/AddToSqlFromAction.java =================================================================== --- src/com/metamatrix/modeler/transformation/ui/actions/AddToSqlFromAction.java (revision 1310) +++ src/com/metamatrix/modeler/transformation/ui/actions/AddToSqlFromAction.java (working copy) @@ -1,155 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * - * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. - * - * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. - */ -package com.metamatrix.modeler.transformation.ui.actions; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import com.metamatrix.metamodels.diagram.Diagram; -import com.metamatrix.metamodels.transformation.SqlTransformationMappingRoot; -import com.metamatrix.modeler.internal.transformation.util.TransformationHelper; -import com.metamatrix.modeler.internal.ui.editors.MultiPageModelEditor; -import com.metamatrix.modeler.internal.ui.viewsupport.ModelObjectUtilities; -import com.metamatrix.modeler.transformation.ui.UiPlugin; -import com.metamatrix.modeler.transformation.ui.editors.TransformationObjectEditorPage; -import com.metamatrix.modeler.transformation.ui.util.TransformationUiResourceHelper; -import com.metamatrix.modeler.ui.editors.ModelObjectEditorPage; -import com.metamatrix.query.ui.sqleditor.SqlEditorPanel; -import com.metamatrix.ui.internal.eventsupport.SelectionUtilities; - -/** - * AddToSqlFromAction This action adds the selected SqlTable fullnames to the SQL FROM clause. The action is currently contributed - * by the TransformationObjectEditorPage, so that it only appears when the editor is displayed. The Groups are added to the editor - * at the current cursor location, or at the end of the FROM clause if the cursor is not within the FROM clause. - */ -public class AddToSqlFromAction extends TransformationAction { - - // ///////////////////////////////////////////////////////////////////////////////////////////// - // CONSTRUCTORS - // ///////////////////////////////////////////////////////////////////////////////////////////// - - public AddToSqlFromAction( EObject transformationEObject, - Diagram diagram ) { - super(transformationEObject, diagram); - // setImageDescriptor(UiPlugin.getDefault().getImageDescriptor(UiConstants.Images.CLEAR_TRANSFORMATION)); - } - - // ///////////////////////////////////////////////////////////////////////////////////////////// - // METHODS - // ///////////////////////////////////////////////////////////////////////////////////////////// - - /* (non-Javadoc) - * @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection) - */ - @Override - public void selectionChanged( IWorkbenchPart thePart, - ISelection theSelection ) { - super.selectionChanged(thePart, theSelection); - - // Enable the action based on the selection - boolean enable = shouldEnable(); - setEnabled(enable); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IAction#run() - */ - @Override - protected void doRun() { - // Build list of Table fullnames from the selected EObjects - List groupNames = new ArrayList(); - ISelection theSelection = getSelection(); - List selectedEObjs = SelectionUtilities.getSelectedEObjects(theSelection); - Iterator iter = selectedEObjs.iterator(); - while (iter.hasNext()) { - EObject eObj = (EObject)iter.next(); - String fullName = TransformationHelper.getSqlEObjectFullName(eObj); - if (fullName != null) { - groupNames.add(fullName); - } - } - - // - // Get the currently active ModelObjectEditorPage, ensure its TransformationObjEditorPage - // - IEditorPart editor = UiPlugin.getDefault().getCurrentWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof MultiPageModelEditor) { - ModelObjectEditorPage moep = ((MultiPageModelEditor)editor).getActiveObjectEditor(); - if (moep != null && moep instanceof TransformationObjectEditorPage) { - TransformationObjectEditorPage transOEP = (TransformationObjectEditorPage)moep; - // TransformationObjectEditorPage - // Get the sqlEditor - SqlEditorPanel sqlEditor = transOEP.getCurrentSqlEditor(); - // If editor cursor is within the FROM, add groups at the cursor, otherwise add to end - if (sqlEditor.isCurrentCaretWithinFrom()) { - sqlEditor.insertGroups(groupNames, sqlEditor.getCaretOffset(), null); - } else { - sqlEditor.insertGroupsAtEndOfFrom(groupNames, null); - } - } - } - - } - - /* - * method to determine if this action should be enabled, based on the current selection - * @param theSelection the current selection - * @return 'true' if the action should be enabled, 'false' if not. - */ - private boolean shouldEnable() { - boolean enable = false; - List selectedEObjs = SelectionUtilities.getSelectedEObjects(getSelection()); - // ---------------------------------------------- - // All of the selected items must be SqlTables - // ---------------------------------------------- - if (!selectedEObjs.isEmpty() && !ModelObjectUtilities.isReadOnly(getTransformation()) && !isDependencyDiagram() - && getSelection() != null && getTransformation() != null - && TransformationUiResourceHelper.isSqlTransformationResource(getTransformation()) && areEObjectsSelected()) { - // - // Get the currently active ModelObjectEditorPage, ensure its TransformationObjEditorPage - // Transformation Editor must be open for this action to enable - // - boolean editorOpen = false; - IEditorPart editor = UiPlugin.getDefault().getCurrentWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor instanceof MultiPageModelEditor) { - ModelObjectEditorPage moep = ((MultiPageModelEditor)editor).getActiveObjectEditor(); - if (moep != null && moep instanceof TransformationObjectEditorPage) { - TransformationObjectEditorPage transOEP = (TransformationObjectEditorPage)moep; - // TransformationObjectEditorPage - // Get the sqlEditor - SqlEditorPanel sqlEditor = transOEP.getCurrentSqlEditor(); - if (sqlEditor != null) editorOpen = true; - } - } - if (editorOpen) { - selectedEObjs = SelectionUtilities.getSelectedEObjects(getSelection()); - Iterator iter = selectedEObjs.iterator(); - // If any are not tables, disable and break - while (iter.hasNext()) { - EObject eObj = (EObject)iter.next(); - if (eObj != null) { - if (com.metamatrix.modeler.core.metamodel.aspect.sql.SqlAspectHelper.isTable(eObj)) { - if (((SqlTransformationMappingRoot)getTransformation()).getOutputs().contains(eObj)) { - return false; - } - enable = true; - } else { - return false; - } - } - } - } - } - return enable; - } - -} Index: src/com/metamatrix/modeler/transformation/ui/actions/TransformationActionAdapter.java =================================================================== --- src/com/metamatrix/modeler/transformation/ui/actions/TransformationActionAdapter.java (revision 1310) +++ src/com/metamatrix/modeler/transformation/ui/actions/TransformationActionAdapter.java (working copy) @@ -47,35 +47,34 @@ import com.metamatrix.modeler.transformation.ui.UiPlugin; import com.metamatrix.modeler.ui.actions.IModelObjectActionContributor; import com.metamatrix.modeler.ui.actions.IModelerActionConstants; +import com.metamatrix.modeler.ui.actions.IModelerActionConstants.ModelerGlobalActions; import com.metamatrix.modeler.ui.actions.ModelerActionBarIdManager; import com.metamatrix.modeler.ui.actions.ModelerActionService; import com.metamatrix.modeler.ui.actions.ModelerSpecialActionManager; -import com.metamatrix.modeler.ui.actions.IModelerActionConstants.ModelerGlobalActions; import com.metamatrix.modeler.ui.editors.ModelEditorPage; import com.metamatrix.ui.actions.AbstractAction; import com.metamatrix.ui.actions.ControlledPopupMenuExtender; import com.metamatrix.ui.actions.GlobalActionsMap; import com.metamatrix.ui.actions.IActionConstants.EclipseGlobalActions; + /** * TransformationActionAdapter */ -public class TransformationActionAdapter - extends DiagramActionAdapter - implements UiConstants, - ITransformationDiagramActionConstants { +public class TransformationActionAdapter extends DiagramActionAdapter + implements UiConstants, ITransformationDiagramActionConstants { - /////////////////////////////////////////////////////////////////////////////////////////////// + // ///////////////////////////////////////////////////////////////////////////////////////////// // CONSTANTS - /////////////////////////////////////////////////////////////////////////////////////////////// + // ///////////////////////////////////////////////////////////////////////////////////////////// private static final String D_MARKER = ContextMenu.TRANS_DIAGRAM_START; private static final String T_MARKER = ContextMenu.TRANS_START; - //============================================================================================================================ + // ============================================================================================================================ // Variables private List modelObjectContributors; - + // our specific actions private AddTransformationSourceAction addSourcesAction; private AddUnionSourceAction addUnionSourcesAction; @@ -83,7 +82,6 @@ private TransformationAction clearSourcesAction; private TransformationAction reconcileAction; private TransformationAction addToSqlSelectAction; - private TransformationAction addToSqlFromAction; private TransformationAction addJoinExpressionAction; private AbstractAction lockAction; private RefreshAction refreshDiagramAction; @@ -103,37 +101,37 @@ // actions map is needed since we want to override the default print action private DiagramGlobalActionsMap actionsMap; - //============================================================================================================================ + // ============================================================================================================================ // Constructors /** * @since 4.0 */ - public TransformationActionAdapter(final ModelEditorPage page) { + public TransformationActionAdapter( final ModelEditorPage page ) { super(page); } - - //============================================================================================================================ + + // ============================================================================================================================ // Methods /* (non-Javadoc) * @see com.metamatrix.modeler.ui.editors.AbstractModelEditorPageActionBarContributor#getGlobalActions() */ @Override - public GlobalActionsMap getGlobalActions() { + public GlobalActionsMap getGlobalActions() { - if ( actionsMap == null ) { + if (actionsMap == null) { // construct a global actions map that contains this adapter's tweaks actionsMap = new DiagramGlobalActionsMap(); actionsMap.reset(); - - actionsMap.put( EclipseGlobalActions.DELETE, this.deleteAction ); - actionsMap.put( EclipseGlobalActions.CUT, this.cutAction ); - actionsMap.put( EclipseGlobalActions.COPY, this.copyAction ); - actionsMap.put( EclipseGlobalActions.PASTE, this.pasteAction ); - actionsMap.put( IModelerActionConstants.ModelerGlobalActions.CLONE, this.cloneAction ); - ((RenameAction)this.renameAction).setDiagramEditor((DiagramEditor)getEditorPage()); - actionsMap.put( EclipseGlobalActions.RENAME, this.renameAction ); + + actionsMap.put(EclipseGlobalActions.DELETE, this.deleteAction); + actionsMap.put(EclipseGlobalActions.CUT, this.cutAction); + actionsMap.put(EclipseGlobalActions.COPY, this.copyAction); + actionsMap.put(EclipseGlobalActions.PASTE, this.pasteAction); + actionsMap.put(IModelerActionConstants.ModelerGlobalActions.CLONE, this.cloneAction); + ((RenameAction)this.renameAction).setDiagramEditor((DiagramEditor)getEditorPage()); + actionsMap.put(EclipseGlobalActions.RENAME, this.renameAction); } @@ -151,153 +149,145 @@ EObject transformationEObject = TransformationSourceManager.getTransformationFromDiagram(currentDiagram); // ** TRANSFORMATION ACTIONS ************************************************** - //----- AddTransformationSourceAction -----// + // ----- AddTransformationSourceAction -----// this.addSourcesAction = (AddTransformationSourceAction)getRegisteredAction(AddTransformationSourceAction.class.getName()); if (this.addSourcesAction == null) { this.addSourcesAction = new AddTransformationSourceAction(transformationEObject, currentDiagram); registerAction(this.addSourcesAction); } - //----- AddUnionSourceAction -----// + // ----- AddUnionSourceAction -----// this.addUnionSourcesAction = (AddUnionSourceAction)getRegisteredAction(AddUnionSourceAction.class.getName()); if (this.addUnionSourcesAction == null) { this.addUnionSourcesAction = new AddUnionSourceAction(transformationEObject, currentDiagram); registerAction(this.addUnionSourcesAction); } - - //----- RemoveTransformationSourceAction -----// + + // ----- RemoveTransformationSourceAction -----// this.removeSourcesAction = (TransformationAction)getRegisteredAction(RemoveTransformationSourceAction.class.getName()); if (this.removeSourcesAction == null) { this.removeSourcesAction = new RemoveTransformationSourceAction(transformationEObject, currentDiagram); registerAction(this.removeSourcesAction); } - - //----- ClearTransformationAction -----// + + // ----- ClearTransformationAction -----// this.clearSourcesAction = (TransformationAction)getRegisteredAction(ClearTransformationAction.class.getName()); if (this.clearSourcesAction == null) { this.clearSourcesAction = new ClearTransformationAction(transformationEObject, currentDiagram); registerAction(this.clearSourcesAction); } - - //----- ReconcileTransformationAction -----// + + // ----- ReconcileTransformationAction -----// this.reconcileAction = (TransformationAction)getRegisteredAction(ReconcileTransformationAction.class.getName()); if (this.reconcileAction == null) { this.reconcileAction = new ReconcileTransformationAction(transformationEObject, currentDiagram); registerAction(this.reconcileAction); } - - //----- AddToSqlFromAction -----// - this.addToSqlFromAction = (TransformationAction)getRegisteredAction(AddToSqlFromAction.class.getName()); - if (this.addToSqlFromAction == null) { - this.addToSqlFromAction = new AddToSqlFromAction(transformationEObject, currentDiagram); - registerAction(this.addToSqlFromAction); - } - - //----- AddToSqlSelectAction -----// + + // ----- AddToSqlSelectAction -----// this.addToSqlSelectAction = (TransformationAction)getRegisteredAction(AddToSqlSelectAction.class.getName()); if (this.addToSqlSelectAction == null) { this.addToSqlSelectAction = new AddToSqlSelectAction(transformationEObject, currentDiagram); registerAction(this.addToSqlSelectAction); } - - //----- AddSqlJoinAction -----// + + // ----- AddSqlJoinAction -----// this.addJoinExpressionAction = (TransformationAction)getRegisteredAction(AddJoinExpressionAction.class.getName()); if (this.addJoinExpressionAction == null) { this.addJoinExpressionAction = new AddJoinExpressionAction(transformationEObject, currentDiagram); registerAction(this.addJoinExpressionAction); } - - //----- LockAction -----// + + // ----- LockAction -----// this.lockAction = (AbstractAction)getRegisteredAction(LockAction.class.getName()); if (this.lockAction == null) { this.lockAction = new LockAction(transformationEObject, currentDiagram); registerAction(this.lockAction); } - //** GLOBAL EDIT OVERRIDE ACTIONS ************************************************** - //----- DeleteAction -----// + // ** GLOBAL EDIT OVERRIDE ACTIONS ************************************************** + // ----- DeleteAction -----// this.deleteAction = (TransformationAction)getRegisteredAction(DeleteAction.class.getName()); if (this.deleteAction == null) { this.deleteAction = new DeleteAction(transformationEObject, currentDiagram); registerAction(this.deleteAction); } - //----- CutAction -----// + // ----- CutAction -----// this.cutAction = (TransformationAction)getRegisteredAction(CutAction.class.getName()); if (this.cutAction == null) { - this.cutAction = new CutAction(transformationEObject,currentDiagram); + this.cutAction = new CutAction(transformationEObject, currentDiagram); registerAction(this.cutAction); } - //----- CopyAction -----// + // ----- CopyAction -----// this.copyAction = (TransformationAction)getRegisteredAction(CopyAction.class.getName()); if (this.copyAction == null) { - this.copyAction = new CopyAction(transformationEObject,currentDiagram); + this.copyAction = new CopyAction(transformationEObject, currentDiagram); registerAction(this.copyAction); } - //----- PasteAction -----// + // ----- PasteAction -----// this.pasteAction = (TransformationAction)getRegisteredAction(PasteAction.class.getName()); if (this.pasteAction == null) { - this.pasteAction = new PasteAction(transformationEObject,currentDiagram); + this.pasteAction = new PasteAction(transformationEObject, currentDiagram); registerAction(this.pasteAction); } - //----- CloneAction -----// + // ----- CloneAction -----// this.cloneAction = (TransformationAction)getRegisteredAction(CloneAction.class.getName()); if (this.cloneAction == null) { - this.cloneAction = new CloneAction(transformationEObject,currentDiagram); + this.cloneAction = new CloneAction(transformationEObject, currentDiagram); registerAction(this.cloneAction); } - - //----- RenameAction -----// + + // ----- RenameAction -----// this.renameAction = (AbstractAction)getRegisteredAction(RenameAction.class.getName()); - if (this.renameAction == null) { + if (this.renameAction == null) { this.renameAction = new RenameAction(); - registerAction(this.renameAction); - } - - //** DIAGRAM-RELATED ACTIONS ************************************************** - //----- RefreshAction -----// + registerAction(this.renameAction); + } + + // ** DIAGRAM-RELATED ACTIONS ************************************************** + // ----- RefreshAction -----// this.refreshDiagramAction = (RefreshAction)getRegisteredAction(RefreshAction.class.getName()); if (this.refreshDiagramAction == null) { this.refreshDiagramAction = new RefreshAction(); registerAction(this.refreshDiagramAction); } - //----- ShowParentDiagramAction -----// + // ----- ShowParentDiagramAction -----// this.upPackageDiagramAction = (ShowParentDiagramAction)getRegisteredAction(ShowParentDiagramAction.class.getName()); if (this.upPackageDiagramAction == null) { this.upPackageDiagramAction = new ShowParentDiagramAction(); registerAction(this.upPackageDiagramAction); } - - //----- SaveDiagramAction -----// + + // ----- SaveDiagramAction -----// this.saveDiagramAction = (AbstractAction)getRegisteredAction(SaveDiagramAction.class.getName()); if (this.saveDiagramAction == null) { this.saveDiagramAction = new SaveDiagramAction((DiagramEditor)this.getEditorPage()); registerAction(this.saveDiagramAction); } - - //----- DiagramPageSetupAction -----// + + // ----- DiagramPageSetupAction -----// this.diagramPageSetupAction = (AbstractAction)getRegisteredAction(DiagramPageSetupAction.class.getName()); if (this.diagramPageSetupAction == null) { this.diagramPageSetupAction = new DiagramPageSetupAction((DiagramEditor)this.getEditorPage()); registerAction(this.diagramPageSetupAction); - } - - //----- DiagramPageSetupAction -----// + } + + // ----- DiagramPageSetupAction -----// this.showPageGridAction = (AbstractAction)getRegisteredAction(ShowPageGridAction.class.getName()); if (this.showPageGridAction == null) { this.showPageGridAction = new ShowPageGridAction((DiagramEditor)this.getEditorPage()); registerAction(this.showPageGridAction); - } + } } - + /** - * private method used to update all transformation actions so they maintain the - * reference to the transformation displayed in the transformation diagram. - * + * private method used to update all transformation actions so they maintain the reference to the transformation displayed in + * the transformation diagram. */ private void resetTransformationActions() { Diagram currentDiagram = ((DiagramEditor)getEditorPage()).getDiagram(); @@ -309,7 +299,6 @@ this.clearSourcesAction.setTransformation(transformationEObject); this.reconcileAction.setTransformation(transformationEObject); this.addToSqlSelectAction.setTransformation(transformationEObject); - this.addToSqlFromAction.setTransformation(transformationEObject); this.addJoinExpressionAction.setTransformation(transformationEObject); this.deleteAction.setTransformation(transformationEObject); this.cutAction.setTransformation(transformationEObject); @@ -317,14 +306,13 @@ this.pasteAction.setTransformation(transformationEObject); this.cloneAction.setTransformation(transformationEObject); ((TransformationAction)this.lockAction).setTransformation(transformationEObject); - + this.addSourcesAction.setDiagram(currentDiagram); this.addUnionSourcesAction.setDiagram(currentDiagram); this.removeSourcesAction.setDiagram(currentDiagram); this.clearSourcesAction.setDiagram(currentDiagram); this.reconcileAction.setDiagram(currentDiagram); this.addToSqlSelectAction.setDiagram(currentDiagram); - this.addToSqlFromAction.setDiagram(currentDiagram); this.addJoinExpressionAction.setDiagram(currentDiagram); this.deleteAction.setDiagram(currentDiagram); this.cutAction.setDiagram(currentDiagram); @@ -337,13 +325,13 @@ * @see com.metamatrix.modeler.diagram.ui.editor.IDiagramActionAdapter#contributeExportedActions(org.eclipse.jface.action.IMenuManager) */ @Override - public void contributeExportedActions(IMenuManager theMenuMgr) { + public void contributeExportedActions( IMenuManager theMenuMgr ) { resetTransformationActions(); - - // check to see if this is a dependency diagram - if( !isDependencyDiagram() ) { + + // check to see if this is a dependency diagram + if (!isDependencyDiagram()) { Separator groupMarker = new Separator(T_MARKER); - + // check to see if menu is edit menu or just a context menu if ((theMenuMgr.getId() != null) && theMenuMgr.getId().equals(ModelerActionBarIdManager.getEditMenuId())) { setEditMenu(theMenuMgr); // need this in dispose() @@ -353,105 +341,107 @@ // by the pageActivate/pageDeactivate methods. theMenuMgr.appendToGroup(ModelerActionBarIdManager.getMenuAdditionsMarkerId(), groupMarker); addContributionItem(groupMarker); - + theMenuMgr.appendToGroup(T_MARKER, createActionContributionItem(this.addSourcesAction)); theMenuMgr.appendToGroup(T_MARKER, createActionContributionItem(this.addUnionSourcesAction)); theMenuMgr.appendToGroup(T_MARKER, createActionContributionItem(this.clearSourcesAction)); } else { theMenuMgr.add(groupMarker); - if( this.addSourcesAction.isEnabled() ) { + if (this.addSourcesAction.isEnabled()) { theMenuMgr.appendToGroup(T_MARKER, this.addSourcesAction); } - if( this.addUnionSourcesAction.isEnabled() ) { + if (this.addUnionSourcesAction.isEnabled()) { theMenuMgr.appendToGroup(T_MARKER, this.addUnionSourcesAction); } - if( this.clearSourcesAction.isEnabled() ) { + if (this.clearSourcesAction.isEnabled()) { theMenuMgr.appendToGroup(T_MARKER, this.clearSourcesAction); } } } } - + /* (non-Javadoc) * @see com.metamatrix.modeler.ui.editors.AbstractModelEditorPageActionBarContributor#createContextMenu() */ @Override - public void createContextMenu() { + public void createContextMenu() { createContextMenu(ContextMenu.DIAGRAM_EDITOR_PAGE, getEditorPage().getControl()); } - + @Override - public void contributeToMenuManager(IMenuManager theMenuMgr, ISelection selection) { + public void contributeToMenuManager( IMenuManager theMenuMgr, + ISelection selection ) { removeDiagramActions(theMenuMgr); - - if( !isDependencyDiagram() ) { + + if (!isDependencyDiagram()) { Diagram currentDiagram = ((DiagramEditor)getEditorPage()).getDiagram(); EObject transformationEObject = TransformationSourceManager.getTransformationFromDiagram(currentDiagram); - - TransformationSelectionHelper selectionHelper = - new TransformationSelectionHelper(transformationEObject, selection); - if( selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE ) { - switch( selectionHelper.getType() ) { - case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT:{ + + TransformationSelectionHelper selectionHelper = new TransformationSelectionHelper(transformationEObject, selection); + if (selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE) { + switch (selectionHelper.getType()) { + case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT: { resetTransformationActions(); IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) { + if (editAction != null) { TransformationMappingRoot root = (TransformationMappingRoot)selectionHelper.getSingleEObject(); - if( TransformationHelper.isOperation(root.getTarget())) { + if (TransformationHelper.isOperation(root.getTarget())) { ((EditAction)editAction).setEnabledOnce(); } theMenuMgr.add(editAction); } theMenuMgr.add(new Separator()); theMenuMgr.add(this.clearSourcesAction); - } break; + } + break; - case TransformationSelectionHelper.TYPE_XQUERY_TRANSFORMATION_ROOT:{ + case TransformationSelectionHelper.TYPE_XQUERY_TRANSFORMATION_ROOT: { resetTransformationActions(); IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) { + if (editAction != null) { TransformationMappingRoot root = (TransformationMappingRoot)selectionHelper.getSingleEObject(); - if( TransformationHelper.isOperation(root.getTarget())) { + if (TransformationHelper.isOperation(root.getTarget())) { ((EditAction)editAction).setEnabledOnce(); } theMenuMgr.add(editAction); } - } break; - - case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT_EXTRA:{ + } + break; + + case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT_EXTRA: { resetTransformationActions(); IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) { + if (editAction != null) { TransformationMappingRoot root = (TransformationMappingRoot)selectionHelper.getSingleEObject(); - if( TransformationHelper.isOperation(root.getTarget())) { + if (TransformationHelper.isOperation(root.getTarget())) { ((EditAction)editAction).setEnabledOnce(); } theMenuMgr.add(editAction); } - } break; - + } + break; + case TransformationSelectionHelper.TYPE_INPUT_SET: { resetTransformationActions(); IAction newChildAction = getAction(ModelerActionBarIdManager.getInsertChildMenuId()); - if( newChildAction != null ) - theMenuMgr.add(newChildAction); + if (newChildAction != null) theMenuMgr.add(newChildAction); IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) - theMenuMgr.add(editAction); - } break; - + if (editAction != null) theMenuMgr.add(editAction); + } + break; + case TransformationSelectionHelper.TYPE_SOURCE_RESULT_SET: case TransformationSelectionHelper.TYPE_RESULT_SET: { resetTransformationActions(); addDiagramActions(theMenuMgr); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_SOURCE_CHILD: { resetTransformationActions(); IAction existingAction = getAction(ModelerGlobalActions.OPEN); - if( existingAction != null ) - theMenuMgr.add(existingAction); + if (existingAction != null) theMenuMgr.add(existingAction); theMenuMgr.add(new Separator()); theMenuMgr.add(new GroupMarker(T_MARKER)); theMenuMgr.appendToGroup(T_MARKER, this.removeSourcesAction); @@ -461,83 +451,88 @@ theMenuMgr.add(new Separator(ContextMenu.TRANS_END)); // Defect 24443 MenuManager copyMenu = getCopyNameSubMenu(); - if( copyMenu != null ) { + if (copyMenu != null) { theMenuMgr.add(new Separator()); theMenuMgr.add(copyMenu); theMenuMgr.add(new Separator()); } addExtendedActions(theMenuMgr); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_SOURCE_TABLE: { resetTransformationActions(); MenuManager menuMgr = getModelingActionMenu(selection); - if(menuMgr.getItems().length > 0 ) { + if (menuMgr.getItems().length > 0) { theMenuMgr.add(menuMgr); theMenuMgr.add(new Separator()); } IAction existingAction = getAction(ModelerGlobalActions.OPEN); - if( existingAction != null ) - theMenuMgr.add(existingAction); - if( selectionHelper.isVirtual() ) { + if (existingAction != null) theMenuMgr.add(existingAction); + if (selectionHelper.isVirtual()) { IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) - theMenuMgr.add(editAction); + if (editAction != null) theMenuMgr.add(editAction); } theMenuMgr.add(new Separator()); theMenuMgr.add(new GroupMarker(T_MARKER)); theMenuMgr.appendToGroup(T_MARKER, this.removeSourcesAction); theMenuMgr.appendToGroup(T_MARKER, this.clearSourcesAction); - //theMenuMgr.appendToGroup(T_MARKER, this.addToSqlFromAction); - if( selectionHelper.isVirtual() ) { + if (selectionHelper.isVirtual()) { addExternalExportedActions(theMenuMgr, selection); } theMenuMgr.add(new Separator(ContextMenu.TRANS_END)); // Defect 24443 MenuManager copyMenu = getCopyNameSubMenu(); - if( copyMenu != null ) { + if (copyMenu != null) { theMenuMgr.add(new Separator()); theMenuMgr.add(copyMenu); theMenuMgr.add(new Separator()); } addExtendedActions(theMenuMgr); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_TARGET_CHILD: case TransformationSelectionHelper.TYPE_TARGET_TABLE: { resetTransformationActions(); theMenuMgr.add(new GroupMarker(T_MARKER)); theMenuMgr.appendToGroup(T_MARKER, this.lockAction); addDiagramActions(theMenuMgr); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_UNKNOWN: { - - } break; - + + } + break; + case TransformationSelectionHelper.TYPE_DIAGRAM: { resetTransformationActions(); addDiagramActions(theMenuMgr); - } break; - + } + break; + default: - break; + break; } - } else if(selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_MULTIPLE_SAME ) { - switch( selectionHelper.getType() ) { + } else if (selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_MULTIPLE_SAME) { + switch (selectionHelper.getType()) { case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT: { - // Shouldn't ever have this if not dependency. Could have it later + // Shouldn't ever have this if not dependency. Could have it later // if we allow multiple transformations feeding same Virtual group - } break; - + } + break; + case TransformationSelectionHelper.TYPE_INPUT_SET: { // Shouldn't ever have multiple input sets - } break; - + } + break; + case TransformationSelectionHelper.TYPE_RESULT_SET: { // Shouldn't ever have multiple result sets? - } break; - + } + break; + case TransformationSelectionHelper.TYPE_SOURCE_CHILD: { resetTransformationActions(); theMenuMgr.add(new GroupMarker(T_MARKER)); @@ -545,83 +540,84 @@ theMenuMgr.appendToGroup(T_MARKER, this.clearSourcesAction); theMenuMgr.appendToGroup(T_MARKER, this.addToSqlSelectAction); theMenuMgr.appendToGroup(T_MARKER, this.addJoinExpressionAction); - + theMenuMgr.add(new Separator()); - } break; + } + break; case TransformationSelectionHelper.TYPE_SOURCE_TABLE: { resetTransformationActions(); IAction existingAction = getAction(ModelerGlobalActions.OPEN); - if( existingAction != null ) - theMenuMgr.add(existingAction); + if (existingAction != null) theMenuMgr.add(existingAction); theMenuMgr.add(new Separator()); theMenuMgr.add(new GroupMarker(T_MARKER)); theMenuMgr.appendToGroup(T_MARKER, this.removeSourcesAction); theMenuMgr.appendToGroup(T_MARKER, this.clearSourcesAction); - theMenuMgr.appendToGroup(T_MARKER, this.addToSqlFromAction); - - if( selectionHelper.isVirtual() ) { + + if (selectionHelper.isVirtual()) { addExternalExportedActions(theMenuMgr, selection); } theMenuMgr.add(new Separator()); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_TARGET_CHILD: case TransformationSelectionHelper.TYPE_TARGET_TABLE: { resetTransformationActions(); addDiagramActions(theMenuMgr); - } break; - + } + break; + case TransformationSelectionHelper.TYPE_UNKNOWN: { - - } break; - + + } + break; + default: - break; + break; } } } else { Diagram currentDiagram = ((DiagramEditor)getEditorPage()).getDiagram(); EObject transformationEObject = TransformationSourceManager.getTransformationFromDiagram(currentDiagram); - + TransformationSelectionHelper selectionHelper = new TransformationSelectionHelper(transformationEObject, selection); - if( selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE ) { - switch( selectionHelper.getType() ) { + if (selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE) { + switch (selectionHelper.getType()) { // defect 16564 - these cases copied from above to add more menu items case TransformationSelectionHelper.TYPE_SOURCE_CHILD: { resetTransformationActions(); IAction existingAction = getAction(ModelerGlobalActions.OPEN); - if( existingAction != null ) - theMenuMgr.add(existingAction); + if (existingAction != null) theMenuMgr.add(existingAction); theMenuMgr.add(new Separator(ContextMenu.TRANS_END)); addExtendedActions(theMenuMgr); - } break; + } + break; case TransformationSelectionHelper.TYPE_SOURCE_TABLE: { resetTransformationActions(); IAction existingAction = getAction(ModelerGlobalActions.OPEN); - if( existingAction != null ) - theMenuMgr.add(existingAction); - if( selectionHelper.isVirtual() ) { + if (existingAction != null) theMenuMgr.add(existingAction); + if (selectionHelper.isVirtual()) { IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) - theMenuMgr.add(editAction); + if (editAction != null) theMenuMgr.add(editAction); addExternalExportedActions(theMenuMgr, selection); } theMenuMgr.add(new Separator(ContextMenu.TRANS_END)); addExtendedActions(theMenuMgr); - } break; - case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT:{ + } + break; + case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT: { IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) - theMenuMgr.add(editAction); + if (editAction != null) theMenuMgr.add(editAction); theMenuMgr.add(new Separator()); - } break; - - case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT_EXTRA:{ + } + break; + + case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT_EXTRA: { IAction editAction = getAction(ModelerGlobalActions.EDIT); - if( editAction != null ) - theMenuMgr.add(editAction); - } break; - + if (editAction != null) theMenuMgr.add(editAction); + } + break; + case TransformationSelectionHelper.TYPE_INPUT_SET: case TransformationSelectionHelper.TYPE_SOURCE_RESULT_SET: case TransformationSelectionHelper.TYPE_RESULT_SET: @@ -629,71 +625,60 @@ case TransformationSelectionHelper.TYPE_TARGET_TABLE: case TransformationSelectionHelper.TYPE_UNKNOWN: case TransformationSelectionHelper.TYPE_DIAGRAM: - + default: - break; + break; } } - + addDiagramActions(theMenuMgr); } } - - private void addExtendedActions(IMenuManager theMenuMgr) { + + private void addExtendedActions( IMenuManager theMenuMgr ) { ISelectionProvider selProvider = getEditorPage().getModelObjectSelectionProvider(); - if( selProvider != null ) { + if (selProvider != null) { if (theMenuMgr.find(IModelerActionConstants.ContextMenu.ADDITIONS) == null) { theMenuMgr.add(new Separator(IModelerActionConstants.ContextMenu.ADDITIONS)); } // Need to create a PopupMenuExtender to include any external actions here IEditorPart editor = ((ModelEditorSite)getEditorPage().getEditorSite()).getEditor(); - ControlledPopupMenuExtender popupMenuExtender = - new ControlledPopupMenuExtender(ContextMenu.DIAGRAM_EDITOR_PAGE, (MenuManager)theMenuMgr, selProvider, editor ); + ControlledPopupMenuExtender popupMenuExtender = new ControlledPopupMenuExtender(ContextMenu.DIAGRAM_EDITOR_PAGE, + (MenuManager)theMenuMgr, selProvider, + editor); popupMenuExtender.menuAboutToShow(theMenuMgr); } - + } - - private void addExternalExportedActions(IMenuManager theMenuMgr, ISelection selection) { + + private void addExternalExportedActions( IMenuManager theMenuMgr, + ISelection selection ) { List contributors = getModelObjectActionContributors(); for (int size = contributors.size(), i = 0; i < size; i++) { - IModelObjectActionContributor contributor = - (IModelObjectActionContributor)contributors.get(i); + IModelObjectActionContributor contributor = (IModelObjectActionContributor)contributors.get(i); contributor.contributeToContextMenu(theMenuMgr, selection); } } - - private void removeDiagramActions(IMenuManager theMenuMgr) { - if ( theMenuMgr.find( T_MARKER ) != null ) - theMenuMgr.remove( T_MARKER ); - - if ( theMenuMgr.find( this.removeSourcesAction.getId() ) != null ) - theMenuMgr.remove( this.removeSourcesAction.getId() ); - if ( theMenuMgr.find( this.clearSourcesAction.getId() ) != null ) - theMenuMgr.remove( this.clearSourcesAction.getId() ); - if ( theMenuMgr.find( this.lockAction.getId() ) != null ) - theMenuMgr.remove( this.lockAction.getId() ); - if ( theMenuMgr.find( this.refreshDiagramAction.getId() ) != null ) - theMenuMgr.remove( this.refreshDiagramAction.getId() ); - if ( theMenuMgr.find( this.upPackageDiagramAction.getId() ) != null ) - theMenuMgr.remove( this.upPackageDiagramAction.getId() ); - if ( theMenuMgr.find( this.saveDiagramAction.getId() ) != null ) - theMenuMgr.remove( this.saveDiagramAction.getId() ); - if ( theMenuMgr.find( this.diagramPageSetupAction.getId() ) != null ) - theMenuMgr.remove( this.diagramPageSetupAction.getId() ); - if ( theMenuMgr.find( this.showPageGridAction.getId() ) != null ) - theMenuMgr.remove( this.showPageGridAction.getId() ); - - - - if ( theMenuMgr.find( ContextMenu.TRANS_END ) != null ) - theMenuMgr.remove( ContextMenu.TRANS_END ); + + private void removeDiagramActions( IMenuManager theMenuMgr ) { + if (theMenuMgr.find(T_MARKER) != null) theMenuMgr.remove(T_MARKER); + + if (theMenuMgr.find(this.removeSourcesAction.getId()) != null) theMenuMgr.remove(this.removeSourcesAction.getId()); + if (theMenuMgr.find(this.clearSourcesAction.getId()) != null) theMenuMgr.remove(this.clearSourcesAction.getId()); + if (theMenuMgr.find(this.lockAction.getId()) != null) theMenuMgr.remove(this.lockAction.getId()); + if (theMenuMgr.find(this.refreshDiagramAction.getId()) != null) theMenuMgr.remove(this.refreshDiagramAction.getId()); + if (theMenuMgr.find(this.upPackageDiagramAction.getId()) != null) theMenuMgr.remove(this.upPackageDiagramAction.getId()); + if (theMenuMgr.find(this.saveDiagramAction.getId()) != null) theMenuMgr.remove(this.saveDiagramAction.getId()); + if (theMenuMgr.find(this.diagramPageSetupAction.getId()) != null) theMenuMgr.remove(this.diagramPageSetupAction.getId()); + if (theMenuMgr.find(this.showPageGridAction.getId()) != null) theMenuMgr.remove(this.showPageGridAction.getId()); + + if (theMenuMgr.find(ContextMenu.TRANS_END) != null) theMenuMgr.remove(ContextMenu.TRANS_END); } - - private void addDiagramActions(IMenuManager theMenuMgr) { - if( !isDependencyDiagram() ) { + + private void addDiagramActions( IMenuManager theMenuMgr ) { + if (!isDependencyDiagram()) { theMenuMgr.add(new Separator()); theMenuMgr.add(new GroupMarker(D_MARKER)); theMenuMgr.appendToGroup(D_MARKER, this.removeSourcesAction); @@ -714,8 +699,7 @@ } } - - //============================================================================================================================ + // ============================================================================================================================ // EditorActionBarContributor Methods /** @@ -725,13 +709,12 @@ @Override public void dispose() { super.dispose(); - + this.reconcileAction.dispose(); this.clearSourcesAction.dispose(); - + setEditorPage(null); } - /* (non-Javadoc) * @see com.metamatrix.modeler.diagram.ui.editor.IDiagramActionAdapter#contributeToDiagramToolBar(org.eclipse.jface.action.IToolBarManager) @@ -740,31 +723,31 @@ public void contributeToDiagramToolBar() { // NOTE: this method gets called each time the transformation diagram is displayed DiagramToolBarManager tbm = (DiagramToolBarManager)((DiagramEditor)getEditorPage()).getToolBarManager(); - + tbm.removeAll(); - + tbm.add(this.refreshDiagramAction); tbm.add(this.upPackageDiagramAction); tbm.add(new Separator()); - + IAction previewAction = ModelerSpecialActionManager.getAction(com.metamatrix.modeler.ui.UiConstants.Extensions.PREVIEW_DATA_ACTION_ID); - if( previewAction != null ) { + if (previewAction != null) { tbm.add(previewAction); tbm.add(new Separator()); } - + resetTransformationActions(); - + ActionContributionItem addSourcesItem = null; ActionContributionItem addUnionSourcesItem = null; - - if( !isDependencyDiagram() ) { + + if (!isDependencyDiagram()) { addSourcesItem = new ActionContributionItem(this.addSourcesAction); tbm.add(addSourcesItem); addUnionSourcesItem = new ActionContributionItem(this.addUnionSourcesAction); tbm.add(this.addUnionSourcesAction); - + tbm.add(this.removeSourcesAction); tbm.add(this.clearSourcesAction); tbm.add(this.reconcileAction); @@ -773,13 +756,13 @@ tbm.add(this.saveDiagramAction); tbm.add(this.diagramPageSetupAction); tbm.add(this.showPageGridAction); - + this.refreshDiagramAction.setDiagramEditor((DiagramEditor)getEditorPage()); this.upPackageDiagramAction.setDiagramEditor((DiagramEditor)getEditorPage()); - - if( !isDependencyDiagram() ) { + + if (!isDependencyDiagram()) { // Special wiring is needed to help this action determine if it's diagram toolbar button - // was pressed when the diagram was not in "Focus". This was causing additional selection events + // was pressed when the diagram was not in "Focus". This was causing additional selection events // to be handled before the action's "doRun()" method which messed up the intended selected item(s) // say.. from the tree, or another diagram. this.addSourcesAction.setToolBarManager(tbm); @@ -787,25 +770,23 @@ this.addUnionSourcesAction.setToolBarManager(tbm); this.addUnionSourcesAction.setItem(addUnionSourcesItem); } - + tbm.update(true); } - + private boolean isDependencyDiagram() { DiagramEditor editor = ((DiagramEditor)getEditorPage()); - if( editor.getDiagram()!= null && - editor.getDiagram().getType()!= null && - editor.getDiagram().getType().equals(PluginConstants.DEPENDENCY_DIAGRAM_TYPE_ID)) - return true; - + if (editor.getDiagram() != null && editor.getDiagram().getType() != null + && editor.getDiagram().getType().equals(PluginConstants.DEPENDENCY_DIAGRAM_TYPE_ID)) return true; + return false; } - + /* (non-Javadoc) * @see com.metamatrix.modeler.diagram.ui.editor.IDiagramActionAdapter#handleNotification(org.eclipse.emf.common.notify.Notification) */ @Override - public void handleNotification(Notification theNotification) { + public void handleNotification( Notification theNotification ) { // Currently doesn't need to do anything. } @@ -814,24 +795,22 @@ */ @Override public void enableDiagramToolbarActions() { - if( this.upPackageDiagramAction != null ) - this.upPackageDiagramAction.determineEnablement(); + if (this.upPackageDiagramAction != null) this.upPackageDiagramAction.determineEnablement(); } - - /** + + /** * @see com.metamatrix.modeler.diagram.ui.editor.IDiagramActionAdapter#shouldOverrideMenu() * @since 4.2 */ @Override - public boolean shouldOverrideMenu(ISelection selection) { + public boolean shouldOverrideMenu( ISelection selection ) { boolean value = false; Diagram currentDiagram = ((DiagramEditor)getEditorPage()).getDiagram(); EObject transformationEObject = TransformationSourceManager.getTransformationFromDiagram(currentDiagram); - TransformationSelectionHelper selectionHelper = - new TransformationSelectionHelper(transformationEObject, selection); - if( selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE ) { - switch( selectionHelper.getType() ) { + TransformationSelectionHelper selectionHelper = new TransformationSelectionHelper(transformationEObject, selection); + if (selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_SINGLE) { + switch (selectionHelper.getType()) { case TransformationSelectionHelper.TYPE_DIAGRAM: case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT: case TransformationSelectionHelper.TYPE_SQL_TRANSFORMATION_ROOT_EXTRA: @@ -841,25 +820,26 @@ case TransformationSelectionHelper.TYPE_SOURCE_RESULT_SET: case TransformationSelectionHelper.TYPE_XQUERY_TRANSFORMATION_ROOT: { value = true; - } break; - + } + break; + case TransformationSelectionHelper.TYPE_RESULT_SET: case TransformationSelectionHelper.TYPE_TARGET_CHILD: case TransformationSelectionHelper.TYPE_TARGET_TABLE: case TransformationSelectionHelper.TYPE_UNKNOWN: - + default: - break; + break; } - } else if( selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_MULTIPLE_SAME ) { - switch( selectionHelper.getType() ) { + } else if (selectionHelper.getCountType() == TransformationSelectionHelper.COUNT_MULTIPLE_SAME) { + switch (selectionHelper.getType()) { - case TransformationSelectionHelper.TYPE_SOURCE_CHILD: case TransformationSelectionHelper.TYPE_SOURCE_TABLE: { value = true; - } break; - + } + break; + // All these either aren't possible, or shouldn't be overridden case TransformationSelectionHelper.TYPE_INPUT_SET: case TransformationSelectionHelper.TYPE_RESULT_SET: @@ -868,62 +848,63 @@ case TransformationSelectionHelper.TYPE_TARGET_CHILD: case TransformationSelectionHelper.TYPE_TARGET_TABLE: case TransformationSelectionHelper.TYPE_UNKNOWN: - + default: - break; + break; } } - return value; } - + /** - * Gets the Copy Name menu. - * For Defect 24443 + * Gets the Copy Name menu. For Defect 24443 + * * @return the Copy Name submenu */ - private MenuManager getCopyNameSubMenu( ) { + private MenuManager getCopyNameSubMenu() { boolean foundActions = false; - MenuManager menu = new MenuManager( com.metamatrix.modeler.ui.UiConstants.Util.getString( "ModelerActionService.copyNameSubMenu.title" ) ); //$NON-NLS-1$ + MenuManager menu = new MenuManager( + com.metamatrix.modeler.ui.UiConstants.Util.getString("ModelerActionService.copyNameSubMenu.title")); //$NON-NLS-1$ IAction action = getAction(ModelerGlobalActions.COPY_FULL_NAME); - if( action != null ) { + if (action != null) { foundActions = true; menu.add(getAction(ModelerGlobalActions.COPY_FULL_NAME)); } - + action = getAction(ModelerGlobalActions.COPY_NAME); - if( action != null ) { + if (action != null) { foundActions = true; menu.add(getAction(ModelerGlobalActions.COPY_NAME)); } - if( !foundActions ) { + if (!foundActions) { menu = null; } return menu; } - - private IAction getAction(String theActionId) { + + private IAction getAction( String theActionId ) { IAction action = null; try { action = getActionService().getAction(theActionId); } catch (CoreException err) { } - + return action; } - - private MenuManager getModelingActionMenu(ISelection theSelection) { + + private MenuManager getModelingActionMenu( ISelection theSelection ) { IWorkbenchWindow window = UiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); ModelerActionService service = (ModelerActionService)com.metamatrix.modeler.ui.UiPlugin.getDefault().getActionService(window.getActivePage()); return service.getModelingActionMenu(theSelection); } + /** - * Gets a list of the extension for the ModelObjectActionContributor extension point. - * This was copied from ModelerActionService and changed to only process the trasformation.ui contributor to - * find the showDependencyAction. + * Gets a list of the extension for the ModelObjectActionContributor extension point. This was copied from + * ModelerActionService and changed to only process the trasformation.ui contributor to find the showDependencyAction. + * * @return the list of IModelObjectActionContributor implementations */ private List getModelObjectActionContributors() { @@ -931,7 +912,8 @@ String ID = com.metamatrix.modeler.ui.UiConstants.ExtensionPoints.ModelObjectActionContributor.ID; String CLASSNAME = com.metamatrix.modeler.ui.UiConstants.ExtensionPoints.ModelObjectActionContributor.CLASSNAME; // get the ModelObjectActionContributor extension point from the plugin class - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(com.metamatrix.modeler.ui.UiConstants.PLUGIN_ID, ID); + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(com.metamatrix.modeler.ui.UiConstants.PLUGIN_ID, + ID); // get the all extensions to the ModelObjectActionContributor extension point IExtension[] extensions = extensionPoint.getExtensions(); @@ -944,20 +926,23 @@ IConfigurationElement[] elements = extensions[i].getConfigurationElements(); Object extension = null; String uniqueID = extensions[i].getSimpleIdentifier(); - if( uniqueID.startsWith("transformationDiagramModelObjectActionContributor") ) { //$NON-NLS-1$ + if (uniqueID.startsWith("transformationDiagramModelObjectActionContributor")) { //$NON-NLS-1$ for (int j = 0; j < elements.length; j++) { try { extension = elements[j].createExecutableExtension(CLASSNAME); - + if (extension instanceof IModelObjectActionContributor) { modelObjectContributors.add(extension); } else { - com.metamatrix.modeler.ui.UiConstants.Util.log(IStatus.ERROR, com.metamatrix.modeler.ui.UiConstants.Util.getString("ModelerActionService.wrongContributorClass", //$NON-NLS-1$ - new Object[] { extension.getClass().getName()})); + com.metamatrix.modeler.ui.UiConstants.Util.log(IStatus.ERROR, + com.metamatrix.modeler.ui.UiConstants.Util.getString("ModelerActionService.wrongContributorClass", //$NON-NLS-1$ + new Object[] {extension.getClass().getName()})); } } catch (Exception theException) { - com.metamatrix.modeler.ui.UiConstants.Util.log(IStatus.ERROR, theException, com.metamatrix.modeler.ui.UiConstants.Util.getString("ModelerActionService.contributorProblem", //$NON-NLS-1$ - new Object[] { elements[j].getAttribute(CLASSNAME)})); + com.metamatrix.modeler.ui.UiConstants.Util.log(IStatus.ERROR, + theException, + com.metamatrix.modeler.ui.UiConstants.Util.getString("ModelerActionService.contributorProblem", //$NON-NLS-1$ + new Object[] {elements[j].getAttribute(CLASSNAME)})); } } } Index: src/com/metamatrix/modeler/transformation/ui/i18n.properties =================================================================== --- src/com/metamatrix/modeler/transformation/ui/i18n.properties (revision 1310) +++ src/com/metamatrix/modeler/transformation/ui/i18n.properties (working copy) @@ -96,8 +96,6 @@ ClearTransformationAction.deleteAttributesTitle=Delete Virtual Attributes ClearTransformationAction.deleteAttributesMessage=Delete all virtual attributes in "{0}"? -com.metamatrix.modeler.transformation.ui.actions.AddToSqlFromAction.text=Add to FROM Clause -com.metamatrix.modeler.transformation.ui.actions.AddToSqlFromAction.toolTip=Add the selected group(s) to FROM Clause com.metamatrix.modeler.transformation.ui.actions.AddToSqlSelectAction.text=Add to SELECT Clause com.metamatrix.modeler.transformation.ui.actions.AddToSqlSelectAction.toolTip=Add the selected attribute(s) to SELECT clause com.metamatrix.modeler.transformation.ui.actions.AddJoinExpressionAction.text=Create INNER Join