Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
284 | 2 | 0 | 1.000 | class_body |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 284 | 33 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/EclipsePreferencesAdapter.java |
2 | 284 | 318 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java |
| ||||
{ /** * Preference change listener. Listens for events preferences * fires a {@link org.eclipse.jface.util.PropertyChangeEvent} * on this adapter with arguments from the received event. */ private class PreferenceChangeListener implements IEclipsePreferences.IPreferenceChangeListener { /** * {@inheritDoc} */ public void preferenceChange( final IEclipsePreferences.PreferenceChangeEvent event) { if (Display.getCurrent() == null) { Display.getDefault().asyncExec(new Runnable() { public void run() { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } ); } else { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } } /** Listeners on on this adapter */ private ListenerList fListeners = new ListenerList(ListenerList.IDENTITY); /** Listener on the node */ private IEclipsePreferences.IPreferenceChangeListener fListener = new PreferenceChangeListener(); /** wrapped node */ private final IScopeContext fContext; private final String fQualifier; /** * Initialize with the node to wrap * * @param context The context to access */ public EclipsePreferencesAdapter(IScopeContext context, String qualifier) { fContext = context; fQualifier = qualifier; } private IEclipsePreferences getNode() { return fContext.getNode(fQualifier); } /** * {@inheritDoc} */ public void addPropertyChangeListener(IPropertyChangeListener listener) { if (fListeners.size() == 0) getNode().addPreferenceChangeListener(fListener); fListeners.add(listener); } /** * {@inheritDoc} */ public void removePropertyChangeListener(IPropertyChangeListener listener) { fListeners.remove(listener); if (fListeners.size() == 0) { getNode().removePreferenceChangeListener(fListener); } } /** * {@inheritDoc} */ public boolean contains(String name) { return getNode().get(name, null) != null; } /** * {@inheritDoc} */ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); Object[] listeners = fListeners.getListeners(); for (int i = 0; i < listeners.length; i++) ((IPropertyChangeListener) listeners[i]).propertyChange(event); } /** * {@inheritDoc} */ public boolean getBoolean(String name) { return getNode().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public boolean getDefaultBoolean(String name) { return BOOLEAN_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public double getDefaultDouble(String name) { return DOUBLE_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public float getDefaultFloat(String name) { return FLOAT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public int getDefaultInt(String name) { return INT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public long getDefaultLong(String name) { return LONG_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public String getDefaultString(String name) { return STRING_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public float getFloat(String name) { return getNode().getFloat(name, FLOAT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public int getInt(String name) { return getNode().getInt(name, INT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public long getLong(String name) { return getNode().getLong(name, LONG_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public String getString(String name) { return getNode().get(name, STRING_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public boolean isDefault(String name) { return false; } /** * {@inheritDoc} */ public boolean needsSaving() { try { return getNode().keys().length > 0; } catch (BackingStoreException e) { // ignore } return true; } /** * {@inheritDoc} */ public void putValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, String defaultObject) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, boolean value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setToDefault(String name) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, boolean value) { throw new UnsupportedOperationException(); } } |
| ||||
{ /** * Preference change listener. Listens for events preferences * fires a {@link org.eclipse.jface.util.PropertyChangeEvent} * on this adapter with arguments from the received event. */ private class PreferenceChangeListener implements IEclipsePreferences.IPreferenceChangeListener { /** * {@inheritDoc} */ public void preferenceChange( final IEclipsePreferences.PreferenceChangeEvent event) { if (Display.getCurrent() == null) { Display.getDefault().asyncExec(new Runnable() { public void run() { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } ); } else { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } } /** Listeners on on this adapter */ private ListenerList fListeners = new ListenerList(ListenerList.IDENTITY); /** Listener on the node */ private IEclipsePreferences.IPreferenceChangeListener fListener = new PreferenceChangeListener(); /** wrapped node */ private final IScopeContext fContext; private final String fQualifier; /** * Initialize with the node to wrap * * @param context The context to access */ public EclipsePreferencesAdapter(IScopeContext context, String qualifier) { fContext = context; fQualifier = qualifier; } private IEclipsePreferences getNode() { return fContext.getNode(fQualifier); } /** * {@inheritDoc} */ public void addPropertyChangeListener(IPropertyChangeListener listener) { if (fListeners.size() == 0) getNode().addPreferenceChangeListener(fListener); fListeners.add(listener); } /** * {@inheritDoc} */ public void removePropertyChangeListener(IPropertyChangeListener listener) { fListeners.remove(listener); if (fListeners.size() == 0) { getNode().removePreferenceChangeListener(fListener); } } /** * {@inheritDoc} */ public boolean contains(String name) { return getNode().get(name, null) != null; } /** * {@inheritDoc} */ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); Object[] listeners = fListeners.getListeners(); for (int i = 0; i < listeners.length; i++) ((IPropertyChangeListener) listeners[i]).propertyChange(event); } /** * {@inheritDoc} */ public boolean getBoolean(String name) { return getNode().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public boolean getDefaultBoolean(String name) { return BOOLEAN_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public double getDefaultDouble(String name) { return DOUBLE_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public float getDefaultFloat(String name) { return FLOAT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public int getDefaultInt(String name) { return INT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public long getDefaultLong(String name) { return LONG_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public String getDefaultString(String name) { return STRING_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public float getFloat(String name) { return getNode().getFloat(name, FLOAT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public int getInt(String name) { return getNode().getInt(name, INT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public long getLong(String name) { return getNode().getLong(name, LONG_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public String getString(String name) { return getNode().get(name, STRING_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ public boolean isDefault(String name) { return false; } /** * {@inheritDoc} */ public boolean needsSaving() { try { return getNode().keys().length > 0; } catch (BackingStoreException e) { // ignore } return true; } /** * {@inheritDoc} */ public void putValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, String defaultObject) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setDefault(String name, boolean value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setToDefault(String name) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ public void setValue(String name, boolean value) { throw new UnsupportedOperationException(); } } |
| |||
{ /** * Preference change listener. Listens for events preferences * fires a {@link org.eclipse.jface.util.PropertyChangeEvent} * on this adapter with arguments from the received event. */ /** * Preference change listener. Listens for events preferences * fires a {@link org.eclipse.jface.util.PropertyChangeEvent} * on this adapter with arguments from the received event. */ private class PreferenceChangeListener implements IEclipsePreferences.IPreferenceChangeListener { /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void preferenceChange( final IEclipsePreferences.PreferenceChangeEvent event) { if (Display.getCurrent() == null) { Display.getDefault().asyncExec(new Runnable() { public void run() { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } ); } else { firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); } } } /** Listeners on on this adapter */ private ListenerList fListeners = new ListenerList(ListenerList.IDENTITY); /** Listener on the node */ private IEclipsePreferences.IPreferenceChangeListener fListener = new PreferenceChangeListener(); /** wrapped node */ private final IScopeContext fContext; private final String fQualifier; /** * Initialize with the node to wrap * * @param context The context to access */ /** * Initialize with the node to wrap * * @param context The context to access */ public EclipsePreferencesAdapter(IScopeContext context, String qualifier) { fContext = context; fQualifier = qualifier; } private IEclipsePreferences getNode() { return fContext.getNode(fQualifier); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void addPropertyChangeListener(IPropertyChangeListener listener) { if (fListeners.size() == 0) getNode().addPreferenceChangeListener(fListener); fListeners.add(listener); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void removePropertyChangeListener(IPropertyChangeListener listener) { fListeners.remove(listener); if (fListeners.size() == 0) { getNode().removePreferenceChangeListener(fListener); } } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public boolean contains(String name) { return getNode().get(name, null) != null; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); Object[] listeners = fListeners.getListeners(); for (int i = 0; i < listeners.length; i++) ((IPropertyChangeListener) listeners[i]).propertyChange(event); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public boolean getBoolean(String name) { return getNode().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public boolean getDefaultBoolean(String name) { return BOOLEAN_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public double getDefaultDouble(String name) { return DOUBLE_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public float getDefaultFloat(String name) { return FLOAT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public int getDefaultInt(String name) { return INT_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public long getDefaultLong(String name) { return LONG_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public String getDefaultString(String name) { return STRING_DEFAULT_DEFAULT; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public float getFloat(String name) { return getNode().getFloat(name, FLOAT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public int getInt(String name) { return getNode().getInt(name, INT_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public long getLong(String name) { return getNode().getLong(name, LONG_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public String getString(String name) { return getNode().get(name, STRING_DEFAULT_DEFAULT); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public boolean isDefault(String name) { return false; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public boolean needsSaving() { try { return getNode().keys().length > 0; } catch (BackingStoreException e) { // ignore } return true; } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void putValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, String defaultObject) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setDefault(String name, boolean value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setToDefault(String name) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, double value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, float value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, int value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, long value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, String value) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} */ /** * {@inheritDoc} */ public void setValue(String name, boolean value) { throw new UnsupportedOperationException(); } } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
None |