/** * 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); }
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; }
/** * 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; }
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; }
/** * 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); } }
/** * 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); } }
/** * 생성자 * * @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; }
/** * 생성자 * * @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; }
@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); } }
/** * 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(); }
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; }
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(); }
@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; }
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; } }
/** * @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; }
/** * 생성자 * * @param parentObject */ public DetailValueLabelProvider(DynamicEObjectImpl parentObject) { this.parentObject = parentObject; }