private SQLCompletionProposal makeProposalsFromObject( DBPNamedObject object, @Nullable DBPImage objectIcon) { String objectName = DBUtils.getObjectFullName(object); StringBuilder info = new StringBuilder(); PropertyCollector collector = new PropertyCollector(object, false); collector.collectProperties(); for (DBPPropertyDescriptor descriptor : collector.getPropertyDescriptors2()) { Object propValue = collector.getPropertyValue(descriptor.getId()); if (propValue == null) { continue; } String propString = propValue.toString(); info.append("<b>").append(descriptor.getDisplayName()).append(": </b>"); info.append(propString); info.append("<br>"); } boolean isSingleObject = true; String replaceString = null; DBPDataSource dataSource = editor.getDataSource(); if (dataSource != null) { // If we replace short name with referenced object // and current active schema (catalog) is not this object's container then // replace with full qualified name if (!getPreferences().getBoolean(SQLPreferenceConstants.PROPOSAL_SHORT_NAME) && object instanceof DBSObjectReference) { if (wordDetector.getFullWord().indexOf(editor.getSyntaxManager().getStructSeparator()) == -1) { DBSObjectReference structObject = (DBSObjectReference) object; if (structObject.getContainer() != null) { DBSObject selectedObject = getSelectedObject(dataSource); if (selectedObject != structObject.getContainer()) { replaceString = DBUtils.getFullQualifiedName(dataSource, structObject.getContainer(), object); isSingleObject = false; } } } } if (replaceString == null) { replaceString = DBUtils.getQuotedIdentifier(dataSource, object.getName()); } } else { replaceString = DBUtils.getObjectShortName(object); } return createCompletionProposal( replaceString, objectName, info.toString(), objectIcon, isSingleObject, object); }
@Override public String getTargetName() { switch (mappingType) { case existing: if (target != null) { return DBUtils.getObjectFullName(target, DBPEvaluationContext.UI); } else { return targetName; } case create: return targetName; case skip: return TARGET_NAME_SKIP; default: return "?"; } }
public AttributeEditPage( @Nullable DBECommandContext commandContext, @NotNull DBSEntityAttribute attribute) { super("Edit attribute " + DBUtils.getObjectFullName(attribute, DBPEvaluationContext.UI)); this.commandContext = commandContext; this.attribute = attribute; }