Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Saving Data Stored In Editorpart in RCP application(I want to save selected and not selected value of check box in SWT table. in web application provide a session but in Eclipse RCP application how is it possible.)
Saving Data Stored In Editorpart in RCP application [message #1765914] Wed, 14 June 2017 13:10
Sumit Fataniya is currently offline Sumit FataniyaFriend
Messages: 12
Registered: July 2016
Junior Member
I am using saveState method of viewPart to save my view state.Below is my code for saving data in my EditorPart.

public class FoodDetailsEditor extends EditorPart {

public static final String ID = "rcp_demo.Editor.FoodDetailsEditor"; //$NON-NLS-1$Food_Details
public static final String BID = "Food_Details";
private Table table;

public FoodDetailsEditor() {
}


@Override
public void createPartControl(Composite parent) {

ScrolledComposite scrolledComposite_2 = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite_2.setExpandHorizontal(true);
scrolledComposite_2.setExpandVertical(true);

Composite composite = new Composite(scrolledComposite_2, SWT.NONE);
composite.setLayout(new GridLayout(1, false));

table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION|SWT.CHECK);
GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_table.heightHint = 156;
gd_table.widthHint = 565;
table.setLayoutData(gd_table);
table.setHeaderVisible(true);
table.setLinesVisible(true);

TableColumn tblclmnCheckbox = new TableColumn(table, SWT.NONE);
tblclmnCheckbox.setWidth(100);
tblclmnCheckbox.setText("Checkbox");

TableColumn tblclmnTiming = new TableColumn(table, SWT.NONE);
tblclmnTiming.setWidth(100);
tblclmnTiming.setText("Timing");

TableColumn tblclmnMonday = new TableColumn(table, SWT.NONE);
tblclmnMonday.setWidth(100);
tblclmnMonday.setText("Monday");

TableColumn tblclmnTuesday = new TableColumn(table, SWT.NONE);
tblclmnTuesday.setWidth(100);
tblclmnTuesday.setText("Tuesday");

TableColumn tblclmnWednesday = new TableColumn(table, SWT.NONE);
tblclmnWednesday.setWidth(100);
tblclmnWednesday.setText("Wednesday");

TableColumn tblclmnThursday = new TableColumn(table, SWT.NONE);
tblclmnThursday.setWidth(100);
tblclmnThursday.setText("Thursday");

TableColumn tblclmnFriday = new TableColumn(table, SWT.NONE);
tblclmnFriday.setWidth(100);
tblclmnFriday.setText("Friday");

TableColumn tblclmnSaturday = new TableColumn(table, SWT.NONE);
tblclmnSaturday.setWidth(100);
tblclmnSaturday.setText("Saturday");
scrolledComposite_2.setContent(composite);
scrolledComposite_2.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

TableItem item1 = new TableItem(table, SWT.NONE);
item1.setText(new String[]{"","10:00 to 10:30","Food1","Food2","Food3","Food4","Food5"});
TableItem item2 = new TableItem(table, SWT.NONE);
item2.setText(new String[]{"","11:00 to 11:30","Food1","Food2","Food3","Food4","Food5"});
TableItem item3 = new TableItem(table, SWT.NONE);
item3.setText(new String[]{"","12:00 to 12:30","Food1","Food2","Food3","Food4","Food5"});
TableItem item4 = new TableItem(table, SWT.NONE);
item4.setText(new String[]{"","13:00 to 13:30","Food1","Food2","Food3","Food4","Food5"});

}

@Override
public void setFocus() {
// Set the focus
}

@Override
public void doSave(IProgressMonitor monitor) {
// Do the Save operation
}

@Override
public void doSaveAs() {
// Do the Save As operation
}

@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
// Initialize the editor part
if (!(input instanceof FoodDetailsEditorInput)) {
throw new PartInitException("Invalid Input: Must be " + FoodDetailsEditorInput.class.getName());
}
setSite(site);
setInput(input);
}
@Override
public boolean isDirty() {
return false;
}
@Override
public boolean isSaveAsAllowed() {
return true;
}
}

Following problem occurs:
once I select any checkbox then just select another toolbar Item then i am rollback to previous editor again then i am shock,All the check box item is selected item is not selected.

Previous Topic:Popup menu doesn't synch with E4 model
Next Topic:IPerspectiveFactory in an e4 application
Goto Forum:
  


Current Time: Tue Sep 25 02:47:48 GMT 2018

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

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

Back to the top