|
From: jistrawn <jis...@us...> - 2006-10-24 21:43:50
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/profileViewer In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3447/src/net/sourceforge/modelWizard/profileViewer Modified Files: Intermediary.java Log Message: removed unused imports or reformatted import order (ctrl-shift-o) Index: Intermediary.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/profileViewer/Intermediary.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Intermediary.java 23 Nov 2005 23:27:08 -0000 1.3 --- Intermediary.java 24 Oct 2006 21:43:46 -0000 1.4 *************** *** 1,157 **** ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.profileViewer; ! ! import net.sourceforge.modelWizard.Profile.Class; ! import net.sourceforge.modelWizard.Profile.Method; ! import net.sourceforge.modelWizard.Profile.Property; ! import net.sourceforge.modelWizard.backingModelAbstraction.IAssociation; ! import net.sourceforge.modelWizard.backingModelAbstraction.IClass; ! import net.sourceforge.modelWizard.backingModelAbstraction.IMethod; ! import net.sourceforge.modelWizard.backingModelAbstraction.IModel; ! import net.sourceforge.modelWizard.backingModelAbstraction.INamedElement; ! import net.sourceforge.modelWizard.backingModelAbstraction.IProperty; ! import net.sourceforge.modelWizard.modelAbstraction.ModelAccess; ! ! import java.util.ArrayList; ! import java.util.Iterator; ! ! ! /** ! * @author stjerman ! * ! * TODO To change the template for this generated type comment go to Window - ! * Preferences - Java - Code Style - Code Templates ! */ ! public class Intermediary { ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) ! */ ! public static final int PROFILE_PROPS = 1; ! public static final int OTHER_PROPS = 2; ! public static final int PROFILE_METHODS = 3; ! public static final int OTHER_METHODS = 4; ! int type; ! private Class theClass; ! private INamedElement modelElement; ! private IModel model = ModelAccess.INSTANCE.getCurrentModel(); ! ! Intermediary(int type, Class theClass) { ! this.type = type; ! this.theClass = theClass; ! modelElement = model.findElement(theClass.getClassName()); ! } ! ! public String getText() { ! switch (type) { ! case PROFILE_PROPS: ! return "Blueprint Properties"; ! ! case OTHER_PROPS: ! return "Model Properties"; ! ! case PROFILE_METHODS: ! return "Blueprint Methods"; ! ! case OTHER_METHODS: ! return "Model Methods"; ! } ! ! return null; ! } ! ! public Property[] getProfileProperties() { ! return (Property[]) theClass.getProperty().toArray(new Property[] { }); ! } ! ! public Object[] getOtherProperties() { ! ArrayList otherProps = new ArrayList(); ! ! if (modelElement instanceof IClass) { ! otherProps.addAll(((IClass) modelElement).getProperties(true) ! .values()); ! } ! ! if (modelElement instanceof IAssociation) { ! otherProps.addAll(((IAssociation) modelElement).getEnds().values()); ! } ! ! Iterator allProps = otherProps.iterator(); ! Property[] profProps = getProfileProperties(); ! ArrayList props = new ArrayList(); ! ! while (allProps.hasNext()) { ! IProperty p = (IProperty) allProps.next(); ! boolean here = false; ! ! for (int n = 0; n < profProps.length; n++) { ! if (profProps[n].getPropertyName().equalsIgnoreCase(p.getName())) { ! here = true; ! } ! } ! ! if (!here) { ! props.add(p); ! } ! } ! ! return props.toArray(); ! } ! ! public Method[] getProfileMethods() { ! return (Method[]) theClass.getMethod().toArray(); ! } ! ! public Object[] getOtherMethods() { ! ArrayList methods = new ArrayList(); ! ! if (modelElement instanceof IClass) { ! Iterator allMethods = ((IClass) modelElement).getMethods(true) ! .values().iterator(); ! Method[] profMethods = getProfileMethods(); ! ! while (allMethods.hasNext()) { ! IMethod m = (IMethod) allMethods.next(); ! boolean here = false; ! ! for (int n = 0; n < profMethods.length; n++) { ! if (profMethods[n].getMethodName().equalsIgnoreCase(m.getName())) { ! here = true; ! } ! } ! ! if (!here) { ! methods.add(m); ! } ! } ! } ! ! return methods.toArray(); ! } ! ! /** ! * @return Returns the theClass. ! */ ! public Class getTheClass() { ! return theClass; ! } ! ! public int getType() { ! return type; ! } ! } --- 1,157 ---- ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.profileViewer; ! ! import java.util.ArrayList; ! import java.util.Iterator; ! ! import net.sourceforge.modelWizard.Profile.Class; ! import net.sourceforge.modelWizard.Profile.Method; ! import net.sourceforge.modelWizard.Profile.Property; ! import net.sourceforge.modelWizard.backingModelAbstraction.IAssociation; ! import net.sourceforge.modelWizard.backingModelAbstraction.IClass; ! import net.sourceforge.modelWizard.backingModelAbstraction.IMethod; ! import net.sourceforge.modelWizard.backingModelAbstraction.IModel; ! import net.sourceforge.modelWizard.backingModelAbstraction.INamedElement; ! import net.sourceforge.modelWizard.backingModelAbstraction.IProperty; ! import net.sourceforge.modelWizard.modelAbstraction.ModelAccess; ! ! ! /** ! * @author stjerman ! * ! * TODO To change the template for this generated type comment go to Window - ! * Preferences - Java - Code Style - Code Templates ! */ ! public class Intermediary { ! /* ! * (non-Javadoc) ! * ! * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) ! */ ! public static final int PROFILE_PROPS = 1; ! public static final int OTHER_PROPS = 2; ! public static final int PROFILE_METHODS = 3; ! public static final int OTHER_METHODS = 4; ! int type; ! private Class theClass; ! private INamedElement modelElement; ! private IModel model = ModelAccess.INSTANCE.getCurrentModel(); ! ! Intermediary(int type, Class theClass) { ! this.type = type; ! this.theClass = theClass; ! modelElement = model.findElement(theClass.getClassName()); ! } ! ! public String getText() { ! switch (type) { ! case PROFILE_PROPS: ! return "Blueprint Properties"; ! ! case OTHER_PROPS: ! return "Model Properties"; ! ! case PROFILE_METHODS: ! return "Blueprint Methods"; ! ! case OTHER_METHODS: ! return "Model Methods"; ! } ! ! return null; ! } ! ! public Property[] getProfileProperties() { ! return (Property[]) theClass.getProperty().toArray(new Property[] { }); ! } ! ! public Object[] getOtherProperties() { ! ArrayList otherProps = new ArrayList(); ! ! if (modelElement instanceof IClass) { ! otherProps.addAll(((IClass) modelElement).getProperties(true) ! .values()); ! } ! ! if (modelElement instanceof IAssociation) { ! otherProps.addAll(((IAssociation) modelElement).getEnds().values()); ! } ! ! Iterator allProps = otherProps.iterator(); ! Property[] profProps = getProfileProperties(); ! ArrayList props = new ArrayList(); ! ! while (allProps.hasNext()) { ! IProperty p = (IProperty) allProps.next(); ! boolean here = false; ! ! for (int n = 0; n < profProps.length; n++) { ! if (profProps[n].getPropertyName().equalsIgnoreCase(p.getName())) { ! here = true; ! } ! } ! ! if (!here) { ! props.add(p); ! } ! } ! ! return props.toArray(); ! } ! ! public Method[] getProfileMethods() { ! return (Method[]) theClass.getMethod().toArray(); ! } ! ! public Object[] getOtherMethods() { ! ArrayList methods = new ArrayList(); ! ! if (modelElement instanceof IClass) { ! Iterator allMethods = ((IClass) modelElement).getMethods(true) ! .values().iterator(); ! Method[] profMethods = getProfileMethods(); ! ! while (allMethods.hasNext()) { ! IMethod m = (IMethod) allMethods.next(); ! boolean here = false; ! ! for (int n = 0; n < profMethods.length; n++) { ! if (profMethods[n].getMethodName().equalsIgnoreCase(m.getName())) { ! here = true; ! } ! } ! ! if (!here) { ! methods.add(m); ! } ! } ! } ! ! return methods.toArray(); ! } ! ! /** ! * @return Returns the theClass. ! */ ! public Class getTheClass() { ! return theClass; ! } ! ! public int getType() { ! return type; ! } ! } |