Java 类org.eclipse.emf.ecore.impl.DynamicEObjectImpl 实例源码

项目:NEXCORE-UML-Modeler    文件:ProjectUtil.java   
/**
 * updateParentInExplorer
 *  
 * @param target void
 */
public static void updateParentInExplorer(EObject target) {
    if (null == target) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    EObject parent = UMLManager.getParent((Element) target);
    targetNode = UMLTreeNodeRegistry.getTreeNode(parent);
    String[] flags = null;
    flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT,
        IBasicPropertyConstants.P_CHILDREN };
    commonViewer.update(targetNode, flags);
}
项目:OpenSPIFe    文件:TemporalMemberUtils.java   
public static boolean hasDurationFormula(TemporalMember temporalMember) {
    EPlanElement ePlanElement = temporalMember.getPlanElement();
    if (ePlanElement instanceof EActivity) {
        EActivity eActivity = (EActivity)ePlanElement;
        EObject eObject = eActivity.getData();
        if (eObject instanceof DynamicEObjectImpl) {
            DynamicEObjectImpl dynamicEObjectImpl = (DynamicEObjectImpl)eObject;
            EClass eClass = dynamicEObjectImpl.eClass();
            if(eClass instanceof EActivityDef) {
                EActivityDef eActivityDef = (EActivityDef) eClass;
                String duration = eActivityDef.getDuration();
                if ((duration != null) && duration.trim().length() > 0) {
                    return true;
                }
            }
        }
    }
    return false;
}
项目:OpenSPIFe    文件:TemplatePlanUtils.java   
/**
 * Returns all folder models contained in the selection. If any non model items are found, an empty collection is returned.
 * 
 */
public static List<DynamicEObjectImpl> getAllFolderModels(IStructuredSelection structuredSelection) {
    List<DynamicEObjectImpl> models = new ArrayList<DynamicEObjectImpl>();
    List list = structuredSelection.toList();
    for (Object object : list) {
        if (object instanceof IAdaptable) {
            IAdaptable adaptable = (IAdaptable) object;
            Object adapter = adaptable.getAdapter(DynamicEObjectImpl.class);
            if (adapter instanceof DynamicEObjectImpl) {
                models.add((DynamicEObjectImpl) adapter);
            } else {
                return Collections.emptyList();
            }
        }
    }
    return models;
}
项目:OpenSPIFe    文件:PlanDiffListImpl.java   
private Set<ReferenceAndEObject> getReferences(EActivity activityInstance) {
    Set<ReferenceAndEObject> result = new HashSet<ReferenceAndEObject>();
    EObject activityDef = activityInstance.getData();
    if (activityDef == null) { // one case it's null is in some JUnit tests
        return result; // return empty set
    }
    EList<EReference> allReferences = activityDef.eClass().getEAllReferences();
    for(EReference reference : allReferences) {
        // Is this a dynamic resource?
        if (reference instanceof EReferenceParameter) {
            Object refList = activityDef.eGet(reference);
            if (refList instanceof Collection) // e.g. crew, filters, execution notes {
                for (DynamicEObjectImpl object : (Collection<? extends DynamicEObjectImpl>) refList) {
                    result.add(new ReferenceAndEObject(reference, object));
                }
            else if (refList instanceof EObject) { // e.g. OpsNote
                result.add(new ReferenceAndEObject(reference, (EObject) refList));
            }
        }
       }
    return result;
}
项目:NEXCORE-UML-Modeler    文件:ProjectUtil.java   
/**
 * refreshNodeInExplorer
 *  
 * @param target void
 */
public static void refreshNodeInExplorer(EObject target) {
    if (target instanceof EAnnotation) {
        return;
    }
    if (null == target) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }

    ISelection selection = commonViewer.getSelection();
    TreePath[] expanedTreePaths = TreeItemUtil.getExpandTreePaths(commonViewer.getTree()).clone();

    /*
     * stereotype인 경우 전달 객체가 DynamicEobjectImpl이므로 할당된 클래스를 계산하여 처리해야 함.
     */
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    targetNode = UMLTreeNodeRegistry.getTreeNode(target);

    if (null != targetNode) {
        commonViewer.refresh(targetNode);
        TreeItemUtil.expandTreePath(expanedTreePaths, selection);
    }
}
项目:NEXCORE-UML-Modeler    文件:ProjectUtil.java   
/**
 * updateExplorer
 *  
 * @param target
 * @param childIncluded void
 */
public static void updateExplorer(EObject target, boolean childIncluded) {
    if (null == target) {
        return;
    }
    if (target instanceof EAnnotation) {
        return;
    }
    CommonViewer commonViewer = ViewerRegistry.getViewer();
    if (commonViewer.getControl().isDisposed()) {
        return;
    }
    if (target instanceof DynamicEObjectImpl) {
        target = UMLUtil.getBaseElement(target);
    }
    ITreeNode targetNode = null;
    targetNode = UMLTreeNodeRegistry.getTreeNode(target);
    if (null == targetNode) {
        return;
    }
    String[] flags = null;
    if (childIncluded) {
        flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT,
            IBasicPropertyConstants.P_CHILDREN };
    } else {
        flags = new String[] { IBasicPropertyConstants.P_IMAGE, IBasicPropertyConstants.P_TEXT };
    }
    try {
        commonViewer.update(targetNode, flags);
        commonViewer.refresh(targetNode);
    } catch (Exception ex) {
        Log.error(ex);
    }
}
项目:NEXCORE-UML-Modeler    文件:ModifyDetailValueDialog.java   
/**
 * 생성자
 * 
 * @param parent
 * @param parentObject
 * @param title
 * @param detailValueList
 */
public ModifyDetailValueDialog(Shell parent, DynamicEObjectImpl parentObject, String title,
EList<EStructuralFeature> detailValueList) {
    this(parent);

    this.parentObject = parentObject;
    this.title = title;
    this.detailValueList = detailValueList;
}
项目:NEXCORE-UML-Modeler    文件:HandleDetailValueCommand.java   
/**
 * 생성자
 * 
 * @param domain
 * @param parentObject
 * @param selectedObject
 * @param inputValue
 */
public HandleDetailValueCommand(TransactionalEditingDomain domain, DynamicEObjectImpl parentObject,
EStructuralFeature selectedObject, Object inputValue) {
    super(domain);

    this.parentObject = parentObject;
    this.selectedObject = selectedObject;
    this.inputValue = inputValue;
}
项目:OpenSPIFe    文件:PlanPatchBuilder.java   
@Override
public void generateDisplayMessage(EObject target, PatchFeatureChange featureChange) {
    if (target instanceof EMember) {
        EPlanElement planElement = ((EMember) target).getPlanElement();
        super.generateDisplayMessage(planElement, featureChange);
    } else if (target instanceof DynamicEObjectImpl) {
        if (target.eContainer() instanceof EPlanElement) {
            super.generateDisplayMessage(target.eContainer(), featureChange);
        }
    } else {
        super.generateDisplayMessage(target, featureChange);
    }
}
项目:OpenSPIFe    文件:PlanDiffUtils.java   
/**
 * Tries various ways of getting the name of an EMF object.
 * @param object -- object whose name to get
 * @return a string in all cases, unless object itself is null.
 */
static public String getObjectName(EObject object) {
    if (object==null) return null;
    String displayName = getObjectNameOrNull(object);
    if (displayName == null) displayName = findBuriedName(object);
    if (displayName != null) return displayName;
    if (displayName == null && object.eIsProxy() && object instanceof DynamicEObjectImpl) {
        return "[Unresolved reference to " + ((DynamicEObjectImpl)object).eProxyURI().toString() + "]";
    }
    else
        return displayName; /// "Unnamed " + object.eClass().getName();
}
项目:OpenSPIFe    文件:PlanDiffUtils.java   
public static String getObjectId(EObject object) {
    if (object.eIsProxy() && object instanceof DynamicEObjectImpl) {
        return ((DynamicEObjectImpl)object).eProxyURI().fragment();
    }
    String id1 = ADParameterUtils.getObjectString(object, "id");
    if (id1 != null) return id1;
    String id2 = ADParameterUtils.getObjectString(object, "id");
    if (id2 != null) return id2;
    return null;
}
项目:OpenSPIFe    文件:PlanDiffUtils.java   
public static String structureToStrings(DynamicEObjectImpl structure) {
    StringBuilder s = new StringBuilder();
    for (EStructuralFeature field : structure.eClass().getEStructuralFeatures()) {
        Object value = structure.eGet(field, true, true);
        if (value instanceof String) {
            s.append(value.toString());
            s.append('\n');
        }
    }
    return s.toString();
}
项目:NIEM-Modeling-Tool    文件:IsPOCType.java   
@Override
protected boolean match(final Object selection) {
    if (selection instanceof DynamicEObjectImpl) {
        final EObject element = (EObject) selection;
        if ("POCType".equals(element.eClass().getName())) {
            return true;
        }
    }
    return false;
}
项目:emf-fragments    文件:FStoreImpl.java   
private Object getUserValue(Object internalValue, EStructuralFeature userFeature) {
    if (userFeature != null && userFeature.getEType() instanceof EEnum) {
        return EcoreUtil.createFromString((EDataType) userFeature.getEType(), internalValue.toString());
    } else if (internalValue != null && internalValue instanceof DynamicEObjectImpl) {
        FInternalObjectImpl internalObject = (FInternalObjectImpl) internalValue;
        return getUserObject(internalObject);
    } else {
        return internalValue;
    }
}
项目:NEXCORE-UML-Modeler    文件:MultiValueLabelProvider.java   
/**
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
 *      int)
 */
public String getColumnText(Object element, int columnIndex) {
    String result = ""; //$NON-NLS-1$

    if (element != null) {
        if (element instanceof String) {
            switch (columnIndex) {
                case 0:
                    result = String.valueOf(index);
                    break;
                case 1:
                    result = (String) element;
                    index++;
                    break;
                default:
                    break;
            }
        } else if (element instanceof DynamicEObjectImpl) {
            switch (columnIndex) {
                case 0:
                    result = String.valueOf(index);
                    break;
                case 1:
                    result = ((DynamicEObjectImpl) element).eClass().getName();
                    index++;
                    break;
                default:
                    break;
            }
        } else if (element instanceof EClass) {
            switch (columnIndex) {
                case 0:
                    result = String.valueOf(index);
                    break;
                case 1:
                    result = ((EClass) element).toString();
                    index++;
                    break;
                default:
                    break;
            }
        }
    }

    return result;
}
项目:NEXCORE-UML-Modeler    文件:DetailValueLabelProvider.java   
/**
 * 생성자
 * 
 * @param parentObject
 */
public DetailValueLabelProvider(DynamicEObjectImpl parentObject) {
    this.parentObject = parentObject;
}