[platform] drops/deprecates outdated IdeaPluginDescriptorImpl properties

This commit is contained in:
Roman Shevchenko
2018-03-09 14:44:02 +01:00
parent 9fa36c951c
commit 53082af049
5 changed files with 24 additions and 89 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.plugins;
import com.intellij.openapi.components.ComponentConfig;
@@ -77,6 +63,7 @@ public interface IdeaPluginDescriptor extends PluginDescriptor {
boolean getUseIdeaClassLoader();
/** @deprecated doesn't make sense for installed plugins; use PluginNode#getDownloads (to be removed in IDEA 2019) */
String getDownloads();
String getSinceBuild();
@@ -88,4 +75,4 @@ public interface IdeaPluginDescriptor extends PluginDescriptor {
boolean isEnabled();
void setEnabled(boolean enabled);
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.plugins;
import com.intellij.AbstractBundle;
@@ -41,7 +27,6 @@ import gnu.trove.THashMap;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -92,8 +77,6 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
@Nullable private MultiMap<String, Pair<String, Element>> myExtensions; // extension point name -> list of (extension default NS, extension element)
@Nullable private MultiMap<String, Element> myExtensionsPoints;
private String myDescriptionChildText;
private String myDownloadCounter;
private long myDate;
private boolean myUseIdeaClassLoader;
private boolean myUseCoreClassLoader;
private boolean myAllowBundledUpdate;
@@ -221,7 +204,6 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
myCategory = pluginBean.category;
if (pluginBean.vendor != null) {
myVendor = pluginBean.vendor.name;
myVendorEmail = pluginBean.vendor.email;
@@ -364,11 +346,6 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
return myVendor;
}
public void setVendor( final String val )
{
myVendor = val;
}
@Override
public String getVersion() {
return myVersion;
@@ -475,21 +452,11 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
return myVendorEmail;
}
public void setVendorEmail( final String val )
{
myVendorEmail = val;
}
@Override
public String getVendorUrl() {
return myVendorUrl;
}
public void setVendorUrl( final String val )
{
myVendorUrl = val;
}
@Override
public String getUrl() {
return url;
@@ -500,7 +467,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
url = val;
}
@NonNls
@Override
public String toString() {
return "PluginDescriptor[name='" + myName + "', classpath='" + myPath + "']";
}
@@ -517,6 +484,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
myLoader = loader;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof IdeaPluginDescriptorImpl)) return false;
@@ -526,6 +494,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
return myName == null ? pluginDescriptor.myName == null : myName.equals(pluginDescriptor.myName);
}
@Override
public int hashCode() {
return myName != null ? myName.hashCode() : 0;
}
@@ -541,31 +510,14 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
return myId;
}
/*
This setter was explicitly defined to be able to set downloads count for a
descriptor outside its loading from the xml file since this information
is available only from the site.
*/
public void setDownloadsCount(String downloadsCount) {
myDownloadCounter = downloadsCount;
/** @deprecated doesn't make sense for installed plugins; use PluginNode#getDownloads (to be removed in IDEA 2019) */
public String getDownloads() {
return null;
}
@Override
public String getDownloads(){
return myDownloadCounter;
}
public long getDate(){
return myDate;
}
/*
This setter was explicitly defined to be able to set date for a
descriptor outside its loading from the xml file since this information
is available only from the site.
*/
public void setDate( long date ){
myDate = date;
/** @deprecated doesn't make sense for installed plugins; use PluginNode#getDate (to be removed in IDEA 2019) */
public long getDate() {
return 0;
}
@Override
@@ -578,10 +530,6 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
return myVendorLogoPath;
}
public void setVendorLogoPath(final String vendorLogoPath) {
myVendorLogoPath = vendorLogoPath;
}
@Override
public boolean getUseIdeaClassLoader() {
return myUseIdeaClassLoader;
@@ -722,4 +670,4 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
public List<String> getModules() {
return myModules;
}
}
}
@@ -57,11 +57,11 @@ public class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, St
}
else if (columnIdx == COLUMN_DOWNLOADS) {
// Base class IdeaPluginDescriptor does not declare this field.
return base.getDownloads();
return base instanceof PluginNode ? ((PluginNode)base).getDownloads() : null;
}
if (columnIdx == COLUMN_DATE) {
// Base class IdeaPluginDescriptor does not declare this field.
long date = (base instanceof PluginNode) ? ((PluginNode)base).getDate() : ((IdeaPluginDescriptorImpl)base).getDate();
long date = (base instanceof PluginNode) ? ((PluginNode)base).getDate() : 0;
if (date != 0) {
return DateFormatUtil.formatDate(date);
}
@@ -161,8 +161,8 @@ public class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, St
}
if (isSortByDate()) {
long date1 = (o1 instanceof PluginNode) ? ((PluginNode)o1).getDate() : ((IdeaPluginDescriptorImpl)o1).getDate();
long date2 = (o2 instanceof PluginNode) ? ((PluginNode)o2).getDate() : ((IdeaPluginDescriptorImpl)o2).getDate();
long date1 = (o1 instanceof PluginNode) ? ((PluginNode)o1).getDate() : 0;
long date2 = (o2 instanceof PluginNode) ? ((PluginNode)o2).getDate() : 0;
date1 /= 60 * 1000;
date2 /= 60 * 1000;
if (date2 != date1) {
@@ -171,8 +171,8 @@ public class PluginManagerColumnInfo extends ColumnInfo<IdeaPluginDescriptor, St
}
if (isSortByDownloads()) {
String d1 = o1.getDownloads();
String d2 = o2.getDownloads();
String d1 = o1 instanceof PluginNode ? ((PluginNode)o1).getDownloads() : null;
String d2 = o2 instanceof PluginNode ? ((PluginNode)o2).getDownloads() : null;
Long count1 = d1 == null ? 0 : Long.valueOf(d1);
Long count2 = d2 == null ? 0 : Long.valueOf(d2);
int result = count2.compareTo(count1);
@@ -604,7 +604,7 @@ public class PluginManagerConfigurableNew extends BaseConfigurable
@Nullable
private static String getDownloads(@NotNull IdeaPluginDescriptor plugin) {
String downloads = plugin.getDownloads();
String downloads = ((PluginNode)plugin).getDownloads();
if (!StringUtil.isEmptyOrSpaces(downloads)) {
try {
Long value = Long.valueOf(downloads);
@@ -64,7 +64,7 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer {
myStatus.setText("");
if (myPluginsView || pluginDescriptor.getDownloads() == null || !(pluginDescriptor instanceof PluginNode)) {
if (myPluginsView || !(pluginDescriptor instanceof PluginNode) || ((PluginNode)pluginDescriptor).getDownloads() == null) {
myPanel.remove(myRightPanel);
}
if (myPluginsView) {
@@ -135,8 +135,8 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer {
myStatus.setIcon(AllIcons.Nodes.PluginJB);
}
String downloads = myPluginDescriptor.getDownloads();
if (downloads != null && myPluginDescriptor instanceof PluginNode) {
String downloads;
if (myPluginDescriptor instanceof PluginNode && (downloads = ((PluginNode)myPluginDescriptor).getDownloads()) != null) {
if (downloads.length() > 3) {
downloads = new DecimalFormat("#,###").format(Integer.parseInt(downloads));
}