/** * Constructs a new document model. * * @param editor The editor this model is associated to. */ public TexDocumentModel(TexEditor editor) { this.editor = editor; this.isDirty = true; // initialize jobs parseJob = new ParseJob("Parsing"); postParseJob = new PostParseJob("Updating"); parseJob.setPriority(Job.DECORATE); postParseJob.setPriority(Job.DECORATE); // get preferences this.parseDelay = TexlipsePlugin.getDefault() .getPreferenceStore() .getInt(TexlipseProperties.AUTO_PARSING_DELAY); this.autoParseEnabled = TexlipsePlugin.getDefault() .getPreferenceStore() .getBoolean(TexlipseProperties.AUTO_PARSING); this.sectionCheckEnabled = TexlipsePlugin.getDefault() .getPreferenceStore() .getBoolean(TexlipseProperties.SECTION_CHECK); // add preference change listener TexlipsePlugin.getDefault() .getPreferenceStore() .addPropertyChangeListener( new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (TexlipseProperties.AUTO_PARSING.equals(property)) { autoParseEnabled = TexlipsePlugin.getDefault() .getPreferenceStore() .getBoolean(TexlipseProperties.AUTO_PARSING); } else if (TexlipseProperties.AUTO_PARSING_DELAY.equals(property)) { parseDelay = TexlipsePlugin.getDefault() .getPreferenceStore() .getInt(TexlipseProperties.AUTO_PARSING_DELAY); } else if (TexlipseProperties.SECTION_CHECK.equals(property)) { sectionCheckEnabled = TexlipsePlugin.getDefault() .getPreferenceStore() .getBoolean(TexlipseProperties.SECTION_CHECK); } } }); }