Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » How to create an IJavaScriptProject?
How to create an IJavaScriptProject? [message #808173] Mon, 27 February 2012 13:44 Go to next message
Alireza Missing name is currently offline Alireza Missing nameFriend
Messages: 105
Registered: July 2009
Senior Member

I need to create IJavaScriptProject, anybody knows how to do that?

Alireza
Re: How to create an IJavaScriptProject? [message #808272 is a reply to message #808173] Mon, 27 February 2012 15:49 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

Call org.eclipse.wst.jsdt.core.JavaScriptCore#create(IProject) . If you're asking how to create a new Javascript project from scratch rather than the representation of an existing one, though, it's a little more complicated.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to create an IJavaScriptProject? [message #808355 is a reply to message #808272] Mon, 27 February 2012 17:42 Go to previous messageGo to next message
Alireza Missing name is currently offline Alireza Missing nameFriend
Messages: 105
Registered: July 2009
Senior Member
Yes I need to do it from scratch. Any reference that have an example?
Regards,
Alireza
Re: How to create an IJavaScriptProject? [message #809132 is a reply to message #808355] Tue, 28 February 2012 14:13 Go to previous messageGo to next message
Alireza Missing name is currently offline Alireza Missing nameFriend
Messages: 105
Registered: July 2009
Senior Member
Is it necessary to have a plugin project to do so?

Alireza
Re: How to create an IJavaScriptProject? [message #810137 is a reply to message #809132] Wed, 29 February 2012 18:39 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

On 2/28/2012 9:13 AM, Alireza Mising name wrote:
> Is it necessary to have a plugin project to do so?

Yes, most of JSDT is only written to work in the Eclipse runtime.
org.eclipse.wst.jsdt.web.core.internal.project.JsWebNature.configure()
shows the most straightforward way, but it's not all written to do it
through the public APIs. It's highly unusual for anyone other than JSDT
to have to create a JavaScript project programmatically, though.

---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to create an IJavaScriptProject? [message #810516 is a reply to message #810137] Thu, 01 March 2012 07:33 Go to previous messageGo to next message
Alireza Missing name is currently offline Alireza Missing nameFriend
Messages: 105
Registered: July 2009
Senior Member

What about the include path that you mentioned? I tried to include the js source file folder but it did not work out.

Alireza
Re: How to create an IJavaScriptProject? [message #817204 is a reply to message #810516] Fri, 09 March 2012 19:45 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

On 3/1/2012 2:33 AM, Alireza Mising name wrote:
>
> What about the include path that you mentioned? I tried to include the
> js source file folder but it did not work out.
> Alireza

Can you elaborate on that?

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to create an IJavaScriptProject? [message #1734797 is a reply to message #817204] Sun, 12 June 2016 18:55 Go to previous message
Akash Srivastava is currently offline Akash SrivastavaFriend
Messages: 4
Registered: June 2016
Junior Member
Hi, I also need some guidance on creating a Javascipt Project programmatically from scratch.
I tried using the below code:

String code = "var a = \"Akash\"";
Shell dialog = new Shell(Display.getCurrent().getActiveShell());
dialog.setText("Dialog");
dialog.setSize(400, 400);
dialog.setLayout(new FillLayout());


IWorkspace workspace = JavaScriptPlugin.getDefault().getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("proj1"); //$NON-NLS-1$
IFolder folder = project.getFolder("scripts"); //$NON-NLS-1$
if (!project.exists())
{
try
{
project.create(null);

}
catch (CoreException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
IJavaScriptProject proj = JavaScriptCore.create(project);

IProjectDescription description= null;
try
{
description = project.getDescription();
description.setNatureIds(new String[] {JavaScriptCore.NATURE_ID});
project.setDescription(description,null);
}
catch (CoreException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}


But it gave me this error :
org.osgi.framework.BundleException: Could not resolve module: com.lab.helloworld [1583]
Unresolved requirement: Require-Bundle: org.eclipse.swt.win32.win32.x86_64.source; bundle-version="3.103.2"

at org.eclipse.osgi.container.Module.start(Module.java:434)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

[Updated on: Sun, 12 June 2016 18:56]

Report message to a moderator

Previous Topic:JavaSourceViewer not working in SWT composites
Next Topic:a serious issue when deploying through Eclipse
Goto Forum:
  


Current Time: Sat Apr 20 02:22:24 GMT 2024

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

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

Back to the top