Package com.dci.intellij.dbn.object.properties

Source Code of com.dci.intellij.dbn.object.properties.DBObjectPresentableProperty

package com.dci.intellij.dbn.object.properties;

import com.dci.intellij.dbn.common.util.NamingUtil;
import com.dci.intellij.dbn.object.common.DBObject;
import com.dci.intellij.dbn.object.lookup.DBObjectRef;
import com.intellij.pom.Navigatable;

import javax.swing.Icon;

public class DBObjectPresentableProperty extends PresentableProperty{
    private DBObjectRef objectRef;
    private boolean qualified = false;
    private String name;


    public DBObjectPresentableProperty(String name, DBObject object, boolean qualified) {
        this.objectRef = object.getRef();
        this.qualified = qualified;
        this.name = name;
    }

    public DBObjectPresentableProperty(DBObject object, boolean qualified) {
        this.objectRef = object.getRef();
        this.qualified = qualified;
    }

    public DBObjectPresentableProperty(DBObject object) {
        this.objectRef = object.getRef();
    }

    public String getName() {
        return name == null ? NamingUtil.capitalize(objectRef.getObjectType().getName()) : name;
    }

    public String getValue() {
        return qualified ? objectRef.getPath() : objectRef.getName();
    }

    public Icon getIcon() {
        DBObject object = objectRef.get();
        return object == null ? null : object.getIcon();
    }

    @Override
    public Navigatable getNavigatable() {
        return objectRef.get();
    }
}
TOP

Related Classes of com.dci.intellij.dbn.object.properties.DBObjectPresentableProperty

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.