way to avoid initialization in constructor
authorNikolay Matveev <Nikolay.Matveev@jetbrains.com>
Wed, 10 Nov 2010 12:14:52 +0000 (15:14 +0300)
committerNikolay Matveev <Nikolay.Matveev@jetbrains.com>
Wed, 10 Nov 2010 12:30:34 +0000 (15:30 +0300)
platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java

index 19d51954a0873ebc0f3dfcd0b0e6291b567cfb83..a31e681be63d8a233b22f5ef40853c37aef15571 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2010 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.
@@ -55,6 +55,15 @@ public abstract class NamedItemsListEditor<T> extends MasterDetailsComponent {
                                    Cloner<T> cloner,
                                    Equality<T> comparer,
                                    List<T> items) {
+      this(namer, factory, cloner, comparer, items, true);
+    }
+
+    protected NamedItemsListEditor(Namer<T> namer,
+                                   Factory<T> factory,
+                                   Cloner<T> cloner,
+                                   Equality<T> comparer,
+                                   List<T> items,
+                                   boolean initInConstructor) {
         myNamer = namer;
         myFactory = factory;
         myCloner = cloner;
@@ -62,9 +71,10 @@ public abstract class NamedItemsListEditor<T> extends MasterDetailsComponent {
 
         myOriginalItems = items;
         myResultItems = items;
-        reset();
-
-        initTree();
+        if (initInConstructor) {
+          reset();
+          initTree();
+        }
     }
 
     public void reset() {