KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > text > build > BuildModel


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core.text.build;
12
13 import java.io.IOException JavaDoc;
14 import java.io.InputStream JavaDoc;
15
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.jface.text.IDocument;
18 import org.eclipse.pde.core.build.IBuild;
19 import org.eclipse.pde.core.build.IBuildModel;
20 import org.eclipse.pde.core.build.IBuildModelFactory;
21 import org.eclipse.pde.internal.core.NLResourceHelper;
22 import org.eclipse.pde.internal.core.text.AbstractEditingModel;
23
24
25 public class BuildModel extends AbstractEditingModel implements IBuildModel {
26     
27     //private Properties fProperties;
28
private BuildModelFactory fFactory;
29     private Build fBuild;
30
31     /**
32      * @param document
33      * @param isReconciling
34      */

35     public BuildModel(IDocument document, boolean isReconciling) {
36         super(document, isReconciling);
37     }
38     /* (non-Javadoc)
39      * @see org.eclipse.pde.internal.ui.model.AbstractEditingModel#createNLResourceHelper()
40      */

41     protected NLResourceHelper createNLResourceHelper() {
42         return null;
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.pde.core.IModel#load(java.io.InputStream, boolean)
47      */

48     public void load(InputStream JavaDoc source, boolean outOfSync) throws CoreException {
49         try {
50             fLoaded = true;
51             ((Build)getBuild()).load(source);
52         } catch (IOException JavaDoc e) {
53             fLoaded = false;
54         }
55     }
56     
57     /* (non-Javadoc)
58      * @see org.eclipse.pde.internal.ui.model.AbstractEditingModel#adjustOffsets(org.eclipse.jface.text.IDocument)
59      */

60     public void adjustOffsets(IDocument document) {
61         ((Build)getBuild()).adjustOffsets(document);
62     }
63     
64     /* (non-Javadoc)
65      * @see org.eclipse.pde.core.build.IBuildModel#getBuild()
66      */

67     public IBuild getBuild() {
68         if (fBuild == null)
69             fBuild = new Build(this);
70         return fBuild;
71     }
72     /* (non-Javadoc)
73      * @see org.eclipse.pde.core.build.IBuildModel#getFactory()
74      */

75     public IBuildModelFactory getFactory() {
76         if (fFactory == null)
77             fFactory = new BuildModelFactory(this);
78         return fFactory;
79     }
80 }
Popular Tags