Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: Marker.java   Sprache: JAVA

Original von: Isabelle©

/*
 * Marker.java - Named location in a buffer
 * :tabSize=4:indentSize=4:noTabs=false:
 * :folding=explicit:collapseFolds=1:
 *
 * Copyright (C) 1998, 1999, 2000, 2001 Slava Pestov
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */


package org.gjt.sp.jedit;

import javax.swing.text.Position;

/**
 * Buffers may contain one or more <i>markers</i> which serve
 * as textual bookmarks.<p>
 *
 * A <code>Marker</code> has three key attributes: the
 * <code>Buffer</code> to which it relates, the offset to which
 * the marker refers, and an optional shortcut character. The shortcut
 * identifies the key that can be pressed with the
 * <b>Markers</b>><b>Go To Marker</b> command.
 *
 * @author Slava Pestov
 * @author John Gellene (API documentation)
 * @version $Id: Marker.java 21831 2012-06-18 22:54:17Z ezust $
 */

public class Marker
{
 //{{{ getShortcut() method
 /**
 * Returns the marker's shortcut character.
 * @since jEdit 3.2pre1
 */

 public char getShortcut()
 {
  return shortcut;
 } //}}}

 //{{{ getPosition() method
 /**
 * Returns the position of this marker.
 * @since jEdit 3.2pre1
 */

 public int getPosition()
 {
  return (position == null ? pos : position.getOffset());
 } //}}}

 //{{{ Package-private members

 //{{{ Marker constructor
 /**
 * <p>After a marker is created using the constructor,
 * {@link #createPosition} should be called, to make the marker reflect
 * always the same place despite text editions. The position is maintained
 * by {@link org.gjt.sp.jedit.buffer.PositionManager} class, which is
 * maintained by {@link org.gjt.sp.jedit.buffer.JEditBuffer}.
 */

 Marker(Buffer buffer, char shortcut, int position)
 {
  this.buffer = buffer;
  this.shortcut = shortcut;
  this.pos = position;
 } //}}}

 //{{{ setShortcut() method
 /**
 * Sets the marker's shortcut.
 * @param shortcut The new shortcut
 * @since jEdit 3.2pre1
 */

 void setShortcut(char shortcut)
 {
  this.shortcut = shortcut;
 } //}}}

 //{{{ createPosition() method
 void createPosition()
 {
  position = buffer.createPosition(pos);
 } //}}}

 //{{{ removePosition() method
 void removePosition()
 {
  // forget the cached Position instance
  if(position != null)
  {
   pos = position.getOffset();
   position = null;
  }
 } //}}}

 //{{{ setPosition() method
 /**
 * Sets the position of this marker.
 * @since jEdit 4.0pre5
 */

 void setPosition(int pos)
 {
  this.pos = pos;
 } //}}}

 //}}}

 //{{{ Private members
 private Buffer buffer;
 private char shortcut;
 private int pos;
 private Position position;
 //}}}
}

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.


Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.


Bot Zugriff



                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik