Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] Persistence unit is not updated properly after renaming entity

Petya:

I have fixed this problem and pushed my changes.

I tested the change by renaming a type via the diagram editor etc. My fix seems to
work OK; but I ran into a couple of issues:

- I encountered a deadlock during a refactor. The thread dump is attached.

- The refactoring seems to ignore the settings I pick in the dialog. (e.g. If I do not
click the "Update similarly named variables and methods" check box; the variables
and methods are still changed.) Maybe this is because the feature is still under
construction?

I also have an observation: The diagram editor should explicitly participate in the refactoring,
not try to "participate" in the background. That is, you should be extending the
extension point "org.eclipse.ltk.core.refactoring.renameParticipants" and adding any diagram
editor changes to the list of potential refactoring changes that are presented to the
user. Then you would also be notified when the changes are applied. It might make
your code much more simple?

Regards,
Brian


On 3/7/2013 9:36 AM, Sabeva, Petya wrote:

Hi all,

 

After I rebased my changes today, on top of the master branch, I’ve notice that when I have an entity and rename it, the corresponding persistent type in the persistence unit is not updated properly. What exactly is happening is that the classRef refers to a class with the new name, but if I call classRef.getJavaManagedType() -> it returns the old persistent type (a JPT object with old name). This leads to NPE when I try to manipulate an object, which is returned by persistenceUnit.getPersistentType(newName) and thus it prevents me to rename a persistent type in the JPA diagram editor. I guess this is caused by the huge refactoring from these days… However I am interested in, whether it is working on this issue, or should I open a bug?

 

Regards,

Petya



_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev

Thread [main] (Suspended)	
	owns: RunnableLock  (id=278)	
	owns: GFWorkspaceCommandStackImpl  (id=279)	
	waiting for: JPASolver$WorkingCopyChangeListener  (id=280)	
	JPASolver$WorkingCopyChangeListener.elementChanged(ElementChangedEvent) line: 1112	
	DeltaProcessor$4.run() line: 1682	
	SafeRunner.run(ISafeRunnable) line: 42	
	DeltaProcessor.notifyListeners(IJavaElementDelta, int, IElementChangedListener[], int[], int) line: 1672	
	DeltaProcessor.firePostChangeDelta(IJavaElementDelta, IElementChangedListener[], int[], int) line: 1506	
	DeltaProcessor.fire(IJavaElementDelta, int) line: 1482	
	DeltaProcessor.resourceChanged(IResourceChangeEvent) line: 2094	
	DeltaProcessingState.resourceChanged(IResourceChangeEvent) line: 470	
	NotificationManager$1.run() line: 291	
	SafeRunner.run(ISafeRunnable) line: 42	
	NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 285	
	NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 149	
	Workspace.broadcastPostChange() line: 396	
	Workspace.checkpoint(boolean) line: 558	
	PerformChangeOperation$1.run(IProgressMonitor) line: 263	
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2345	
	PerformChangeOperation.executeChange(IProgressMonitor) line: 306	
	PerformChangeOperation.run(IProgressMonitor) line: 223	
	BatchOperation.executeOperation() line: 39	
	BatchOperation(JavaModelOperation).run(IProgressMonitor) line: 728	
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2345	
	JavaCore.run(IWorkspaceRunnable, ISchedulingRule, IProgressMonitor) line: 5332	
	WorkbenchRunnableAdapter.run(IProgressMonitor) line: 106	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 464	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 372	
	WorkbenchWindow$13.run() line: 1671	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 1668	
	RefactoringExecutionHelper.perform(boolean, boolean, boolean) line: 193	
	RefactoringExecutionHelper.perform(boolean, boolean) line: 151	
	RenameSupport.perform(Shell, IRunnableContext) line: 198	
	RenameAttributeCommand.renameGetter(IMethod, String) line: 228	
	RenameAttributeCommand.renameAttribute(ICompilationUnit, String, String, IJPAEditorFeatureProvider, boolean) line: 178	
	RenameAttributeCommand.execute() line: 76	
	InternalJpaProjectManager.execute(Command, ExtendedCommandContext) line: 1103	
	JpaArtifactFactory.renameAttribute(PersistentType, String, String, String, IJPAEditorFeatureProvider) line: 1244	
	RefactorEntityFeature$JPAProjectListener$1.run() line: 325	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 135	
	Display.runAsyncMessages(boolean) line: 4144	
	Display.readAndDispatch() line: 3761	
	ModalContext$ModalContextThread.block() line: 173	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 388	
	WorkbenchWindow$13.run() line: 1671	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 1668	
	RefactoringExecutionHelper.perform(boolean, boolean, boolean) line: 191	
	RefactoringExecutionStarter.startCleanupRefactoring(ICompilationUnit[], ICleanUp[], boolean, Shell, boolean, String) line: 245	
	MultiFormatAction(CleanUpAction).performRefactoring(ICompilationUnit[], ICleanUp[]) line: 91	
	MultiFormatAction(CleanUpAction).run(ICompilationUnit) line: 176	
	MultiFormatAction(CleanUpAction).run(IStructuredSelection) line: 108	
	FormatAllAction.run(IStructuredSelection) line: 112	
	JPAEditorUtil.formatCode(ICompilationUnit, IWorkbenchSite) line: 981	
	JPAEditorUtilImpl.formatCode(ICompilationUnit, IWorkbenchSite) line: 47	
	RefactorEntityFeature$3.run() line: 219	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	RenameEntityFeature(RefactorEntityFeature).remapEntity(PersistentType, Shape, PersistenceUnit, boolean, RefactorEntityFeature$JPAProjectListener, IJPAEditorFeatureProvider) line: 174	
	RefactorEntityFeature$1.doExecute() line: 140	
	RefactorEntityFeature$1(RecordingCommand).execute() line: 135	
	GFWorkspaceCommandStackImpl.execute(Command, Map<?,?>) line: 117	
	GFWorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command) line: 219	
	RenameEntityFeature(RefactorEntityFeature).execute(ICustomContext, SelectionDispatchAction) line: 137	
	RenameEntityFeature.execute(ICustomContext) line: 36	
	RenameEntityFeature(AbstractCustomFeature).execute(IContext) line: 83	
	GenericFeatureCommandWithContext.execute() line: 64	
	CommandContainer.execute() line: 81	
	GefCommandWrapper.execute() line: 51	
	EmfOnGefCommand.execute() line: 54	
	GFPreparableCommand2.doExecute() line: 37	
	GFPreparableCommand2(RecordingCommand).execute() line: 135	
	EMFCommandOperation.doExecute(IProgressMonitor, IAdaptable) line: 119	
	EMFCommandOperation(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 150	
	DefaultOperationHistory.execute(IUndoableOperation, IProgressMonitor, IAdaptable) line: 513	
	GFWorkspaceCommandStackImpl(WorkspaceCommandStackImpl).doExecute(Command, Map<?,?>) line: 208	
	GFWorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command, Map<?,?>) line: 165	
	GFWorkspaceCommandStackImpl.execute(Command, Map<?,?>) line: 84	
	GFCommandStack.execute(Command) line: 124	
	CustomAction.executeOnCommandStack(ICommand) line: 64	
	CustomAction.run() line: 59	
	CustomAction(Action).runWithEvent(Event) line: 499	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 584	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 501	
	ActionContributionItem$5.handleEvent(Event) line: 411	
	EventTable.sendEvent(Event) line: 84	
	MenuItem(Widget).sendEvent(Event) line: 1053	
	Display.runDeferredEvents() line: 4169	
	Display.readAndDispatch() line: 3758	
	PartRenderingEngine$9.run() line: 1057	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 941	
	E4Workbench.createAndRunUI(MApplicationElement) line: 79	
	Workbench$5.run() line: 588	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 543	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 124	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 354	
	EclipseStarter.run(String[], Runnable) line: 181	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 636	
	Main.basicRun(String[]) line: 591	
	Main.run(String[]) line: 1450	
	Main.main(String[]) line: 1426	

Daemon Thread [org.eclipse.jdt.internal.ui.text.JavaReconciler] (Suspended)	
	owns: JPASolver$WorkingCopyChangeListener  (id=280)	
	waiting for: GFWorkspaceCommandStackImpl  (id=279)	
	GFWorkspaceCommandStackImpl.execute(Command, Map<?,?>) line: 67	
	GFWorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command) line: 219	
	GraphicsUpdater.updateHeader(ContainerShape, String) line: 182	
	JPASolver$WorkingCopyChangeListener.elementChanged(ElementChangedEvent) line: 1128	
	DeltaProcessor$4.run() line: 1682	
	SafeRunner.run(ISafeRunnable) line: 42	
	DeltaProcessor.notifyListeners(IJavaElementDelta, int, IElementChangedListener[], int[], int) line: 1672	
	DeltaProcessor.fireReconcileDelta(IElementChangedListener[], int[], int) line: 1524	
	DeltaProcessor.fire(IJavaElementDelta, int) line: 1483	
	ReconcileWorkingCopyOperation(JavaModelOperation).run(IProgressMonitor) line: 769	
	ReconcileWorkingCopyOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 788	
	CompilationUnit.reconcile(int, int, WorkingCopyOwner, IProgressMonitor) line: 1247	
	CompilationUnit.reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor) line: 1208	
	JavaReconcilingStrategy.reconcile(ICompilationUnit, boolean) line: 133	
	JavaReconcilingStrategy.access$0(JavaReconcilingStrategy, ICompilationUnit, boolean) line: 108	
	JavaReconcilingStrategy$1.run() line: 89	
	SafeRunner.run(ISafeRunnable) line: 42	
	JavaReconcilingStrategy.reconcile(boolean) line: 87	
	JavaReconcilingStrategy.reconcile(IRegion) line: 151	
	JavaCompositeReconcilingStrategy(CompositeReconcilingStrategy).reconcile(IRegion) line: 86	
	JavaCompositeReconcilingStrategy.reconcile(IRegion) line: 104	
	JavaReconciler(MonoReconciler).process(DirtyRegion) line: 77	
	AbstractReconciler$BackgroundThread.run() line: 206	

Back to the top