Eclipse RCP App: How can I prompt the user to set the workspace - osgi

I want my RCP app to always prompt the user for the workspace location. I can specify a default location either with the -data arg in eclipse.ini or the osgi.instance.area.default property in configuration/config.ini. But I don't want the user to have to know about and edit either of these files to change the workspace location.
Setting the preference Prompt for workspace on startup has no effect. I launch the app in a clean workspace, with no -data arg or osgi.instance.area.default property set, and it creates a workspace folder in the current directory, and does not prompt to select a location.
I use a copy of the IDEApplication class for my application. I see that in line 188 which is one of the first lines run after start(), the platform location is already set, and this prevents the dialog from showing. I don't know why it's already set before even trying to launch the UI, and setting the preference has no effect. (I verified in configuration/.settings/org.eclipse.ui.ide.prefs that SHOW_WORKSPACE_SELECTION_DIALOG=true).
I tried re-setting the location by adding
instanceLoc = instanceLoc.createLocation(instanceLoc, null, false);
at the beginning of checkInstanceLocation(). This enables the workspace chooser dialog to come up, but setting the location this way has no effect on what the app actually uses for its instance area when it launches.
I thought that maybe some earlyStartup code in my app may be interfering, as I read that if you access the preferences too soon you can prevent the workspace chooser from opening. So I commented out the few earlyStartup declarations I had, and still I can't get the workspace chooser dialog to show.

The problem turned out to be that some classes loaded as dependencies of my OSGI service were accessing the class ResourcesPlugin, which causes the workspace location to be set immediately. Since this was happening before the workspace chooser dialog was launched, the location used was the value of the -data arg if specified, otherwise $(pwd)/workspace.
I tried resolving the issue by adjusting the start level of my service plug-in. With a start level of 7 or higher, the workspace chooser dialog was no longer pre-empted. However, the service did not work properly then. After numerous unsuccessful attempts to make the service work properly with a custom start level, I abandoned that approach and re-worked my code so the reference to ResourcesPlugin occurs later in the application startup process. Specifically, I moved it to the postWindowOpen method of my custom WorkbenchWindowAdvisor implementation.

Related

install4j how to create custom installer for macOS single bundle archive

To create installer for macOS (i4j 9.0.2) I used option "Installer-macOS single bundle". But it is deprecated now. As advised I use "Archive-macOS single bundle archive" instead. I want to have same installation dialogs as before. So, I selected "Use setup application" and had to create custom installer application in section "Installer". I created new application same as default "Installer" - manually added there all screens and actions with the same values as in "Installer".
Is this correct?
Anyway installation dialogs on Mac run without icons and images. Also installation wizard default location is not "Applications". What is wrong?
I created new application same as default "Installer" - manually added there all
screens and actions with the same values as in "Installer". Is this correct?
You can put all the screens that you want to use in the macOS setup application into a screen group and then add a link to that screen group in the setup application. In that way you do not have to duplicate them.
Anyway installation dialogs on Mac run without icons and images
I do not see that behavior here. Please contact support#ej-technologies.com with a download link to a media file that exhibits this behavior together with the .install4j project file.
Also installation wizard default location is not "Applications".
The media file type is an archive, it does not have an installation directory, but the user drags the application bundle to the desired location. This is the default installation procedure on macOS. You can style the DMG so that it shows a symbolic link to /Applications as a target in the window. This makes it easier for the user. For more information on that topic, see
https://www.ej-technologies.com/resources/install4j/help/doc/concepts/dmgStyling.html

How do programs that don't appear in the startup folder auto-execute on startup?

Just out of curiosity I was wondering how this is done. I know you can probably manually make a program startup using windows scheduler, but for something download from the interwebs, such as Discord, how does it autonomously give itself the ability to run on startup without actually being in the startup folder?
I found the answer elsewhere on this site, here is the link and a quote
https://stackoverflow.com/a/20781275/9546874
Add a new startup application Open your registry and find the key [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run].
For each program you want to start automatically create a new string value using a descriptive name, and set the value of the string to the program executable.
For example, to automatically start Notepad, add a new entry of "Notepad"="c:\windows\notepad.exe".
Some applications do not appear in the startup folder but start up automatically anyway. Programmers have the ability to disable their application showing up in the startup folder. To answer your question, it's a decision made by the dev team behind the application.
Here is a link to disable those applications using the shell: Disable items not in the Startup folder
This article goes into depth about how windows uses registry keys to open applications upon startup.
If you would like to disable discord's auto startup, this is how.

How to automatically upload externally changed file without IDE focus

I know about the automatic upload on external change setting in PHP Storm, but it only happens if PHP Storm is "active / in user focus". So if a file get's changed by some other source and my window focus is e.g. a browser, the file doesn't get uploaded until i refocus the IDE.
Do you know any way how to fix this behavior?
'Upload on external change' can't work unless PHPStorm is aware of this change. This is only possible if IDE virtual file system is synchronized with external changes - and it's get synchronized when you move focus to PHPStorm (if 'synchronize files on frame activation' is enabled). To synchronize VFS automatically, you need to run your 'some other source' from PHPStorm (as a file watcher, for example). Otherwise focusing IDE is the only way to make this work

Windows Registry changes will not work

I´m trying to make some changes(Wallpaper/Themes) on a windows7 enviroment, until now, I copied some files in to a directory with admin rights, so the "hard" part is over.
Trying to change the registryKey with a batch or with a Powershell file will work, as an Admin and as a normal-user.
The bad thing is, if I try to make the changes as an Admin, then the changes will be just for the adminSession. And I want to make the changes for the normalUser and every new user(with not admin rights).
I found that with a batch file, I can make some changes to my normalUser account:
HKCU:\Software\Micorsoft....\Themes\ and change the value CurrentTheme to my own Windows theme.
If I check my registry, I notice that the CurrentTheme value was accepted, and after a reboot stay so.
But Windows shows me the default theme... ¬¬
I tried to change "everything" to set my Theme as default, but nothing works..
Is there a way to make it works? Why windows is refusing to take the changes in the registry and always show me the default Theme?
Go to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows
In the left pane, right click on Windows and click on New and Key. Type Personalization and press enter (if not already exists).
Create a New and String Value called ThemeFile and press Enter. Right click on ThemeFile and click on Modify. Type in the full path of the .theme file with file extension in "" (example: "C:\Users\UserName\AppData\Local\Microsoft\Windows\Themes\NewCustomTheme.theme") ; it will be default for new users.
Are the systems on a domain?
You should know that registry values stored within the Policies key and all the subkeys after that can be reset by domain group policy at any time. That is to say that if you make a change here and reboot or run gpupdate, you can expect the values to be erased.
If you really want to change the theme for all users, you should use Group Policy to apply the theme, as seen in this link. Group Policy Settings for Windows Personalization.. Look in the section under "Set a Specific Theme".
I've done this for clients a number of times. You can also set a specific theme as the default by logging on as the Default Profile and making changes. Keep in mind that this approach should be done when you build a system image to deploy to the environment.

How can I debug a single ruby script in netbeans?

All of this is on a windows xp box:
Netbeans managed to accept an existing rails project and allowed me to debug it just fine, but my project has a number of processing scripts that handle non-MVC aspects. The rails project is just a system for queuing requests for the execution of these scripts.
I've attempted to create netbeans projects using existing sources, but it fails for a number of reasons.
First, since I have a number of scripts in one place, netbeans complains that I can't add a source directory to the project because it already belongs to another project. If I put the script into its own, empty, directory and try to add that directory, netbeans stalls while trying to create the project and I have to end the process from the task manager.
If I create a new project for it, remove the default main.rb and replace it with the script I want to debug, the debug session will not start - netbeans complains that it cannnot find the program entry point.
It seems to me that if I can debug rails apps as easily as netbeans allows me to, that running a single standalone script would be trivial. What on earth am I missing?
UPDATE: Loading the script and doing "Debug/Debug File" isn't possible. The option is always greyed out, even for hello world.
Right click on the project, click Properties, choose Run, and change the Main Script to your script.
You can also debug a single file in Rails project by opening the file, then click Debug in menu toolbar, then Debug "file_name.rb". Or just press Ctrl-Shift-F5 on the opened file.

Resources