use of org.eclipse.core.runtime.ListenerList in project liferay-ide by liferay.
the class LiferayPropertiesFileDescriber method describe.
public int describe(Reader contents, IContentDescription description) throws IOException {
try {
Class<?> contentClass = contents.getClass();
Field documentReaderField = contentClass.getDeclaredField("in");
documentReaderField.setAccessible(true);
Object documentReader = documentReaderField.get(contents);
Class<?> documentReaderClass = documentReader.getClass();
Field fDocumentField = documentReaderClass.getDeclaredField("fDocument");
fDocumentField.setAccessible(true);
Object fDocument = fDocumentField.get(documentReader);
Class<?> documentClass = fDocument.getClass();
Class<?> clazz = documentClass.getSuperclass();
Field fDocumentListenersField = clazz.getSuperclass().getDeclaredField("fDocumentListeners");
fDocumentListenersField.setAccessible(true);
ListenerList fDocumentListeners = (ListenerList) fDocumentListenersField.get(fDocument);
Object[] listeners = fDocumentListeners.getListeners();
for (Object listener : listeners) {
try {
Class<?> listenerClass = listener.getClass();
Class<?> superClass = listenerClass.getEnclosingClass().getSuperclass();
Field fFileField = superClass.getDeclaredField("fFile");
fFileField.setAccessible(true);
// get enclosing instance of listener
Field thisField = listenerClass.getDeclaredField("this$0");
thisField.setAccessible(true);
Object enclosingObject = thisField.get(listener);
Object fFile = fFileField.get(enclosingObject);
if (fFile instanceof IFile) {
IFile file = (IFile) fFile;
if (isPropertiesFile(file)) {
return VALID;
}
}
} catch (Exception e) {
}
}
} catch (Exception e) {
// ignore errors
}
return INVALID;
}
use of org.eclipse.core.runtime.ListenerList in project mdw-designer by CenturyLinkCloud.
the class PropertyEditor method dispose.
public void dispose() {
disposeWidget();
valueChangeListeners = new ListenerList();
}
Aggregations