Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dash » Selected Resource
Selected Resource [message #1687] Tue, 07 November 2006 14:45 Go to next message
Chris Lenz is currently offline Chris Lenz
Messages: 214
Registered: July 2009
Senior Member
Is it possible to get the selected file in a dash script

Is it also possible to create a new file ?
Re: Selected Resource [message #1695 is a reply to message #1687] Thu, 09 November 2006 01:57 Go to previous messageGo to next message
Bjorn Freeman-Benson is currently offline Bjorn Freeman-Benson
Messages: 335
Registered: July 2009
Senior Member
Sure - anything you can do in Java you can do in Monkey.

--- Came wiffling through the eclipsey wood ---
/*
* Menu: Selected File
* Kudos: Bjorn Freeman-Benson
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/das\
h/update/org.eclipse.dash.doms
*/

function main() {

selection = window.getSelectionService().getSelect\
ion().getFirstElement();

Packages.org.eclipse.jface.dialogs.MessageDialog.o\
penInformation(
window.getShell(),
"Monkey Dialog",
selection.toString()
)

}
--- And burbled as it ran! ---

and

--- Came wiffling through the eclipsey wood ---
/*
* Menu: IO > File Sample
* Kudos: Paul Colton, Aptana, Inc.
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/das\
h/update/org.eclipse.dash.doms
*/

function main()
{
var date = new Date();

// Write out new file
var file = new File("myFile.txt");
file.createNewFile();
file.write("Date: " + date);

// Read lines from file
var text = file.readLines();

// Display what we read
Packages.org.eclipse.jface.dialogs.MessageDialog.\
openInformation(
window.getShell(),
"File I/O",
"Contents: " + text
);

}

--- And burbled as it ran! ---

Chris Lenz wrote:
> Is it possible to get the selected file in a dash script
>
> Is it also possible to create a new file ?
Re: Selected Resource [message #2731 is a reply to message #1695] Tue, 14 November 2006 16:00 Go to previous message
Chris Lenz is currently offline Chris Lenz
Messages: 214
Registered: July 2009
Senior Member
if i try to run that i get serveral errors
"TypeError: getFirstElement is not a funciton

"Error File is not defined

Bjorn Freeman-Benson schrieb:
> Sure - anything you can do in Java you can do in Monkey.
>
> --- Came wiffling through the eclipsey wood ---
> /*
> * Menu: Selected File
> * Kudos: Bjorn Freeman-Benson
> * License: EPL 1.0
> * DOM: http://download.eclipse.org/technology/das\
> h/update/org.eclipse.dash.doms
> */
>
> function main() {
>
> selection = window.getSelectionService().getSelect\
> ion().getFirstElement();
>
> Packages.org.eclipse.jface.dialogs.MessageDialog.o\
> penInformation(
> window.getShell(),
> "Monkey Dialog",
> selection.toString()
> )
>
> }
> --- And burbled as it ran! ---
>
> and
>
> --- Came wiffling through the eclipsey wood ---
> /*
> * Menu: IO > File Sample
> * Kudos: Paul Colton, Aptana, Inc.
> * License: EPL 1.0
> * DOM: http://download.eclipse.org/technology/das\
> h/update/org.eclipse.dash.doms
> */
>
> function main()
> {
> var date = new Date();
>
> // Write out new file
> var file = new File("myFile.txt");
> file.createNewFile();
> file.write("Date: " + date);
>
> // Read lines from file
> var text = file.readLines();
>
> // Display what we read
> Packages.org.eclipse.jface.dialogs.MessageDialog.\
> openInformation(
> window.getShell(),
> "File I/O",
> "Contents: " + text
> );
>
> }
>
> --- And burbled as it ran! ---
>
> Chris Lenz wrote:
>> Is it possible to get the selected file in a dash script
>>
>> Is it also possible to create a new file ?
Re: Selected Resource [message #560418 is a reply to message #1687] Thu, 09 November 2006 01:57 Go to previous message
Bjorn Freeman-Benson is currently offline Bjorn Freeman-Benson
Messages: 335
Registered: July 2009
Senior Member
Sure - anything you can do in Java you can do in Monkey.

--- Came wiffling through the eclipsey wood ---
/*
* Menu: Selected File
* Kudos: Bjorn Freeman-Benson
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/das\
h/update/org.eclipse.dash.doms
*/

function main() {

selection = window.getSelectionService().getSelect\
ion().getFirstElement();

Packages.org.eclipse.jface.dialogs.MessageDialog.o\
penInformation(
window.getShell(),
"Monkey Dialog",
selection.toString()
)

}
--- And burbled as it ran! ---

and

--- Came wiffling through the eclipsey wood ---
/*
* Menu: IO > File Sample
* Kudos: Paul Colton, Aptana, Inc.
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/das\
h/update/org.eclipse.dash.doms
*/

function main()
{
var date = new Date();

// Write out new file
var file = new File("myFile.txt");
file.createNewFile();
file.write("Date: " + date);

// Read lines from file
var text = file.readLines();

// Display what we read
Packages.org.eclipse.jface.dialogs.MessageDialog.\
openInformation(
window.getShell(),
"File I/O",
"Contents: " + text
);

}

--- And burbled as it ran! ---

Chris Lenz wrote:
> Is it possible to get the selected file in a dash script
>
> Is it also possible to create a new file ?
Re: Selected Resource [message #560426 is a reply to message #1695] Tue, 14 November 2006 16:00 Go to previous message
Chris Lenz is currently offline Chris Lenz
Messages: 214
Registered: July 2009
Senior Member
if i try to run that i get serveral errors
"TypeError: getFirstElement is not a funciton

"Error File is not defined

Bjorn Freeman-Benson schrieb:
> Sure - anything you can do in Java you can do in Monkey.
>
> --- Came wiffling through the eclipsey wood ---
> /*
> * Menu: Selected File
> * Kudos: Bjorn Freeman-Benson
> * License: EPL 1.0
> * DOM: http://download.eclipse.org/technology/das\
> h/update/org.eclipse.dash.doms
> */
>
> function main() {
>
> selection = window.getSelectionService().getSelect\
> ion().getFirstElement();
>
> Packages.org.eclipse.jface.dialogs.MessageDialog.o\
> penInformation(
> window.getShell(),
> "Monkey Dialog",
> selection.toString()
> )
>
> }
> --- And burbled as it ran! ---
>
> and
>
> --- Came wiffling through the eclipsey wood ---
> /*
> * Menu: IO > File Sample
> * Kudos: Paul Colton, Aptana, Inc.
> * License: EPL 1.0
> * DOM: http://download.eclipse.org/technology/das\
> h/update/org.eclipse.dash.doms
> */
>
> function main()
> {
> var date = new Date();
>
> // Write out new file
> var file = new File("myFile.txt");
> file.createNewFile();
> file.write("Date: " + date);
>
> // Read lines from file
> var text = file.readLines();
>
> // Display what we read
> Packages.org.eclipse.jface.dialogs.MessageDialog.\
> openInformation(
> window.getShell(),
> "File I/O",
> "Contents: " + text
> );
>
> }
>
> --- And burbled as it ran! ---
>
> Chris Lenz wrote:
>> Is it possible to get the selected file in a dash script
>>
>> Is it also possible to create a new file ?
Previous Topic:Selected Resource
Next Topic:Still here?
Goto Forum:
  


Current Time: Fri Oct 24 10:26:17 GMT 2014

Powered by FUDForum. Page generated in 0.10101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software