01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * Portions Copyrighted 2007 Sun Microsystems, Inc.
16: */
17: package org.netbeans.modules.xslt.mapper.model;
18:
19: import org.netbeans.modules.xslt.mapper.view.XsltMapper;
20:
21: /**
22: *
23: * @author Alexey
24: * Keeps mapper trees in-sync with schema models
25: * Subscribes on changes in schema model and reloads left and right trees
26: *
27: */
28: public class SchemaModelBridge extends ModelBridge {
29:
30: public SchemaModelBridge(XsltMapper mapper) {
31: super (mapper);
32: if (mapper.getContext().getSourceType() != null) {
33: // super.subscribe(mapper.getContext().getSourceType().getModel());
34: }
35:
36: if (mapper.getContext().getTargetType() != null) {
37: // super.subscribe(mapper.getContext().getTargetType().getModel());
38: }
39: }
40:
41: protected void onModelChanged() {
42: if (!checkErrors()) {
43: return;
44: }
45: super .reloadTree(getMapper().getMapperViewManager()
46: .getDestView().getTree());
47: super .reloadTree(getMapper().getMapperViewManager()
48: .getSourceView().getTree());
49:
50: getMapper().getBuilder().updateDiagram(false);
51: }
52: }
|