/*******************************************************************************
 * Copyright (c) 2012-2016 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package org.eclipse.che.ide.project.node;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import org.eclipse.che.ide.api.data.HasDataObject;
import org.eclipse.che.ide.api.data.tree.AbstractTreeNode;
import org.eclipse.che.ide.api.data.tree.settings.HasSettings;
import org.eclipse.che.ide.api.data.tree.settings.NodeSettings;
import org.eclipse.che.ide.resource.Path;
import org.eclipse.che.ide.ui.smartTree.presentation.HasPresentation;
import org.eclipse.che.ide.ui.smartTree.presentation.NodePresentation;

/**
 * Base class for the synthetic, non-resourced item
 *
 * @author Vlad Zhukovskiy
 */
public abstract class SyntheticNode<D> extends AbstractTreeNode implements HasDataObject<D>, HasPresentation, HasSettings {

    private long hashSalt = -1;

    private D                data;
    private NodeSettings     nodeSettings;
    private NodePresentation nodePresentation;

    public static final String CUSTOM_BACKGROUND_FILL = "fill";

    public SyntheticNode(D data, NodeSettings nodeSettings) {

        this.data = data;
        this.nodeSettings = nodeSettings;
        this.hashSalt = System.currentTimeMillis();
    }

    /** {@inheritDoc} */
    @Override
    public NodeSettings getSettings() {
        return nodeSettings;
    }

    public Path getProject() {
        return Path.EMPTY;
    }

    /** {@inheritDoc} */
    @Override
    public D getData() {
        return data;
    }

    /** {@inheritDoc} */
    @Override
    public void setData(D data) {
        this.data = data;
    }

    /** {@inheritDoc} */
    @Override
    public final NodePresentation getPresentation(boolean update) {
        if (nodePresentation == null) {
            nodePresentation = new NodePresentation();
            updatePresentation(nodePresentation);
        }

        if (update) {
            updatePresentation(nodePresentation);
        }
        return nodePresentation;
    }

    /** {@inheritDoc} */
    @Override
    public final boolean supportGoInto() {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (!(o instanceof SyntheticNode)) {
            return false;
        }

        SyntheticNode node = (SyntheticNode)o;

        return node.getData().equals(getData()) &&  node.hashSalt == hashSalt;
    }

    /** {@inheritDoc} */
    @Override
    public int hashCode() {
        return Objects.hashCode(data, hashSalt);
    }

    /** {@inheritDoc} */
    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                          .add("data", data)
                          .add("hashSalt", hashSalt)
                          .toString();
    }
}

@@ -1281,41 +1281,8 @@
  %7B%0A%0A
-    private long hashSalt = -1;%0A%0A
     
@@ -1530,17 +1530,16 @@
 ings) %7B%0A
-%0A
         
@@ -1602,60 +1602,8 @@
 gs;%0A
-        this.hashSalt = System.currentTimeMillis();%0A
     
@@ -2808,28 +2808,41 @@
 ode.
-hashSalt == hashSalt
+getProject().equals(getProject())
 ;%0A  
@@ -2951,24 +2951,28 @@
 e(data, 
-hashSalt
+getProject()
 );%0A    %7D
@@ -3172,27 +3172,30 @@
 dd(%22
-hashSalt%22, hashSalt
+project%22, getProject()
 )%0A  

Fix collapse External Libraries after changing pom.xml