Używam Eclipse do programowania Android i już skonfigurowałem mój styl formatowania kodu, ale wciąż mam anonimowe metody, których nie mogłem wymyślić jak sformatować w Eclipse . Oto, jak Eclipse formatuje teraz anonimowe metody:Jak ustawić Code Formatter dla Java Anonymous Methods in Eclipse
// The BroadcastReceiver that listens for discovered devices and
// changes the title when discovery is finished
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Utils.Log.i("BLUETOOTH: " + action);
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the
// BluetoothDevice
// object from the
// Intent
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// If it's already
// paired, skip it,
// because it's been
// listed already
if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
if (mNewDevicesArrayAdapter.getCount() == 0) {
mNewDevicesArrayAdapter.add(device);
}
btDevicesUpdateList.add(device);
}
}
else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
mNewDevicesArrayAdapter.setItems(btDevicesUpdateList);
mNewDevicesArrayAdapter.notifyDataSetChanged();
btDevicesUpdateList.clear();
mBtAdapter.startDiscovery();
}
else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
if (mBtAdapter.getState() == BluetoothAdapter.STATE_ON) {
switchToView(viewBluetoothOn);
firstTimeDiscover();
}
else if (mBtAdapter.getState() == BluetoothAdapter.STATE_OFF) {
switchToView(viewBluetoothOff);
}
}
}
};
Zobacz? To bardzo bzdura. Jakie jest prawidłowe ustawienie formatu anonimowej deklaracji metody, aby pozostać po lewej stronie i nie należy pod takim samym znakiem?
proszę zamieszczać treści swoich .settings/org.eclipse.jdt.core.prefs –
spędziłem dobre pięć minut sprzątanie że strasznym formatowania, tylko uświadomić sobie pytanie brzmi * o * powiedział straszny formatowanie. **** headdesk **** –
@EugeneKuleshov to ustawienie specyficzne dla projektu. – papaiatis