Exemple #1
0
        void getElementFromEA( )
        {
            EA.Repository repo  = ProjectSetting.getEARepo();
            EA.ObjectType otype = repo.GetContextItemType();

            if (otype == EA.ObjectType.otElement)
            {
                // Code for when an element is selected
                EA.Element eaElemObj = (EA.Element)repo.GetContextObject();

                if (eaElemObj != null && (eaElemObj.Type == "Class" || eaElemObj.Type == "Enumeration"))
                {
                    ElementVO eaElement = ObjectEAConverter.getElementFromEAObject(eaElemObj);
                    textBoxElementName.Text = eaElement.name;
                    targetElement           = eaElement;
                }
                else
                {
                    textBoxElementName.Text = "(EA上でクラスを選択してください)";
                    targetElement           = null;
                }
            }
            else
            {
                textBoxElementName.Text = "(EA上でクラスを選択してください)";
                targetElement           = null;
            }
        }
Exemple #2
0
 public EaHistoryListEntry(EA.ObjectType eaType, string guid, string bookmarkName)
 {
     EaTyp             = eaType;
     Guid              = guid;
     this.BookmarkName = bookmarkName;
     //this.update();
 }
        private void ExecuteAddSingleRequirementToSpecIF()
        {
            object selectedItem;

            EAAPI.ObjectType objectType = _repository.GetTreeSelectedItem(out selectedItem);

            EAAPI.Element element = selectedItem as EAAPI.Element;

            ProjectDescriptor project = ExecuteSelectProject();

            if (project != null)
            {
                logger.Info("Integrating requirement " + element.Name + "...");
                Resource repositoryResource = _projectIntegrator.AddRequirementToSpecIF(_requirementMasterDataWriter, element, project.ID);

                if (repositoryResource == null)
                {
                    logger.Error("Error integrating requirement.");
                }
                else
                {
                    logger.Info("Finished.");
                }
            }
        }
Exemple #4
0
 public override void Add(EA.ObjectType ot, string guid)
 {
     // bookmark not registered yet
     if (this.FindIndex(guid) == -1)
     {
         base.Add(ot, guid);
     }
 }
        /// <summary>
        /// Get the current Diagram with it's selected objects and connectors.
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="getAllDiagramObject">True if you want all diagram objects if nothing no diagram object is selected</param>
        public EaDiagram(Repository rep, bool getAllDiagramObject = false)
        {
            _rep = rep;
            _dia = _rep.GetCurrentDiagram();
            IsSelectedObjects = false;
            if (_dia == null)
            {
                return;
            }
            if (_dia.SelectedObjects.Count == 0 && getAllDiagramObject)
            {
                // overall diagram objects
                foreach (EA.DiagramObject obj in _dia.DiagramObjects)
                {
                    _selectedObjects.Add(obj);
                    SelElements.Add(rep.GetElementByID(obj.ElementID));
                }
            }
            // If an context element exists than this is the last selected element
            if (_dia.SelectedObjects.Count > 0)
            {
                EA.ObjectType type = _rep.GetContextItemType();
                // only package and object makes sense, or no context element (than go for selected elements)
                if (type == EA.ObjectType.otElement ||
                    type == EA.ObjectType.otPackage ||
                    type == EA.ObjectType.otNone)
                {
                    // 1. store context element/ last selected element
                    EA.Element elContext = (EA.Element)rep.GetContextObject();
                    // no context element available, take first element
                    if (elContext == null)
                    {
                        EA.DiagramObject obj = (EA.DiagramObject)_dia.SelectedObjects.GetAt(0);
                        elContext = rep.GetElementByID(obj.ElementID);
                    }
                    _conTextDiagramObject = _dia.GetDiagramObjectByID(elContext.ElementID, "");

                    SelElements.Add(elContext);
                    _selectedObjects.Add(_conTextDiagramObject);
                    IsSelectedObjects = true;

                    // over all selected diagram objects
                    foreach (EA.DiagramObject obj in _dia.SelectedObjects)
                    {
                        // skip last selected element / context element
                        if (obj.ElementID == _conTextDiagramObject.ElementID)
                        {
                            continue;
                        }

                        _selectedObjects.Add(obj);
                        SelElements.Add(rep.GetElementByID(obj.ElementID));
                    }
                }
            }
            _selectedConnector = _dia.SelectedConnector;
        }
Exemple #6
0
        private void callWeb2(EA.Repository Repository)
        {
            object o;

            EA.ObjectType type = Repository.GetContextItem(out o);
            MessageBox.Show("Type:" + type);

            EA.Element e = (EA.Element)o;
            MessageBox.Show("Name:" + e.Name);
        }
        private void ExecuteSynchronizeSingleElement()
        {
            object selectedItem;

            EAAPI.ObjectType objectType = _repository.GetTreeSelectedItem(out selectedItem);

            EAAPI.Element element = selectedItem as EAAPI.Element;

            _projectIntegrator.SynchronizeSingleElement(element);
        }
Exemple #8
0
 // diagram viewed, add to history
 public virtual void  Add(EA.ObjectType ot, string guid)
 {
     if (ot.Equals(EA.ObjectType.otDiagram))
     {
         EA.Diagram dia = (EA.Diagram)_rep.GetDiagramByGuid(guid);
         if (dia != null)
         {
             if (LPosition < 0 || L[LPosition].Guid != guid)
             {
                 int position = AddEntry(ot, guid);
                 if (position > -1)
                 {
                     UpdateDiagram(position, dia);
                 }
             }
         }
     }
     if (ot.Equals(EA.ObjectType.otPackage))
     {
         EA.Package pkg = _rep.GetPackageByGuid(guid);
         if (pkg != null)
         {
             // not already defined as bookmark
             if (this.FindIndex(pkg.PackageGUID) == -1)
             {
                 int position = AddEntry(ot, guid);
                 if (position > -1)
                 {
                     UpdatePackage(position, pkg);
                 }
             }
         }
     }
     if (ot.Equals(EA.ObjectType.otElement))
     {
         EA.Element el = _rep.GetElementByGuid(guid);
         if (el != null)
         {
             // not already defined as bookmark
             if (this.FindIndex(el.ElementGUID) == -1)
             {
                 int position = AddEntry(ot, guid);
                 if (position > -1)
                 {
                     UpdateElement(position, el);
                 }
             }
         }
     }
 }
Exemple #9
0
 public override void Add(EA.ObjectType ot, string guid)
 {
     // diagram is selected by add/return
     if (LPosition < 0)
     {
         base.Add(ot, guid);
     }
     else if (L[LPosition].Guid != guid)
     {
         base.Add(ot, guid);
     }
     else
     {
         // do nothing
     }
 }
Exemple #10
0
 public void Remove(EA.ObjectType ot, string guid)
 {
     if (ot.Equals(EA.ObjectType.otDiagram))
     {
         EA.Diagram dia = (EA.Diagram)_rep.GetDiagramByGuid(guid);
         if (dia != null)
         {
             int index = this.FindIndex(dia.DiagramGUID);
             if (index > -1)
             {
                 L.RemoveAt(index);
                 if (index <= LPosition)
                 {
                     LPosition = LPosition - 1;
                 }
             }
         }
         // settings of project
         _settings.SetHistory(_historyType, _rep.ProjectGUID, L);
     }
 }
Exemple #11
0
 //
 private int AddEntry(EA.ObjectType ot, string guid)
 {
     if (L.Count > 0)
     {
         if (L[0].Guid == guid)
         {
             return(-1);                  // Entry exists already
         }
     }
     L.Add(new EaHistoryListEntry(ot, guid));
     if (L.Count > 50)
     {
         L.RemoveAt(0);
         if (LPosition > -1)
         {
             LPosition = LPosition - 1;
         }
     }
     // set settings of project
     //m_settings.setHistory(m_historyType, m_rep.ProjectGUID, m_l);
     return(L.Count - 1);
 }
Exemple #12
0
 public void EA_OnNotifyContextItemModified(EAAPI.Repository repository, string guid, EAAPI.ObjectType objectType)
 {
     ;
 }
Exemple #13
0
        public bool EA_OnContextItemDoubleClicked(EAAPI.Repository repository, string guid, EAAPI.ObjectType objectType)
        {
            bool result = false;

            if (objectType == EAAPI.ObjectType.otElement)
            {
                EAAPI.Element element = repository.GetElementByGuid(guid);

                ViewModelBase viewModel = null;

                viewModel = GetEditorViewModel(repository, element);

                if (viewModel != null)
                {
                    FMCElementPropertyWindow newAgentWindow = new FMCElementPropertyWindow();
                    newAgentWindow.DataContext = viewModel;
                    newAgentWindow.ShowDialog();
                    repository.AdviseElementChange(element.ElementID);
                    result = true;
                }
            }
            else if (objectType == EAAPI.ObjectType.otConnector)
            {
                EAAPI.Connector connector = repository.GetConnectorByGuid(guid) as EAAPI.Connector;
                if (connector != null && connector.Stereotype == "access type" && _mainViewModel != null)
                {
                    _mainViewModel.ShowConnectorDirectionDialogCommand.Execute(connector);
                    repository.AdviseConnectorChange(connector.ConnectorID);
                    result = true;
                }
            }
            return(result);
        }
Exemple #14
0
        public bool EA_OnContextItemDoubleClicked(EAAPI.Repository repopsitory, string guid, EAAPI.ObjectType objectType)
        {
            bool result = false;

            if (objectType == EAAPI.ObjectType.otElement && _mainViewModel != null)
            {
                EAAPI.Element element = repopsitory.GetElementByGuid(guid);



                if (element.Type == "Requirement")
                {
                    string identifier = element.GetTaggedValueString("Identifier");

                    if (!string.IsNullOrEmpty(identifier))
                    {
                        _mainViewModel.OpenJiraViewCommand.Execute(identifier);
                        result = true;
                    }
                }
            }

            return(result);
        }
Exemple #15
0
        public object EA_GetMenuItems(EAAPI.Repository repository,
                                      string location,
                                      string menuName)
        {
            object result = "";

            List <string> menuEntries = new List <string>();

            object selectedItem = null;

            EAAPI.ObjectType objectType = repository.GetTreeSelectedItem(out selectedItem);

            EAAPI.Element selectedElement = null;

            if (objectType == EAAPI.ObjectType.otElement)
            {
                selectedElement = selectedItem as EAAPI.Element;
            }
            else if (objectType == EAAPI.ObjectType.otPackage)
            {
                EAAPI.Package package = selectedItem as EAAPI.Package;
                selectedElement = package.Element;
            }

            switch (menuName)
            {
            // defines the top level menu option
            case "":
                result = MAIN_MENU;
                break;
            // defines the submenu options

            case MAIN_MENU:
                if (location == "TreeView")
                {
                    //menuEntries.Add(EXPORT_MENU);
                    //menuEntries.Add("-");
                    menuEntries.Add(SYNC_PROJECT_ROOTS_MENU);
                    menuEntries.Add(SYNC_HIERARHY_ROOTS_MENU);
                    menuEntries.Add(SYNC_HIERARHY_MENU);

                    if (selectedElement != null &&
                        selectedElement.Type == "Requirement" &&
                        selectedElement.Stereotype == "fmcreq" &&
                        !string.IsNullOrEmpty(_configuration.JiraURL) &&
                        string.IsNullOrEmpty(selectedElement.GetTaggedValueString("specifId")))
                    {
                        menuEntries.Add("-");
                        menuEntries.Add(ADD_REQIOREMENT_TO_SPECIF_REPOSITORY_MENU);
                    }

                    if (selectedElement != null &&
                        !string.IsNullOrEmpty(selectedElement.GetTaggedValueString("specifId")))
                    {
                        menuEntries.Add("-");
                        menuEntries.Add(SYNC_SINGLE_ELEMENT_MENU);
                    }

                    if (objectType == EAAPI.ObjectType.otPackage &&
                        selectedElement != null &&
                        selectedElement.Stereotype == "specification")
                    {
                        menuEntries.Add("-");
                        menuEntries.Add(ADD_SPECIFICATION_TO_SPECIF_MENU);
                    }
                }
                else if (location == "MainMenu")
                {
                    menuEntries.Add(EDIT_SETTINGS_MENU);
                    menuEntries.Add("-");
                    menuEntries.Add(ABOUT_MENU);
                }
                result = menuEntries.ToArray();
                break;
            }

            return(result);
        }
Exemple #16
0
        /// <summary>
        /// Get the current Diagram with it's selected objects and connectors.
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="getAllDiagramObject">True if you want all diagram objects if nothing no diagram object is selected</param>
        public EaDiagram(Repository rep, bool getAllDiagramObject = false)
        {
            _rep = rep;
            _selectedConnector = null;
            IsSelectedObjects  = false;

            _dia = rep.GetCurrentDiagram();
            // Nothing selected
            if (_dia == null || (_dia.SelectedConnector == null && _dia.SelectedObjects.Count == 0))
            {
                GetTreeSelected();
                return;
            }

            EA.ObjectType contextObjectType = Rep.GetContextItemType();


            // Check if context is diagram or something inside the current diagram is selected (selected things are never old)
            if (contextObjectType != ObjectType.otDiagram && _dia.SelectedObjects.Count == 0 &&
                _dia.SelectedConnector == null)
            {
                return;
            }


            // Diagram is context or something inside the diagram is selected
            IsSelectedObjects = false;
            if (_dia.SelectedObjects.Count == 0 && getAllDiagramObject)
            {
                // overall diagram objects
                foreach (EA.DiagramObject obj in _dia.DiagramObjects)
                {
                    _selectedObjects.Add(obj);
                    SelElements.Add(rep.GetElementByID(obj.ElementID));
                }
            }
            // If an context element exists than this is the last selected element
            if (_dia.SelectedObjects.Count > 0)
            {
                // The context item isn't always set, try to estimate it
                if (contextObjectType == EA.ObjectType.otElement ||
                    contextObjectType == EA.ObjectType.otPackage ||
                    contextObjectType == EA.ObjectType.otNone ||
                    contextObjectType == EA.ObjectType.otDiagram
                    )
                {
                    // 1. store context element/ last selected element
                    // Context Element may be a Package. EA also stores the package as Element
                    EA.Element elContext = null;
                    switch (rep.GetContextItemType())
                    {
                    case EA.ObjectType.otElement:
                        elContext = (EA.Element)rep.GetContextObject();
                        break;

                    case EA.ObjectType.otPackage:
                        var pkg = (EA.Package)rep.GetContextObject();
                        elContext = rep.GetElementByGuid(pkg.PackageGUID);
                        break;
                    }

                    // no context element available, take first element
                    if (elContext == null)
                    {
                        EA.DiagramObject obj = (EA.DiagramObject)_dia.SelectedObjects.GetAt(0);
                        elContext = rep.GetElementByID(obj.ElementID);
                    }
                    _conTextDiagramObject = _dia.GetDiagramObjectByID(elContext.ElementID, "");

                    SelElements.Add(elContext);
                    _selectedObjects.Add(_conTextDiagramObject);
                    IsSelectedObjects = true;

                    // over all selected diagram objects
                    foreach (EA.DiagramObject obj in _dia.SelectedObjects)
                    {
                        // skip last selected element / context element
                        if (_conTextDiagramObject != null && obj.ElementID == _conTextDiagramObject.ElementID)
                        {
                            continue;
                        }

                        _selectedObjects.Add(obj);
                        SelElements.Add(rep.GetElementByID(obj.ElementID));
                    }
                }
            }
            _selectedConnector = _dia.SelectedConnector;
        }
Exemple #17
0
 public EaHistoryListEntry(EA.ObjectType eaType, string guid)
 {
     EaTyp = eaType;
     Guid  = guid;
     //this.update();
 }
Exemple #18
0
        public static void DiagramObjectMove(Repository rep)
        {
            // Package in browser selected
            // only copy elements of type element
            EA.ObjectType objType = rep.GetTreeSelectedItemType();

            // if diagram: get the Element or Package

            EA.Package pkg      = null;
            EA.Element elTarget = null;
            if (objType == EA.ObjectType.otDiagram)
            {
                var dia = (EA.Diagram)rep.GetTreeSelectedObject();
                if (dia.ParentID == 0)
                {
                    pkg = rep.GetPackageByID(dia.PackageID);
                }
                else
                {
                    elTarget = rep.GetElementByID(dia.ParentID);
                }
            }

            if (objType == EA.ObjectType.otPackage || pkg != null)
            {
                // get selected DiagramObjects
                EaDiagram eaDia = new EaDiagram(rep, getAllDiagramObject: false);

                // Handle selected diagram and its selected items (connector/objects)
                if (eaDia.Dia != null)
                {
                    if (objType == EA.ObjectType.otPackage && pkg == null)
                    {
                        pkg = (EA.Package)rep.GetTreeSelectedObject();
                    }
                    // over all selected objects
                    var count = 0;

                    foreach (var dObj in eaDia.SelObjects)
                    {
                        EA.Element el = rep.GetElementByID(dObj.ElementID);
                        // don't change nested elements, you have to move the root element
                        if (el.Type != "Package" && el.ObjectType == EA.ObjectType.otElement && el.ParentID == 0)
                        {
                            el.PackageID = pkg.PackageID;
                            el.Update();
                            count = count + 1;
                        }
                    }
                    rep.RefreshModelView(pkg.PackageID);
                    if (count != eaDia.SelObjects.Count)
                    {
                        MessageBox.Show($@"Total items: {eaDia.SelObjects.Count}
Moved items: {count}

If item is a nested item only the root will be copied.
", @"not all items moved");
                    }
                }
            }
            // Element in browser selected, or element to copy beneath exists
            if (rep.GetTreeSelectedItemType() == EA.ObjectType.otElement || elTarget != null)
            {
                if (elTarget == null)
                {
                    elTarget = (EA.Element)rep.GetTreeSelectedObject();
                }

                // get selected DiagramObjects
                EaDiagram eaDia = new EaDiagram(rep, getAllDiagramObject: false);

                // Handle selected diagram and its selected items (connector/objects)
                if (eaDia.Dia != null)
                {
                    // over all selected objects
                    foreach (var dObj in eaDia.SelObjects)
                    {
                        EA.Element el = rep.GetElementByID(dObj.ElementID);
                        // don't change nested elements, you have to move the root element
                        // don't copy to itself
                        if (el.Type != "Package" && el.ObjectType == EA.ObjectType.otElement && el.ParentID == 0 && el.ElementID != elTarget.ElementID)
                        {
                            el.ParentID = elTarget.ElementID;
                            el.Update();
                        }
                    }
                }
            }
        }