"REMOVE_DEPENDENCY", getDisplayName() ) ); //NOI18N
}
@Override
public void actionPerformed ( ActionEvent e ) {
final DataObject dob = getLookup().lookup( DataObject.class );
if (dob != null && dob.isValid()) {
Project p = FileOwnerQuery.getOwner( dob.getPrimaryFile().getParent() );
final NodeJSProject prj = p == null ? null : p
.getLookup()
.lookup( NodeJSProject.class );
System.out.println( "PROJECT IS " + prj );
RequestProcessor.getDefault().post( new Runnable() {
@Override
public void run () {
try {
String libName = dob.getName();
System.out.println( "Remove library " + libName );
dob.delete();
if (prj != null) {
List<AddLibraryAction.LibraryAndVersion> libs
= AddLibraryAction.libraries( prj );
for (Iterator<AddLibraryAction.LibraryAndVersion> it = libs.iterator(); it.hasNext();) {
LibraryAndVersion a = it.next();
System.out.println( "LIB " + a.name + " " + a.version );
if (libName.equals( a.name )) {
System.out.println( " REMOVE " + a.name );
it.remove();
}
}
AddLibraryAction.updateDependencies( prj, libs, libName );
}
} catch ( IOException ex ) {
Logger.getLogger( LibraryFilterNode.class.getName() ).log(
Level.INFO, "Could not delete " + dob.getName(), ex ); //NOI18N
}
}
} );
} else {
Toolkit.getDefaultToolkit().beep();