public HyperlinkAction(IDEState ids, GUIResources resources){ this.ids=ids; this.resources=resources; browser=new BrowserImp(ids); }
public static boolean compare(Browser bimp1, Browser bimp2) { return findAllDifferences(bimp1, bimp2).isEmpty() && findAllDifferences(bimp2, bimp1).isEmpty(); }
public GraphEntity findEntity(String id){ GraphEntity[] ents=this.getAllEntities(); boolean found=false; int k=0; for (k=0;k<ents.length &&!found;k++){ found=ents[k].getID().equals(id); } if (found) return ents[k-1]; else return null; }
private boolean differentContent() { try { Browser bimp=BrowserImp.initialise(watchedFile.getCanonicalPath()); ModelJGraph.enableAllListeners(); // a browser initialised through the initialise method is assumed to be //linked to no gui. Therefore, the persistence does load the spec without any listeners // and this prevents some runtime exception due to the event managers acting over elements in the specification // which were not layered out. This causes the listeners to be disabled by default, which is handled by // a static var. So, loading a new spec in headless mode causes a gui to ignore events. //return !BrowserImp.compare(bimp, new BrowserImp(ide.getIds())); Vector<String> diffs2 = BrowserImp.findAllDifferences(bimp, new BrowserImp(ide.getIds())); Vector<String> diffs1=BrowserImp.findAllDifferences(new BrowserImp(ide.getIds()),bimp); return !diffs2.isEmpty() || !diffs1.isEmpty(); } catch (UnknowFormat e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DamagedFormat e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (CannotLoad e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
evaluateSimpleValueField(ent1, differences, gaE1, gaE2); } else evaluateCollectionValueField(ent1, alreadyVerified, differences, found, gaE1, gaE2); } else { if (gaE1.isEntityValue() && gaE2.isEntityValue()) evaluateEntityValueField(ent1, alreadyVerified, differences, gaE1, gaE2); else {
BrowserImp bimp=new BrowserImp(ids); bimp.getGraph(diagramPath); g = bimp.getGraph(diagramPath); ids.editor.changeGraph(g.getGraph());
public static Vector<String> findAllDifferences(Browser bimp1, Browser bimp2){ GraphEntity[] entities = bimp1.getAllEntities(); boolean allIncluded=true; Vector<String> differences=new Vector<String>(); int k=0; while (k<entities.length){ GraphEntity ent1 = entities[k]; GraphEntity ent2 = bimp2.findEntity(ent1.getID()); allIncluded=allIncluded && ent2!=null; if (ent2==null){ differences.add("entity "+ent1.getID()+":"+ent1.getType()+" does not exist"); } else { differences.addAll(checkEntity(ent1, ent2, new Vector())); } k++; } return differences; }
public static boolean containedInto(Browser bimp1, Browser bimp2){ GraphEntity[] entities = bimp1.getAllEntities(); boolean allIncluded=true; int k=0; while (allIncluded && k<entities.length){ GraphEntity ent1 = entities[k]; GraphEntity ent2 = bimp2.findEntity(ent1.getID()); allIncluded=allIncluded && ent2!=null; allIncluded = allIncluded && containedIntoAttributes(allIncluded, ent1, ent2); Vector<GraphRelationship> relationships1 = ent1.getAllRelationships(); Vector<GraphRelationship> relationships2 = ent2.getAllRelationships(); int j=0; allIncluded=allIncluded && relationships1.size()==relationships2.size(); while (allIncluded && j<relationships1.size()){ GraphRelationship gr1=relationships1.elementAt(j); boolean found=false; for (int l=0;l<relationships2.size() && !found;l++){ GraphRelationship gr2=relationships2.elementAt(l); found=found || (gr2.getID().equals(gr1.getID()) && containedIntoAttributes(allIncluded, gr1, gr2)); } allIncluded=allIncluded && found; j++; } k++; } return allIncluded; }
if (!alreadyVerified.contains(ent1)){ alreadyVerified.add(ent1); Vector<String> fieldDifferences=checkFields(ent1,ent2,alreadyVerified); differences.addAll(fieldDifferences); if (!fieldDifferences.isEmpty()){
public void actionPerformed(ActionEvent e) { Log.getInstance().logERROR("Replacing"); try { Vector<GraphRelationship> rels = browser.findEntity(ent.getId()).getAllRelationships(); Entity newent = ConvertUtils.convert(state,ent.getId(), ent.getType(), current); for (int j=0;j<rels.size();j++){ ((GraphRelationshipImp)rels.elementAt(j)).getNAryEdge().replace(ent.getId(),newent); } Vector<ModelJGraph> models = state.gm.getUOModels(); for (int j=0;j<models.size();j++){ GraphModel mjg = models.elementAt(j).getModel(); for (int l=0;l<mjg.getRootCount();l++){ if (((DefaultGraphCell)mjg.getRootAt(l)).getUserObject().equals(ent)){ ((DefaultGraphCell)mjg.getRootAt(l)).setUserObject(newent); Log.getInstance().logERROR("Replaced in model "+models.elementAt(j).getName()); } } } } catch (Exception e1) { e1.printStackTrace(); Log.getInstance().log(e1.getMessage()); } } });
private Vector<String> getDifferences() { try { Browser bimp=BrowserImp.initialise(watchedFile.getCanonicalPath()); ModelJGraph.enableAllListeners(); // a browser initialised through the initialise method is assumed to be //linked to no gui. Therefore, the persistence does load the spec without any listeners // and this prevents some runtime exception due to the event managers acting over elements in the specification // which were not layered out. This causes the listeners to be disabled by default, which is handled by // a static var. So, loading a new spec in headless mode causes a gui to ignore events. //return !BrowserImp.compare(bimp, new BrowserImp(ide.getIds())); Vector<String> diffs2 = BrowserImp.findAllDifferences(bimp, new BrowserImp(ide.getIds())); Vector<String> diffs1=BrowserImp.findAllDifferences(new BrowserImp(ide.getIds()),bimp); diffs1.addAll(diffs2); if (diffs1.size()>0) System.out.println("aqui"); return diffs1; } catch (UnknowFormat e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DamagedFormat e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (CannotLoad e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return new Vector<String>(); }
} else if (entValue1!=null && entValue2!=null){ Vector<String> cdifferences = checkEntity(entValue1,entValue2,alreadyVerified); differences.addAll(cdifferences); found=cdifferences.isEmpty();
public ObjectTreeMenuEntries(IDEState ids, GUIResources resources){ this.ids=ids; this.resources=resources; browser=new BrowserImp(ids); }
for (int l=0;l<colValue1.size();l++){ try { cdifferences.addAll(checkEntity(colValue1.getElementAt(l), colValue2.getElementAt(l), alreadyVerified));
/** * Performs an empty initialisation. Only works when there is an already existing * instance of GraphManager * *@exception Exception Description of Exception */ public static void initialise(IDEState ids) { // To check if it is initialised browser = new BrowserImp(ids); }
public UpdateToolsAndCG(ManageExtensions me, ModuleLoader ml, IDEState ids) { this.me = me; this.ids=ids; this.ml=ml; browser=new BrowserImp(ids); }
public CommonMenuEntriesActionFactory(GUIResources resources, IDEState state){ this.resources=resources; this.state=state; browser=new BrowserImp(state); }
public GraphRelationshipFactory(IDEState ids){ this.ids=ids; browser=new BrowserImp(ids); }
/** * Initialises the diagram browser with a INGENIAS specification file * *@param file Description of Parameter *@exception Exception Description of Exception */ public static Browser initialise(String file) throws ingenias.exception.UnknowFormat, ingenias.exception.DamagedFormat, ingenias.exception.CannotLoad { //browser = new BrowserImp(IDEState.emptyIDEState()); browser = new BrowserImp(file); return browser; }
public static void main(String[] args) { ObjectLoad objectLoad1 = new ObjectLoadImp1(new BrowserImp(IDEState.emptyIDEState())); }