mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 23:55:26 +02:00
[203114] Usability improvements for file transfer mode prefs
This commit is contained in:
parent
38b0baf93b
commit
4976135552
2 changed files with 27 additions and 3 deletions
|
@ -172,7 +172,6 @@ public class UniversalPreferencePage
|
|||
resourceTypeTable.addListener(SWT.DefaultSelection, this);
|
||||
data = new GridData(GridData.FILL_BOTH);
|
||||
data.heightHint = resourceTypeTable.getItemHeight() * 12;
|
||||
data.widthHint = 200;
|
||||
data.grabExcessHorizontalSpace = true;
|
||||
resourceTypeTable.setLayoutData(data);
|
||||
|
||||
|
@ -407,20 +406,30 @@ public class UniversalPreferencePage
|
|||
tableLayout.addColumnData(layoutData);
|
||||
TableColumn tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 0);
|
||||
tableCol.setResizable(false);
|
||||
tableCol.pack();
|
||||
tableCol.setWidth(20);
|
||||
tableCol.setText(""); //$NON-NLS-1$
|
||||
|
||||
|
||||
layoutData = new ColumnWeightData(40, true);
|
||||
tableLayout.addColumnData(layoutData);
|
||||
tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 1);
|
||||
tableCol.setResizable(true);
|
||||
tableCol.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_TABLECOL_LABEL);
|
||||
tableCol.pack();
|
||||
tableCol.setWidth(100);
|
||||
|
||||
|
||||
layoutData = new ColumnWeightData(60, true);
|
||||
tableLayout.addColumnData(layoutData);
|
||||
tableCol = new TableColumn(resourceTypeTable, SWT.NONE, 2);
|
||||
tableCol.setResizable(true);
|
||||
tableCol.setText(FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_LABEL);
|
||||
|
||||
tableCol.pack();
|
||||
tableCol.setWidth(200);
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = new String[2];
|
||||
contentTypes[0] = FileResources.RESID_PREF_UNIVERSAL_FILES_FILETYPES_MODE_BINARY_LABEL;
|
||||
|
@ -471,6 +480,7 @@ public class UniversalPreferencePage
|
|||
protected void resetResourceTypeTable()
|
||||
{
|
||||
//clear table and reload defaults
|
||||
modeRegistry.renit();
|
||||
modeMappings.clear();
|
||||
resourceTypeTable.setRedraw(false);
|
||||
resourceTypeTable.removeAll();
|
||||
|
@ -482,7 +492,7 @@ public class UniversalPreferencePage
|
|||
}
|
||||
resourceTypeTable.setRedraw(true);
|
||||
|
||||
int defaultFileTransferMode = getFileTransferModeDefaultPreference();
|
||||
int defaultFileTransferMode = ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE;
|
||||
defaultBinaryButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY);
|
||||
defaultTextButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT);
|
||||
|
||||
|
@ -809,7 +819,7 @@ public class UniversalPreferencePage
|
|||
*/
|
||||
public static int getFileTransferModeDefaultPreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getInt(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,14 @@ public class SystemFileTransferModeRegistry implements ISystemFileTransferModeRe
|
|||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete's the existing file associations and reinitializes with defaults
|
||||
*/
|
||||
public void renit()
|
||||
{
|
||||
deleteAssociations();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the registry from storage.
|
||||
|
@ -489,6 +497,12 @@ public class SystemFileTransferModeRegistry implements ISystemFileTransferModeRe
|
|||
return result;
|
||||
}
|
||||
|
||||
private void deleteAssociations()
|
||||
{
|
||||
String location = getFileLocation();
|
||||
File assFile = new File(location);
|
||||
assFile.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the contents of the registry
|
||||
|
|
Loading…
Add table
Reference in a new issue