本文整理汇总了Java中org.eclipse.wst.sse.core.internal.provisional.INodeNotifier类的典型用法代码示例。如果您正苦于以下问题:Java INodeNotifier类的具体用法?Java INodeNotifier怎么用?Java INodeNotifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INodeNotifier类属于org.eclipse.wst.sse.core.internal.provisional包,在下文中一共展示了INodeNotifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAdapter
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
protected void initAdapter(INodeAdapter adapter, INodeNotifier node) {
// Assert.isTrue(cmDocumentManager == null);
// Assert.isTrue(fCMDocumentManagerListener == null);
//
// // register for CMDocumentManager events
// ModelQueryAdapter mqadapter = (ModelQueryAdapter)
// node.getAdapterFor(ModelQueryAdapter.class);
// if (mqadapter != null) {
// ModelQuery mquery = mqadapter.getModelQuery();
// if ((mquery != null) && (mquery.getCMDocumentManager() != null)) {
// cmDocumentManager = mquery.getCMDocumentManager();
// fCMDocumentManagerListener = new CMDocumentManagerListenerImpl();
// cmDocumentManager.addListener(fCMDocumentManagerListener);
// }
// }
}
示例2: pairReplaced
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* attrReplaced method
*
* @param element
* org.w3c.dom.Element
* @param newAttr
* org.w3c.dom.IJSONNode
* @param oldAttr
* org.w3c.dom.IJSONNode
*/
public void pairReplaced(IJSONObject element, IJSONPair newAttr,
IJSONPair oldAttr) {
if (element == null)
return;
IJSONNode attr = null;
IJSONValue oldValue = null;
IJSONValue newValue = null;
if (oldAttr != null) {
attr = oldAttr;
oldValue = oldAttr.getValue();
}
if (newAttr != null) {
attr = newAttr;
newValue = newAttr.getValue();
}
IJSONNode notifier = (IJSONNode) element;
int offset = notifier.getStartOffset();
notify(notifier, INodeNotifier.CHANGE, attr, oldValue, newValue, offset);
propertyChanged(notifier);
}
示例3: childReplaced
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* childReplaced method
*
* @param parentNode
* org.w3c.dom.Node
* @param newChild
* org.w3c.dom.Node
* @param oldChild
* org.w3c.dom.Node
*/
@Override
public void childReplaced(IJSONNode parentNode, IJSONNode newChild,
IJSONNode oldChild) {
if (parentNode == null)
return;
IJSONNode notifier = (IJSONNode) parentNode;
int type = INodeNotifier.CHANGE;
if (newChild == null)
type = INodeNotifier.REMOVE;
else if (oldChild == null)
type = INodeNotifier.ADD;
int offset = notifier.getStartOffset();
notify(notifier, type, oldChild, oldChild, newChild, offset);
structureChanged(notifier);
}
示例4: notifyStructureChanged
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
*/
private void notifyStructureChanged(IJSONNode root) {
if (root == null)
return;
INodeNotifier notifier = (INodeNotifier) root;
try {
// Its important to "keep going" if exception occurs, since this
// notification
// comes in between "about to change" and "changed" events. We do
// log, however,
// since would indicate a program error.
notifier.notify(INodeNotifier.STRUCTURE_CHANGED, null, null, null,
-1);
} catch (Exception e) {
Logger.logException(
"A structured model client threw following exception during adapter notification (" + INodeNotifier.EVENT_TYPE_STRINGS[INodeNotifier.STRUCTURE_CHANGED] + " )", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例5: cleanupModel
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
public void cleanupModel(IStructuredModel structuredModel, int start,
int length) {
JSONFormatUtil formatUtil = JSONFormatUtil.getInstance();
if (structuredModel instanceof IJSONModel) {
IJSONDocument doc = ((IJSONModel) structuredModel).getDocument();
IJSONSourceFormatter formatter = JSONSourceFormatterFactory
.getInstance().getSourceFormatter((INodeNotifier) doc);
StringBuilder buf = formatter.cleanup(doc);
if (buf != null) {
int startOffset = ((IndexedRegion) doc).getStartOffset();
int endOffset = ((IndexedRegion) doc).getEndOffset();
formatUtil.replaceSource(doc.getModel(), startOffset, endOffset
- startOffset, buf.toString());
}
}
}
示例6: attrReplaced
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* attrReplaced method
*
* @param element
* org.w3c.dom.Element
* @param newAttr
* org.w3c.dom.Attr
* @param oldAttr
* org.w3c.dom.Attr
*/
public void attrReplaced(Element element, Attr newAttr, Attr oldAttr) {
if (element == null)
return;
Attr attr = null;
String oldValue = null;
String newValue = null;
if (oldAttr != null) {
attr = oldAttr;
oldValue = oldAttr.getValue();
}
if (newAttr != null) {
attr = newAttr;
newValue = newAttr.getValue();
}
IDOMNode notifier = (IDOMNode) element;
int offset = notifier.getStartOffset();
notify(notifier, INodeNotifier.CHANGE, attr, oldValue, newValue, offset);
propertyChanged(notifier);
}
示例7: notifyStructureChanged
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
*/
private void notifyStructureChanged(Node root) {
if (root == null)
return;
INodeNotifier notifier = (INodeNotifier) root;
try {
// Its important to "keep going" if exception occurs, since this
// notification
// comes in between "about to change" and "changed" events. We do
// log, however,
// since would indicate a program error.
notifier.notify(INodeNotifier.STRUCTURE_CHANGED, null, null, null,
-1);
} catch (Exception e) {
Logger
.logException(
"A structured model client threw following exception during adapter notification (" + INodeNotifier.EVENT_TYPE_STRINGS[INodeNotifier.STRUCTURE_CHANGED] + " )", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例8: getNodeNotifiers
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
protected Set<INodeNotifier> getNodeNotifiers(Node node) {
Set<INodeNotifier> set = new HashSet<INodeNotifier>();
if (node instanceof INodeNotifier)
set.add((INodeNotifier)node);
if (node instanceof Element) {
Element econfig = XPagesDOMUtil.getAttributeElement((Element)node, EXT_LIB_ATTR_CONFIGURATION);
if (econfig instanceof INodeNotifier) {
set.add((INodeNotifier)econfig);
}
}
return set;
}
示例9: getAdapter
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* Returns the JFace adapter for the specified object.
*
* @param adaptable
* java.lang.Object The object to get the adapter for
*/
protected IJFaceNodeAdapter getAdapter(Object adaptable) {
if (adaptable instanceof INodeNotifier) {
INodeAdapter adapter = ((INodeNotifier) adaptable)
.getAdapterFor(IJFaceNodeAdapter.class);
if (adapter instanceof IJFaceNodeAdapter) {
return (IJFaceNodeAdapter) adapter;
}
}
return null;
}
示例10: getAdapter
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* Returns the JFace adapter for the specified object.
*
* @param adaptable
* java.lang.Object The object to get the adapter for
*/
protected IJFaceNodeAdapter getAdapter(Object adaptable) {
if (adaptable instanceof INodeNotifier) {
INodeAdapter adapter = ((INodeNotifier) adaptable).getAdapterFor(IJFaceNodeAdapter.class);
if (adapter instanceof IJFaceNodeAdapter) {
return (IJFaceNodeAdapter) adapter;
}
}
return null;
}
示例11: notifyChanged
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* Called by the object being adapter (the notifier) when something has
* changed.
*/
public void notifyChanged(INodeNotifier notifier, int eventType,
Object changedFeature, Object oldValue, Object newValue, int pos) {
// future_TODO: the 'uijobs' used in this method were added to solve
// threading problems when the dom
// is updated in the background while the editor is open. They may be
// a bit overkill and not that useful.
// (That is, may be be worthy of job manager management). If they are
// found to be important enough to leave in,
// there's probably some optimization that can be done.
if (notifier instanceof IJSONNode) {
Collection listeners = fAdapterFactory.getListeners();
Iterator iterator = listeners.iterator();
while (iterator.hasNext()) {
Object listener = iterator.next();
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90637
// if (notifier instanceof Node && (listener instanceof
// StructuredViewer) && (eventType ==
// INodeNotifier.STRUCTURE_CHANGED || (eventType ==
// INodeNotifier.CHANGE && changedFeature == null))) {
if ((listener instanceof StructuredViewer)
&& ((eventType == INodeNotifier.STRUCTURE_CHANGED)
|| (eventType == INodeNotifier.CONTENT_CHANGED) || (eventType == INodeNotifier.CHANGE))) {
if (DEBUG) {
System.out
.println("JFaceNodeAdapter notified on event type > " + eventType); //$NON-NLS-1$
}
// refresh on structural and "unknown" changes
StructuredViewer structuredViewer = (StructuredViewer) listener;
// https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=5230
if (structuredViewer.getControl() != null) {
getRefreshJob().refresh(structuredViewer,
(IJSONNode) notifier);
}
}
}
}
}
示例12: createAdapter
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
* Create a new JFace adapter for the JSON node passed in
*/
@Override
protected INodeAdapter createAdapter(INodeNotifier node) {
if (singletonAdapter == null) {
// create the JFaceNodeAdapter
singletonAdapter = new JFaceNodeAdapter(this);
initAdapter(singletonAdapter, node);
}
return singletonAdapter;
}
示例13: getParentFormatter
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
*/
protected IJSONSourceGenerator getParentFormatter(IJSONNode node) {
IJSONNode parent = node.getParentNode();
if (parent != null) {
IJSONSourceGenerator formatter = (IJSONSourceGenerator) ((INodeNotifier) parent)
.getAdapterFor(IJSONSourceFormatter.class);
if (formatter == null) {
formatter = JSONSourceFormatterFactory.getInstance()
.getSourceFormatter((INodeNotifier) parent);
}
return formatter;
}
return null;
}
示例14: NotifyEvent
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
NotifyEvent(INodeNotifier notifier, int type, Object changedFeature,
Object oldValue, Object newValue, int pos) {
this.notifier = notifier;
this.type = type;
this.changedFeature = changedFeature;
this.oldValue = oldValue;
this.newValue = newValue;
this.pos = pos;
this.reason = ""; //$NON-NLS-1$
}
示例15: notify
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; //导入依赖的package包/类
/**
*/
private void notify(INodeNotifier notifier, int eventType,
Object changedFeature, Object oldValue, Object newValue, int pos) {
if (notifier == null)
return;
if (this.changing && !this.flushing) {
// defer notification
if (this.fEvents == null)
this.fEvents = new ArrayList();
// we do not defer anything if we are doing a new Model,
// except for the document event, since all others are
// trivial and not needed at that initial point.
// But even for that one document event, in the new model case,
// it is still important to defer it.
if ((!doingNewModel)
|| (((IJSONNode) notifier).getNodeType() == IJSONNode.DOCUMENT_NODE)) {
this.fEvents.add(new NotifyEvent(notifier, eventType,
changedFeature, oldValue, newValue, pos));
}
return;
}
try {
// Its important to "keep going" if exception occurs, since this
// notification
// comes in between "about to change" and "changed" events. We do
// log, however,
// since would indicate a program error.
notifier.notify(eventType, changedFeature, oldValue, newValue, pos);
} catch (Exception e) {
Logger.logException(
"A structured model client threw following exception during adapter notification (" + INodeNotifier.EVENT_TYPE_STRINGS[eventType] + " )", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}