Override clone method to perform model specific actions (FELIX-2152) also some minor code refactoring to move all overridden methods to one block of code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@917982 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
index 1c08187..47d4eab 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
@@ -317,39 +317,6 @@
}
- @Override
- public String toString()
- {
- return "SigilBundle["
- + ( getBundleInfo() == null ? null : ( getBundleInfo().getSymbolicName() + ":" + getBundleInfo()
- .getVersion() ) ) + "]";
- }
-
-
- @Override
- public boolean equals( Object obj )
- {
- if ( obj == null )
- return false;
- if ( obj == this )
- return true;
-
- if ( obj instanceof SigilBundle )
- {
- return obj.toString().equals( toString() );
- }
-
- return false;
- }
-
-
- @Override
- public int hashCode()
- {
- return 31 * toString().hashCode();
- }
-
-
public IPath getLicencePathLocation()
{
return licencePathLocation;
@@ -436,4 +403,57 @@
}
return null;
}
+
+ @Override
+ public String toString()
+ {
+ return "SigilBundle["
+ + ( getBundleInfo() == null ? null : ( getBundleInfo().getSymbolicName() + ":" + getBundleInfo()
+ .getVersion() ) ) + "]";
+ }
+
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( obj == null )
+ return false;
+ if ( obj == this )
+ return true;
+
+ if ( obj instanceof SigilBundle )
+ {
+ return obj.toString().equals( toString() );
+ }
+
+ return false;
+ }
+
+
+ @Override
+ public int hashCode()
+ {
+ return 31 * toString().hashCode();
+ }
+
+ @Override
+ public SigilBundle clone()
+ {
+ SigilBundle b = (SigilBundle) super.clone();
+ b.bundle = (IBundleModelElement) b.bundle.clone();
+
+ IPath[] newPaths = new IPath[b.sourcePaths.length];
+ System.arraycopy(b.sourcePaths, 0, newPaths, 0, b.sourcePaths.length);
+ b.sourcePaths = newPaths;
+
+ String[] tmp = new String[classpath.length];
+ System.arraycopy(b.classpath, 0, tmp, 0, b.classpath.length);
+ b.classpath = tmp;
+
+ tmp = new String[packages.length];
+ System.arraycopy(b.packages, 0, tmp, 0, b.packages.length);
+ b.packages = tmp;
+
+ return b;
+ }
}