I am writing an eclipse plugin and I want to implement a "expiration checker" to disable my plugin once a certain date is reached.
I understand that in order to disable the bundle, I need to turn it into UNINSTALL state (FYI - I got this from here: http://www.eclipse.org/forums/index.php/t/210006/). Furthermore, I will need to do this in preStartup() by implementing the WorkbenchAdvisor class (from org.eclipse.ui.application.WorkbenchAdvisor)
I found this answer which has contains everything I need to know (https://stackoverflow.com/a/11726335/2851950) EXCEPT I couldn't find IApplication or WorkbenchAdvisor under my plugin.xml's dependencies page.
Do I need install additional plugins from somewhere? What I am missing here? Thanks
Related
I am currently working on an API for a server software so users can extend my software by programming plugins for it instead of modifying the software themselves, and allow other users without programming knowledge to easily change the software by adding these plugins. So far, everything is working fine. But, I am running into a problem with configuration.
You see, each plugin has a plugin.yml file stored with these 4 attributes:
Main: The main class is stored here
Name: This is where the plugin name is stored
Version: This is where the plugin version is stored
Author: This is where the plugin author is stored
Now, in order for the plugin to print something to the console, they use a function called: this.getServer().getLogger().info("MESSAGE); (They extend another class for plugins, thats why they use "this" instead of another class to log)
But, I do not have any idea on how to get which plugin is which when they are calling the function. I have a ArrayList of PluginSessions which event handlers use to cycle through to run Event Functions.
My solution is to get the jar from which a class is being called so I can then get the plugin.yml from there. But, I have NO idea on how to get that, I have tried using Class.forName(); and some other code. But because the class is non-existent within the jar/project running the code, It will throw a ClassNotFoundException.
Does anyone here know how to get the jar from which a class is coming from without using Class.forName()? Thanks! -Trent
Take a look at Class.getResource.
If you call MyClass.getResource("plugin.yml") (or "/plugin.yml" with leading slash, I forget) you get back a file URL pointing to the plugin.yml file in the same jar as MyClass. (Or null if the path is wrong or the jar doesn't contain a "plugin.yml" file.) You can then open an InputStream to that resource. In a plugin framework you may want to use myPluginInstance.getClass().getResource.
Assuming jar for 'PluginSessions' is already added in you classpath by eclipse then you can try the following trick -
Select/highlight PluginSessions by double clicking on it
Now press CTRL+SHIFT+T
A dialog named Open Type is appeared. Here you found from where the PluginSessions class is coming from. If you have more than one jar containing PluginSessions class than you have a list of them.
To benefited from this CTRL+SHIFT+T trick you need to add all of your jar need by the project to be added in your classpath.
I am using Eclipse Spring edition (STS) and I am getting a strange error in one of the classes in my project:
can not implement the missing methods, either due to compile errors can not implement the missing methods, either due to compile errors
The class causing this error name is ItemDAO, and it implements interface IItemDAO, and I am 100% sure that there are no un-implemented methods, but Eclipse insists that there are some un-implemented methods, and when I click on the class name and select implement un-implemented methods I get the above error.
Can someone please tell me what I am doing wrong here and how to fix this problem?
Thanks for your time
I Just had the issue and fixed it by cleaning the project.
What the messages says is that since you have compile errors, Eclipse cannot perform the auto-implement action.
The compilation errors are most probably, either in ItemDAO class or IItemDAO interface. Fix them first and then retry the auto-implement action.
The error message states that you have not implemented all the
methods in IItemDAO.
While you try to order eclipse to implement it automatically, it can't be done, because there are compilation errors in the methods (which are still to be implemented or unimplemented) in IItemDAO
Instead of using the jre, use jdk. It will resolve your problem.
I had the same issue.
Here is the error message :
cannot implement the missing methods, either due to compile errors or the project build path does not resolve all dependency
The issue was resolved after cleaning the project as suggested
Go to Source -> cleanup -> besides there is a button configure click on it -> check Enable project specific settings -> apply and close
I have faced the problem, at my situation (I use Maven). I want use struts ServletRequestAware, and it need the servlet-api.jar. So you need to add Tomcat runtimes.
Go to your project, right click->Properties->Project Facets->Runtimes-> add Tomcat.
That`s all.
Error: Could not find or load main class jewelleryerpapplication.GUI.ERPMainMenu
Java Result: 1
Actually i am using Net Beans 7.1 and in that i am continuosly getting the same error but un able to get the solution for that even after installing the latest update for that. The solution which i got from some body that create new project and copy the source and library foldes in that Project from the previous which generate the above error. this solution works for me but i need some simpler solution for this problem.Lot of thanks in advance.
Don't Forget To Give UpVote It If It Helps.
Right click on project node, go to Set configuration, select the main class for your application. Then clean and build.
Even if this doesn't solve your problem, then delete the Netbeans cache by deleting the (index) folder
User\.netbeans\6.9\var\cache\index\
I think that the following is happening:
If this is a third party application, you have not included some jar files on your class path;
Or, (which in my opinion is the most likely) you do not have a method which has this signature: public static void main(String[] args). This method defines the main entry point for your application, not having it might cause that error when you try and run the project. To my knowledge, Netbeans creates a main class with such a method automatically whenever you create a new project. This might be the reason why you are not having this exception when you create a new Project and throw everything in it.
You might be having an issue with Netbeans itself. You can start by either checkin gout this previous SO thread in which a similar (I think) issue is being discussed, or else, as a final resort, you might want to remove Netbeans and all its files, and install an earlier version. You can also try and see if you get the same issue if you use a different IDE such as Eclipse.
the solution is,right click your package in netbeans,go to properties,source now go to the jre option and choose your version,the programme will now run.
I've setup my Play Framework 1.2.1 project to run from within IntelliJ using the instructions from the following post on Google groups:
http://groups.google.com/group/play-framework/msg/54cfe212cbae218e
However, following the tutorial at http://www.playframework.org/documentation/1.2.2/guide8, I'm getting the following error from the IDE:
/Library/WebServer/Documents/devschool.play/app/controllers/Security.java
package Secure does not exist
/Library/WebServer/Documents/devschool.play/app/controllers/Application.java
cannot find symbol class Secure
When I run the application with > play run, everything works fine, but I prefer running it from the IDE. Please note that the project was running perfectly from the IDE before I added the secure module.
Is there a way to fix this? I have a hunch it's to do with an external source, but not being a Java expert, I'm not entirely sure how to do this.
Can anyone please assist?
You should run the following commands:
play dependencies
play idealize
The first one will resolve the dependencies from the Secure module.
The second will update the IntelliJ "classpath" and the red lines/errors regarding the Secure module will disappear.
Okay, so the project is compiling and running okay after unchecking the "Make" checkbox from the Edit Configurations dialog box.
To get the IDE to find the code, you simply need to Attach Sources. On the Mac, press Command + ; and add the sources under the Libraries section.
From the second link you posted, there is a class called Security, it looks like this:
public class Security extends Secure.Security {
static boolean authenticate(String username, String password) {
return true;
}
}
Security extends Secure.Security, which is another class named Security in the Secure package. This error is saying that it cannot find the package Secure. Make sure you are including everything in your classpath properly.
Make sure you run play idealize after adding modules to dependencies.yml or adding dependencies to the application.conf(which is deprecated by the way)
Adding modules in application.conf is deprecated and shouldn't be used anymore. Instead use dependencies.yml and add
- play -> secure
So now my dependencies.yml looks like:
# Application dependencies
require:
- play
- play -> secure
I then ran:
play dependencies
play idealize
and there was a delay but eventually Intellij recognized the module. Not sure exactly if the last commands were necessary.
(Reposting an answer by Sascha Kleiber from the relevant page of the Play tutorial: http://www.playframework.org/documentation/1.2.4/guide8)
I have a Maven Java project, imported using m2eclipse.
The target/ directory is not marked as 'Derived' by m2eclipse.
Problems:
It is validated, so any validation error appear twice. My example shows a JSP Problem, when I insert intentionally an error in a jsp.
When I want to open a resource with Ctrl-Shift-R, all files appear twice, and I run the risk of editing the copy instead of the original file.
Possibly see post eclipse-ignore-folder
Note: When I set manually the directory to derived, the validation problem doesn't disappear, so that would only be part of the solution...
Question:
Is there something I need to do, so that m2eclipse sets the target/ directory to 'Derived' ?
Yeah, that has been around for a while. I wrote a plug-in that allows you to mark directories as "derived" without having to find them all (http://eclipsefrills.sourceforge.net/). It's not great, and you still have to manually run the action to make it work, but it may help.
Odd, though, I have not noticed the problem lately, myself. I wonder if there is some setting in the preferences that takes care of this now.
Good luck.
I got rid of this problem by writing a custom plug-in KeepTargetDerivedPlugin. As its name suggests, it automatically keeps all target folders derived (unlike the other solutions, which require user action).
Still, e. g. the YA2O's plug-in can be used to mark derived folders of projects which already reside in the given Eclipse workspace.
Yes: open a bug report :)
I have been so annoyed by this problem that I wrote a plugin to solve it. You can get the source and jar from here.