mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce InstalledPackage class as superclass for PyPackage; use it on PackageManagementService API
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
<orderEntry type="module" module-name="lang-api" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="module" module-name="webide-api" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jetbrains.python.packaging;
|
||||
|
||||
import com.intellij.webcore.packaging.InstalledPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -8,15 +9,12 @@ import java.util.List;
|
||||
/**
|
||||
* @author vlan
|
||||
*/
|
||||
public class PyPackage {
|
||||
private final String myName;
|
||||
private final String myVersion;
|
||||
public class PyPackage extends InstalledPackage {
|
||||
private final String myLocation;
|
||||
private final List<PyRequirement> myRequirements;
|
||||
|
||||
public PyPackage(@NotNull String name, @NotNull String version, @Nullable String location, @NotNull List<PyRequirement> requirements) {
|
||||
myName = name;
|
||||
myVersion = version;
|
||||
super(name, version);
|
||||
myLocation = location;
|
||||
myRequirements = requirements;
|
||||
}
|
||||
@@ -26,16 +24,6 @@ public class PyPackage {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getVersion() {
|
||||
return myVersion;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<PyRequirement> getRequirements() {
|
||||
return myRequirements;
|
||||
@@ -49,21 +37,4 @@ public class PyPackage {
|
||||
public boolean isInstalled() {
|
||||
return myLocation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PyPackage aPackage = (PyPackage)o;
|
||||
if (myName != null ? !myName.equals(aPackage.myName) : aPackage.myName != null) return false;
|
||||
if (myVersion != null ? !myVersion.equals(aPackage.myVersion) : aPackage.myVersion != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = myName != null ? myName.hashCode() : 0;
|
||||
result = 31 * result + (myVersion != null ? myVersion.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user