BoxPlugin 

HOME INDEX SEARCH GO  

 <<O>>  Difference Topic BoxPlugin (r1.4 - 27 Aug 2003 - TimurZambalayev)
Added:
>
>

0.1.1 (#908) - Aug 27, 2003

  • Recompiled for #908.
Changed:
<
<

%META:FIELD{name="IntelliJPluginVersion" title="IntelliJPluginVersion" value="0.1"}%

>
>

%META:FIELD{name="IntelliJPluginVersion" title="IntelliJPluginVersion" value="0.1.1"}%


 <<O>>  Difference Topic BoxPlugin (r1.3 - 26 Aug 2003 - TimurZambalayev)
Changed:
<
<

  1. Specify the location of $idea.home in ../build-home.properties
>
>

  1. Specify locations in build-home.properties

 <<O>>  Difference Topic BoxPlugin (r1.2 - 18 Aug 2003 - TimurZambalayev)
Added:
>
>

%META:FORM{name="IntelliJPluginWebForm"}% %META:FIELD{name="IntelliJPluginName" title="IntelliJPluginName" value="BoxPlugin"}% %META:FIELD{name="IntelliJPluginVersion" title="IntelliJPluginVersion" value="0.1"}% %META:FIELD{name="IntelliJPluginVendor" title="IntelliJPluginVendor" value="TimurZambalayev"}% %META:FIELD{name="IntelliJPluginBinary" title="IntelliJPluginBinary" value="http://sourceforge.net/projects/tz-ip/"}% %META:FIELD{name="IntelliJPluginSource" title="IntelliJPluginSource" value="http://sourceforge.net/projects/tz-ip/"}% %META:FIELD{name="IntelliJPluginClassification" title="IntelliJPluginClassification" value="CodeHelper"}% %META:FIELD{name="TopicClassification" title="TopicClassification" value="IntelliJPluginPackage"}% %META:FIELD{name="TopicShortDescription" title="TopicShortDescription" value="Conversion intentions from one type to another."}% %META:FIELD{name="TestedOnOS" title="TestedOnOS" value="OsWin2K"}% %META:FIELD{name="ShouldRunOnOS" title="ShouldRunOnOS" value="AnyOS"}%


 <<O>>  Difference Topic BoxPlugin (r1.1 - 16 Aug 2003 - TimurZambalayev)
Added:
>
>

%META:TOPICINFO{author="TimurZambalayev" date="1061010840" format="1.0" version="1.1"}% %META:TOPICPARENT{name="TimurZambalayev"}%

Description.

Conversion intentions from one type to another. Say, you often encounter situations when you have conversions of one type to another. These two types are not assignable and probably not even castable. At the same time you have some very well-known conversion (could be either a constructor or some static factory method taking an only parameter). This plugin allows to specify such conversions/intentions.

This plugin uses non-published IDEA API.

Downloads, Bugs, RFEs:

http://sourceforge.net/projects/tz-ip/

ConversionExamples.java:

class ConversionExamples {

    boolean booleanP;
    Object object;
    Integer integer, integer2;
    Long longW;
    Character character;

    {
        {
            // new PrimitiveNumberConversion(project, "int", "new Integer($e)", "$e.intValue()")
            Integer i1 = 0; // -> Integer i1 = new Integer(0);
            int i2 = integer; // -> int i2 = integer.intValue();
            Object i3 = 0; // -> Object i3 = new Integer(0);
            int i4 = longW; // -> int i4 = longW.intValue();
            int i5 = (Integer) object; // -> int i5 = ((Integer) object).intValue(); // note added parentheses
            int i6 = booleanP ? integer : integer2; // int i6 = (booleanP ? integer : integer2).intValue(); // note added parentheses
        }
        {
            // new Conversion(project, "char", "Character", "$e.charValue()")
            char i1 = character; // -> char i1 = character.charValue();
            int i2 = character; // -> int i2 = character.charValue();
        }
        {
            // new Conversion(project, "Object", "boolean", new String[]{"Boolean.valueOf($e)", "$e ? Boolean.TRUE : Boolean.FALSE"})
            Boolean i1 = booleanP;
            // if Boolean.valueOf(booleanP) is available (it will be checked automagically), i.e. if you have Java 1.4:
            // -> Boolean i1 = Boolean.valueOf(booleanP);
            // if you use Java 1.3:
            // -> Boolean i1 = booleanP ? Boolean.TRUE : Boolean.FALSE;
        }
        {
            // new Conversion(project, "java.math.BigInteger", "String", "new java.math.BigInteger($e)")
            java.math.BigInteger i1 = "2";
            // -> java.math.BigInteger i1 = new BigInteger("2"); // an import declaration will be added
            // or
            // -> java.math.BigInteger i1 = new java.math.BigInteger("2");
            // depending the "Use fully qualified class names" setting
        }
    }

}

AvailabilityExamples.java:

class AvailabilityExamples {

    Integer integer;
    int i3;
    String[] strings;
    int[] ints;

    int i1 = integer;

    {
        int i2 = integer;
        System.out.println(i2);
        i3 = integer;
        strings[integer] = ""; // only for conversions to int
        ints = new int[]{integer};
        f2(integer);
    }

    int f1() {
        return integer;
    }

    void f2(int i) {
    }

}

Current conversions (see Box/src/main/tzambalayev/ideaplugins/box/ConversionSuite.java):

new PrimitiveNumberConversion(project, "byte", "new Byte($e)", "$e.byteValue()"),
new PrimitiveNumberConversion(project, "short", "new Short($e)", "$e.shortValue()"),
new PrimitiveNumberConversion(project, "int", "new Integer($e)", "$e.intValue()"),
new PrimitiveNumberConversion(project, "long", "new Long($e)", "$e.longValue()"),
new PrimitiveNumberConversion(project, "float", "new Float($e)", "$e.floatValue()"),
new PrimitiveNumberConversion(project, "double", "new Double($e)", "$e.doubleValue()"),

new Conversion(project, "char", "Character", "$e.charValue()"),
new Conversion(project, "Object", "char", "new Character($e)"),

new Conversion(project, "Object", "boolean", new String[]{"Boolean.valueOf($e)", "$e ? Boolean.TRUE : Boolean.FALSE"}),
new Conversion(project, "boolean", "Boolean", "$e.booleanValue()"),

new Conversion(project, "double", "String", "Double.parseDouble($e)"),
new Conversion(project, "float", "String", "Float.parseFloat($e)"),
new Conversion(project, "long", "String", "Long.parseLong($e)"),
new Conversion(project, "int", "String", "Integer.parseInt($e)"),
new Conversion(project, "short", "String", "Short.parseShort($e)"),
new Conversion(project, "byte", "String", "Byte.parseByte($e)"),
new Conversion(project, "boolean", "String",
        new String[]{"Boolean.parseBoolean($e)", "Boolean.valueOf($e).booleanValue()"}),

new Conversion(project, "Double", "String", "Double.valueOf($e)"),
new Conversion(project, "Float", "String", "Float.valueOf($e)"),
new Conversion(project, "Long", "String", "Long.valueOf($e)"),
new Conversion(project, "Integer", "String", "Integer.valueOf($e)"),
new Conversion(project, "Short", "String", "Short.valueOf($e)"),
new Conversion(project, "Byte", "String", "Byte.valueOf($e)"),
new Conversion(project, "Boolean", "String", "Boolean.valueOf($e)"),

new Conversion(project, "String", "double", "String.valueOf($e)"),
new Conversion(project, "String", "boolean", "String.valueOf($e)"),

new Conversion(project, "String", "Object", "String.valueOf($e)"),

new Conversion(project, "StringBuffer", "String", "new StringBuffer($e)"),
new Conversion(project, "Class", "String", "Class.forName($e)"),
new Conversion(project, "Thread", "Runnable", "new Thread($e)"),

new Conversion(project, "java.math.BigInteger", "long", "java.math.BigInteger.valueOf($e)"),
new Conversion(project, "java.math.BigInteger", "String", "new java.math.BigInteger($e)"),

new Conversion(project, "java.util.Collection", "Object[]", "java.util.Arrays.asList($e)"),
new Conversion(project, "Object[]", "java.util.Collection", "$e.toArray()"),

How to deploy.

  • Copy the jar file (e.g. Box.jar) to the plugins directory ($IDEA_HOME/plugins).
  • Restart IDEA.

How to build

  1. Specify the location of $idea.home in ../build-home.properties
  2. ant clean main.

History.

0.1 (#896) - Aug 16, 2003

  • Initial release.

-- TimurZambalayev - Aug 16, 2003


View | Diffs | r1.4 | > | r1.3 | > | r1.2 | More

e d i t a t t a c h r e f - b y d i f f s
Ideas,requests,problems regarding this site? Send feedback.
Copyright @ 2000-2003 by the contribution authors. All material on this collaboration tool is the property of the contributing authors.

Revision r1.1 - 16 Aug 2003 - 05:14 GMT - TimurZambalayev
Revision r1.4 - 27 Aug 2003 - 05:06 GMT - TimurZambalayev
Copyright © 2001 by the contributing authors. All material on this collaboration tool is the property of the contributing authors.
Ideas, requests, problems regarding this site? Send feedback.