eclipse preferences: setting proxy bypass defaults via plugin - eclipse

i'm trying to set some values into the Eclipse preferences, especially in the network connections -> Proxy bypass. I want to make some own entries.
So how can I put there some values?
By the
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
or better by
InstanceScope.INSTANCE.getNode(... ?
How do i access it, to put some values into?
Any hints would be welcome.
Thanks a lot guys!

You can find details about ConfigurationScope, InstanceScope and DefaultScope right here, from Vogella.
What you want to do is create FieldEditors.
Create preference pages like this:
public class ProxyPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
You will also need a "static" class (preferably interface) to hold the preference keys
IProxyPreferenceKeys -> put all your preference variables here.
When you create the field editors, pass the preference constant to it.
new ColorFieldEditor(IProxyPreferenceKeys.PROXY, "Proxy color:", parent);
Finally, in your code, when you need the preference setting, just get it like this:
Activator.getDefault().getPreferenceStore().getString(IProxyPreferenceKeys.PROXY)

The Network Connections preference page is org.eclipse.ui.internal.net.ProxyPreferencePage. This does not get the values directly from preferences but via classes such as ProxySelector and ProxyManager (all internal classes).
Looks like the values actually come from ConfigurationScope.INSTANCE.getNode("org.eclipse.core.net") with the keys defined in org.eclipse.core.internal.net.ProxyManager

Related

Eclipse key for "go to typed in class"

Is there a key in Eclipse Neon.3 (Java) that allows me to type in a class name and which then takes me to that class, whichever project in my workspace contains it? Specifically, I am not sitting in a source file with a reference to it, but I have a case like someone emails me and says "I have a question about class StoreImportantData" and I want to be able to type that class name in and go to it without thinking about where it might be located. Various "Search" functions will work, but are very clumsy or require temporarily changing my default search settings.
Normally Ctrl+Shift+T is bound to Open Type - should be the default, I'm pretty sure that I've not changed it.
Note: Ctrl+Shift+L list all key bindings, and the preferences
Window -> Preferences -> General -> Keys
lists all commands and bindings. It not only allows changing the binding, but also has a filter field that helps searching a specific functionality..

ELKI: Implementing a custom ResultHandler

I need to implement a custom ResultHandler but I am confused about how to actually integrate my custom class into the software package.
I have read this: http://elki.dbs.ifi.lmu.de/wiki/HowTo/InvokingELKIFromJava but my question is how are you meant to implement a custom result handler such that it shows up in the GUI?
The only way I can think of doing it is by extracting the elki.jar package and manually inserting my custom class into the source code, and then re-jarring the package. However I am fairly sure this is not the way it is meant to be done.
Also, in my resulthandler I need to output all the rows to a single text file with the cluster that each row belongs to displayed. How tips on how I can achieve this?
There are two questions in here.
in order to make your class instantiable by the UIs (both MiniGUI and command line), the classes must implement our Parameterization API. There are essentially two choices to make your class instantiable:
Add a public constructor without parameters (the UI won't know how to set your parameters!)
Add an inner static class Parameterizer that handles parameterization
in order to add your class to autocompletion (dropdown menu), the classes must be discovered by the MiniGUI/CLI/other UIs. ELKI uses two methods of discovery:
for .jar files, it reads the META-INF/elki/interfacename service files. This is a classic service-loader approach; except that we also allow ordering instances.
for directories only, ELKI will also scan for all .class files, and inspect them. This is mostly meant for development time, to avoid having to update the service files all the time. For performance reasons, we do not inspect the contents of .jar files; these are expected to use service files.
You do not need your class to be in the dropdown menu - you can always type the full class name. If this does not work, adding the name to the service file will not help either, but ELKI can either not find the class at all, or cannot instantiate it.
There is also a tutorial on implementing a custom result handler, but it does not discuss how to add it to the menu. In "development mode" - when having a folder with .class files - it will show up automatically.

MATLAB doesn't show help for user-created class private methods and properties

This is the problem:
Create a class and set the access to be private for some of the properties or methods.
Use the doc command for the created class. This will auto-generate documentation from your comments and show it in the built-in help browser.
doc classname
The problem is that documentation for the private properties and methods is not shown in the help browser. Is there any way to overcome this problem?
So I spent like 10 minutes using the debugger, jumping from one function to the next, tracing the execution path of a simple doc MyClass call.
Eventually it lead me to the following file:
fullfile(toolboxdir('matlab'),'helptools','+helpUtils','isAccessible.m')
This function is called during the process of generating documentation for a class to determine if the class elements (including methods, properties, and events) are publicly accessible and non-hidden. This information is used later on to "cull" the elements.
So if you are willing to modify MATLAB's internal functions, and you want the docs to always show all methods and properties regardless of their scope, just rewrite the function to say:
function b = isAccessible(classElement, elementKeyword)
b = true;
return
% ... some more code we'll never reach!
end
Of course, don't forget to make a backup of the file in case you changed your mind later :)
(on recent Windows, you'll need to perform this step with administrative privileges)
As a test, take the sample class defined in this page and run doc someClass. The result:
This behaviour is by design - the auto-generated documentation is intended for users of the class, who would only be able to access the public properties and methods.
There's no way that I'm aware of to change this behaviour.
You could try:
Use an alternative system of auto-generating documentation such as this from the MATLAB Central File Exchange (which I believe will document all properties, not just public).
Implement your own doc command. Your doc command should accept exactly the same inputs as the built-in doc command, detect if its inputs correspond to your class/methods/properties etc, and if so display their documentation, otherwise pass its inputs straight through to the built-in doc. Make sure your command is ahead of the built-in on the path.

Set Defaults on attribute

In EA I when I am adding attributes to a class I use the insert button. I would like to change the default new attribute to be public and of type string. I quickly did a search and found nothing. EA is hard to search for based on so many bogus responses.
So I thought I would quickly ask here.
Thanks in advance.
I'm fairly sure there isn't an option for this.
If you create your own UML profile (with a customized diagram type), you can set the default attribute type for attributes created from the diagram toolbox (not from within the Properties dialog), but even then there isn't a way to specify the default visibility.

Read remote properties

First of all, Hello everyone(/world) !
I am making an Eclipse RCP app' who needs to inspect some .properties located in some plugins who's Id I know at runtime.
I'd like to know if there is an easy way to read them, for example I know that in my plugin *org.anyname.myplugins.mypluginthatrocks I have a file named myawsomeproperties.properties*, how can I open it and read it easyly with a sort of getter/setter system like String getInProperties(String fileNameOrPath,String myPropertieId)
void setInProperties(String fileNameOrPath,String myPropertieId,String myPropertieValue)orString getInProperties(File file,String myPropertieId)
void setInProperties(File file,String myPropertieId,String myPropertieValue)or any other mean in that type if you get what I mean ...
Thanks in advance ^^
Well, if these are juste plain old properties, there is the good old ResourceBundle that will do the trick.
But, if you would like to do it, IMHO, a little bit cleaner, and in a more Eclipse oriented mind, I would suggest that you create a class that you use the NLS class, as explained here.