use of org.eclipse.core.internal.events.ResourceChangeEvent in project tdi-studio-se by Talend.
the class StandAloneTalendJavaEditor method dispose.
@SuppressWarnings("restriction")
@Override
public void dispose() {
// remove the Runtines .java file in the .Java Project.
// try {
// rEditorInput.getFile().delete(true, null);
// } catch (CoreException e1) {
// RuntimeExceptionHandler.process(e1);
// }
super.dispose();
if (lockService != null) {
lockService.unregister();
}
// Unlock the process :
IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
try {
item.getProperty().eAdapters().remove(dirtyListener);
repFactory.unlock(item);
} catch (PersistenceException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
// }
if (!isEditable) {
rEditorInput.getFile().setReadOnly(false);
}
// dispose custom color
if (bgColorForReadOnlyItem != null) {
bgColorForReadOnlyItem.dispose();
}
if (bgColorForEditabeItem != null) {
bgColorForEditabeItem.dispose();
}
ITalendProcessJavaProject talendProcessJavaProject = CorePlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
talendProcessJavaProject.updateRoutinesPom(true, true);
}
// only for sql template
if (item instanceof SQLPatternItem) {
IProject jProject = talendProcessJavaProject.getProject();
ResourceChangeEvent event = new ResourceChangeEvent(item, IResourceChangeEvent.PRE_CLOSE, 1, null);
try {
//$NON-NLS-1$
Field resourceField = event.getClass().getDeclaredField("resource");
resourceField.setAccessible(true);
resourceField.set(event, jProject);
} catch (Exception e) {
ExceptionHandler.process(e);
}
Workspace ws = (Workspace) ResourcesPlugin.getWorkspace();
ws.getNotificationManager().broadcastChanges(ws.getElementTree(), event, false);
}
}
Aggregations