Package org.apache.directory.studio.ldifparser.model.lines

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifLineBase


                // int offset = damage.getOffset() + parts[i].getOffset();
                int offset = parts[i].getOffset();

                if ( parts[i] instanceof LdifLineBase )
                {
                    LdifLineBase line = ( LdifLineBase ) parts[i];

                    // String debug = line.getClass().getName() +
                    // "("+line.getOffset()+","+line.getLength()+"):
                    // "+line.toString();
                    // debug = debug.replaceAll("\n", "\\\\n");
                    // debug = debug.replaceAll("\r", "\\\\r");
                    // System.out.println(debug);

                    if ( line instanceof LdifVersionLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), KEYWORD_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifCommentLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), COMMENT_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifDnLine )
                    {
                        LdifDnLine dnLine = ( LdifDnLine ) line;
                        int dnSpecLength = dnLine.getRawDnSpec().length();
                        int valueTypeLength = dnLine.getRawValueType().length();
                        int dnLength = dnLine.getRawDn().length();
                        this.addStyleRange( presentation, offset, dnSpecLength, DN_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + dnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + dnSpecLength + valueTypeLength, dnLength,
                            DN_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifAttrValLine )
                    {
                        LdifAttrValLine attrValLine = ( LdifAttrValLine ) line;
                        int attributeNameLength = attrValLine.getRawAttributeDescription().length();
                        int valueTypeLength = attrValLine.getRawValueType().length();
                        int valueLength = attrValLine.getRawValue().length();
                        this.addStyleRange( presentation, offset, attributeNameLength, ATTRIBUTE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength + valueTypeLength, valueLength,
                            VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifChangeTypeLine )
                    {
                        LdifChangeTypeLine changeTypeLine = ( LdifChangeTypeLine ) line;
                        int changeTypeSpecLength = changeTypeLine.getRawChangeTypeSpec().length();
                        int valueTypeLength = changeTypeLine.getRawValueType().length();
                        int changeTypeLength = changeTypeLine.getRawChangeType().length();
                        this.addStyleRange( presentation, offset, changeTypeSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + changeTypeSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );

                        if ( container instanceof LdifChangeAddRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, ADD_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeModifyRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, MODIFY_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeModDnRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, MODDN_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeDeleteRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, DELETE_TEXT_ATTRIBUTE );
                        }
                    }
                    else if ( line instanceof LdifNewrdnLine )
                    {
                        LdifNewrdnLine newrdnLine = ( LdifNewrdnLine ) line;
                        int newrdnSpecLength = newrdnLine.getRawNewrdnSpec().length();
                        int valueTypeLength = newrdnLine.getRawValueType().length();
                        int newrdnLength = newrdnLine.getRawNewrdn().length();
                        this.addStyleRange( presentation, offset, newrdnSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newrdnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newrdnSpecLength + valueTypeLength, newrdnLength,
                            VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifDeloldrdnLine )
                    {
                        LdifDeloldrdnLine deleteoldrdnLine = ( LdifDeloldrdnLine ) line;
                        int deleteoldrdnSpecLength = deleteoldrdnLine.getRawDeleteOldrdnSpec().length();
                        int valueTypeLength = deleteoldrdnLine.getRawValueType().length();
                        int deleteoldrdnLength = deleteoldrdnLine.getRawDeleteOldrdn().length();
                        this.addStyleRange( presentation, offset, deleteoldrdnSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + deleteoldrdnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + deleteoldrdnSpecLength + valueTypeLength,
                            deleteoldrdnLength, VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifNewsuperiorLine )
                    {
                        LdifNewsuperiorLine newsuperiorLine = ( LdifNewsuperiorLine ) line;
                        int newsuperiorSpecLength = newsuperiorLine.getRawNewSuperiorSpec().length();
                        int valueTypeLength = newsuperiorLine.getRawValueType().length();
                        int newsuperiorLength = newsuperiorLine.getRawNewSuperiorDn().length();
                        this.addStyleRange( presentation, offset, newsuperiorSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newsuperiorSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newsuperiorSpecLength + valueTypeLength,
                            newsuperiorLength, VALUE_TEXT_ATTRIBUTE );
                    }
                    // else if(line instanceof LdifDeloldrdnLine) {
                    // this.addStyleRange(presentation, offset,
                    // line.getLength(), MODTYPE_TEXT_ATTRIBUTE);
                    // }
                    // else if(line instanceof LdifNewsuperiorLine) {
                    // this.addStyleRange(presentation, offset,
                    // line.getLength(), MODTYPE_TEXT_ATTRIBUTE);
                    // }
                    else if ( line instanceof LdifModSpecTypeLine )
                    {
                        LdifModSpecTypeLine modSpecTypeLine = ( LdifModSpecTypeLine ) line;
                        int modTypeLength = modSpecTypeLine.getRawModType().length();
                        int valueTypeLength = modSpecTypeLine.getRawValueType().length();
                        int attributeDescriptionLength = modSpecTypeLine.getRawAttributeDescription().length();
                        this.addStyleRange( presentation, offset, modTypeLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + modTypeLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + modTypeLength + valueTypeLength,
                            attributeDescriptionLength, ATTRIBUTE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifModSpecSepLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), VALUETYPE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifControlLine )
                    {
                        LdifControlLine controlLine = ( LdifControlLine ) line;
                        int controlSpecLength = controlLine.getRawControlSpec().length();
View Full Code Here


                // int offset = damage.getOffset() + parts[i].getOffset();
                int offset = parts[i].getOffset();

                if ( parts[i] instanceof LdifLineBase )
                {
                    LdifLineBase line = ( LdifLineBase ) parts[i];

                    // String debug = line.getClass().getName() +
                    // "("+line.getOffset()+","+line.getLength()+"):
                    // "+line.toString();
                    // debug = debug.replaceAll("\n", "\\\\n");
                    // debug = debug.replaceAll("\r", "\\\\r");
                    // System.out.println(debug);

                    if ( line instanceof LdifVersionLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), KEYWORD_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifCommentLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), COMMENT_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifDnLine )
                    {
                        LdifDnLine dnLine = ( LdifDnLine ) line;
                        int dnSpecLength = dnLine.getRawDnSpec().length();
                        int valueTypeLength = dnLine.getRawValueType().length();
                        int dnLength = dnLine.getRawDn().length();
                        this.addStyleRange( presentation, offset, dnSpecLength, DN_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + dnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + dnSpecLength + valueTypeLength, dnLength,
                            DN_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifAttrValLine )
                    {
                        LdifAttrValLine attrValLine = ( LdifAttrValLine ) line;
                        int attributeNameLength = attrValLine.getRawAttributeDescription().length();
                        int valueTypeLength = attrValLine.getRawValueType().length();
                        int valueLength = attrValLine.getRawValue().length();
                        this.addStyleRange( presentation, offset, attributeNameLength, ATTRIBUTE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength + valueTypeLength, valueLength,
                            VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifChangeTypeLine )
                    {
                        LdifChangeTypeLine changeTypeLine = ( LdifChangeTypeLine ) line;
                        int changeTypeSpecLength = changeTypeLine.getRawChangeTypeSpec().length();
                        int valueTypeLength = changeTypeLine.getRawValueType().length();
                        int changeTypeLength = changeTypeLine.getRawChangeType().length();
                        this.addStyleRange( presentation, offset, changeTypeSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + changeTypeSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );

                        if ( container instanceof LdifChangeAddRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, ADD_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeModifyRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, MODIFY_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeModDnRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, MODDN_TEXT_ATTRIBUTE );
                        }
                        else if ( container instanceof LdifChangeDeleteRecord )
                        {
                            this.addStyleRange( presentation, offset + changeTypeSpecLength + valueTypeLength,
                                changeTypeLength, DELETE_TEXT_ATTRIBUTE );
                        }
                    }
                    else if ( line instanceof LdifNewrdnLine )
                    {
                        LdifNewrdnLine newrdnLine = ( LdifNewrdnLine ) line;
                        int newrdnSpecLength = newrdnLine.getRawNewrdnSpec().length();
                        int valueTypeLength = newrdnLine.getRawValueType().length();
                        int newrdnLength = newrdnLine.getRawNewrdn().length();
                        this.addStyleRange( presentation, offset, newrdnSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newrdnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newrdnSpecLength + valueTypeLength, newrdnLength,
                            VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifDeloldrdnLine )
                    {
                        LdifDeloldrdnLine deleteoldrdnLine = ( LdifDeloldrdnLine ) line;
                        int deleteoldrdnSpecLength = deleteoldrdnLine.getRawDeleteOldrdnSpec().length();
                        int valueTypeLength = deleteoldrdnLine.getRawValueType().length();
                        int deleteoldrdnLength = deleteoldrdnLine.getRawDeleteOldrdn().length();
                        this.addStyleRange( presentation, offset, deleteoldrdnSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + deleteoldrdnSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + deleteoldrdnSpecLength + valueTypeLength,
                            deleteoldrdnLength, VALUE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifNewsuperiorLine )
                    {
                        LdifNewsuperiorLine newsuperiorLine = ( LdifNewsuperiorLine ) line;
                        int newsuperiorSpecLength = newsuperiorLine.getRawNewSuperiorSpec().length();
                        int valueTypeLength = newsuperiorLine.getRawValueType().length();
                        int newsuperiorLength = newsuperiorLine.getRawNewSuperiorDn().length();
                        this.addStyleRange( presentation, offset, newsuperiorSpecLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newsuperiorSpecLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + newsuperiorSpecLength + valueTypeLength,
                            newsuperiorLength, VALUE_TEXT_ATTRIBUTE );
                    }
                    // else if(line instanceof LdifDeloldrdnLine) {
                    // this.addStyleRange(presentation, offset,
                    // line.getLength(), MODTYPE_TEXT_ATTRIBUTE);
                    // }
                    // else if(line instanceof LdifNewsuperiorLine) {
                    // this.addStyleRange(presentation, offset,
                    // line.getLength(), MODTYPE_TEXT_ATTRIBUTE);
                    // }
                    else if ( line instanceof LdifModSpecTypeLine )
                    {
                        LdifModSpecTypeLine modSpecTypeLine = ( LdifModSpecTypeLine ) line;
                        int modTypeLength = modSpecTypeLine.getRawModType().length();
                        int valueTypeLength = modSpecTypeLine.getRawValueType().length();
                        int attributeDescriptionLength = modSpecTypeLine.getRawAttributeDescription().length();
                        this.addStyleRange( presentation, offset, modTypeLength, KEYWORD_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + modTypeLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + modTypeLength + valueTypeLength,
                            attributeDescriptionLength, ATTRIBUTE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifModSpecSepLine )
                    {
                        this.addStyleRange( presentation, offset, line.getLength(), VALUETYPE_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifControlLine )
                    {
                        LdifControlLine controlLine = ( LdifControlLine ) line;
                        int controlSpecLength = controlLine.getRawControlSpec().length();
View Full Code Here

                            range = getRange( relativePos, part.getOffset(), new String[]
                                { line.getRawLineStart(), line.getRawValueType(), line.getRawValue() } );
                        }
                        else if ( part instanceof LdifLineBase )
                        {
                            LdifLineBase line = ( LdifLineBase ) part;
                            range = new int[]
                                { part.getOffset(), part.getLength() - line.getRawNewLine().length() };
                        }

                        // set range on viewer, add global offset
                        int start = range != null ? range[OFFSET] : part.getOffset();
                        start += offset;
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldifparser.model.lines.LdifLineBase

Copyright © 2018 www.massapicom. 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.