~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigExtensionReference.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2007, 2008 Intel 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
 * Intel Corporation - Initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.internal.core.settings.model;
 
12
 
 
13
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
 
14
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
 
15
import org.eclipse.cdt.internal.core.CExtensionInfo;
 
16
import org.eclipse.core.runtime.CoreException;
 
17
 
 
18
public class CConfigExtensionReference implements ICConfigExtensionReference {
 
19
 
 
20
        private CConfigurationSpecSettings fCfgSettings;
 
21
        private String fExtPoint;
 
22
        private String fId;
 
23
 
 
24
        public CConfigExtensionReference(CConfigurationSpecSettings cfg, String extPoint, String id) {
 
25
                fCfgSettings = cfg;
 
26
                fExtPoint = extPoint;
 
27
                fId = id;
 
28
        }
 
29
 
 
30
        public CConfigExtensionReference(CConfigurationSpecSettings cfg, CConfigExtensionReference base) {
 
31
                fCfgSettings = cfg;
 
32
                fExtPoint = base.fExtPoint;
 
33
                fId = base.fId;
 
34
        }
 
35
 
 
36
        public String getExtensionPoint() {
 
37
                return fExtPoint;
 
38
        }
 
39
 
 
40
        public String getID() {
 
41
                return fId;
 
42
        }
 
43
 
 
44
        private CExtensionInfo getInfo() {
 
45
                return fCfgSettings.getInfo(this);
 
46
        }
 
47
 
 
48
        @Override
 
49
        public boolean equals(Object obj) {
 
50
                if (obj == this) {
 
51
                        return true;
 
52
                }
 
53
                if (obj instanceof CConfigExtensionReference) {
 
54
                        CConfigExtensionReference ext = (CConfigExtensionReference)obj;
 
55
                        if (ext.fExtPoint.equals(fExtPoint) && ext.fId.equals(fId)) {
 
56
                                return true;
 
57
                        }
 
58
                }
 
59
                return false;
 
60
        }
 
61
 
 
62
        @Override
 
63
        public int hashCode() {
 
64
                return fExtPoint.hashCode() + fId.hashCode();
 
65
        }
 
66
 
 
67
        public void setExtensionData(String key, String value) throws CoreException {
 
68
                getInfo().setAttribute(key, value);
 
69
                fCfgSettings.setModified();
 
70
        }
 
71
 
 
72
        public String getExtensionData(String key) {
 
73
                return getInfo().getAttribute(key);
 
74
        }
 
75
 
 
76
        public ICConfigurationDescription getConfiguration() {
 
77
                return fCfgSettings.getConfigurarion();
 
78
        }
 
79
}