RCP/RAP: Link in SWT/JFace-TableViewer-Cell - hyperlink

Does anyone know a possibility to place a link in a JFace-TableViewer-Cell? I just need something that fires an event, when it is clicked on. Something that looks like a hyperlink would be perfect. The (big) problem is, that it should work not only under RCP but also under RAP.

I don't know how to do this for RAP, but for RCP have a look at the answer for How to add Hyperlink in SWT Table`s column?.
Unfortunately, the graphical context is not supported with RAP (AFAIK...)...

It is very easy and can be done with something called Markup (https://www.eclipse.org/rap/developers-guide/devguide.php?topic=markup.html&version=3.23): in getText() of ColumnLabelProvider you could provide html part for example getText() result for link could look like this:
return "<a href='http://www.eclipse.org/rap' target='_blank'>RAP</a>";

Another way is to use TreeViewerColumn.setEditingSupport and override ColumnViewer class. In that way you could have your own custom control after you click on a cell (in edition mode).

Related

Excel Hyperlink Function - Display Nice Name?

I found this formula online. It takes a cell, and handles the hyperlink, based on the excel spreadsheet being in the root folder, so the files being hyperlinked are in that directory (or sub-directory). This is the formula:
=HYPERLINK(LEFT(CELL("filename"),FIND("|",SUBSTITUTE(CELL("filename"),"\","|",LEN(CELL("filename"))-LEN(SUBSTITUTE(CELL("filename"),"\",""))))) & C2)
I would like to have it say something like "Click Here to Open" or something nice. I can certainly handle that in another cell, if that would be easier, but I'm not seeing a way to do that. Anyone know how to handle this?
We don't want the users to see D:\blah\folder\filename.pdf
It looks messy and would like something nicer.
Thanks!
Nevermind. I found it was as simple as adding
,"nicename")
OR
,A2)
to get the name I want.
Duh.

Enable Vorto text in Archetype - Umbraco 7

I have Archetype in umbraco 7.4.3
When I set vorto text box in the archetype I get:
Its look like the vorto box is disabled.
whenever I set the vorto (translated) text box in simple document type it work's perfect
Vorto nested in an Archetype doesn't work ootb they both have to be modified in order to work this way. An alternative is to wrap Vorto around your Archetype. However if this isn't suitable for you setup see the following issue on the Archetype github, which has a pull request which should show you want needs to be changed. https://github.com/imulus/Archetype/issues/235
I find answer that works perfect for me.
In the "vorto.js" file their is a function named "getDataTypeById".
In this function their is a call to another function named "getDataTypeByAlias".
After the inner function call the parameter "dataType2" is returned as "null" so we need to set "if" statement that checks if "dataType2" is "null" and if the code returns "true" we will assign:
dataType2 = dataType;
Their only one problem left.. when the data type is "rich text editor" it's trow exception so i added to the condition another check and now its look like this:
if (dataType2 && dataType.propertyEditorAlias != "Umbraco.TinyMCEv3") {
dataType2 = dataType;
}
I hope its helps others...

Solution for Tag Wrapping in Notepadd++ is required

Greeting. I am using Notepad++ and i am trying to find tag wrapper for example i have a code
<p>My Name is Pakhpalay Zamborday</p>
now i want to know is there any wrapper plugin or short key in notepad++ that wrap or surround the tags as per my requirement like i select above mention code and press that short key and next action ask me for tags with i want to wrap selected code. like i put article tag and press enter and the result will be
<article><p>My Name is Pakhpalay Zamborday</p></article>
Please help me
You can use snippetPlus plugin for this purpose. here the link and installation guide link:
installation and usage guide link

How to link a google apps script in a google site

I'm creating a google site for my company and I'm utilizing google apps scripts to do a little extra on the site. I would really like to link a script to a drop-down menu that I made. However, I can't figure out how to link the script. I know how to link a script just as a google gadget and as a stand alone link, but I would really like to have the script run when I click on an item from my drop-down menu.
For security reasons, Google don't let you put javascript in Google Sites.
They provide Apps Scripts instead, but as they work on an isolated world (on the server rather than the browser), its very tricky and has its ways.
Because its very different to standard page's javascript, you have to rethink your goal in terms of what Apps Scripts lets you do.
Google Apps Scripts lets you build an User Interface (using its yet experimental UI API) that can be visualized as a standalone script in a full page or inserted in a iframe in Sites. This means you won't have a dropdown menu overlaping your site: you need an static space to visualize your script's UI.
There is another more primitive way to "embed" your scripts commands in your site: use links. A link that fires a script, even with your own parameters, only to run de command, but without any UI. You can make a menu with options, each of them fires a script. But I'm not talking about dropdown menu.
About Google Apps Scripts User Interfaces
https://developers.google.com/apps-script/guide_user_interfaces
https://developers.google.com/apps-script/guide_gui_builder
https://developers.google.com/apps-script/service_ui
Not sure what you mean by "link the script", do you have code someplace else? By "link" it sounds like you mean to "Call" the code, with an event handler. I'll show you how to call a function with a ServerHandler triggered by either a GUI ListBox Change event or from a Button Click event.
In Google Apps Scrips (GAS) there are three methods to do GUI.
HTML Service - Much like plain HTML, you could insert HTML form and input tags.
UI Service - Much like java (as far as layout managers), see below.
GUI Builder - I suggest doing it manually first to better understand layout.
In Google Sites you can add most HTML directly without a script. The UI Service and GUI Builder will generate HTML form tags for you, and since there's rarely any reason to insert GUI elements unless you are executing some code you probably want to start with using these.
Here is a Drop-Down list examplewith some changes to show how a handler function can be called from multiple UI elements (which they call Widgets sometimes) and how to use the parameter:
function doGet(e) { // use doGet() & UiApp to make a canvas.
var app = UiApp.createApplication();
var doEvent = app.createServerHandler('doEvent').setId('doEvent');
var myList = app.createListBox().setId('myList').setName('myList');
myList.addItem('one'); // add items, I use single quote strings.
myList.addItem('two').addItem('three') // I know it looks weird.
// Scripts let you do this, by returning self for your convenience.
.addChangeHandler(
app.createServerHandler('doEvent')
);
app.add(myList); // Add element to GUI.
doEvent.addCallbackElement(myList); // Add to Event Handler.
app.add(app.createButton('Click Me').setId('myButton')
.addClickHandler(doEvent));
return app;
} // Simple DropDown by Jason K.
function doEvent(e) { // use split() if isMultipleSelect is true
var app = UiApp.getActiveApplication();
app.add(app.createLabel(
'List Value is ' + e.parameter.myList
+ ' from ' + e.parameter.source));
return app;
}
As far as troubleshooting, remember to add each element with app.add() and return app; at the end of doGet and each handler function.
Handlers execute a function like JavaScript onClick() or onChange() functions, most UI are not useful without handlers. ClientHandler are more efficient but ServerHandler do more, start with ServerHandlers and any simple functions can be converted to ClientHandlers for better performance. You can choose to space out your handlers or cram it all into one line-of-code, really a matter of personal preference however do assign it to a variable if you plan to use it for more than one GUI object. You may want to look up the different layout managers to make more fancy looking applications, or just use the GUI Builder. Also there use to be other create functions like app.createServerClickHandler() but I understand those were useless and are now deprecated so ignore any other references you find like that, however we do still use addChangeHandler() and addClickHandler() to the GUI elements themselves.
The setName() seems to be silly, it is only needed to set the parameter name (I hope they change that) so for now I suggest just setting it the same as the element id. I also made the Handler's variable name = its id = the event function name just to illustrate how they are all related.

Bind functions to elements inserted in the DOM? (Implicitly?)

This is probably jquery basics, but I can't find a solution after much googling.
How do you attach "non-events" to elements inserted in the DOM?
For events, like click, we can use live() or bind().
How would you, for instance, initialize tabs() or addClass() to a new element?
Specifically, I'm trying to get tabs() to work in the content of an ajax loaded dialog, but I think the correct solution should be applicable to any situation.
I did see a trick that involved $('body').mousemove() which did work, but that is still binding to an event and obviously a hack.
For instance, how would you get addClass() to fire on a newly inserted table row?
I mean to do this implicitly, meaning that I don't want to write out specific instructions for every event that adds nodes to the dom, I just want it to "run in the background".
Let me know if this needs clarification, I see many similar questions on SO but no answers that have helped.
EDIT: Simple example: A page calls $('a').addClass('highlight') which works on all anchors in the page. A new anchor is then added to the page dynamically by jQuery, but does not get the class added.
EDIT: I have tried all kinds of bind(), trigger() and change() methods but I'm afraid I'm barking up the wrong tree.
you need to look at livequery it will allow you to apply things to newly added elements
also if your adding the element you can do
$('body')append('<div>some content</div>').tabs();
or something like that
I know that I may contradicting your "non-event" rule here, but just by saying that you want something "triggered", you're already implying some kind of event.
In that case, may I suggest jQuery custom events? You may want to create a custom event, then trigger it manually somewhere in your code. It's not automatic (like when you add a row, BOOM, it fires™), but that's the closest thing I can think of with what you were describing.
Specifically, you may want to look at jQuery's .bind() and .trigger() methods.

Resources