Source

jackpot30 / overlays / netbeans

Full commit
diff --git a/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
new file mode 100644
--- /dev/null
+++ b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
@@ -0,0 +1,23 @@
+'FileObject.getPackageNameExt(char, char) is deprecated':
+   $0.getPackageNameExt('/', '.') :: $0 instanceof org.openide.FileObject
+=> $0.getPath()
+;;
+'FileObject.getPackageNameExt(char, char) is deprecated':
+   $0.getPackageNameExt($1, '.') :: $0 instanceof org.openide.FileObject && $1 instanceof char
+=> $0.getPath().replace('/', $1)
+;;
+
+'FileObject.isReadOnly() is deprecated':
+    $0.isReadOnly() :: $0 instanceof org.openide.FileObject
+=> !$0.canWrite()
+;;
+
+'Repository.getDefaultFileSystem()':
+   org.openide.filesystems.Repository.getDefault.getDefaultFileSystem()
+=> org.openide.filesystems.FileUtil.getConfigRoot()
+;;
+
+'Repository.getDefaultFileSystem()':
+   org.openide.filesystems.Repository.getDefault.getDefaultFileSystem().findResource($path) :: $path instanceof java.lang.String
+=> org.openide.filesystems.FileUtil.getConfigFile($path)
+;;
diff --git a/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
new file mode 100644
--- /dev/null
+++ b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
@@ -0,0 +1,3 @@
+'DataObject.getCookie is obsolette':
+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
+   => $this.getLookup().lookup($1) ;;
diff --git a/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
new file mode 100644
--- /dev/null
+++ b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
@@ -0,0 +1,3 @@
+'Node.getCookie is obsolette':
+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
+   => $this.getLookup().lookup($1) ;;
diff --git a/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
new file mode 100644
--- /dev/null
+++ b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
@@ -0,0 +1,12 @@
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
diff --git a/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
new file mode 100644
--- /dev/null
+++ b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
@@ -0,0 +1,104 @@
+'ErrorManager.notify is deprecated':
+$this.notify(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>org.openide.util.Exceptions.printStackTrace($1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, null, $1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
+   ;;
+
+'ErrorManager.notify is deprecated':
+$this.notify($1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
+   =>org.openide.util.Exceptions.printStackTrace($1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.ERROR, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
+   ;;
+
+'ErrorManager.log is deprecated':
+org.openide.ErrorManager.getDefault().log($1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.UNKNOWN) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.INFO)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.ERROR) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.EXCEPTION) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.INFORMATIONAL) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.FINE)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.USER) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
+   ;;
+
+'ErrorManager.isLoggable is deprecated':
+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.WARNING) :: $this instanceof org.openide.ErrorManager
+   =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
+   ;;
+
+'ErrorManager.annotate is deprecated':
+$this.annotate($1, $2) :: $1 instanceof java.lang.Throwable && $2 instanceof java.lang.String  && $this instanceof org.openide.ErrorManager
+   =>org.openide.util.Exceptions.attachLocalizedMessage($1, $2)
+   ;;
diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
new file mode 100644
--- /dev/null
+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
@@ -0,0 +1,17 @@
+'Lookup.lookupAll can be used instead':
+$0.lookup(new org.openide.util.Lookup.Template($1)).allInstances() :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class
+=>
+$0.lookupAll($1)
+;;
+
+'Lookup.lookupResult can be used instead':
+$0.lookup(new org.openide.util.Lookup.Template($1)) :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class && !parentMatches("$_.allInstances()")
+=>
+$0.lookupResult($1)
+;;
+
+'Lookup.Template() is deprecated':
+new org.openide.util.Lookup.Template()
+=>
+new org.openide.util.Lookup.Template(java.lang.Object.class)
+;;
diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
new file mode 100644
--- /dev/null
+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
@@ -0,0 +1,19 @@
+'Utilities.mergeImages is deprecated':
+   org.openide.util.Utilities.mergeImages($1, $2, $3, $4) :: $1 instanceof java.awt.Image && $2 instanceof java.awt.Image && $3 instanceof int && $4 instanceof int
+=> org.openide.util.ImageUtilities.mergeImages($1, $2, $3, $4)
+;;
+
+'Utilities.loadImage is deprecated':
+   org.openide.util.Utilities.loadImage($1) :: $1 instanceof String
+=> org.openide.util.ImageUtilities.loadImage($1)
+;;
+
+'Utilities.icon2Image is deprecated':
+   org.openide.util.Utilities.icon2Image($1) :: $1 instanceof javax.swing.Icon
+=> org.openide.util.ImageUtilities.icon2Image($1)
+;;
+
+'Utilities.image2Icon can be used instead of new ImageIcon':
+   new javax.swing.ImageIcon($1) :: $1 instanceof java.awt.Image
+=> org.openide.util.ImageUtilities.image2Icon($1)
+;;
diff --git a/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
new file mode 100644
--- /dev/null
+++ b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
@@ -0,0 +1,86 @@
+%%TestCase mergeImages1
+package test;
+import java.awt.Image;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Image i1 = null, i2 = null;
+        Utilities.mergeImages(i1, i2, -9, 34);
+    }
+}
+%%=>
+package test;
+import java.awt.Image;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Image i1 = null, i2 = null;
+        ImageUtilities.mergeImages(i1, i2, -9, 34);
+    }
+}
+%%TestCase loadImage1
+package test;
+import java.awt.Image;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Utilities.loadImage("foobar");
+    }
+}
+%%=>
+package test;
+import java.awt.Image;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        ImageUtilities.loadImage("foobar");
+    }
+}
+%%TestCase icon2Image1
+package test;
+import javax.swing.Icon;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Icon i = null;
+        Utilities.icon2Image(i);
+    }
+}
+%%=>
+package test;
+import javax.swing.Icon;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Icon i = null;
+        ImageUtilities.icon2Image(i);
+    }
+}
+%%TestCase image2Icon1
+package test;
+import java.awt.Image;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Image img = null;
+        Icon i = new ImageIcon(img);
+    }
+}
+%%=>
+package test;
+import java.awt.Image;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import org.openide.util.ImageUtilities;
+import org.openide.util.Utilities;
+public class Test {
+    private void test() {
+        Image img = null;
+        Icon i = ImageUtilities.image2Icon(img);
+    }
+}