Kaydet (Commit) 53b80ecb authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Stephan Bergmann

Java cleanup - Static methods and fields should be accessed in a static way.

Change-Id: Ic9539f4c78574d995d983ab4b13b371f650e0c69
üst 309b4e24
...@@ -34,6 +34,7 @@ import com.sun.star.uno.*; ...@@ -34,6 +34,7 @@ import com.sun.star.uno.*;
import org.openoffice.java.accessibility.*; import org.openoffice.java.accessibility.*;
import java.awt.EventQueue;
import java.awt.Window; import java.awt.Window;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -224,7 +225,8 @@ public class AccessBridge { ...@@ -224,7 +225,8 @@ public class AccessBridge {
public void dispose() { public void dispose() {
try { try {
java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait( java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
EventQueue.invokeAndWait(
new Runnable() { new Runnable() {
public void run() { public void run() {
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
*/ */
package org.openoffice.accessibility; package org.openoffice.accessibility;
import javax.accessibility.AccessibleContext;
import org.openoffice.java.accessibility.*; import org.openoffice.java.accessibility.*;
...@@ -103,7 +105,7 @@ public class PopupWindow extends java.awt.Window { ...@@ -103,7 +105,7 @@ public class PopupWindow extends java.awt.Window {
javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext(); javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext();
if (ac != null) { if (ac != null) {
ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY, null, ac.firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null,
popupLayer.getAccessibleContext()); popupLayer.getAccessibleContext());
} }
} }
...@@ -118,7 +120,7 @@ public class PopupWindow extends java.awt.Window { ...@@ -118,7 +120,7 @@ public class PopupWindow extends java.awt.Window {
javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext(); javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext();
if (ac != null) { if (ac != null) {
ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY, ac.firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
popupLayer.getAccessibleContext(), null); popupLayer.getAccessibleContext(), null);
} }
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.openoffice.java.accessibility; package org.openoffice.java.accessibility;
import java.awt.Component; import java.awt.Component;
import java.awt.EventQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import javax.accessibility.Accessible; import javax.accessibility.Accessible;
import javax.accessibility.AccessibleStateSet; import javax.accessibility.AccessibleStateSet;
...@@ -73,7 +74,7 @@ public class AccessibleObjectFactory { ...@@ -73,7 +74,7 @@ public class AccessibleObjectFactory {
public static void invokeAndWait() { public static void invokeAndWait() {
try { try {
theEventQueue.invokeAndWait( new java.lang.Runnable () { EventQueue.invokeAndWait( new java.lang.Runnable () {
public void run() { public void run() {
} }
}); });
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
package org.openoffice.java.accessibility; package org.openoffice.java.accessibility;
import java.awt.EventQueue;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleState;
...@@ -168,7 +170,8 @@ public abstract class Component extends java.awt.Component { ...@@ -168,7 +170,8 @@ public abstract class Component extends java.awt.Component {
} }
protected void firePropertyChange(String property, Object oldValue, Object newValue) { protected void firePropertyChange(String property, Object oldValue, Object newValue) {
getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue)); getEventQueue();
EventQueue.invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue));
} }
protected void fireStatePropertyChange(AccessibleState state, boolean set) { protected void fireStatePropertyChange(AccessibleState state, boolean set) {
...@@ -181,14 +184,15 @@ public abstract class Component extends java.awt.Component { ...@@ -181,14 +184,15 @@ public abstract class Component extends java.awt.Component {
if (set) { if (set) {
broadcaster = new PropertyChangeBroadcaster( broadcaster = new PropertyChangeBroadcaster(
accessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
null, state); null, state);
} else { } else {
broadcaster = new PropertyChangeBroadcaster( broadcaster = new PropertyChangeBroadcaster(
accessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
state, null); state, null);
} }
getEventQueue().invokeLater(broadcaster); getEventQueue();
EventQueue.invokeLater(broadcaster);
} }
/** /**
...@@ -292,7 +296,7 @@ public abstract class Component extends java.awt.Component { ...@@ -292,7 +296,7 @@ public abstract class Component extends java.awt.Component {
switch (event.EventId) { switch (event.EventId) {
case AccessibleEventId.ACTION_CHANGED: case AccessibleEventId.ACTION_CHANGED:
firePropertyChange(accessibleContext.ACCESSIBLE_ACTION_PROPERTY, firePropertyChange(AccessibleContext.ACCESSIBLE_ACTION_PROPERTY,
toNumber(event.OldValue), toNumber(event.NewValue)); toNumber(event.OldValue), toNumber(event.NewValue));
break; break;
case AccessibleEventId.NAME_CHANGED: case AccessibleEventId.NAME_CHANGED:
...@@ -331,10 +335,10 @@ public abstract class Component extends java.awt.Component { ...@@ -331,10 +335,10 @@ public abstract class Component extends java.awt.Component {
firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null); firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null);
break; break;
case AccessibleEventId.CARET_CHANGED: case AccessibleEventId.CARET_CHANGED:
firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue)); firePropertyChange(AccessibleContext.ACCESSIBLE_CARET_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue));
break; break;
case AccessibleEventId.VALUE_CHANGED: case AccessibleEventId.VALUE_CHANGED:
firePropertyChange(accessibleContext.ACCESSIBLE_VALUE_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue)); firePropertyChange(AccessibleContext.ACCESSIBLE_VALUE_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue));
default: default:
// Warn about unhandled events // Warn about unhandled events
if(Build.DEBUG) { if(Build.DEBUG) {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.openoffice.java.accessibility; package org.openoffice.java.accessibility;
import java.awt.Component; import java.awt.Component;
import java.awt.EventQueue;
import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleState;
...@@ -173,7 +174,8 @@ public class Container extends java.awt.Container implements javax.accessibility ...@@ -173,7 +174,8 @@ public class Container extends java.awt.Container implements javax.accessibility
} }
protected void firePropertyChange(String property, Object oldValue, Object newValue) { protected void firePropertyChange(String property, Object oldValue, Object newValue) {
getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue)); getEventQueue();
EventQueue.invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue));
} }
protected void fireStatePropertyChange(AccessibleState state, boolean set) { protected void fireStatePropertyChange(AccessibleState state, boolean set) {
...@@ -187,7 +189,8 @@ public class Container extends java.awt.Container implements javax.accessibility ...@@ -187,7 +189,8 @@ public class Container extends java.awt.Container implements javax.accessibility
AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
state, null); state, null);
} }
getEventQueue().invokeLater(broadcaster); getEventQueue();
EventQueue.invokeLater(broadcaster);
} }
/** /**
......
...@@ -64,7 +64,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib ...@@ -64,7 +64,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib
int pos = at.getCaretPosition(); int pos = at.getCaretPosition();
// Simulating a caret event here should help at tools // Simulating a caret event here should help at tools
// that re not aware of the paragraph approach of OOo. // that re not aware of the paragraph approach of OOo.
firePropertyChange(ac.ACCESSIBLE_CARET_PROPERTY, firePropertyChange(AccessibleContext.ACCESSIBLE_CARET_PROPERTY,
new Integer(-1), new Integer(pos)); new Integer(-1), new Integer(pos));
} }
} }
...@@ -75,7 +75,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib ...@@ -75,7 +75,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib
public void notifyEvent(AccessibleEventObject event) { public void notifyEvent(AccessibleEventObject event) {
switch (event.EventId) { switch (event.EventId) {
case AccessibleEventId.CARET_CHANGED: case AccessibleEventId.CARET_CHANGED:
firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, firePropertyChange(AccessibleContext.ACCESSIBLE_CARET_PROPERTY,
Component.toNumber(event.OldValue), Component.toNumber(event.OldValue),
Component.toNumber(event.NewValue)); Component.toNumber(event.NewValue));
break; break;
......
...@@ -464,23 +464,23 @@ implements DOCConstants, OfficeConstants, DocumentDeserializer { ...@@ -464,23 +464,23 @@ implements DOCConstants, OfficeConstants, DocumentDeserializer {
// copy font declarations from original document to the new document // copy font declarations from original document to the new document
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_FONT_DECLS); nl = origDomDoc.getElementsByTagName(TAG_OFFICE_FONT_DECLS);
df = doc.createDocumentFragment(); df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0)); newNode = XmlUtil.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode); rootNode.insertBefore(newNode, bodyNode);
// copy style catalog from original document to the new document // copy style catalog from original document to the new document
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_STYLES); nl = origDomDoc.getElementsByTagName(TAG_OFFICE_STYLES);
df = doc.createDocumentFragment(); df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0)); newNode = XmlUtil.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode); rootNode.insertBefore(newNode, bodyNode);
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES); nl = origDomDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
df = doc.createDocumentFragment(); df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0)); newNode = XmlUtil.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode); rootNode.insertBefore(newNode, bodyNode);
nl = origDomDoc.getElementsByTagName(TAG_OFFICE_MASTER_STYLES); nl = origDomDoc.getElementsByTagName(TAG_OFFICE_MASTER_STYLES);
df = doc.createDocumentFragment(); df = doc.createDocumentFragment();
newNode = xu.deepClone(df, nl.item(0)); newNode = XmlUtil.deepClone(df, nl.item(0));
rootNode.insertBefore(newNode, bodyNode); rootNode.insertBefore(newNode, bodyNode);
} }
......
...@@ -51,7 +51,7 @@ public class ConverterFactory { ...@@ -51,7 +51,7 @@ public class ConverterFactory {
// findConverterInfo expects the second paramenter to be the // findConverterInfo expects the second paramenter to be the
// destination MimeType // destination MimeType
if (foundInfo.isValidOfficeType(mimeTypeOut)) if (ConverterInfo.isValidOfficeType(mimeTypeOut))
foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeIn, mimeTypeOut); foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeIn, mimeTypeOut);
else else
foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeOut, mimeTypeIn); foundInfo = ConverterInfoMgr.findConverterInfo(mimeTypeOut, mimeTypeIn);
...@@ -80,7 +80,7 @@ public class ConverterFactory { ...@@ -80,7 +80,7 @@ public class ConverterFactory {
ConverterInfo foundInfo = null; ConverterInfo foundInfo = null;
boolean toOffice; boolean toOffice;
toOffice = foundInfo.isValidOfficeType(mimeTypeOut); toOffice = ConverterInfo.isValidOfficeType(mimeTypeOut);
// findConverterInfo expects the second paramenter to be the // findConverterInfo expects the second paramenter to be the
// destination MimeType // destination MimeType
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment