Where does Eclipse store its user preferences? Specifically the keyboard bindings?
When you close Eclipse, any local settings regarding key shortcuts (settings that differ from the default configuration) are saved in
</path/to/workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\
org.eclipse.ui.workbench.prefs
You can actually just copy the whole line in the org.eclipse.ui.workbech.prefs file that starts with: org.eclipse.ui.commands=
and paste it into the other corresponding eclipse workspace prefs file you want to update - at least in Eclipse Neon, and you'll get them all at once.
You can extract the bindings using the following groovy script. I'm not a groovy developer so please excuse my hack.
Groovy Script Used (substitute in a correct path to the workbench xmi file):
workbench = new XmlSlurper().parse("<path to eclipse>/workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi")
List bindingTables
workbench.bindingTables.each
{ it->
//println "\tContributorURI: ${it.#contributorURI} | \tElementID : it.#elementId";
def command = "command";
def commandName = "commandname";
def description = "description";
def category;
def name = "name";
def keys = "keys";
it.bindings.each
{bindingIt->
//loop through every binding entry
command = bindingIt.#command;
keys = bindingIt.#keySequence;
workbench.commands.each
{commandIt->
def thisCommand = commandIt.attributes()['{http://www.omg.org/XMI}id'];
if(thisCommand.equals(command.toString()) )
{
commandName = commandIt.#commandName;
description = commandIt.#description;
category = commandIt.#category;
workbench.categories.each
{workbenchIt->
if(workbenchIt.attributes()['{http://www.omg.org/XMI}id'].equals(category.toString()) )
{
name = workbenchIt.#name;
}
}
}
}
println "\t\tKeys: ${keys}\tCommand: ${commandName}"+
"\tDescription: "+description+"\tName: "+name;
}
}
Related
I'm using NeoVim with autocomplete using nvim-lspconfig and nvim-cmp. I would like to know if there's a way of filtering out text feeds from the autocompletion menu, so that they don't appear in the contextual menu:
In your setup you can exclude any kind if suggestions thanks to this merged PR.
What is happening is the function "entry_filter" is getting called whenever a suggestion for nvim_lsp is being made. in it we return false if the entry is of the kind "text".
local cmp = require "cmp"
cmp.setup {
...
sources = cmp.config.sources({
-- Dont suggest Text from nvm_lsp
{ name = "nvim_lsp",
entry_filter = function(entry, ctx)
return require("cmp").lsp.CompletionItemKind.Text ~= entry:get_kind()
end },
})
}
Check out nvim-cmp sources list and remove whatever source you don't want to use. Text is quite probably coming from buffer:
cmp.setup({
...
sources = cmp.config.sources({
{ name = 'buffer' }, -- <- remove
{ name = 'nvim_lsp' },
...
})
})
There is an existing project that uses Scalatra (2.6) and Swagger:
scalaMajorVersion = '2.12'
scalaVersion = "${scalaMajorVersion}.8"
scalatraVersion = "${scalaMajorVersion}:2.6.4"
compile "org.scalatra:scalatra-swagger_${scalatraVersion}"
I easily could add a new end point like:
get ("/upload", op[String]( // op finally invokes apiOperation
name = "Test method",
params = List(
query[Long]("id" -> "ID"),
query[String]("loginName" -> "login name")
),
authorizations = List(Permission.xxxxx.name)
)) {
...
}
but I cannot upload a file.
I expect to see a file selector button, but instead I see a single-line edit field.
(There are numerous things I'm uncertain about: form or file, [String] or [FileItem], which trait(s), what kind of initialization, etc.)
In the existing code I found a comment that someone could not get swagger to handle file upload. At the same time, I read that Scalatra and Swagger can do that, not all versions of them, but it looks like the version used in the project should be able to do that.
I could find code examples with yml/json interface definitions, but in the project there is no yml, only the apiOperation-based stuff.
Is there a working example using Scalatra 2.6, Swagger, and apiOperation?
I managed to get the file chooser (file selector, "Browse") button; there was no predefined constant (like DataType.String) for that. After I used DataType("File"), everything else just worked.
https://docs.swagger.io/spec.html says:
4.3.5 File
The File (case sensitive) is a special type used to denote file
upload. Note that declaring a model with the name File may lead to
various conflicts with third party tools and SHOULD be avoided.
When using File, the consumes field MUST be "multipart/form-data", and
the paramType MUST be "form".
post ("/uploadfile", op[String]( // op finally invokes apiOperation
name = "Upload File",
params = List(
new Parameter(
`name` = "kindaName",
`description` = Some("kindaDescription2"),
`type` = DataType("File"), // <===== !!!!!!
`notes` = Some("kindaNotes"),
`paramType` = ParamType.Form, // <===== !!
`defaultValue` = None,
`allowableValues` = AllowableValues.AnyValue,
`required` = true
)
),
consumes = List("multipart/form-data"), // <===== !!
...
)) {
val file: FileItem = fileParams("kindaName") // exception if missing
println("===========")
println("file: " + file)
println("name: " + file.getName + " size:"+file.getSize+" fieldName:"+file.getFieldName+ " ContentType:"+file.getContentType+" Charset:"+file.getCharset)
println("====vvv====")
io.copy(file.getInputStream, System.out)
println("====^^^====")
val file2: Option[FileItem] = fileParams.get("file123") // None if missing, and it is missing
println("file2: " + file2)
PS the apiOperation stuff is called "annotations".
I'm kind of new to xtext and I'm working on an already given Language. I now want to use the StandaloneSetupGenerated class but the extension used for the registry is not the one used for the files. So the setup wont match. Where does the StandaloneSetupGenerated gets this extension from, so where do I need to change the param for the generated file to match my real file extension.
The part of the workflow looks like:
component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${runtimeProject}.ui"
pathTestProject = "../../tests/${projectName}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
encoding = encoding
language = auto-inject {
fileExtensions = file.extensions
uri = grammarURI
the property file.extensions provides the right extension but is not the one used in the generated StandaloneSetup.
the file extensions are configured in the language workflow
language = StandardLanguage {
name = "org.xtext.example.mydsl.MyDsl"
fileExtensions = "mydsl"
in xtext <= 2.8.4 style workflows it is
var fileExtensions = "mydsl"
I'm doing some stuff to create correctly a release like 'X.X.build_number.build_id'. But I can't have correctly my build number like I want :
MMdd instead of YY-MM-DD_hh:mm:ss . With the ZenTimestamp plugin, it only change it on display, but when I try to pass to an other job, PROMOTED_ID have the same value than the timestamp.
So I tried to use a variable to format it, but it's not working ...
I made a variable called ID
I made a Windows Powershell build :
$format = '{0:MMdd}' -f $env:BUILD_ID
echo "`$env:ID='$format'" > releaseId
I made an "Inject environment variables" to pass my new value.
I tried a lot of different solution, but nothing is working like I want... What do I miss ??
#Slav : My parameter wasn't set so I didn't have any value in it.
To solve it I used a groovy script, to recreate my parameters and add what I needed :
import hudson.model.*
import java.text.SimpleDateFormat
def build = Thread.currentThread().executable
def npl = new ArrayList<StringParameterValue>()
def newParam = null
def oldParam = build.getAction(ParametersAction.class)
def dateFormat = new SimpleDateFormat("MMdd").format(new Date())
npl.add(new StringParameterValue("RELEASE_ID",dateFormat))
if (oldParam != null) {
build.actions.remove(oldParam)
newParam = oldParam.createUpdated(npl)
}
else {
newParam = new ParametersAction(npl)
}
build.actions.add(newParam)
return null
I'm trying to create a new file in an eclipse plugin. It's not necessarily a Java file, it can be an HTML file for example.
Right now I'm doing this:
IProject project = ...;
IFile file = project.getFile("/somepath/somefilename"); // such as file.exists() == false
String contents = "Whatever";
InputStream source = new ByteArrayInputStream(contents.getBytes());
file.create(source, false, null);
The file gets created, but the problem is that it doesn't get recognized as any type; I can't open it in any internal editor. That's until I restart Eclipse (refresh or close then open the project doesn't help). After a restart, the file is perfectly usable and opens in the correct default editor for its type.
Is there any method I need to call to get the file outside of that "limbo" state?
That thread does mention the createFile call, but also refers to a FileEditorInput to open it:
Instead of java.io.File, you should use IFile.create(..) or IFile.createLink(..). You will need to get an IFile handle from the project using IProject.getFile(..) first, then create the file using that handle.
Once the file is created you can create FileEditorInput from it and use IWorkbenchPage.openEditor(..) to open the file in an editor.
Now, would that kind of method (from this AbstractExampleInstallerWizard) be of any help in this case?
protected void openEditor(IFile file, String editorID) throws PartInitException
{
IEditorRegistry editorRegistry = getWorkbench().getEditorRegistry();
if (editorID == null || editorRegistry.findEditor(editorID) == null)
{
editorID = getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId();
}
IWorkbenchPage page = getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.openEditor(new FileEditorInput(file), editorID, true, IWorkbenchPage.MATCH_ID);
}
See also this SDOModelWizard opening an editor on a new IFile:
// Open an editor on the new file.
//
try
{
page.openEditor
(new FileEditorInput(modelFile),
workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
}
catch (PartInitException exception)
{
MessageDialog.openError(workbenchWindow.getShell(), SDOEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
return false;
}