String refactoring: Introduce/extract/create variable
Hello all,
I was wondering if it's possible to create a variable in a string. For example, if I have a String like this:
I'd like to "variabelize" the 45, so I'd like to select the 45, do a refactoring to introduce a variable, to create a result (someting) like this:
Is this a new feature, or is this already possible?
Erik
请先登录再写评论。
Hello Erik,
you should try the SmartIntroduce plugin which can do that.
Sascha
Hello Sascha,
The last version (1.5.10) gives me the following error upon startup (using
#6667).
-
Bad version number in .class file
com.intellij.diagnostic.PluginException: Bad version number in .class file
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:68)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:18)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.access$100(ComponentManagerImpl.java:48)
at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:48)
at com.intellij.openapi.components.impl.ComponentManagerImpl.initComponents(ComponentManagerImpl.java:132)
at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.loadApplication(ApplicationStoreImpl.java:105)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:289)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:60)
at com.intellij.idea.Main$3.run(Main.java:1)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:151)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:13)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:18)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in
.class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:71)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:67)
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:48)
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:30)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentsRegistry.a(ComponentManagerImpl.java:73)
... 18 more
Taras Tielkes wrote:
Thanks, the plugin was accidentally compiled against JDK 1.6 which is fixed in
1.5.11. Sorry for the inconvenience.
Sascha
Thanks for the answer. I thought I used most (useful) plugins, but I missed this one!