How to Create a Custom Keyboard Shortcut in DOORS? - automation

Its very time consuming to navigate through:
example:
X->Y->Z->A->B
Can we create a Custom Keyboard Shortcut for this in DOORS?

is this about following out-links?
If so, you could write a DXL script that opens the first out-linked module and navigates to the linked object. This script can be placed in a custom pull-down-menu. The script can be given a shortcut (accelerator key).
Script would look like this.
Object o = current
if (null o) error "no current object"
Link lnk
for lnk in o->"*" do {
ModName_ targetMod
targetMod = target lnk
Module mTgt = read(fullName(targetMod), true)
if (null mTgt) error "cannot open target module"
current = mTgt
Object oTgt = target lnk
current = oTgt
break
}
For information of how to build menus and accelerator keys, look in DXL manual, chapter "Rational DOORS window control"

Related

Text Field with Standard PsiElement Auto Completion in IntelliJ Plugin

I'm trying to create a simple text field with auto completion for my IntelliJ plugin. I think this should be pretty simple but so far I've run into dead ends...
E.g. this should work as far as I understand:
EditorTextField format = new TextFieldWithCompletion(currentEditor.getProject(),
provider,
"",
true,
true,
true);
The problem is the provider. I'd expect to see a provider that isn't a list provider. I just want to show the completion matching the current line in the editor cursor so I'd like the full completion dialog and not just a short list of options.
I also looked at TextFieldWithAutoCompletion but it seems to be designed for hardcoded string values instead of free form completion.
I just want the standard Java/Kotlin completion. Not a custom list or anything like that. I saw some discussion with replacing the document of the text field but I couldn't get that to work either. I have a PsiExpressionCodeFragment and would expect there to be a completion provider that accepts that but I can't find it.
For reference what I want to do is something very similar to the conditional statement in the breakpoint dialog.
Another approach illustrated here is:
JavaCodeFragmentFactory jcff = JavaCodeFragmentFactory.getInstance(currentEditor.getProject());
PsiFile pf = PsiDocumentManager.getInstance(currentEditor.getProject()).getPsiFile(currentEditor.getDocument());
PsiElement psiElement = pf.findElementAt(currentEditor.getCaretModel().getOffset());
PsiExpressionCodeFragment fragment = jcff.createExpressionCodeFragment("", psiElement,null, false);
EditorTextField f = new EditorTextField(PsiDocumentManager.getInstance(currentEditor.getProject()).getDocument(fragment),
currentEditor.getProject(),
FileTypes.PLAIN_TEXT, false, true);
This loads the UI but doesn't popup code completion no matter what I type.
The trick is to create an editor that contains an instance of the Document. And this document refers to a language and a psi element context:
JPanel panel = new JPanel();
// Just detect an element under caret for context
PsiFile psiFile = PsiDocumentManager.getInstance(editor.getProject()).getPsiFile(editor.getDocument());
PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
PsiExpressionCodeFragment code = JavaCodeFragmentFactory.getInstance(editor.getProject()).createExpressionCodeFragment("", element, null, true);
Document document = PsiDocumentManager.getInstance(editor.getProject()).getDocument(code);
EditorTextField myInput = new EditorTextField(document, editor.getProject(), JavaFileType.INSTANCE);
myInput.setPreferredWidth(300);
panel.add(myInput);
return panel;
Here the caret used to be located on dsa5, so the dsa5 variable is not yet visible for the completion.

input dialog box blender

How to make a simple entry dialog box (like in the image) in blender and processing the text entered through python.I am unable to find any good tutorial on this.
For the dialog box the answer from how to show a message from a blender script? might be a starting point.
But I think a better approach is integrating input into the panel like e.g.
To do this you have to add a StringProperty to your add-on and place it inside your panel (see Addon Tutorial for more information). The basic steps are:
def draw(self, context) :
col = self.layout.column(align = True)
col.prop(context.scene, "my_string_prop")
...
def register() :
bpy.types.Scene.my_string_prop = bpy.props.StringProperty \
(
name = "My String",
description = "My description",
default = "default"
)
...
def unregister() :
del bpy.types.Scene.my_string_prop
...
You can access the string by context.scene.my_string_prop
There is another mode to integrate input. When you add for example a text to your scene you can change the parameters after the operator has been called and see the changes immediately:
Changing Location will move the newly created text object at another place. I haven't worked with this but it should be similar to the code above.

Safari extension - how to use the setContextEventUserInfo method

I am building a Safari extension.
On the manual, at the page about "Adding Contextual Menu Items", at the paragraph "Adding Contextual Menu Items Programmatically", it says:
You can add menu items to the contextual menu by responding to the
extension version of the "contextmenu" event in your global page or an
extension bar. If you stored information on the event by calling
setContextEventUserInfo() in your injected script, you can use that
information to help you decide what menu items to add.
Source:
https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/AddingContextualMenuItems/AddingContextualMenuItems.html#//apple_ref/doc/uid/TP40009977-CH4-SW1
Now, I have this code on my injected script (as I am trying to pass the selected text to the background script):
function handleContextMenu(event) {
var htmlClip = getHtmlClip(event);
setContextEventUserInfo(htmlClip);
}
Unfortunately that generates this error:
ReferenceError: Can't find variable: setContextEventUserInfo
Unfortunately when I searched setContextEventUserInfo on Google, the only result was the page of the Safari manual!
Can please anybody explain to me how I am supposed to use the setContextEventUserInfo method?
This is what you need:
function handleContextMenu(event) {
var htmlClip = getHtmlClip(event);
safari.self.tab.setContextEventUserInfo(event, htmlClip);
}

Eclipse plugin:TextSelection cannot resoleve

I am trying to develop my first plug-in.
The plug-in should manipulate the content of the selected text in the active text editor.
I started with the “hello world” example from the “Cheat sheet” which worked perfect.
When tried to modify I found that project not recognizing many types.
I added the following jars to the project build path libraries:
org.eclipse.jface.text_3.5.1.r351_v20090708-0800.jarorg.eclipse.text_3.5.0.v20090513-2000.jarorg.eclipse.ui.editors_3.5.0.v20090527-2000.jar
Now code compiles perfect.
ISelection iSelection = null;
IEditorSite iEditorSite = window.getActivePage().getActiveEditor().getEditorSite();
if (iEditorSite != null) {
ISelectionProvider iSelectionProvider = iEditorSite.getSelectionProvider();
if (iSelectionProvider != null)
{
iSelection = iSelectionProvider.getSelection();
selectedText = ((ITextSelection)iSelection).getText();
}
}
The problem is in line 08. although eclipse recognize the ITextSelection interface, at runtime I get cannot resolve type exception.
When trying to deploy the code I get the following line in the deploy log:
The import org.eclipse.jface.text cannot be resolved
Did you try, in the Run configuration dialog, to open the "Plugins" tab and click the button "add required plug-ins" ?
It might add the right runtime dependencies for you.
See also that same button in the dependencies tab of your plugin project:
alt text http://www.vogella.de/articles/RichClientPlatform/images/product50.gif
(more in the article "Products and Branding")
See also this SO answer for more checks.

Modify HTML in a Internet Explorer window using external.menuArguments

I've got a VB.NET class that is invoked with a context menu extension in Internet Explorer.
The code has access to the object model of the page, and reading data is not a problem. This is the code of a test function...it changes the status bar text (OK), prints the page HTML (OK), changes the HTML by adding a text and prints again the page HTML (OK, in the second pop-up my added text is in the HTML)
But the Internet Explorer window doesn't show it. Where am I doing wrong?
Public Sub CallingTest(ByRef Source As Object)
Dim D As mshtml.HTMLDocument = Source.document
Source.status = "Working..."
Dim H As String = D.documentElement.innerHTML()
MsgBox(H)
D.documentElement.insertAdjacentText("beforeEnd", "ThisIsATest")
H = D.documentElement.outerHTML()
MsgBox(H)
Source.status = ""
End Sub
The function is called like this from JavaScript:
<script>
var EB = new ActiveXObject("MyObject.MyClass");
EB.CallingTest(external.menuArguments);
</script>
To the best of my understanding, in order to use insertAdjacentText or any of the other editing methods, the document object should be in the design mode.
In design mode you can edit the document freely, and so can the user.
Check this site for more details
I do not think that Alex is right, something else is the matter.
When I tried to do something like that, insertBefore would not work for me, but appendChild worked just fine, so adding an element is possible.
I worked in Javascript, but I don't expect that makes a difference.