Skip to content

pre-commit auto remove trailing whitespace from java files #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repos:
- id: mixed-line-ending
files: ^main/.*\.(c|h)xx$|^main/.*\.java$|\.(asp|c|cl|common|dxp|el|h|hrc|idl|in|ini|m|md|mk|mm|mod|pas|php|pl|pm|py|rc|sh|xba|xcs|xdl|xhp|xmi|xsd|xslt?|ya?ml)$|^main/accessibility/.*$|^main/afms/.*$|^main/animations/.*$|^main/apache-commons/.*$|^test/testgui/.*$
- id: trailing-whitespace
files: (m|M)akefile$|\.(asp|bat|cl|common|el|hrc|in|ini|m|mk|mm|mod|pas|php|pl|pm|py|rc|sh|xba|xcs|xdl|xhp|xmi|xsd|ya?ml)$
files: (m|M)akefile$|\.(asp|bat|cl|common|el|hrc|in|ini|java|m|mk|mm|mod|pas|php|pl|pm|py|rc|sh|xba|xcs|xdl|xhp|xmi|xsd|ya?ml)$
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**************************************************************
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*************************************************************/


Expand Down Expand Up @@ -46,13 +46,13 @@


public class AccessBridge {
//
//
protected static java.util.Hashtable topWindowMap = new java.util.Hashtable();

private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) {
// Because it can not be garantied that
// WindowsAccessBridgeAdapter.registerTopWindow() is called
// before windowOpened(), we have to make this operation
// Because it can not be garantied that
// WindowsAccessBridgeAdapter.registerTopWindow() is called
// before windowOpened(), we have to make this operation
// atomic.
synchronized (topWindowMap) {
String oid = UnoRuntime.generateOid(xAccessible);
Expand Down Expand Up @@ -81,13 +81,13 @@ protected static java.awt.Window getTopWindow(XAccessible xAccessible) {
case AccessibleRole.ROOT_PANE:
case AccessibleRole.POPUP_MENU:
return getTopWindow(xAccessibleContext.getAccessibleParent());

case AccessibleRole.WINDOW:
case AccessibleRole.FRAME:
case AccessibleRole.DIALOG:
case AccessibleRole.ALERT:
return getTopWindowImpl(xAccessible);

default:
break;
}
Expand All @@ -108,12 +108,12 @@ protected static java.awt.Window removeTopWindow(XAccessible xAccessible) {
case AccessibleRole.ROOT_PANE:
case AccessibleRole.POPUP_MENU:
return removeTopWindow(xAccessibleContext.getAccessibleParent());

case AccessibleRole.WINDOW:
case AccessibleRole.FRAME:
case AccessibleRole.DIALOG:
return (java.awt.Window) topWindowMap.remove(UnoRuntime.generateOid(xAccessible));

default:
break;
}
Expand Down Expand Up @@ -162,7 +162,7 @@ public void initialize(java.lang.Object[] arguments) {
unoToolkit.addTopWindowListener(this);

String os = (String) System.getProperty("os.name");

// Try to initialize the WindowsAccessBridgeAdapter
if (os.startsWith("Windows")) {
WindowsAccessBridgeAdapter.attach(xComponentContext);
Expand Down Expand Up @@ -215,17 +215,17 @@ public void windowClosed(com.sun.star.lang.EventObject event) {

public void disposing(com.sun.star.lang.EventObject event) {
}

/*
* XComponent
*/

public void addEventListener(com.sun.star.lang.XEventListener listener) {
}

public void removeEventListener(com.sun.star.lang.XEventListener listener) {
}

public void dispose() {
try {
java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**************************************************************
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*************************************************************/


Expand All @@ -35,7 +35,7 @@

public class KeyHandler extends Component implements XKeyHandler, java.awt.KeyEventDispatcher {
EventQueue eventQueue;

public class VCLKeyEvent extends KeyEvent implements Runnable {
boolean consumed = true;

Expand All @@ -55,48 +55,48 @@ public boolean isConsumed() {
return consumed;
}
}

public KeyHandler() {
eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
}
/** This method is called by the current KeyboardFocusManager requesting that this KeyEventDispatcher

/** This method is called by the current KeyboardFocusManager requesting that this KeyEventDispatcher
* dispatch the specified event on its behalf
*/
public boolean dispatchKeyEvent(java.awt.event.KeyEvent e) {
if (e instanceof VCLKeyEvent) {
VCLKeyEvent event = (VCLKeyEvent) e;
event.setConsumed(false);
return true;
}
}
return false;
}

/** Handler for KeyPressed events */
public boolean keyPressed(com.sun.star.awt.KeyEvent event) {
// try {
VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_PRESSED,
AccessibleKeyBinding.convertModifiers(event.Modifiers),
VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_PRESSED,
AccessibleKeyBinding.convertModifiers(event.Modifiers),
AccessibleKeyBinding.convertKeyCode(event.KeyCode),
event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED);

eventQueue.postEvent(vke);
// VCL events for TABs have empty KeyChar

// VCL events for TABs have empty KeyChar
if (event.KeyCode == com.sun.star.awt.Key.TAB ) {
event.KeyChar = '\t';
}

// Synthesize KEY_TYPED event to emulate Java behavior
if (event.KeyChar != 0) {
eventQueue.postEvent(new VCLKeyEvent(this,
KeyEvent.KEY_TYPED,
AccessibleKeyBinding.convertModifiers(event.Modifiers),
KeyEvent.VK_UNDEFINED,
eventQueue.postEvent(new VCLKeyEvent(this,
KeyEvent.KEY_TYPED,
AccessibleKeyBinding.convertModifiers(event.Modifiers),
KeyEvent.VK_UNDEFINED,
event.KeyChar));
}

// Wait until the key event is processed
return false;
// eventQueue.invokeAndWait(vke);
Expand All @@ -107,16 +107,16 @@ public boolean keyPressed(com.sun.star.awt.KeyEvent event) {
// return false;
// }
}

/** Handler for KeyReleased events */
public boolean keyReleased(com.sun.star.awt.KeyEvent event) {
// try {
VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_RELEASED,
VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_RELEASED,
AccessibleKeyBinding.convertModifiers(event.Modifiers),
AccessibleKeyBinding.convertKeyCode(event.KeyCode),
AccessibleKeyBinding.convertKeyCode(event.KeyCode),
event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED);
eventQueue.postEvent(vke);

// Wait until the key event is processed
return false;
// eventQueue.invokeAndWait(vke);
Expand All @@ -127,7 +127,7 @@ public boolean keyReleased(com.sun.star.awt.KeyEvent event) {
// return false;
// }
}

public void disposing(com.sun.star.lang.EventObject event) {
java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**************************************************************
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*************************************************************/


Expand Down
Loading