Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to install a plug-in?
How to install a plug-in? [message #535652] Tue, 25 May 2010 03:35 Go to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
I have done a plug-in for eclipse and now, after make some tries in the execution, I want to install it on a new eclipse to see how it works.

But seeing the project folders, I don't know how to install it in Eclipse, I see there is a folder called bin, whose contents com/articles/.... where there are the .class of the files of my plug-in and nothing more....

What must I do?

Thanks!
Re: How to install a plug-in? [message #535926 is a reply to message #535652] Wed, 26 May 2010 07:10 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 720
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi,

José a écrit :
> I have done a plug-in for eclipse and now, after make some tries in the
> execution, I want to install it on a new eclipse to see how it works.
>
> But seeing the project folders, I don't know how to install it in
> Eclipse, I see there is a folder called bin, whose contents
> com/articles/.... where there are the .class of the files of my plug-in
> and nothing more....
>
> What must I do?

You should create an update-site project (File > New > Plugin development > Update site). Then you can export your plugin as an update site and use it to install your plugin in other Eclipse platforms.

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: How to install a plug-in? [message #537052 is a reply to message #535652] Tue, 01 June 2010 04:00 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
Hello!, thanks for the answer!

I have tried this solution and when I try to add a feature... (I supposed that I must add my plug-in on it, I don't find my plug-in to be add feature. I must doing something bad....
Re: How to install a plug-in? [message #538308 is a reply to message #535652] Mon, 07 June 2010 06:00 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
Hi again!

I have found this tutorial.

http://www.eclipse.org/articles/article.php?file=Article-Upd ate/index.html

I have done all the steps and it almost work, there is something that I need and I can't do it.

My plug-in need a folder that I have included on the workspace, to work with it. When I use the plug-in at executing it does well, like I want (executing from the workspace, like a attempt).

But, when I execute it like a installed feature of Eclipse. It does badly because it doesn't have the folder needed for doing a good execution. Trying to fix this I have added to the build.properties this firstly:

source.. = src/,\

output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
baseproject/
.

"baseproject" is the folder I need. With this attempt I didn't fix it...and with this one either

source.. = src/,\
baseproject/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.

What can I do?


Re: How to install a plug-in? [message #538320 is a reply to message #535652] Mon, 07 June 2010 07:09 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
Hi again!

I have found this tutorial.

http://www.eclipse.org/articles/article.php?file=Article-Upd ate/index.html

I have done all the steps and it almost work, there is something that I need and I can't do it.

My plug-in need a folder that I have included on the workspace, to work with it. When I use the plug-in at executing it does well, like I want (executing from the workspace, like a attempt).

But, when I execute it like a installed feature of Eclipse. It does badly because it doesn't have the folder needed for doing a good execution. Trying to fix this I have added to the build.properties this firstly:

source.. = src/,\

output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
baseproject/
.

"baseproject" is the folder I need. With this attempt I didn't fix it...and with this one either

source.. = src/,\
baseproject/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.

What can I do?
Re: How to install a plug-in? [message #539375 is a reply to message #535652] Thu, 10 June 2010 11:02 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
I don't know...,but maybe it's not possible to do what I want, is there any way to do what I want?

I was thinking that compress the folders feature and plugin with the *.jar files and, in the plugin one, putting the baseproject folder could work, then when the package is unzipped the folder that I want is where I want...

But.. I don't know if the eclipse would add by itself the plugin at starting the next time or its necessary that it will be installed by the wizard to do that.
Re: How to install a plug-in? [message #539416 is a reply to message #535652] Thu, 10 June 2010 12:19 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
I have opened the *.jar file of the plugin folder with winrar and yes, the folder that I need is inside...so them, I don't know why it's not working, here's the code when I try to use the folder

String stringSourcePath = Platform.getBundle("com.argos.framework").getLocation();

stringSourcePath = stringSourcePath.substring(16); // To quit the reference:file:/

copyFilesToWorkSpace(new File(stringSourcePath + "/baseproject"), new File(stringDestinationPath + "/" + ArgosModel.getProjectName()));

and the plugin.xml has this content:

<plugin>

<extension
id="com.argos.framework"
name="Argos"
point="org.eclipse.ui.newWizards">
.
.
.
</plugin>

anyone knows?

[Updated on: Thu, 10 June 2010 12:21]

Report message to a moderator

Re: How to install a plug-in? [message #539587 is a reply to message #539416] Fri, 11 June 2010 08:43 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

So you have a directory with some files in your plugin? And you would
like to copy them into your workspace?

Once you have your Bundle: Platform.getBundle("com.argos.framework")
use org.osgi.framework.Bundle.findEntries(String, String, boolean) or
getEntryPaths(*)/getEntry(*) to get URLs (which have openStream() on them).

Then use ResourcesPlugin.getWorkspace().getRoot() and the appropriate
IProject/IFolder/IFile code to copy the InputStreams into your workspace.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to install a plug-in? [message #539914 is a reply to message #535652] Mon, 14 June 2010 05:30 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
Thank you so much, I'm trying in that way, but I'm get lost in the second part, with the inputstreams...

I want to copy the folder with its own subfolders and files into a new folder in the workspace. How I create the new folder using ResoucesPlugin?, after that how can I do to copy "baseproject" content to that new folder?.


Bundle bundleArgos = Platform.getBundle("com.argos.framework");
URL urlArgos = bundleArgos.getEntry("baseproject");
ResourcesPlugin.getWorkspace().getRoot().?

A part of that, I don't understand why my way works fine when I try it at executting like a project of Eclipse, and now, when I install it into a Eclipse, it doens't work, it should be the same...
Re: How to install a plug-in? [message #540010 is a reply to message #539914] Mon, 14 June 2010 10:53 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

José wrote:
> Bundle bundleArgos = Platform.getBundle("com.argos.framework");
> URL urlArgos = bundleArgos.getEntry("baseproject");
> ResourcesPlugin.getWorkspace().getRoot().?

http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Workspace_ and_Resources_API

>
> A part of that, I don't understand why my way works fine when I try it
> at executting like a project of Eclipse, and now, when I install it into
> a Eclipse, it doens't work, it should be the same...

From within eclipse your plugin is being viewed on the disk as a folder
(it's in your workspace) and so some things work because your running in
a java environment. But when deployed, you are a jar representing an
OSGi bundle. That's why Bundle provides API that works both within
eclipse and deployed.

So getLocation() doesn't promise anything useful for copying files out
of a plugin outside of a development environment.

You basically need to find all of the "files" within your plugin, and
then walk them creating the appropriate IFolders/IFiles within the
user's workspace.

There's no magic "copy out this entire directory" function, although you
might be able to find one if you google.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to install a plug-in? [message #540173 is a reply to message #535652] Tue, 15 June 2010 05:15 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
Thanks for the help guide, very useful!

I have done that for copy one file...and it works perfectly

Bundle bundleArgos = Platform.getBundle("com.argos.framework");
URL urlArgos = bundleArgos.getEntry("/baseproject/AndroidManifest.xml");
InputStream source;
try {
source = urlArgos.openStream();
IProject ArgosProject = root.getProject(ArgosModel.getProjectName());
IFolder folder = ArgosProject.getFolder("tupac");
if (!folder.exists())
try {
folder.create(IResource.NONE, true, null);
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
IFile file = folder.getFile("hello.txt");
try {
file.create(source, IResource.NONE, null);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

But now, how can I do a automatic way of copy all the files and subfolders?, I haven't seen in the IFOLDER or IFILE something that allows this without indicating the exactly name of the file, I must have they recorded in the code in order to do that? :S

Thank you so much

[Updated on: Tue, 15 June 2010 05:17]

Report message to a moderator

Re: How to install a plug-in? [message #540224 is a reply to message #540173] Tue, 15 June 2010 08:37 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

There's no "copy out this whole thing". It's not a common operation.

You're on the right track, however. You'll have to write the code to do
it. If you don't want to hardcode the list to your directory in your
bundle, you can use Bundle.findEntries(*) or Bundle.getEntryPaths(*) to
fine your list of files/folder to copy out.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to install a plug-in? [message #540327 is a reply to message #535652] Tue, 15 June 2010 12:07 Go to previous messageGo to next message
José is currently offline José
Messages: 31
Registered: March 2010
Member
I have done the next code that it's supposed to be in a recursive method

Bundle  bundleArgos =  Platform.getBundle("com.argos.framework");
Enumeration<String> List = bundleArgos.getEntryPaths("/");

while (List.hasMoreElements()){
                  /*HERE, ASK IF IT IS A FOLDER OR NOT
                     IF IT IS A FOLDER, create it at destination and call this method with the folders.
                     ELSE copy the file into the actual folder of destination*/
		}


The problem is that I do the next thing:

URL urlArgos1 = bundleArgos.getEntry(List.getClass().toString());

How can I know if it's a file or folder?. I haven't seen that in the bundle you do "get folder or get file" in order to see if it returns null or not (to know if it's a folder or not).

Thank you so much, I think I'm near


DP: I don't know if enumeration<string> is right, but I have seen that it supposed to have a type, and I haven't found which is it by googling... is it right?

[Updated on: Tue, 15 June 2010 12:10]

Report message to a moderator

Re: How to install a plug-in? [message #540340 is a reply to message #540327] Tue, 15 June 2010 13:40 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

José wrote:
> I have done the next code that it's supposed to be in a recursive method
>
>
> Bundle bundleArgos = Platform.getBundle("com.argos.framework");
> Enumeration<String> List = bundleArgos.getEntryPaths("/");

^^^ List should probably be list. also, that will potentially return
everything in your bundle ... I thought you wanted to copy one folder,
not all of the class files? You probably need to put any files that you
need in a subdirectory like "config" or "templates" in your plugin.

>
>
> The problem is that I do the next thing:
>
> URL urlArgos1 = bundleArgos.getEntry(List.getClass().toString());

List.getClass() ... that's not useful in the least. You have an
Enumeration of Strings,

>
> How can I know if it's a file or folder?.

That's spelled out in the javadoc for getEntryPaths(*).

You can use org.eclipse.core.runtime.Path to easily break up a path into
segments, BTW.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to install a plug-in? [message #540350 is a reply to message #535652] Tue, 15 June 2010 14:55 Go to previous message
José is currently offline José
Messages: 31
Registered: March 2010
Member
thank you so much!!!, I've done it... and it works ^^ lol....

I let this here, to help to others, this is the less I can do being so helped like I've been... thanks!

	private void copyBundleToWorkSpace(Bundle bundleArgos, String path, IProject project) {
		// TODO Auto-generated method stub
		
		Enumeration<?> List = bundleArgos.getEntryPaths(path);
		
		while (List.hasMoreElements()){
			Object object = List.nextElement();
			Enumeration<?> tmpList = bundleArgos.getEntryPaths(object.toString());
			if(tmpList!=null){
				//Create and recall
				IFolder folder = project.getFolder(object.toString().substring(12));
				if (!folder.exists())
				try {
					folder.create(IResource.NONE, true, null);
				} catch (CoreException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				copyBundleToWorkSpace(bundleArgos, object.toString(), project);
			}
			else{
				IFile file = project.getFile(object.toString().substring(12));
				URL urlArgos = bundleArgos.getEntry(object.toString());
				try {
					InputStream source = urlArgos.openStream();
					try {
						file.create(source, IResource.NONE, null);
					} catch (CoreException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		}
	}


It only has a problem....that it doens't create empty folders, because it "detects" that like a file, and then it "fails"....but the rest works perfectly

NOTE: substr (substring) is used because i take the folder baseproject and I want it to the root directory of the project, so I take the "baseproject/" with the substr

[Updated on: Tue, 15 June 2010 14:58]

Report message to a moderator

Previous Topic:One Handler, multiple WorkbenchWindows
Next Topic:Should product configuration include fragments
Goto Forum:
  


Current Time: Fri Apr 18 16:51:52 EDT 2014

Powered by FUDForum. Page generated in 0.09359 seconds