Is there a simple source code viewer plugin for eclipse? - eclipse

for example
setMediamixDefaultTime(mediamixVO);
boolean booked = false;
Long campaignSeq = mediamixVO.getCampaignSeq();
when I want to know about how to declared setMediamixDefaultTime() method,
I have to jump to setMediamixDefaultTime() declaration line.
It's very annoying especiouly source code is long..
so I need that is,
if I move mouse to that method or keyboard shortcut, the method declaration popup in small window.

just crtl+click on the item you want to jump to.
There is also an outline view, which shows the program structure.

Control + mouse click on the method will take you to the method declartion and you can use the back button to come back to the previous code.
Again the shortcut for back button is Alt + left arrow

You can make use of the Declaration View if you don't want to lose your place, but the Navigate menu's "Last Edit Location", Back, and Forward actions may also work.

Related

Protractor : How to select an item from list when right-clicked

I am trying to Right click on an element and then select an option "Rename" from the list. I have got "right clicking" working but can't select option from the list. Referred links 1, 2
Note 1:
1: On right click the menu options that are visible are native context menus. So, they don't appear in my DOM that I can see.
2: The App runs only in Chrome browser(not sure if it is a browser issue)
I have tried the following code:
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).click(protractor.Button.ARROW_DOWN).click(protractor.Button.ARROW_DOWN).click(protractor.Button.ARROW_DOWN).perform();
Consider, "Rename" to be the third option in the list.
Note 2:
If I am just running the app and enter 'R' from my keyboard, it selects the "Rename" option. But when I tried to run it in my test, it doesn't select the "Rename" option. See below code I tried:
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.ARROW_RIGHT).sendKeys('R',protractor.Key.ENTER).perform();
None of the above code works. Let me know if more information is required.
EDIT:
I am guessing the following to be happening:
once I mouse over, the script "right clicks" and after that the "tooltip" is displayed. Since the "tooltip" is displayed after "right click" I think the menu list goes to the background(the list is still visible along with the tool-tip), which is why the arrow down keys aren't working. Is this possible? If yes, how can I wait for the tooltip to be invisible and then right click?
Input: I tried to wait for tool-tip to be invisible and then right click, but still the "Arrow_down" doesn't work.
Is there a way to bring the menu list in the front once we have right clicked?
IMPORTANT:
I took a screenshot after I right clicked on the element, and the screenshot doesn't show the "menu list". Below is the code for screenshot:
browser.actions().click(protractor.Button.RIGHT).perform()
.then(function() {
browser.takeScreenshot().then(function(screenShot) {
writeScreenShot(screenShot, "image.png");
});
});
//writeScreenShot takes two variables actual screenshot data and the file name. And the screenshot is saved as "image.png"
What needs to be done?
When you send ARROW keys to the browser, you have to send them as keys instead of passing them to click() function and the ARROW_DOWN key is part of Key object and not BUTTON. Here's how -
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).perform();
For your second try, you should send RIGHT in the place of protractor.Button.ARROW_RIGHT to right click. When you send two actions/keys to sendKeys() function, you have to join them using chord object which combines the action of pressing two keys at a time(ex: CTRL+C for copy). But in your case i don't think its really necessary. Here's how to use it -
browser.actions().mouseMove(elementVar).perform();
browser.actions().click(protractor.Button.RIGHT).sendKeys(protractor.Key.chord("r", protractor.Key.ENTER).perform(); //Not necessary as you wont be pressing R+ENTER in your keyboard
OR
browser.actions().click(protractor.Button.RIGHT).sendKeys('R').sendKeys(protractor.Key.ENTER).perform();
Hope this helps.
use XPath to solve your problem
browser.actions().mouseMove(target).perform();
browser.actions().click(protractor.Button.RIGHT).perform();
element(by.xpath('//*[#id="context-menu"]/ul/li[1]')).click();
In your case it will be "//*[#id="context-menu"]/ul/li[3]" most probably.

openoffice calc button mouse over event cursor change

I have created an OpenOffice Calc spreadsheet and I have inserted a button into it. I can successfully call a macro with the button. I want to have a cursor hand when I mouse-over the button.
First, I switched to 'Design' mode, then I right-clicked on my button, and using the pop-up menu which appears, I selected the 'Events' tab. Then I clicked on the 'Mouse inside' dot dot dot button. In the 'Assign action' window that popped up, I clicked on the 'Macro..' button. I then got the 'Macro Selector' pop-up window, where I choose the 'OpenOffice Macros' folder in the left side pane. I expanded 'Tools'>'ModuleControls' from that 'Library' pane and then selected 'SwitchMousePointer' from the right side 'Macro name' pane, then clicked the 'Ok' 'Ok' buttons.
But now when I hover the mouse cursor over my button I get an OpenOffice Error window popping up "A Scripting Framework error occurred while running the Basic script Tools.ModuleControls.SwitchMousePointer."
I've very little OO experience but I have not found what I want here or on the OO Forum site. I would be very grateful to get some help, thanks, Nige.
The SwitchMousePointer needs attributes (oWindowPeer as Object, bDoEnable as Boolean). So you can't simply assign it to a event. And it will not do what you think.
You should better write you own Sub to change the Pointer. Also there is no need to do this on every mouse event. It should be done once on sheet activate for example.
For a introduce in OpenOffice.org BASIC Programming see https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide. And you will need a debugging tool, if you want to program your own BASIC macros. Therefore see especially: https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/UNO_Tools
Assuming on the sheet is a button named "Push Button 1" then:
Sub ChangeMousePointer
oController = ThisComponent.CurrentController
oButtonModel = oController.ActiveSheet.DrawPage.Forms(0).getByName("Push Button 1")
oButtonControl = oController.getControl(oButtonModel)
oWindowPointer = CreateUnoService("com.sun.star.awt.Pointer")
oWindowPointer.SetType(com.sun.star.awt.SystemPointer.HAND)
oButtonControl.Peer.setPointer(oWindowPointer)
End Sub
And assign this to the sheet event Activate Document.
Right click the sheet tab and select Sheet Events from the context menu. Then:
If, and only if, the button is on Sheets(0) then the sheet event Activate Document not occurs while opening the document and this sheet is in front. In this case we have to call the Sub ChangeMousePointer also on document event Open Document.
Sub Document_Open
oController = ThisComponent.CurrentController
oSheet = oController.ActiveSheet
if oSheet.Name = ThisComponent.Sheets(0).Name then
if oController.ActiveSheet.DrawPage.Forms.Count > 0 then
if oController.ActiveSheet.DrawPage.Forms(0).hasByName("Push Button 1") then
call ChangeMousePointer
end if
end if
end if
End Sub
To assign the macro to the document event Open Document select Tools - Customize from the menu and:

Google Closure add onclick to button after adding this button with custom editor plugin

I am making a custom plugin for the editor provided by Google Closure. The plugin makes it able to add a button.
I am having problems by setting an onclick on the button, the other values are nicely set.
button.innerHTML = event.label;
button.className = event.initialClass;
var extraClasses = event.extraClasses;
if (extraClasses)
{
button.className += ' ' + extraClasses
}
button.onclick = function() { event.onclick };
Does anyone know what I am doing wrong and how I can fix this?
After creating a button it is added to the editors SeamlessField. A second problem that I currently have is that after creating the button, my pointer is inside the button and I can't seem to get it out of there.
I've got the follow piece of code for handling this at the moment. The var button is the created button. button contains: <button class="orange">test</button>
// We want to insert the button in place of the user's selection.
// So we restore it first, and then use it for insertion.
this.restoreOriginalSelection();
var range = this.fieldObject.getRange();
button = range.replaceContentsWithNode(button);
// Done making changes, notify the editor.
this.fieldObject.dispatchChange();
// Put the user's selection right after the newly inserted button.
goog.editor.range.placeCursorNextTo(button, false);
// Dispatch selection change event because we just moved the selection.
this.fieldObject.dispatchSelectionChangeEvent();
Any ideas about how I could fix this second problem aswell?
For the first, it does not look like you have begun using Google Closure event code. Wiring up the button to the 'click' event in Google Closure would be as follows:
goog.events.listen(button, goog.events.EventType.CLICK, event.onclick)
You should also be investigating the goog.dom and goog.dom.classes namespaces if you'd like to use Google Closure's wrappers around standard CSS class and text DOM manipulation.
For the second, were you testing in Chrome? If so, you might have ran into a range issue in Webkit, documented within the Closure code itself:
https://code.google.com/p/closure-library/source/browse/closure/goog/editor/range.js#174
I have gotten around this in the past by inserting an empty <span> element as a sibling after the offending element (the button, in your case), and placing the cursor next to the <span> instead. However, there's nothing stopping the user from moving the cursor back inside your button. You'll have to add more logic to prevent a user from placing the cursor within the button's text.

How to jump from an event handler in story board to the code

I have a "Hello" button in the main view. I have set its Touch Up Inside handler to changeGreeting() in HelloWorldViewController.m. From the Connections Inspector, I can clear see this association:
My question is, how to jump to changeGreeting() function in the .m file from here (the story board view)?
I would expect simply clicking on that "Hello World View Controller changeGreeting:" button would bring me to the source code. But it turns out not the case.
There is no way (as far as I can tell) to jump directly from that panel to the changeGreeting: method.
You can press Command-Shift-O (or choose File > Open Quickly…) and type changeGreeting: (or some prefix of it) to jump to the definition.
If you want Apple to add a better way, go to https://bugreport.apple.com/ and file a feature request.
You could go to the 'Jump Bar' which is the horizontal bar at the top of the main viewer. Here change the file to the .m file and then start typing 'change' or 'greeting' to see all the methods in this file that match the filter.

How to programmatically press toolstripbutton down?

I want to push toolstripbutton down in my code and I can't seem to be able to do that. I know on Delphi RAD Studio or XE, you can do the following and cause the button to be pressed.
ToolStripButton1.Down := true;
The only ToolStripButton property I see that comes close to "down" is checked true or false. If I do set it to true, it only highlights the toolstripbutton not press it down.
Here is how the button looks when I put my mouse on it and click:
You can clearly see that the Zoom In button is down.
Here is how the button looks when I try to do the samething through my code by setting CheckOnClick true and Checked true.
In this image, the only thing you can see is the blue box around it. I suppose if I had used just the text on the button, you will see that the whole button filled with blue color to show that it was pressed.
I also have toolstrip button in my other program which acts the same way but I had to use imagelist control to switch between pressed or down or checked verses not pressed or down or checked.
So, is there a way to press the ToolStripButton programmatically in Delphi Prism or C#?
Set the ToolStripButton.CheckOnClick property to True. (It's found in the Behavior section of the Items Collection Editor.)
This makes clicking it just like toggling the Down property in a Delphi TSpeedButton (making it flat or depressed), and if ToolStripButton1.Checked is the equivalent of if SpeedButton1.Down in Delphi.
To set up the test, I did the following:
Created a new Winforms application
Dropped a ToolStrip onto the new MainForm
Added four ToolStripButton items and gave them images to make them easier to see.
Set the CheckOnClick property to True for each of them
Set the Checked property of toolStripButton1 to True;
Added the code below to toolStripButton1.Click
method MainForm.toolStripButton1_Click(sender: System.Object; e: System.EventArgs);
begin
toolStripButton2.Checked := not toolStripButton2.Checked;
toolStripButton4.Checked := toolStripButton2.Checked;
end;
Running the app (initial startup, toolStripButton1 checked and the others unchecked):
The first button is clearly down, and the rest are up.
After clicking toolStripButton1 once:
The first button is now up (unchecked) and the second and fourth are down (checked). (I should pay more attention to the consistency in sizing if I do successive images in future posts.)
If have placed this code in the preceding control in the 'Leave' event.
Private Sub PurposeComboBox_Leave(sender As Object, e As EventArgs) Handles PurposeComboBox.Leave
Me.AppliancesForSelectedFunctionToolStripButton.PerformClick()
End Sub
I do not know if you could place code in Form Load or not.
Hope this helps.