Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » NsLock issue
NsLock issue [message #663925] Wed, 06 April 2011 20:11 Go to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Dear all,

I'm developing an editor and I have the need of set a property of an object when I insert it in an instance of the model. This property is a String and I have built a Dialog in order to define it.

I open this JDialog in the doExecuteWithResult method but unfortunately it block the entire application. This is the code:

protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
			IAdaptable info) throws ExecutionException {
		featureModel.Constraint newElement = featureModel.featureModelFactory.eINSTANCE
				.createConstraint();

		featureModel.FeatureModel model = (featureModel.FeatureModel) getElementToEdit();
		model.getConstraints().add(newElement);

		ArrayList<featureModel.Feature> features = model.getAllFeatures();
		ArrayList<String> featuresName = new ArrayList<String>(); 
		for (Iterator<featureModel.Feature> iterator = features.iterator(); iterator.hasNext();) {
			featuresName.add(iterator.next().getName());
		}
		
		ConstraintRuleDialog dialog = new ConstraintRuleDialog(featuresName);
		// It is a modal JDialog
		String rule = dialog.getRule();
		newElement.setRule(rule);
		
		doConfigure(newElement, monitor, info);

		((CreateElementRequest) getRequest()).setNewElement(newElement);
		return CommandResult.newOKCommandResult(newElement);
	}




The console returns an exception regarding a NsConditionLock.

2011-04-06 21:36:41.097 java[54761:17d03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1200096f0> '(null)') unlocked when not locked
2011-04-06 21:36:41.097 java[54761:17d03] *** Break on _NSLockError() to debug.


Does anyone know how can i sOlve this problem?

Regards,
Luca

[Updated on: Wed, 06 April 2011 23:06]

Report message to a moderator

Re: NsLock issue [message #664024 is a reply to message #663925] Thu, 07 April 2011 08:32 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

didyou try with a SWT/JFace component? JDialog is a Swing component AFAIK.
As all is written in SWT/JFace. It might help.

You can try with an InputDialog for instance lik ethat you can return the rule as string and simulate the whole process.

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: NsLock issue [message #664032 is a reply to message #664024] Thu, 07 April 2011 08:59 Go to previous messageGo to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Thanks a lot,

it seems that with a simple InputDialog it works.

Now I have to build a custom InputDialog because the JDialog that i have initially developed was composed by a text area, a Jsplit and a lot of button...

Do you think it is possible to port all in a JFace Dialog?

Regards,

Luca


[Updated on: Thu, 07 April 2011 12:52]

Report message to a moderator

Re: NsLock issue [message #664083 is a reply to message #664032] Thu, 07 April 2011 12:51 Go to previous messageGo to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Ok,

I've solved the problem of translating the jDialog in a JFace Dialog and now it work...I've only a little problem due to the dispose of the Dialog.
This is the exception:
org.eclipse.core.commands.ExecutionException: While executing the operation, an exception occurred
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:519)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:206)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:169)
	at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:156)
	at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:425)
	at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:438)
	at org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.performCreation(CreationTool.java:133)
	at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:186)
	at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1201)
	at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:301)
	at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:380)
	at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:548)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:213)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1383)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1195)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3629)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3284)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:715)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:531)
	at org.eclipse.swt.widgets.Text.getText(Text.java:1082)
	at featureModel.utility.constraints.ConstraintRuleDialog.getRule(ConstraintRuleDialog.java:191)
	at featureModel.diagram.edit.commands.ConstraintCreateCommand.doExecuteWithResult(ConstraintCreateCommand.java:84)
	at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.gmf.runtime.diagram.ui.commands.SemanticCreateCommand.doExecuteWithResult(SemanticCreateCommand.java:91)
	at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:135)
	at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:403)
	at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:135)
	at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:403)
	at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:135)
	at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:403)
	at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:135)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
	... 41 more

Re: NsLock issue [message #664115 is a reply to message #663925] Thu, 07 April 2011 14:15 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

I think that you need to store the value of the swt text widget into a String attribute when the dialog closed. (when you click on OK for instance) and then put a getter to retrieve this value on the dialog.

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: NsLock issue [message #664148 is a reply to message #664115] Thu, 07 April 2011 16:02 Go to previous message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
You are totally right.
Now it works.

Thanks a lot,
Luca
Previous Topic:Create a child Reference automatically when I create an child contained in the first one
Next Topic:Customize GMF editors
Goto Forum:
  


Current Time: Sun Nov 10 08:54:37 GMT 2024

Powered by FUDForum. Page generated in 0.03753 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top