Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 96067 Details for
Bug 180280
Unmovable rows in Datapool Editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch.
Defect_180280_patch.txt (text/plain), 19.91 KB, created by
Paul Slauenwhite
on 2008-04-15 09:31:16 EDT
(
hide
)
Description:
Patch.
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2008-04-15 09:31:16 EDT
Size:
19.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.ui >Index: src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolMenuManager.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolMenuManager.java,v >retrieving revision 1.13 >diff -u -r1.13 DatapoolMenuManager.java >--- src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolMenuManager.java 26 Apr 2007 18:50:09 -0000 1.13 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolMenuManager.java 15 Apr 2008 13:30:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -20,6 +20,7 @@ > import org.eclipse.hyades.test.ui.datapool.internal.action.DeleteColumnAction; > import org.eclipse.hyades.test.ui.datapool.internal.action.DeleteRowAction; > import org.eclipse.hyades.test.ui.datapool.internal.action.EditColumnAction; >+import org.eclipse.hyades.test.ui.datapool.internal.action.EditRowAction; > import org.eclipse.hyades.test.ui.datapool.internal.action.FindReplaceAction; > import org.eclipse.hyades.test.ui.datapool.internal.action.InsertColumnAction; > import org.eclipse.hyades.test.ui.datapool.internal.action.InsertRowAction; >@@ -32,12 +33,20 @@ > import org.eclipse.jface.viewers.ISelectionProvider; > > /** >- * @author psun >- * >+ * DatapoolMenuManager.java >+ * <p/> >+ * >+ * >+ * @author Peter Sun >+ * @author Paul E. Slauenwhite >+ * @version April 13, 2008 >+ * @since January 27, 2005 > */ > public class DatapoolMenuManager { >- private InsertRowAction insertRowAction = null; >+ >+ private InsertRowAction insertRowAction = null; > private DeleteRowAction deleteRowAction = null; >+ private EditRowAction editRowAction = null; > private InsertColumnAction insertColumnAction = null; > private DeleteColumnAction deleteColumnAction = null; > private EditColumnAction editColumnAction = null; >@@ -51,6 +60,51 @@ > private boolean showColumnActions = true; > private boolean showRowActions = true; > private boolean showEditActions = true; >+ >+ /** >+ * Display mode Display mode constant for enabling the {@link InsertRowAction} (value is 1<<1). >+ */ >+ public static final int INSERT_ROW_ACTION_ENABLED = 1 << 1; >+ >+ /** >+ * Display mode constant for enabling the {@link DeleteRowAction} (value is 1<<2). >+ */ >+ public static final int DELETE_ROW_ACTION_ENABLED = 1 << 2; >+ >+ /** >+ * Display mode constant for enabling the {@link EditRowAction} (value is 1<<3). >+ */ >+ public static final int EDIT_ROW_ACTION_ENABLED = 1 << 3; >+ >+ /** >+ * Display mode constant for enabling the {@link InsertColumnAction} (value is 1<<4). >+ */ >+ public static final int INSERT_COLUMN_ACTION_ENABLED = 1 << 4; >+ >+ /** >+ * Display mode constant for enabling the {@link DeleteColumnAction} (value is 1<<5). >+ */ >+ public static final int DELETE_COLUMN_ACTION_ENABLED = 1 << 5; >+ >+ /** >+ * Display mode constant for enabling the {@link EditColumnAction} (value is 1<<6). >+ */ >+ public static final int EDIT_COLUMN_ACTION_ENABLED = 1 << 6; >+ >+ /** >+ * Display mode constant for enabling the cut {@link EditAction} (value is 1<<7). >+ */ >+ public static final int CUT_ACTION_ENABLED = 1 << 7; >+ >+ /** >+ * Display mode constant for enabling the copy {@link EditAction} (value is 1<<8). >+ */ >+ public static final int COPY_ACTION_ENABLED = 1 << 8; >+ >+ /** >+ * Display mode constant for enabling the paste {@link EditAction} (value is 1<<9). >+ */ >+ public static final int PASTE_ACTION_ENABLED = 1 << 9; > > public DatapoolMenuManager(DatapoolTable table, String vendorID, boolean showEquivalenceClassActions, boolean showVariableActions, boolean showRecordActions) { > if (table == null) return; >@@ -70,7 +124,7 @@ > > insertRowAction = new InsertRowAction(provider, table); > deleteRowAction = new DeleteRowAction(provider, table); >- //editRowAction = new EditRowAction(provider, table); >+ editRowAction = new EditRowAction(provider, table); > insertColumnAction = new InsertColumnAction(provider, table); > deleteColumnAction = new DeleteColumnAction(provider, table); > editColumnAction = new EditColumnAction(provider, table); >@@ -102,7 +156,7 @@ > if (showRowActions) { > menuMgr.add(insertRowAction); > menuMgr.add(deleteRowAction); >- //menuMgr.add(editRowAction); >+ menuMgr.add(editRowAction); > menuMgr.add(new Separator()); > } > if (showColumnActions) { >@@ -125,87 +179,28 @@ > } > } > >- public void setDisplayMode(int mode, boolean isCutCopyPasteable) { >- //- Enable find/replace action >- FindReplaceAction frAction = DatapoolActionHandlerListener.INSTANCE.getFindReplaceAction(); >- if (frAction != null) { >- frAction.setEnabled(true); >- } >- boolean showPaste = !DatapoolClipboard.getInstance().isEmpty(); >- // Based on the mode, enable certain menu items. >- switch (mode) { >- case 0: >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(true); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(false); >- editColumnAction.aboutToShow(false); >- cutAction.setEnabled(isCutCopyPasteable); >- copyAction.setEnabled(isCutCopyPasteable); >- pasteAction.setEnabled(showPaste && isCutCopyPasteable); >- break; >- case 1: >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(true); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(true); >- editColumnAction.aboutToShow(true); >- cutAction.setEnabled(true && isCutCopyPasteable); >- copyAction.setEnabled(true && isCutCopyPasteable); >- pasteAction.setEnabled(showPaste && isCutCopyPasteable); >- break; >- case 2: >- case 4: >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(false); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(false); >- editColumnAction.aboutToShow(false); >- cutAction.setEnabled(false && isCutCopyPasteable); >- copyAction.setEnabled(false && isCutCopyPasteable); >- pasteAction.setEnabled(false && isCutCopyPasteable); >- break; >- case 3: >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(false); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(true); >- editColumnAction.aboutToShow(false); >- cutAction.setEnabled(false && isCutCopyPasteable); >- copyAction.setEnabled(false && isCutCopyPasteable); >- pasteAction.setEnabled(false && isCutCopyPasteable); >- break; >- case 5: >- insertRowAction.aboutToShow(false); >- deleteRowAction.aboutToShow(false); >- insertColumnAction.aboutToShow(false); >- deleteColumnAction.aboutToShow(false); >- editColumnAction.aboutToShow(false); >- cutAction.setEnabled(false && isCutCopyPasteable); >- copyAction.setEnabled(true && isCutCopyPasteable); >- pasteAction.setEnabled(false && isCutCopyPasteable); >- break; >- case 6: >- //- Case of only one variable left in the equivalence class >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(true); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(false); >- editColumnAction.aboutToShow(true); >- cutAction.setEnabled(true && isCutCopyPasteable); >- copyAction.setEnabled(true && isCutCopyPasteable); >- pasteAction.setEnabled(showPaste && isCutCopyPasteable); >- break; >- default: >- insertRowAction.aboutToShow(true); >- deleteRowAction.aboutToShow(true); >- insertColumnAction.aboutToShow(true); >- deleteColumnAction.aboutToShow(true); >- editColumnAction.aboutToShow(true); >- cutAction.setEnabled(true && isCutCopyPasteable); >- copyAction.setEnabled(true && isCutCopyPasteable); >- pasteAction.setEnabled(false && isCutCopyPasteable); >- break; >- } >+ public void setDisplayMode(int displayMode) { >+ >+ //Enable find/replace action: >+ FindReplaceAction findReplaceAction = DatapoolActionHandlerListener.INSTANCE.getFindReplaceAction(); >+ >+ if (findReplaceAction != null) { >+ findReplaceAction.setEnabled(true); >+ } >+ >+ //Set the display modes for the row actions: >+ insertRowAction.aboutToShow((displayMode & INSERT_ROW_ACTION_ENABLED) != 0); >+ deleteRowAction.aboutToShow((displayMode & DELETE_ROW_ACTION_ENABLED) != 0); >+ editRowAction.aboutToShow((displayMode & EDIT_ROW_ACTION_ENABLED) != 0); >+ >+ //Set the display modes for the columns actions: >+ insertColumnAction.aboutToShow((displayMode & INSERT_COLUMN_ACTION_ENABLED) != 0); >+ deleteColumnAction.aboutToShow((displayMode & DELETE_COLUMN_ACTION_ENABLED) != 0); >+ editColumnAction.aboutToShow((displayMode & EDIT_COLUMN_ACTION_ENABLED) != 0); >+ >+ //Set the display modes for the edit actions: >+ cutAction.setEnabled((displayMode & CUT_ACTION_ENABLED) != 0); >+ copyAction.setEnabled((displayMode & COPY_ACTION_ENABLED) != 0); >+ pasteAction.setEnabled((displayMode & PASTE_ACTION_ENABLED) != 0); > } > } >Index: src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java,v >retrieving revision 1.48 >diff -u -r1.48 DatapoolTable.java >--- src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java 10 Apr 2008 01:45:35 -0000 1.48 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java 15 Apr 2008 13:30:06 -0000 >@@ -72,6 +72,7 @@ > import org.eclipse.swt.events.KeyListener; > import org.eclipse.swt.events.MenuEvent; > import org.eclipse.swt.events.MenuListener; >+import org.eclipse.swt.events.MouseAdapter; > import org.eclipse.swt.events.MouseEvent; > import org.eclipse.swt.events.MouseListener; > import org.eclipse.swt.events.PaintEvent; >@@ -111,7 +112,7 @@ > * > * @author Peter Sun > * @author Paul E. Slauenwhite >- * @version April 8, 2008 >+ * @version April 13, 2008 > * @since January 27, 2005 > */ > public class DatapoolTable implements IMenuListener, MenuListener, SelectionListener, IDatapoolListener { >@@ -862,7 +863,6 @@ > // No editing of equivalence class/record name; > if(newColumnSelectionIndex == 0) > { >- //editRowAux(row); > return; > } > >@@ -914,7 +914,7 @@ > } > } > >- class CursorMouseAdapter implements MouseListener >+ class CursorMouseAdapter extends MouseAdapter > { > private TableCursor cursor = null; > private IDatapoolPart datapoolPart = null; >@@ -924,36 +924,36 @@ > this.cursor = cursor; > this.datapoolPart = datapoolPart; > } >- >- // Double clicking in a cell creates an editor and begins editing >- // for that cell >- public void mouseDoubleClick(MouseEvent event) >- { >- if(equivalenceClass == null) >- return; >- datapoolPart.notifyEdit(); >- if(datapoolPart.isReadOnly()) >- return; >- TableItem row = this.cursor.getRow(); >- int column = this.cursor.getColumn(); >+ >+ public void mouseDown(MouseEvent event) { >+ >+ if(event.button == 1){ >+ >+ clearCellEditor(); >+ >+ if(equivalenceClass != null){ > >- // No editing of equivalence class/record name; >- if(column == 0) >- { >- //editRowAux(row); >- return; >- } >+ datapoolPart.notifyEdit(); >+ >+ if(!datapoolPart.isReadOnly()){ > >- startCellEditing(row, column); >- if(DatapoolTable.this.cellEditor != null) >- DatapoolTable.this.isF2Mode = true; >- } >- >- public void mouseDown(MouseEvent event) >- { >- if(event.button != 1) >- return; >- clearCellEditor(); >+ TableItem row = this.cursor.getRow(); >+ int column = this.cursor.getColumn(); >+ >+ if(column == 0){ >+ editRowAux(row); >+ } >+ else{ >+ >+ startCellEditing(row, column); >+ >+ if(DatapoolTable.this.cellEditor != null){ >+ DatapoolTable.this.isF2Mode = true; >+ } >+ } >+ } >+ } >+ } > } > > public void mouseUp(MouseEvent event) >@@ -1740,40 +1740,51 @@ > */ > private void setMenuMode(DatapoolMenuManager dpMenuManager) > { >- if(dpMenuManager == null) >- return; >+ if(dpMenuManager != null){ >+ >+ int displayMode = 0; >+ int recordCount = equivalenceClass.getRecordCount(); > >- int menuMode = 0; >- if(equivalenceClass == null) >- { >- menuMode = 5; >- } >- else >- { >- IDatapool datapool = getDatapool(); >- if (tableCursor != null && !tableCursor.isDisposed()) { >- if (tableCursor.getColumn() == 0) { >- menuMode = 0; >- } else if (datapool.getVariableCount() == 1) { >- menuMode = 6; >- } else { >- menuMode = 1; >- } >- } >- if(table.getSelectionIndex() == -1) >- menuMode = 2; >- //bugzillar#84838: if there's no records, should not allow to remove variables, since >- //user cannot select which variable to remove >- if(equivalenceClass.getRecordCount() == 0 ) >- menuMode = 4; >- if(datapoolEditorPart.isReadOnly()) >- menuMode = 5; >- } >+ if((!datapoolEditorPart.isReadOnly()) && (equivalenceClass != null)){ >+ >+ //Set the display modes for the row actions: >+ displayMode |= DatapoolMenuManager.INSERT_ROW_ACTION_ENABLED; >+ >+ if(recordCount > 0){ > >- boolean isCutCopyPasteable = false; >- if(!table.isDisposed() && table.getSelectionCount() > 0 && tableUtil.getColumnCount() > 1) >- isCutCopyPasteable = true; >- dpMenuManager.setDisplayMode(menuMode, isCutCopyPasteable); >+ displayMode |= DatapoolMenuManager.DELETE_ROW_ACTION_ENABLED; >+ >+ if(recordCount > 1){ >+ displayMode |= DatapoolMenuManager.EDIT_ROW_ACTION_ENABLED; >+ } >+ } >+ >+ //Set the display modes for the columns actions: >+ displayMode |= DatapoolMenuManager.INSERT_COLUMN_ACTION_ENABLED; >+ >+ if (((tableCursor != null) && (!tableCursor.isDisposed()) && (tableCursor.getColumn() > 0)) && (table.getSelectionIndex() > -1)) { >+ >+ if(getDatapool().getVariableCount() > 1){ >+ displayMode |= DatapoolMenuManager.DELETE_COLUMN_ACTION_ENABLED; >+ } >+ >+ displayMode |= DatapoolMenuManager.EDIT_COLUMN_ACTION_ENABLED; >+ } >+ } >+ >+ //Set the display modes for the copy edit action: >+ if((!table.isDisposed()) && (table.getSelectionCount() > 0) && (tableUtil.getColumnCount() > 1) && (recordCount > 0)){ >+ >+ displayMode |= DatapoolMenuManager.CUT_ACTION_ENABLED; >+ displayMode |= DatapoolMenuManager.COPY_ACTION_ENABLED; >+ >+ if(!DatapoolClipboard.getInstance().isEmpty()){ >+ displayMode |= DatapoolMenuManager.PASTE_ACTION_ENABLED; >+ } >+ } >+ >+ dpMenuManager.setDisplayMode(displayMode); >+ } > } > > /** >@@ -1843,12 +1854,9 @@ > */ > public void editRow() > { >- TableItem tableItem = null; >- if(tableCursor != null && !tableCursor.isDisposed()) >- tableItem = tableCursor.getRow(); >- else >- return; >- editRowAux(tableItem); >+ if((tableCursor != null) && (!tableCursor.isDisposed())){ >+ editRowAux(tableCursor.getRow()); >+ } > } > > /* >@@ -1856,34 +1864,48 @@ > */ > private void editRowAux(TableItem tableItem) > { >- if(showRecords == false) >- return; >- >- // can't move record if there's none or only 1 record. >- if(getEquivalenceClass().getRecordCount() < 2) >- return; >- >- int rowIndex = table.getSelectionIndex(); >- TableItem previousTableItem = null; >- if(rowIndex != 0) >- previousTableItem = table.getItem(rowIndex - 1); > >- IDatapool datapool = getDatapool(); >- DatapoolRowDialog dialog = new DatapoolRowDialog(Display.getCurrent().getActiveShell(), datapool, table, tableItem, previousTableItem, UiPluginResourceBundle.DATA_ROW_DLG_TITLE_EDIT, false); >- if (dialog.open() == IDialogConstants.OK_ID) >- { >- setWaitCursor(); >- IDatapoolRecord record = (IDatapoolRecord)tableItem.getData(TAG_RECORD); >- int recordIndex = getRecordIndex(equivalenceClass, record); >- int insertionRecordIndex = dialog.getInsertionRecordIndex(); >- if(recordIndex != insertionRecordIndex + 1) >- { >- if(insertionRecordIndex > recordIndex) >- equivalenceClass.moveRecord(recordIndex, insertionRecordIndex); >- else >- equivalenceClass.moveRecord(recordIndex, insertionRecordIndex + 1); >+ if((showRecords) && (getEquivalenceClass().getRecordCount() > 1)){ >+ >+ int rowIndex = table.getSelectionIndex(); >+ TableItem previousTableItem = null; >+ >+ if(rowIndex != 0){ >+ previousTableItem = table.getItem(rowIndex - 1); >+ } >+ >+ DatapoolRowDialog dialog = new DatapoolRowDialog(Display.getCurrent().getActiveShell(), getDatapool(), table, tableItem, previousTableItem, UiPluginResourceBundle.DATA_ROW_DLG_TITLE_EDIT, false); >+ >+ if (dialog.open() == IDialogConstants.OK_ID){ >+ >+ try{ >+ >+ setWaitCursor(); >+ >+ IDatapoolRecord record = ((IDatapoolRecord)(tableItem.getData(TAG_RECORD))); >+ int recordIndex = getRecordIndex(equivalenceClass, record); >+ int insertionRecordIndex = dialog.getInsertionRecordIndex(); >+ >+ if(recordIndex != insertionRecordIndex){ >+ >+ if (insertionRecordIndex == -1){ >+ equivalenceClass.moveRecord(recordIndex, 0); >+ } >+ else if (insertionRecordIndex > recordIndex){ >+ equivalenceClass.moveRecord(recordIndex, insertionRecordIndex); >+ } >+ else{ >+ equivalenceClass.moveRecord(recordIndex, insertionRecordIndex + 1); >+ } >+ } >+ } >+ catch(Exception e){ >+ e.printStackTrace(); >+ } >+ finally { >+ unsetWaitCursor(); >+ } > } >- unsetWaitCursor(); > } > } > >@@ -2186,14 +2208,14 @@ > if(!isCancelChange)//input the correct key > { > if (dialog.isEncrypted()) { >- if (!isVariableEncrypted) {//encrypted a varible which didn't encrypted >+ if (!isVariableEncrypted) {//encrypted a variable which didn't encrypted > DatapoolEncryptManager.encryptedCellInVarible(variable,key,datapool); > if(variable instanceof DPLVariable) > ((DPLVariable)variable).setEncrypted(true); > } > > } else { >- if (isVariableEncrypted) {//decrypted am encrypted variable >+ if (isVariableEncrypted) {//decrypt an encrypted variable > DatapoolEncryptManager.decryptedCellInVarible(variable,key,datapool); > if(variable instanceof DPLVariable) > ((DPLVariable)variable).setEncrypted(false);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 180280
: 96067