Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » TableViewer EditElement Problem
TableViewer EditElement Problem [message #55779] Sun, 06 July 2003 20:55
MorPheus is currently offline MorPheusFriend
Messages: 57
Registered: July 2009
Member
Hi,

I am using tableviewer to display table of contents.I used
setCellEditors to set the desired widget over the particular column, so that
the users can update the contents.

I have three column Viz., Name,Address,Code. I have set text editor for the
name column.

I want the name to be unique so when the user try to set the name that is
already exist in the database I will throw error via MessageDialog.

The Problem is after the message Dialog is displayed the text widget
disposes.so the user has to click the concern column to do get the desired
widget to do the updation.I want to avoid this.

Is there any way that after the I display the MessageDialog I will be able
to get back the user to edit mode so that the user doesn't have to click the
column again to get the edit mode.

I have tried using editElement but in vain.The Problem arises when the we
try to set the column in the editElement to '0'.I am not able to get the
problem when I set the column to '1' or above.

The same problem also arises when the element at editElement argument is at
the '0' row.

//snippet

public void modify(Object element, String property, Object value)

{

boolean errorOccured = false;

if (element instanceof Item)

{

element = ((Item) element).getData();

}

if (property == "Name")

{

if (!((CxMathParameter)
element).getName().equalsIgnoreCase((String) value))

{

ArrayList tempList = mathParamModel.getList(
CxMathBuilderProperties.CXMathParametersModel_PARAMETER_TYPE _MAIN);

for (Iterator iter = tempList.iterator(); iter.hasNext();)

{

CxMathParameter et = (CxMathParameter) iter.next();

//************************************ Have a look at here
********************************************

if (et.getName().equalsIgnoreCase((String) value))

{


MessageDialog.openError(CxMathBuilderPlugin.getActiveWorkben chShell(), "Ratin
g Parameters Error","The Name "+ et.getName()+ " Already Exist Please
Correct
it");

//************************** Using Edit Element to get the user back to edit
mode********************************************


tableViewer.editElement(tableViewer.getElementAt(tableViewer .getTable().getS
electionIndex()),0);

//************************** Using Edit Element to get the user back to edit
mode********************************************

errorOccured = true;

}

//************************************ End of - Have a look at here
********************************************

}

if (!errorOccured)

{

((CxMathParameter) element).setName((String) value);

errorOccured = false;

}

}

}




MorPheus
Previous Topic:A Requirements plugin...anybody interested?
Next Topic:TableViewer EditElement Problem
Goto Forum:
  


Current Time: Fri Apr 26 08:11:32 GMT 2024

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

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

Back to the top