当前位置: 首页>>代码示例>>Java>>正文


Java BadLocationException.getMessage方法代码示例

本文整理汇总了Java中javax.swing.text.BadLocationException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java BadLocationException.getMessage方法的具体用法?Java BadLocationException.getMessage怎么用?Java BadLocationException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.BadLocationException的用法示例。


在下文中一共展示了BadLocationException.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
public String toString() {
    String elementContent = "";
    try {
        elementContent = getContent().trim().length() > PRINT_MAX_CHARS ?
            getContent().trim().substring(0, PRINT_MAX_CHARS) + "..." :
            getContent().trim();
    }catch(BadLocationException e) {
        elementContent = "error:" + e.getMessage();
    }
    return "DE (" + hashCode() + ")[\"" + getName() +
            "\" (" + getType() +
            ") <" + getStartOffset() +
            "-" + getEndOffset() +
            "> '" + encodeNewLines(elementContent) +
            "']";
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DocumentElement.java

示例2: insertSaasServiceAccessCode

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 *  Insert the Saas client call
 */
protected void insertSaasServiceAccessCode(boolean isInBlock) throws IOException {
    try {
        String code = "";
        if (isInBlock) {
            code = getCustomMethodBody();
        } else {
            code = "\nprivate String call" + getBean().getName() + "Service() {\n"; // NOI18n
            code += getCustomMethodBody() + "\n";
            code += "return "+getResultPattern()+";\n";
            code += "}\n";
        }
        insert(code, true);
    } catch (BadLocationException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CustomClientPojoCodeGenerator.java

示例3: insertSaasServiceAccessCode

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 *  Insert the Saas client call
 */
protected void insertSaasServiceAccessCode(boolean isInBlock) throws IOException {
    try {
        String code = "";
        if (isInBlock) {
            code = getCustomMethodBody();
        } else {
            code = "\nprivate String call" + getBean().getName() + "Service() {\n";
            code += getCustomMethodBody() + "\n";
            code += "return " + getResultPattern() + ";\n";
            code += "}\n";
        }
        insert(code, true);
    } catch (BadLocationException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SoapClientPojoCodeGenerator.java

示例4: insertSaasServiceAccessCode

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 *  Insert the Saas client call
 */
protected void insertSaasServiceAccessCode(boolean isInBlock) throws IOException {
    try {
        String code = "";
        if (isInBlock) {
            code = getCustomMethodBody();
        } else {
            code = "\nprivate String call" + getBean().getName() + "Service() {\n"; // NOI18n

            code += getCustomMethodBody() + "\n";
            code += "return "+getResultPattern()+";\n";
            code += "}\n";
        }
        insert(code, true);
    } catch (BadLocationException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:RestClientPojoCodeGenerator.java

示例5: replaceWord

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/** Replaces the current word token
   * @param newWord The new word to replace the misspelled one
   */
  @Override
public void replaceWord(String newWord) {
    if (currentWordPos != -1) {
      try {
        document.remove(currentWordPos, currentWordEnd - currentWordPos);
        document.insertString(currentWordPos, newWord, null);
        //Need to reset the segment
        document.getText(0, document.getLength(), text);
      } catch (BadLocationException ex) {
        throw new RuntimeException(ex.getMessage());
      }
      //Position after the newly replaced word(s)
      first = true;
      currentWordPos = getNextWordStart(text, currentWordPos + newWord.length());
      if (currentWordPos != -1) {
        currentWordEnd = getNextWordEnd(text, currentWordPos);
        nextWordPos = getNextWordStart(text, currentWordEnd);
        sentenceIterator.setText(text);
        sentenceIterator.following(currentWordPos);
      } else
        moreTokens = false;
    }
  }
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:27,代码来源:DocumentWordTokenizer.java

示例6: replaceRange

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 * Replaces text from the indicated start to end position with the
 * new text specified.  Does nothing if the model is null.  Simply
 * does a delete if the new string is null or empty.
 * <p>
 * This method is thread safe, although most Swing methods
 * are not.<p>
 * This method is overridden so that our Undo manager remembers it as a
 * single operation (it has trouble with this, especially for
 * <code>RSyntaxTextArea</code> and the "auto-indent" feature).
 *
 * @param str the text to use as the replacement
 * @param start the start position &gt;= 0
 * @param end the end position &gt;= start
 * @exception IllegalArgumentException  if part of the range is an
 *  invalid position in the model
 * @see #insert(String, int)
 * @see #replaceRange(String, int, int)
 */
@Override
public void replaceRange(String str, int start, int end) {
	if (end < start) {
		throw new IllegalArgumentException("end before start");
	}
	Document doc = getDocument();
	if (doc != null) {
		try {
			// Without this, in some cases we'll have to do two undos
			// for one logical operation (for example, try editing a
			// Java source file in an RSyntaxTextArea, and moving a line
			// with text already on it down via Enter.  Without this
			// line, doing a single "undo" moves all later text up,
			// but the first line moved down isn't there!  Doing a
			// second undo puts it back.
			undoManager.beginInternalAtomicEdit();
			((AbstractDocument)doc).replace(start, end - start,
                              		                     str, null);
		} catch (BadLocationException e) {
			throw new IllegalArgumentException(e.getMessage());
		} finally {
			undoManager.endInternalAtomicEdit();
		}
	}
   }
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:45,代码来源:RTextArea.java

示例7: getSelectedText

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 * Returns the selected text contained for this
 * <code>Caret</code>.  If the selection is
 * <code>null</code> or the document empty, returns <code>null</code>.
 *
 * @param caret
 * @return the text
 * @exception IllegalArgumentException if the selection doesn't
 *  have a valid mapping into the document for some reason
 */
private String getSelectedText(CaretItem caret) {
    String txt = null;
    int p0 = Math.min(caret.getDot(), caret.getMark());
    int p1 = Math.max(caret.getDot(), caret.getMark());
    if (p0 != p1) {
        try {
            Document doc = component.getDocument();
            txt = doc.getText(p0, p1 - p0);
        } catch (BadLocationException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
    return txt;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EditorCaret.java

示例8: getCatalogAsStream

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
public InputStream getCatalogAsStream() throws IOException{
    try {
        String docContent = backendCatalogSwingDocument.getText(0, backendCatalogSwingDocument.getLength());
        InputStream bis = new ByteArrayInputStream(docContent.getBytes());
        logger.finer("In getCatalogAsStream gona return:"+docContent);
        return bis;
    } catch (BadLocationException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CatalogFileWrapperDOMImpl.java

示例9: createPosition

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
public static Position createPosition(Document doc, int offset) {
    try {
        return doc.createPosition(offset);
    } catch (BadLocationException ex) {
        throw new IndexOutOfBoundsException(ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:AbstractPositionElement.java

示例10: charAt

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
public synchronized char charAt(int index) {
    try {
        doc.getText(index, 1, segment);
    } catch (BadLocationException e) {
        IndexOutOfBoundsException ioobe = new IndexOutOfBoundsException(e.getMessage()
            + " at offset=" + e.offsetRequested()); // NOI18N
        ioobe.initCause(e);
        throw ioobe;
    }
    char ch = segment.array[segment.offset];
    segment.array = null; // Allow GC of large char arrays
    return ch;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DocumentUtilities.java

示例11: getDocumentText

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
private String getDocumentText(int offset, int length) {
    try {
        return doc.getText(offset, length);
    } catch (BadLocationException e) {
        throw new IllegalStateException(e.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DemoTokenUpdater.java

示例12: _makeVisible

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
@Override public Object _makeVisible() {
    JEditorPane editor = (JEditorPane) parent.getComponent();
    try {
        Rectangle bounds = editor.modelToView(pos);
        if (bounds != null) {
            bounds.height = editor.getVisibleRect().height;
            editor.scrollRectToVisible(bounds);
        }
    } catch (BadLocationException e) {
        throw new InvalidElementStateException("Invalid position " + pos + "(" + e.getMessage() + ")", e);
    }
    return null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JEditorPanePosJavaElement.java

示例13: _getMidpoint

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
@Override public Point _getMidpoint() {
    JEditorPane editor = (JEditorPane) parent.getComponent();
    try {
        Rectangle bounds = editor.modelToView(pos);
        return new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
    } catch (BadLocationException e) {
        throw new InvalidElementStateException("Invalid position " + pos + "(" + e.getMessage() + ")", e);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JEditorPanePosJavaElement.java

示例14: _moveto

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
@Override public void _moveto() {
    JEditorPane editor = (JEditorPane) parent.getComponent();
    try {
        Rectangle bounds = editor.modelToView(pos);
        getDriver().getDevices().moveto(parent.getComponent(), bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
    } catch (BadLocationException e) {
        throw new InvalidElementStateException("Invalid position " + pos + "(" + e.getMessage() + ")", e);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JEditorPanePosJavaElement.java

示例15: replaceWord

import javax.swing.text.BadLocationException; //导入方法依赖的package包/类
/**
 * Replaces the current word token
 *
 * @param  newWord  The new word to replace the misspelt one
 */
public void replaceWord(String newWord) {
	AttributeSet attr = null;
	if (currentWordPos != -1) {
		try {
			if (document instanceof StyledDocument)
				attr = ((StyledDocument) document).getCharacterElement(currentWordPos).getAttributes();
			document.remove(currentWordPos, currentWordEnd - currentWordPos);
			document.insertString(currentWordPos, newWord, null);
			//Need to reset the segment
			document.getText(0, document.getLength(), text);
		}
		catch (BadLocationException ex) {
			throw new RuntimeException(ex.getMessage());
		}
		//Position after the newly replaced word(s)
		first = true;
		currentWordPos = getNextWordStart(text, currentWordPos + newWord.length());
		if (currentWordPos != -1) {
			currentWordEnd = getNextWordEnd(text, currentWordPos);
			nextWordPos = getNextWordStart(text, currentWordEnd);
			sentenceIterator.setText(text);
			sentenceIterator.following(currentWordPos);
		}
		else
			moreTokens = false;
	}
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:33,代码来源:DocumentWordTokenizer.java


注:本文中的javax.swing.text.BadLocationException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。