本文整理汇总了Java中ro.sync.ecss.extensions.api.AuthorAccess类的典型用法代码示例。如果您正苦于以下问题:Java AuthorAccess类的具体用法?Java AuthorAccess怎么用?Java AuthorAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthorAccess类属于ro.sync.ecss.extensions.api包,在下文中一共展示了AuthorAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customizePopUpMenu
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void customizePopUpMenu(Object popUp, AuthorAccess authorAccess) {
String editorURLString = PluginWorkspaceProvider.getPluginWorkspace().
getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA).getEditorLocation().toString();
final String selectedText = authorAccess.getEditorAccess().getSelectedText();
if ((selectedText != null) && (!selectedText.equals(""))) {
JMenuItem editorSelectionMenu = createSnippetEditorPopUpAddition();
((JPopupMenu) popUp).add(editorSelectionMenu, 0);
}
if (editorURLString.toLowerCase().startsWith("argon")) {
if (authorAccess.getEditorAccess().isEditable()) {
JMenuItem checkInMenuItem = createCheckInEditorPopUpAddition();
((JPopupMenu) popUp).add(checkInMenuItem, 0);
} else {
JMenuItem checkOutMenuItem = createCheckOutEditorPopUpAddition();
((JPopupMenu) popUp).add(checkOutMenuItem, 0);
}
}
}
示例2: doOperation
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws IllegalArgumentException, AuthorOperationException {
try {
final int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
final AuthorNode nodeAtCaret = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
//logger.info("nodeAtCaret: " + nodeAtCaret.getDisplayName());
XsltConref xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(nodeAtCaret, authorAccess);
if (xsltConref == null) {
// check if the parent node is an XSLT-Conref
xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(nodeAtCaret.getParent(), authorAccess);
//logger.info("nodeAtCaret.getParent(): " + nodeAtCaret.getParent().getDisplayName());
}
if (xsltConref != null) {
final String filetype = (String)args.getArgumentValue(ARG_FILETYPE);
//logger.info("filetype: " + filetype);
final URL url = ((filetype != null) && (filetype.equalsIgnoreCase(FILETYPE_SOURCE))) ? xsltConref.getXmlSourceUrl() : xsltConref.getScriptUrl();
PluginWorkspaceProvider.getPluginWorkspace().open(url, EditorPageConstants.PAGE_TEXT);
}
} catch (Exception e) {
logger.error(e, e);
}
}
示例3: resolve
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
private static boolean resolve(Styles styles, AuthorNode contextNode, String attrName, boolean replaceFirst) {
boolean handled = false;
final StaticContent[] mixedContent = styles.getMixedContent();
if ((mixedContent != null) && (mixedContent.length > 0)) {
final AuthorAccess authorAccess = getAuthorAccess();
if (authorAccess != null) {
final AuthorNodeWrapper context = new AuthorNodeWrapper(contextNode, authorAccess);
final String attrValue = context.getAttribute(attrName, NAMESPACE_URI);
if (attrValue != null) {
String resolved;
try {
resolved = EmbeddedXPathResolver.resolve(attrValue, context);
} catch (XPathException e) {
final String errMsg = e.getMessage().replaceFirst(ERR_MSG_REMOVE_REGEXP, "");
resolved = ERR_PREFIX + errMsg + ERR_SUFFIX;
styles.setProperty(Styles.KEY_FONT_WEIGHT, Styles.FONT_WEIGHT_BOLD);
styles.setProperty(Styles.KEY_FOREGROUND_COLOR, Color.COLOR_RED);
}
styles.getMixedContent()[replaceFirst ? 0 : styles.getMixedContent().length-1] = new StringContent(resolved);
}
}
handled = true;
}
return handled;
}
示例4: doOperation
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap argumentsMap) {
try {
final int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
final AuthorDocumentController documentController = authorAccess.getDocumentController();
final AuthorNode nodeAtCaret = documentController.getNodeAtOffset(caretOffset);
final AuthorNodeWrapper authorNode = new AuthorNodeWrapper(nodeAtCaret, authorAccess);
KeyDef keyDef = KeyDef.fromNode(authorNode);
KeyDefInformationDialog keyInformationDialog = new KeyDefInformationDialog((Frame)authorAccess.getWorkspaceAccess().getParentFrame(), keyDef);
keyInformationDialog.setLocationRelativeTo((Component)authorAccess.getWorkspaceAccess().getParentFrame());
keyInformationDialog.showDialog();
} catch (Exception e) {
logger.error(e, e);
}
}
示例5: replacePageSelectionWith
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
/**
* Performs a replace operation in the author page.
*
* @param fragment
* the fragment to insert
*/
private void replacePageSelectionWith(String fragment) {
AuthorAccess authorAccess = editorPage.getAuthorAccess();
AuthorDocumentController controller = authorAccess
.getDocumentController();
controller.beginCompoundEdit();
boolean deleteSelection = false;
try {
if (authorAccess.getEditorAccess().hasSelection()) {
deleteSelection = true;
authorAccess.getEditorAccess().deleteSelection();
}
CommonsOperationsUtil.surroundWithFragment(authorAccess, false,
fragment);
} catch (AuthorOperationException e) {
if (deleteSelection) {
controller.cancelCompoundEdit();
}
LOGGER.warn("Error: replacePageSelectionWith()", e);
} finally {
controller.endCompoundEdit();
}
}
示例6: actionPerformed
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
String selection = "";
WSEditor editorAccess = workspace.getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA);
if (editorAccess.getCurrentPageID().equals(EditorPageConstants.PAGE_AUTHOR)) {
WSEditorPage editorPage = editorAccess.getCurrentPage();
AuthorAccess authorAccess = ((WSAuthorEditorPage) editorPage).getAuthorAccess();
//selection = authorAccess.getEditorAccess().getSelectedText();
WSAuthorEditorPageBase baseAccess = authorAccess.getEditorAccess();
int[] nodeSelection = baseAccess.
getBalancedSelection(baseAccess.getBalancedSelectionStart(), baseAccess.getBalancedSelectionEnd());
AuthorParentNode selectedNode = (AuthorParentNode) baseAccess.
getFullySelectedNode(nodeSelection[0], nodeSelection[1]);
try {
selection = getAuthorText(((WSAuthorEditorPage) editorPage).getDocumentController(), selectedNode, 0);
} catch (BadLocationException ble) {
logger.error("Error while parsing XML from AuthorPage selection: ", ble.getMessage());
}
} else if (editorAccess.getCurrentPageID().equals(EditorPageConstants.PAGE_TEXT)) {
WSTextEditorPage textPage = (WSTextEditorPage)editorAccess.getCurrentPage();
selection = textPage.getSelectedText();
} else return;
String[] buttons = {Lang.get(Lang.Keys.cm_tofile), Lang.get(Lang.Keys.cm_todb), Lang.get(Lang.Keys.cm_cancel)};
int[] responseIDs = { 0, 1, -1};
int saveTo = workspace.showConfirmDialog(Lang.get(Lang.Keys.dlg_snippet), Lang.get(Lang.Keys.lbl_snippet), buttons, responseIDs, 0);
if (saveTo == -1)
return;
if (saveTo == 0)
saveToFile(selection);
else
saveToArgon(selection);
}
示例7: doOperation
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap argumentsMap) throws IllegalArgumentException, AuthorOperationException {
final AuthorEditorAccess editorAccess = authorAccess.getEditorAccess();
final boolean isModified = editorAccess.isModified();
try {
final int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
final AuthorNode nodeAtCaret = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
AuthorNode xsltConrefNode = nodeAtCaret;
XsltConref xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(xsltConrefNode, authorAccess);
if (xsltConref == null) {
// check if the parent node is an XSLT-Conref
xsltConrefNode = nodeAtCaret.getParent();
xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(xsltConrefNode, authorAccess);
}
if (xsltConref != null) {
// ensure the script will be recompiled.
XsltConrefResolver.getInstance().getTransformerCache().removeFromCache(xsltConref.getScriptUrl());
// ensure the schema will be reloaded.
XsltConrefResolver.getInstance().getTransformerCache().getConfiguration().clearSchemaCache();
}
authorAccess.getDocumentController().refreshNodeReferences(xsltConrefNode);
} catch (Exception e) {
logger.error(e, e);
}
if (!isModified) {
editorAccess.setModified(false);
}
}
示例8: resolveReference
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
public static String resolveReference(AuthorNode authorNode, AuthorAccess authorAccess) {
String resolved = null;
final AuthorNodeWrapper node = new AuthorNodeWrapper(authorNode, authorAccess);
final String attrClass = node.getAttribute(DitaUtil.ATTR_CLASS, null);
final String attrHref = node.getAttribute(DitaUtil.ATTR_HREF, null);
if ((attrHref != null) && (!attrHref.isEmpty()) && (attrClass.contains(DitaUtil.CLASS_XREF)) && (attrHref.contains(DitaUtil.HREF_URL_ID_DELIMITER))) {
final int hrefSplitPos = attrHref.indexOf(DitaUtil.HREF_URL_ID_DELIMITER);
final String hrefUrl = attrHref.substring(0, hrefSplitPos);
final String hrefId = attrHref.substring(hrefSplitPos + 1);
//logger.info("hrefUrl: " + hrefUrl + ", hrefId: " + hrefId);
URL refUrl;
if (hrefUrl.isEmpty()) {
refUrl = node.getBaseUrl();
} else {
try {
refUrl = new URL(node.getBaseUrl(), hrefUrl);
} catch (MalformedURLException e) {
logger.error(e, e);
refUrl = null;
}
}
//logger.info("refUrl: " + refUrl);
if (refUrl != null) {
final BookCache bookCache = BookCacheHandler.getInstance().getBookCache(node.getBaseUrl());
final FileCache fileCache = bookCache.getFile(refUrl);
if (fileCache != null) {
resolved = fileCache.getLinkText(hrefId, node);
}
}
}
return resolved;
}
示例9: getAuthorAccess
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
private static AuthorAccess getAuthorAccess() {
WSEditor editorAccess = PluginWorkspaceProvider.getPluginWorkspace().getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA);
if (editorAccess != null) {
WSEditorPage currentPage = editorAccess.getCurrentPage();
if (currentPage instanceof WSAuthorEditorPage) {
return ((WSAuthorEditorPage)currentPage).getAuthorAccess();
}
}
return null;
}
示例10: resolveContent
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
public static String resolveContent(AuthorNode node, AuthorAccess authorAccess) {
KeyRef keyRef = KeyRef.fromNode(new AuthorNodeWrapper(node, authorAccess));
if (keyRef != null) {
final BookCache cache = BookCacheHandler.getInstance().getBookCache(node.getXMLBaseURL());
return keyRef.getDisplaySuffix(cache, true).toString();
} else {
return null;
}
}
示例11: getReferenceSystemID
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public String getReferenceSystemID(AuthorNode node, AuthorAccess authorAccess) {
String systemID = null;
if (XsltConref.isXsltConref(new AuthorNodeWrapper(node, null))) {
systemID = node.getXMLBaseURL().toExternalForm();
} else {
systemID = super.getReferenceSystemID(node, authorAccess);
}
//logger.info("getReferenceSystemID: " + systemID);
return systemID;
}
示例12: resolveReference
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public SAXSource resolveReference(AuthorNode node, String systemID, AuthorAccess authorAccess, EntityResolver entityResolver) throws ReferenceResolverException {
final XsltConref xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(node, authorAccess);
SAXSource saxSource = null;
if (xsltConref != null) {
saxSource = XsltConrefResolver.getInstance().resolveXsltConref(xsltConref, authorAccess);
} else {
saxSource = super.resolveReference(node, systemID, authorAccess, entityResolver);
}
return saxSource;
}
示例13: getReferenceSystemID
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public String getReferenceSystemID(AuthorNode node, AuthorAccess authorAccess)
{
String systemID = null;
if (XsltConref.isXsltConref(new AuthorNodeWrapper(node, null))) {
systemID = node.getXMLBaseURL().toExternalForm();
} else {
systemID = super.getReferenceSystemID(node, authorAccess);
}
//logger.info("getReferenceSystemID: " + systemID);
return systemID;
}
示例14: resolveReference
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
public SAXSource resolveReference(AuthorNode node, String systemID, AuthorAccess authorAccess, EntityResolver entityResolver)
{
final XsltConref xsltConref = XsltConrefResolver.getInstance().xsltConrefFromNode(node, authorAccess);
SAXSource saxSource = null;
if (xsltConref != null) {
saxSource = XsltConrefResolver.getInstance().resolveXsltConref(xsltConref, authorAccess);
} else {
saxSource = super.resolveReference(node, systemID, authorAccess, entityResolver);
}
//logger.info("saxSource: " + saxSource);
return saxSource;
}
示例15: customizePopUpMenu
import ro.sync.ecss.extensions.api.AuthorAccess; //导入依赖的package包/类
@Override
public void customizePopUpMenu(Object popUp, AuthorAccess authorAccess) {
Highlight[] highlights = authorAccess.getEditorAccess().getHighlighter().getHighlights();
int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
for (Highlight highlight : highlights) {
if (caretOffset >= highlight.getStartOffset() && caretOffset <= highlight.getEndOffset()) {
RuleMatch match = (RuleMatch) highlight.getAdditionalData();
replaceMenuItems((JPopupMenu) popUp, match, new AuthorModeApplyReplacementAction(match, authorAccess));
break;
}
}
}