Skip to main content



      Home
Home » Eclipse Projects » Sirius » Can't edit cell in sirius table after getting error
Can't edit cell in sirius table after getting error [message #1798214] Wed, 14 November 2018 04:32 Go to next message
Eclipse UserFriend
Hi all,

In sirius table if we enter data of different data type i.e., instead of number if we enter string one dialogue box with title "Problem occurred" will display and unable to edit that cell.

If we want to edit we need to reopen that table.

index.php/fa/34324/0/


index.php/fa/34325/0/

[1] Can we control that dialogue box so that we can edit that cell immediately after closing that error box!!

[2] Or can we check for the data type when we enter the value expression arg() in label edit. But for that how can we give condition because in set while entering the arg() we should give condition.

I tried calling setValue(arg()) in value expression which is not working!!

index.php/fa/34327/0/

public static String setValue(EObject self, String arg) {

		System.out.println(self.toString());
		//System.out.println(arg.toString());
		return arg;
	}


  • Attachment: error.PNG
    (Size: 10.28KB, Downloaded 610 times)
  • Attachment: UnableToedit.PNG
    (Size: 0.72KB, Downloaded 450 times)
  • Attachment: set.PNG
    (Size: 13.42KB, Downloaded 472 times)

[Updated on: Wed, 14 November 2018 04:32] by Moderator

Re: Can't edit cell in sirius table after getting error [message #1798216 is a reply to message #1798214] Wed, 14 November 2018 04:50 Go to previous messageGo to next message
Eclipse UserFriend
Hello

Once you get the error dialog box it is too late and moreover you do not want to see that awful dialog box.
So I would agree with your second proposition that is using a service to check the value and to manage wrong matching with the requested value type.

Peering your Value Interpreted Expression, it seems that you miswrote the arg0 argument. You used opening and closing parenthesis instead of 0 digit.

Regards
Laurent

Re: Can't edit cell in sirius table after getting error [message #1798219 is a reply to message #1798216] Wed, 14 November 2018 05:11 Go to previous messageGo to next message
Eclipse UserFriend
yes Laurent, thank you, i was using arg() instead of arg0

But if I change also it is not working

index.php/fa/34328/0/

I am getting NPE.. It is not considering that service method service:setValue(arg0) If I give service method without passing argument it will work.

Value Expression service:setValue()

public static String setValue(EObject self) {

		System.out.println(self.toString());
		//System.out.println(arg.toString());
		return "22";
	}



But I guess we need arg0 to set value !!
  • Attachment: error2.PNG
    (Size: 11.48KB, Downloaded 426 times)
Re: Can't edit cell in sirius table after getting error [message #1798384 is a reply to message #1798219] Fri, 16 November 2018 09:37 Go to previous messageGo to next message
Eclipse UserFriend
Hello

It is normal that it does not work because your java method has only one argument whereas it should have two if you pass the arg0 argument.

Here is an extract of the Sirius documentation [1]:
Quote:
When the service is invoked, the model element on which it is invoked is used as the first argument to the Java method. If arguments are passed in the expression, they are mapped to the second, third, etc. parameters of the Java method, assuming the types are compatible.


[1] https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#service_methods

Regards
Laurent
Re: Can't edit cell in sirius table after getting error [message #1798436 is a reply to message #1798384] Sun, 18 November 2018 23:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi Laurent,

Yeah, That code I used is for setValue().

If I use setValue(arg0) I'm using

public static String setValue(EObject self,String arg) {
	//self
		
		System.out.println(self.toString());
		System.out.println(arg.toString());
		return "22";
	}



But I am getting NPE. It is not displaying those sysout statements in console also. So I guess it is not considering that method even though I pass a String arg!!

I tried by this also

public static String setValue(EObject self,String args[]) {
	//self
		
		System.out.println(self.toString());
		return "22";
	}



How can I give a method so that it returns integer data type.

[Updated on: Mon, 19 November 2018 00:03] by Moderator

Re: Can't edit cell in sirius table after getting error [message #1798626 is a reply to message #1798436] Wed, 21 November 2018 04:57 Go to previous messageGo to next message
Eclipse UserFriend
Prajna VG wrote on Mon, 19 November 2018 05:34
Hi Laurent,

Yeah, That code I used is for setValue().

If I use setValue(arg0) I'm using

public static String setValue(EObject self,String arg) {
	//self
		
		System.out.println(self.toString());
		System.out.println(arg.toString());
		return "22";
	}



But I am getting NPE.


How can we help if you do not give us actual details about the NPE (e.g. a stack trace)?

Quote:

It is not displaying those sysout statements in console also. So I guess it is not considering that method even though I pass a String arg!!

I tried by this also

public static String setValue(EObject self,String args[]) {
	//self
		
		System.out.println(self.toString());
		return "22";
	}




The documentation page Laurent already pointed you at clearly mentions that "array types are not supported" for the arguments of service methods.

Quote:

How can I give a method so that it returns integer data type.


I just tested, and a service method which returns an int works perfectly fine.

    public int nodeBorderSize(EClass klass) {
    	return klass.getName().length();
    }

Re: Can't edit cell in sirius table after getting error [message #1800137 is a reply to message #1798626] Thu, 20 December 2018 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi Pierre,

I tried using service method it is working for integer value if I set value expression service:setValue(arg0)

But if I enter alphabetical value we are getting java.lang.IllegalArgumentException

Below is the stack trace of my code.


!ENTRY org.eclipse.ui 4 0 2018-12-20 16:33:56.629
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalArgumentException: The value 'hn' is invalid. java.lang.NumberFormatException: For input string: "hn"
	at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:470)
	at autosar40.genericstructure.generaltemplateclasses.primitivetypes.impl.PrimitivetypesFactoryImpl.createPositiveIntegerFromString(PrimitivetypesFactoryImpl.java:886)
	at autosar40.genericstructure.generaltemplateclasses.primitivetypes.impl.PrimitivetypesFactoryImpl.createFromString(PrimitivetypesFactoryImpl.java:163)
	at org.eclipse.sirius.table.ui.tools.internal.editor.provider.DFeatureColumnEditingSupport.setValue(DFeatureColumnEditingSupport.java:245)
	at org.eclipse.jface.viewers.EditingSupport.saveCellEditorValue(EditingSupport.java:113)
	at org.eclipse.jface.viewers.ColumnViewerEditor.saveEditorValue(ColumnViewerEditor.java:453)
	at org.eclipse.jface.viewers.ColumnViewerEditor.applyEditorValue(ColumnViewerEditor.java:309)
	at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:436)
	at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:677)
	at org.eclipse.sirius.table.ui.tools.internal.editor.DTableTreeViewer.triggerEditorActivationEvent(DTableTreeViewer.java:109)
	at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:652)
	at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:648)
	at org.eclipse.jface.viewers.ColumnViewer$1.mouseDoubleClick(ColumnViewer.java:103)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:197)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.NumberFormatException: For input string: "hn"
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Long.parseLong(Unknown Source)
	at java.lang.Long.valueOf(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.emf.ecore.impl.EFactoryImpl.createFromString(EFactoryImpl.java:454)
	... 40 more



and after we can not edit that cell. Can anyone help me on how I can enable that cell after getting that error.

[Updated on: Thu, 20 December 2018 06:13] by Moderator

Re: Can't edit cell in sirius table after getting error [message #1800797 is a reply to message #1800137] Tue, 08 January 2019 08:05 Go to previous message
Eclipse UserFriend
Hi,

It is up to your service to return an integer even if a string is given to your service by user.
Your service must always return an integer and its signature should be int : public static int setValue(EObject self,String arg) {.
Then you will not have any error message.

Regards,
Previous Topic:Sirius Community Survey 2019
Next Topic:Header Column of Sirius table
Goto Forum:
  


Current Time: Wed Jul 23 17:05:47 EDT 2025

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

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

Back to the top