public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TefkatPlugin.URIMAP_PREFERENCE)) { if (null != event.getOldValue()) { List list = TefkatPlugin.convertFromString((String) event.getOldValue()); for (final Iterator itr = list.iterator(); itr.hasNext(); ) { URIMap map = (URIMap) itr.next(); if (map.enabled) { URI uri = URI.createURI(map.source); URIConverter.URI_MAP.remove(uri); } } } if (null != event.getNewValue()) { List list = TefkatPlugin.convertFromString((String) event.getNewValue()); for (final Iterator itr = list.iterator(); itr.hasNext(); ) { URIMap map = (URIMap) itr.next(); if (map.enabled) { URI sourceUri = URI.createURI(map.source); URI targetUri = URI.createURI(map.target); URIConverter.URI_MAP.put(sourceUri, targetUri); } } } } }
protected Control createContents(Composite parent) { noDefaultAndApplyButton(); setDescription( "Enabled entries in the mapping table below will be used to convert Resource URIs into actual URI locations (eg URLs)"); // setMessage("Enabled entries in the mapping table below will be used to convert // Resource URIs into actual URI locations (eg URLs)"); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_BOTH); parent.setLayoutData(gridData); // Set numColumns to 2 for the buttons GridLayout layout = new GridLayout(2, false); layout.marginWidth = 4; parent.setLayout(layout); // Create the table createTable(parent); // Create and setup the TableViewer createTableViewer(); tableViewer.setContentProvider(new MapListContentProvider()); tableViewer.setLabelProvider(new MapListLabelProvider()); mapList .getMaps() .addAll( TefkatPlugin.convertFromString( getPreferenceStore().getString(TefkatPlugin.URIMAP_PREFERENCE))); tableViewer.setInput(mapList); createButtons(parent); return null; }
public boolean performOk() { boolean result = super.performOk(); if (result) { String value = TefkatPlugin.convertToString(mapList.getMaps()); getPreferenceStore().setValue(TefkatPlugin.URIMAP_PREFERENCE, value); } return result; }
public void init(IWorkbench workbench) { setPreferenceStore(TefkatPlugin.getPlugin().getPreferenceStore()); getPreferenceStore().addPropertyChangeListener(preferenceListener); }