Where does the Apache Derby Eclipse plugin go?

Edit: According to the Derby community, the Eclipse plugin will not be supported or built automatically by the Derby project.

But does anyone else use this plugin? Because, if so, is there a place where he publishes the actual builds that (hopefully) will run under Eclipse Juno?

Or if it's a real dead end, what are the alternatives?


Initial task

Using

  • jdk1.7.0_03
  • Eclipse IDE for Java Developers EE Developers (Win32) Juno (build from 2012/06/14)
  • derby-core-plugin 10.8.2 and -ui-plugin 1.1.3 (since there is no eclipse plugin for the latest version 10.9.1.0)

Problem
When trying to add a new type of derby (right-click on the java project β†’ "Apache Derby" β†’ "Add Apache Derby Nature"). I receive only the following message:

Apache Derby Ui Plug-in Error adding Derby jars to the project: org.eclipse.ui.internal.WorkbenchWindow cannot be cast to org.eclipse.jface.window.ApplicationWindow 

Any ideas?

+6
source share
2 answers

Apache Derby db-derby-10.9.1.0-src / Eclipse 4.2.1 (Juno) / Java 7

Some kind of fix. More research is needed, but it will work.

Literature:
db-bowler-10.9.1.0-src / BUILDING.html
db-derby-10.8.1.2-src / plugins / eclipse / Readme.txt

Download the Apache Derby source ZIP file.
Retrieve the zip code. Change to the source directory.
db-derby-10.9.1.0-src

Complete the following ant goals.
ant -quiet clobber
ant -quiet buildsource
ant -quiet buildjars

Create the main plugin.
ant plug

You should now have the derby_core_plugin_10.9.1.zip file in the db-derby-10.9.1.0-src / jars / sane directory.

Note. Your Eclipse development environment should not start. Extract the main derby plugin created by the ant application described above and copy it to the Eclipse plugin directory.

Launch Eclipse.

Import org.apache.derby.ui from the source tree.
(Import> General> Existing projects in the workspace)

Open the plugin.xml file

On the Overview tab, increase the version number to say 1.1.4.

Save the file.

Bug are in ...
1.) package org.apache.derby.ui.popup.actions.AddDerbyNature.java
2.) package org.apache.derby.ui.popup.actions.RemoveDerbyNature.java

Where the .setStatus method is called in these two units.


Note: (from javadoc ApplicationWindow)

void org.eclipse.jface.window.ApplicationWindow.setStatus (String message)

Sets or clears the message displayed in this window status bar (if there is> one). This method does not work if the window does not have a status bar.

Parameters:
report status message or null to clear it

So, let's say that the IDE does not have a status bar, so this call does not work according to the Java document.

 Commenting out these method calls from: AddDerbyNature.java //((ApplicationWindow) window).setStatus(Messages.ADDING_NATURE); //((ApplicationWindow) window).setStatus(Messages.DERBY_NATURE_ADDED); RemoveDerbyNature.java //((ApplicationWindow)window).setStatus(Messages.REMOVING_NATURE); //((ApplicationWindow)window).setStatus(Messages.DERBY_NATURE_REMOVED); 

Test (s):
Run as an Eclipse application.

Create a project. Perhaps name it "org.apache.derby.ui.test".

Right click on project / select Add Nature Apache Derby
There is no mistake.

Right click on project / select Delete Nature Apache Derby
There is no mistake.

Add nature again to check other menu items.
Right click on project / select Add Nature Apache Derby

Right click on project / Select Start Network Network Server

Error, the server was started.

From the console log ... Sun Jan 27 17:51:29 EST 2013: The security manager is installed using the security policy of the primary server. Sun Jan 27 17:51:29 EST 2013: Apache Derby Network Server - 10.9.1.0 - (Non-authenticated directory) is running and ready to accept connections on port 1527

Note. Not sure what the Unversioned translation message means.

Right click on project / select Stop Derby Network Server
Error, server is stopped.
Sun Jan 27 17:53:32 EST 2013: Apache Derby Network Server - 10.9.1.0 - (Unversified directory) shutdown

Start a server backup ...
Right click on project / Select Start Network Network Server

create sql folder.
create test.sql file

my test sql file.

 connect 'jdbc:derby://localhost:1527/TESTDB;create=true;user=test;password=test;'; -- drop User Indexes - ignore error if first time creating drop index UserNameIdx1; -- drop the table if it exists - ignore error if first time creating drop table TEST_USER; -- create the table create table TEST_USER ( ID integer generated by default as identity, USER_NAME varchar(255) not null, FIRST_NAME varchar(255), LAST_NAME varchar(255), PASSWORD varchar(255), ENABLED integer, CREATED_STAMP timestamp, CREATED_TX_STAMP timestamp, LAST_UPDATED_STAMP timestamp, LAST_UPDATED_TX_STAMP timestamp, constraint TEST_USER_PK primary key (ID) ); -- insert some data -- oops --- will mess with the ID generator, see the alter table restart line below. insert into TEST_USER values(0, 'admin','admin','admin','admin',1,'2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000'); -- make the USER_NAME unique create unique index UserNameIdx1 on TEST_USER(USER_NAME); -- reset the generator alter table TEST_USER alter column ID restart with 1; 

Right click file> Apache Derby> Run SQL Script with 'ij'

Restore the project workspace, now there should be a TESTDB folder.

Database created. OK.

Create a zip code.

Right click on project> Export

Click "Plugin Development"> "Deployed Plugins and Slices."
Destination Tab

Archive file
/ derby _ui_plugin_1.1.4-fix.zip
Options Tab
Deselect package plugins as separate JAR archives

Click Finish.

Close / exit the test instance.
Exit Eclipse.

Extract the zip code you just created.

Copy its contents into the plugins directory into the Eclipse plugins directory (Juno).

Restart Eclipse. Create a new project.

You should be able to install Apache Derby (10.9.1) for your projects.

Note. If you built it using Java 7, don't expect it to work for any smaller version of the JVM.

+5
source

The Derby UI plugin for Eclipse has not been supported for several years, I believe, since none of the usual Derby commiters use this plugin, and there were no community volunteers to support it. Therefore, I think it only works with older versions of Eclipse.

I suspect there is not much work to update it so that it works with current Eclipse. If you are interested in this functionality, I’m sure the Derby community will love to hear from you!

See also: Is it now possible to use derby from apache in Eclipse when they stopped developing the derby plugin for Eclipse?

+4
source

Source: https://habr.com/ru/post/920057/


All Articles