View | Details | Raw Unified | Return to bug 248953 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/ui/tests/runtime/LocalModelTest.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.ui.tests.runtime;
11
package org.eclipse.pde.ui.tests.runtime;
12
12
13
import java.net.URISyntaxException;
14
15
import java.net.URI;
13
import junit.framework.Test;
16
import junit.framework.Test;
14
import junit.framework.TestSuite;
17
import junit.framework.TestSuite;
15
import org.eclipse.pde.internal.runtime.registry.model.RegistryModel;
18
import org.eclipse.pde.internal.runtime.registry.model.RegistryModel;
Lines 17-24 Link Here
17
20
18
public class LocalModelTest extends AbstractRegistryModelTest {
21
public class LocalModelTest extends AbstractRegistryModelTest {
19
22
20
	protected RegistryModel createModel() {
23
	protected RegistryModel createModel() throws URISyntaxException {
21
		return RegistryModelFactory.getRegistryModel("local");
24
		return RegistryModelFactory.getRegistryModel(new URI("local:///"));
22
	}
25
	}
23
	
26
	
24
	public static Test suite() {
27
	public static Test suite() {
(-)src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java (+20 lines)
Lines 1-3 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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
 *******************************************************************************/
1
package org.eclipse.pde.internal.runtime.registry.model;
11
package org.eclipse.pde.internal.runtime.registry.model;
2
12
3
import java.util.ArrayList;
13
import java.util.ArrayList;
Lines 64-67 Link Here
64
	public int hashCode() {
74
	public int hashCode() {
65
		return uniqueIdentifier.hashCode();
75
		return uniqueIdentifier.hashCode();
66
	}
76
	}
77
78
	public void addChild(ModelObject obj) {
79
		if (obj instanceof Extension) {
80
			extensions.add(obj);
81
		}
82
	}
83
84
	public ModelObject[] getChildren() {
85
		return (ModelObject[]) extensions.toArray(new ModelObject[extensions.size()]);
86
	}
67
}
87
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/Extension.java (+24 lines)
Lines 1-3 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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
 *******************************************************************************/
1
package org.eclipse.pde.internal.runtime.registry.model;
11
package org.eclipse.pde.internal.runtime.registry.model;
2
12
3
public class Extension extends ModelObject {
13
public class Extension extends ModelObject {
Lines 81-84 Link Here
81
			return null;
91
			return null;
82
		return model.getBundle(contributor);
92
		return model.getBundle(contributor);
83
	}
93
	}
94
95
	public void addChild(ModelObject o) {
96
		if (o instanceof ConfigurationElement) {
97
			// XXX very ineffective
98
			ConfigurationElement[] tmp = new ConfigurationElement[configurationElements.length + 1];
99
			System.arraycopy(configurationElements, 0, tmp, 0, configurationElements.length);
100
			tmp[tmp.length - 1] = (ConfigurationElement) o;
101
			configurationElements = tmp;
102
		}
103
	}
104
105
	public ModelObject[] getChildren() {
106
		return configurationElements;
107
	}
84
}
108
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java (-2 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-19 Link Here
13
/**
13
/**
14
 * Delta model objects are of type IBundle, IService, IExtension, IExtensionPoint
14
 * Delta model objects are of type IBundle, IService, IExtension, IExtensionPoint
15
 */
15
 */
16
public class ModelChangeDelta {
16
public class ModelChangeDelta extends ModelObject {
17
17
18
	public static final int ADDED = 0;
18
	public static final int ADDED = 0;
19
	public static final int UPDATED = 1;
19
	public static final int UPDATED = 1;
Lines 25-33 Link Here
25
	public static final int RESOLVED = 7;
25
	public static final int RESOLVED = 7;
26
	public static final int UNRESOLVED = 8;
26
	public static final int UNRESOLVED = 8;
27
27
28
	// TODO SWITCH from HEAVY ModelChangeDelta carrying whole object, to LIGHT delta - name, type (Bundle/Service/Ext/ExtPt), id
28
	private ModelObject fObject;
29
	private ModelObject fObject;
29
	private int fFlag;
30
	private int fFlag;
30
31
32
	public ModelChangeDelta() {
33
		// empty
34
	}
35
31
	public ModelChangeDelta(ModelObject object, int flag) {
36
	public ModelChangeDelta(ModelObject object, int flag) {
32
		fObject = object;
37
		fObject = object;
33
		fFlag = flag;
38
		fFlag = flag;
Lines 40-43 Link Here
40
	public int getFlag() {
45
	public int getFlag() {
41
		return fFlag;
46
		return fFlag;
42
	}
47
	}
48
49
	public void addChild(ModelObject o) {
50
		setModelObject(o);
51
	}
52
53
	public ModelObject[] getChildren() {
54
		return new ModelObject[] {fObject};
55
	}
56
57
	public void setModelObject(ModelObject fObject) {
58
		this.fObject = fObject;
59
	}
60
61
	public void setFlag(int flag) {
62
		this.fFlag = flag;
63
	}
43
}
64
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-20 Link Here
17
	public void setModel(RegistryModel model) {
17
	public void setModel(RegistryModel model) {
18
		this.model = model;
18
		this.model = model;
19
	}
19
	}
20
21
	public void addChild(ModelObject obj) {
22
		// empty
23
	}
24
25
	public ModelObject[] getChildren() {
26
		return null;
27
	}
20
}
28
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/RegistryModelFactory.java (-4 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.registry.model;
11
package org.eclipse.pde.internal.runtime.registry.model;
12
12
13
import java.net.URI;
13
14
14
/**
15
/**
15
 * Produces RegistryModels for URLs. Valid URLs:
16
 * Produces RegistryModels for URLs. Valid URLs:
Lines 20-31 Link Here
20
 */
21
 */
21
public class RegistryModelFactory {
22
public class RegistryModelFactory {
22
23
24
	public static final String LOCAL = "local"; //$NON-NLS-1$
25
23
	/**
26
	/**
24
	 * 
25
	 * @param uri
27
	 * @param uri
26
	 * @return never returns null
28
	 * @return never returns null
27
	 */
29
	 */
28
	public static RegistryModel getRegistryModel(String uri) {
30
	public static RegistryModel getRegistryModel(URI uri) {
29
		return new RegistryModel(new LocalRegistryBackend());
31
		if (uri == null)
32
			throw new IllegalArgumentException();
33
34
		if (LOCAL.equals(uri.getScheme()))
35
			return new RegistryModel(new LocalRegistryBackend());
36
37
		throw new UnsupportedOperationException();
30
	}
38
	}
31
}
39
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java (+24 lines)
Lines 1-3 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 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
 *******************************************************************************/
1
package org.eclipse.pde.internal.runtime.registry.model;
11
package org.eclipse.pde.internal.runtime.registry.model;
2
12
3
public class ConfigurationElement extends Attribute {
13
public class ConfigurationElement extends Attribute {
Lines 14-17 Link Here
14
	public Attribute[] getElements() {
24
	public Attribute[] getElements() {
15
		return elements;
25
		return elements;
16
	}
26
	}
27
28
	public ModelObject[] getChildren() {
29
		return elements;
30
	}
31
32
	public void addChild(ModelObject o) {
33
		if (o instanceof Attribute) {
34
			// XXX very ineffective
35
			Attribute[] tmp = new Attribute[elements.length + 1];
36
			System.arraycopy(elements, 0, tmp, 0, elements.length);
37
			tmp[tmp.length - 1] = (Attribute) o;
38
			elements = tmp;
39
		}
40
	}
17
}
41
}
(-)src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java (+3 lines)
Lines 274-279 Link Here
274
			return null;
274
			return null;
275
		}
275
		}
276
276
277
		if (bundleEntry == null)
278
			return null;
279
277
		try {
280
		try {
278
			bundleEntry = FileLocator.resolve(bundleEntry);
281
			bundleEntry = FileLocator.resolve(bundleEntry);
279
		} catch (IOException e) { // do nothing
282
		} catch (IOException e) { // do nothing
(-)src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java (+23 lines)
Lines 29-34 Link Here
29
	private long id;
29
	private long id;
30
	private BundleLibrary[] libraries = new BundleLibrary[0];
30
	private BundleLibrary[] libraries = new BundleLibrary[0];
31
31
32
	public ModelObject[] getChildren() {
33
		ModelObject[] children = new ModelObject[imports.length + libraries.length];
34
		System.arraycopy(imports, 0, children, 0, imports.length);
35
		System.arraycopy(libraries, 0, children, imports.length, libraries.length);
36
		return children;
37
	}
38
39
	public void addChild(ModelObject o) {
40
		if (o instanceof BundlePrerequisite) {
41
			// XXX very ineffective
42
			BundlePrerequisite[] tmp = new BundlePrerequisite[imports.length + 1];
43
			System.arraycopy(imports, 0, tmp, 0, imports.length);
44
			tmp[tmp.length - 1] = (BundlePrerequisite) o;
45
			imports = tmp;
46
		} else if (o instanceof BundleLibrary) {
47
			// XXX very ineffective
48
			BundleLibrary[] tmp = new BundleLibrary[libraries.length + 1];
49
			System.arraycopy(libraries, 0, tmp, 0, libraries.length);
50
			tmp[tmp.length - 1] = (BundleLibrary) o;
51
			libraries = tmp;
52
		}
53
	}
54
	
32
	public void setSymbolicName(String symbolicName) {
55
	public void setSymbolicName(String symbolicName) {
33
		this.symbolicName = symbolicName;
56
		this.symbolicName = symbolicName;
34
	}
57
	}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (-1 / +9 lines)
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.runtime.registry;
12
package org.eclipse.pde.internal.runtime.registry;
13
13
14
import java.net.URI;
15
import java.net.URISyntaxException;
14
import java.util.*;
16
import java.util.*;
15
import java.util.List;
17
import java.util.List;
16
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.*;
Lines 157-163 Link Here
157
	}
159
	}
158
160
159
	private void initializeModel() {
161
	private void initializeModel() {
160
		model = RegistryModelFactory.getRegistryModel("local"); //$NON-NLS-1$
162
		try {
163
			model = RegistryModelFactory.getRegistryModel(new URI("local:///")); //$NON-NLS-1$
164
			// TODO handle model not connected
165
		} catch (URISyntaxException e) {
166
			PDERuntimePlugin.log(e);
167
		}
168
161
		fTreeViewer.setInput(model);
169
		fTreeViewer.setInput(model);
162
		listener = new RegistryBrowserModelChangeListener(RegistryBrowser.this);
170
		listener = new RegistryBrowserModelChangeListener(RegistryBrowser.this);
163
		model.addModelChangeListener(listener);
171
		model.addModelChangeListener(listener);
(-)src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java (-1 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at

Return to bug 248953