Why does the button that is used to launch a custom macro stop working after I rename the subroutine? - libreoffice

I have a following macro that is added into LibreOffice itself (and not into specific document or spreadsheet):
REM Added into "My Macros & Dialogs: Standard: Module1"
REM (Tools > Macros > Edit Macros > ...)
Sub Foo
MsgBox "hello world"
End Sub
And I have created a custom toolbar to run it by clicking a button on it:
Tools > Customize > Toolbars > Gear button > Add > Toolbar name = My own macros, Save in = LibreOffice Writer
Category = Macros > Expand the "My Macros" tree > Select the "Foo" command in the "Available Commands" list > Add it to the "Assigned Commands" list
This works.*
But if I rename my subroutine in the code from Foo to Bar, the button stops working. It produces the following error:
What I need to do to make it work? (To make the button work after the subroutine had been renamed)?

Related

How to go to a sheet by sheetname?

I have around 300-400 sheets in a Libreoffice Calc file.
I have tried everything and I can't seem to go to a particular sheet by its name, that is the sheet is named: XYZ and when I try to find it using XYZ there are no results.
How do I go to a sheet by its name?
Go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add this code.
Sub gotoSheet
sName = InputBox("Which sheet?")
oSheet = ThisComponent.getSheets().getByName(sName)
ThisComponent.CurrentController.setActiveSheet(oSheet)
End Sub
Then go to Tools -> Customize and attach the macro to a toolbar button or hotkey.
Other options for going to a particular sheet more easily, such as using the Navigator list or creating hyperlinks, are described at:
https://ask.libreoffice.org/en/question/10650/jumping-sheet-tabs/
https://ask.libreoffice.org/en/question/167878/where-is-the-goto-function-within-calc/
No need to create a macro. Just use the keyboard shortcut Ctrl+Shift+F5 to jump to the name box, type the (whole) sheet name and press enter.

VSCode search/go to definitions

I searched in vscode site but I couldn't find information on the following:
Is there any way to search definition in other files.
For example:
In sublime text I can open command pallette (ctrl+p) and write 'User.php#delete' - this will find the method and if i click enter I will go the the specific file and in the line where method 'delete' is.
Does the functionality exist in VSCode (or with extension).
Thanks
There are multiple options to search function/definition.
According to your convenience, you can choose one of the below options :
Best shortcut: Ctrl+Shift+O and type your function name.
Press Ctrl+P for "quick open", then you can use # or #: The latter is handy to see all the symbols in the file grouped by classes, constants, fields, methods
Press Ctrl+T to searches across files, not just the current file.
Hover the method and press crtl. The method will be underlined and show a tooltip with definition. Mouse left click = go to definition.
yes, in command palete enter # symbol (without preceding >) end method name.

How can I get Eclipse to auto-indent code blocks within if and for statements?

I tried to get Eclipse to convert all of the tabs in my project to spaces like this:
Java Editor:
Click Window » Preferences
Expand Java » Code Style
Click Formatter
Click the Edit button
Click the Indentation tab
Under General Settings, set Tab policy to: Spaces only
Click OK ad nauseum to apply the changes.
And now my code is formatted without any indentations within if and for blocks, like this:
private void addAppointment(Resource resource) {
if (resource != null) {
Appt appt1 = new Appt();
appt1.setTime(new Date());
resource.setAppointment(appt1);
}
}
I really don't want to have to manually fix this in the hundreds of files in the project, how can I format to indent within if and for blocks in the whole project?
I should also say that the "Statements within blocks" checkbox in the active Formatter profile is checked. The preview it shows has a for block with an indented body, so I have no idea why that isn't being applied to my project.
#gnac provides some good options, in addition to:
Similarly you can use ctrl+shift+f (Source->Format) on each class to format it on the fly
You can select the project(s) and do Source menu -> Format to format everything in that project in one go. (No keyboard shortcut for it AFAIK.)
So once you set your formatting options you have a couple of options. You can set the preferences to format your files when saving.
Preferences->Java->Editor->Save Actions
However, if you have a lot of files this will be a pain as well. Similarly you can use ctrl+shift+f (Source->Format) on each class to format it on the fly, again having to do it on each file individually.
Inside Eclipse you can use Search->Find, enter "\t" in the text box and select the "Regular Expression" check box and then click the "Replace..." button. When the search is done, it will ask you what to replace it with. Enter 4 spaces into the "With" text field. Click Preview to see what it will do, or OK to make the changes.
I would use a find and sed to find all of the java files in a directory and replace the tabs, although this is outside of eclipse
find -iname ".java" -exec sed -i.orig 's/\t/ /g' {} +
If you're not on Linux you could use cygwin to do the same on Windows.

Returning value to pane from macro in ipython

I am new to python.. I am trying to create a macro. When selected a word and press f3 filedialog will come and ill select a folder,ill get the occurance of that word in all files in tat folder displayed in the pane. The problem now is I couldn't return a value from macro editor to this pane.
Currently I am using this code
code_task = get_active_task()
python_pane = code_task.python_pane
python_pane.execute_command(u'print "searchstring"\n')
(consider searchstring contains the data)
When I try to execute it is telling tat undefined variable searchstring. Help me how to send the data from macro editor to the pane.

Spaces instead of tabs in Eclipse (Galileo 3.52)?

Is there any way in Eclipse (Galileo 3.52) to have it replace tabs with spaces ("soft tabs")? I've tried two things so far . . .
Windows>Preferences>Editors>Text Editors... check "Insert spaces for tabs"
...and...
Window->Preferences->Java->Code Style->Formatter->Edit... "Use Spaces to indent wrapped lines"
(... this forces you to create a new profile to save these settings)
This produces partial success - the first tab is turned in to spaces but subsequent ones are still tabs. So if I type
tabtab 1234
...I end up with...
spacespacespacespace tab 1234
You can do:
Window -> Preferences -> Java -> Code Style -> Formatter
Click on “Show” button (or "Edit") right beside the name of the profile you are using.
In the indentantion Tab, change the "Tab Policy" field to "spaces only"
Click Ok, and save the profile with the name you want.
Could the missing setting be the Tab policy: Spaces only combo box in Preferences >Java > Code Style Formatter > Edit > Indentation (right above where you changed Use spaces to indent wrapped lines)?