auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int compareMajor(RepositoryVersion other) { if (this.major != null && other.major == null) { return 1; } else { if (this.major == null && other.major != null) { return -1; } else { if (this.major == null && other.major == null) { return 0; } else { return this.major - other.major; } } } }

Target:
protected int compareMajor(RepositoryVersion other) { if (this.major != null && other.major == null) { return 1; } else { if (this.major == null && other.major != null) { return -1; } else { if (this.major == null && other.major == null) { return 0; } else { return this.major - other.major; } } } }
Source:
protected static Collection<IResourceSetHook> getMatchingHooks( ResourceSetHookRegistry resourceSetHookRegistry, final Collection<URI> urisToLoad) { final Collection<IResourceSetHook> hooks; if (resourceSetHookRegistry == null) { hooks = Collections.emptyList(); } else { hooks = Collections2.filter(resourceSetHookRegistry.getResourceSetHooks(), new Predicate<IResourceSetHook>() { public boolean apply(IResourceSetHook input) { return input.isHookFor(urisToLoad); } }); } return hooks; }

Target:
private static Collection<IResourceSetHook> getMatchingHooks( ResourceSetHookRegistry resourceSetHookRegistry, final Collection<URI> urisToLoad) { final Collection<IResourceSetHook> hooks; if (resourceSetHookRegistry == null) { hooks = Collections.emptyList(); } else { hooks = Collections2.filter(resourceSetHookRegistry.getResourceSetHooks(), new Predicate<IResourceSetHook>() { public boolean apply(IResourceSetHook input) { return input.isHookFor(urisToLoad); } }); } return hooks; }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (object instanceof NullStateValue){ return -1; } return 1; }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null || object instanceof NullStateValue) { return 0; } /* * We assume that every non-null state value is greater than any null * state value. */ return -1; }
Source:
public MPartStack createStack(String id, boolean visible) { MPartStack newStack = modelService.createModelElement(MPartStack.class); // temporary HACK for bug 303982 newStack.getTags().add("newtablook"); //$NON-NLS-1$ newStack.setElementId(id); newStack.setToBeRendered(visible); return newStack; }

Target:
private MPartStack createStack(String id, boolean visible) { MPartStack newStack = modelService.createModelElement(MPartStack.class); // temporary HACK for bug 303982 newStack.getTags().add("newtablook"); //$NON-NLS-1$ newStack.setElementId(id); newStack.setToBeRendered(visible); return newStack; }
Source:
public ChainingCredentialsProvider(CredentialsProvider... providers) { this.credentialProviders = new LinkedList<CredentialsProvider>(); for (CredentialsProvider p : providers) credentialProviders.add(p); }

Target:
public ChainingCredentialsProvider(CredentialsProvider... providers) { this.credentialProviders = new ArrayList<CredentialsProvider>( Arrays.asList(providers)); for (CredentialsProvider p : providers) credentialProviders.add(p); }
Source:
public void testCreateArtifactsEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); RoughArtifact roughParent = new RoughArtifact(RoughArtifactKind.CONTAINER); RoughArtifactCollector collector = new RoughArtifactCollector(roughParent); dtc.createArtifacts(collector); // exception because there is no data Assert.fail(); }

Target:
public void testCreateArtifactsEmpty() { RoughArtifact roughParent = new RoughArtifact(RoughArtifactKind.CONTAINER); RoughArtifactCollector collector = new RoughArtifactCollector(roughParent); dtc.createArtifacts(collector); // exception because there is no data }
Source:
public static synchronized DoorsColumnType fromString(String value) { // special case since Verification Criteria column heading varies by program if (value.contains("Verification Criteria")) { value = "Verification Criteria"; } if (rawStringToDataType.isEmpty()) { for (DoorsColumnType enumStatus : DoorsColumnType.values()) { DoorsColumnType.rawStringToDataType.put(enumStatus.columnType, enumStatus); } } DoorsColumnType returnVal = rawStringToDataType.get(value); return returnVal != null ? returnVal : OTHER; }

Target:
public static DoorsColumnType fromString(String value) { // special case since Verification Criteria column heading varies by program if (value.contains("Verification Criteria")) { value = "Verification Criteria"; } DoorsColumnType returnVal = rawStringToDataType.get(value); return returnVal != null ? returnVal : OTHER; }
Source:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); this.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new SiriusPopupBarEditPolicy()); // Replace the feedback policy to have a lighter color for guides removeEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE); installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusSnapFeedbackPolicy()); }

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); this.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new SiriusPopupBarEditPolicy()); // Replace the feedback policy to have a lighter color for guides installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusSnapFeedbackPolicy()); }
Source:
public static boolean isEqualToDefault(EObject object, EStructuralFeature feature) { final Object value = ReferenceUtil.safeEGet(object, feature); final Object defaultValue = feature.getDefaultValue(); if (value == null) { return defaultValue == null; } return value.equals(feature.getDefaultValue()) || "".equals(value); //$NON-NLS-1$ }

Target:
private static boolean isEqualToDefault(EObject object, EStructuralFeature feature) { final Object value = ReferenceUtil.safeEGet(object, feature); final Object defaultValue = feature.getDefaultValue(); if (value == null) { return defaultValue == null; } return value.equals(feature.getDefaultValue()) || "".equals(value); //$NON-NLS-1$ }
Source:
public static void applyHyperlinkDetectorStyleRanges( ITextViewer textViewer, IHyperlinkDetector[] hyperlinkDetectors) { StyleRange[] styleRanges = getHyperlinkDetectorStyleRanges(textViewer, hyperlinkDetectors); StyledText styledText = textViewer.getTextWidget(); // Apply hyperlink style ranges one by one. setStyleRange takes care to // do the right thing in case they overlap with an existing style range. for (StyleRange styleRange : styleRanges) { styledText.setStyleRange(styleRange); } }

Target:
public static void applyHyperlinkDetectorStyleRanges( ITextViewer textViewer, IHyperlinkDetector[] hyperlinkDetectors) { StyleRange[] styleRanges = getHyperlinkDetectorStyleRanges(textViewer, hyperlinkDetectors); StyledText styledText = textViewer.getTextWidget(); // Apply hyperlink style ranges one by one. setStyleRange takes care to // do the right thing in case they overlap with an existing style range. for (StyleRange styleRange : styleRanges) styledText.setStyleRange(styleRange); }
Source:
public void run() { for (TimeGraphEntry entry : fZoomEntryList) { if (fMonitor.isCanceled()) { return; } if (entry == null) { break; } zoom(entry, fMonitor); } /* Refresh the arrows when zooming */ List<ILinkEvent> events = getLinkList(fZoomStartTime, fZoomEndTime, fResolution, fMonitor); fTimeGraphWrapper.getTimeGraphViewer().setLinks(events); redraw(); }

Target:
public void run() { for (TimeGraphEntry entry : fZoomEntryList) { if (fMonitor.isCanceled()) { return; } if (entry == null) { break; } zoom(entry, fMonitor); } /* Refresh the arrows when zooming */ List<ILinkEvent> events = getLinkList(fZoomStartTime, fZoomEndTime, fResolution, fMonitor); if (events != null) { fTimeGraphWrapper.getTimeGraphViewer().setLinks(events); redraw(); } }
Source:
public static boolean isBundleClassUri(String uri) { if (uri != null && uri.startsWith(BUNDLECLASS_SCHEMA)) { String[] split = uri.substring(14).split("/"); //$NON-NLS-1$ // valid bundleclass uri should have two segments: // first one for the bundle-symbolic-name // second one for the full qualified classname if (split.length == 2) { return true; } ; } return false; }

Target:
public static boolean isBundleClassUri(String uri) { if (uri != null && uri.startsWith(BUNDLECLASS_SCHEMA)) { String[] split = uri.substring(BUNDLECLASS_SCHEMA.length()).split("/"); //$NON-NLS-1$ // valid bundleclass uri should have two segments: // first one for the bundle-symbolic-name // second one for the full qualified classname if (split.length == 2) { return true; } } return false; }
Source:
public synchronized SynchronizationAlgorithm synchronizeTraces() { return synchronizeTraces(false); }

Target:
public SynchronizationAlgorithm synchronizeTraces() { return synchronizeTraces(false); }
Source:
private boolean isInteresting(ThreadInfo thread) { for (StackTraceElement element : thread.getStackTrace()) { String className = element.getClassName(); if (!className.startsWith("java.") && !className.startsWith("sun.") && //$NON-NLS-1$ //$NON-NLS-2$ !NON_INTERESTING_THREAD_FILTER.matchesFilter(element)) { return true; } } return false; }

Target:
private boolean isInteresting(ThreadInfo thread) { for (StackTraceElement element : thread.getStackTrace()) { if (!NON_INTERESTING_THREAD_FILTER.matchesFilter(element)) { return true; } } return false; }
Source:
public static ImageFigureWithAlpha createImageFigure(final ContainerStyle containerStyle) { if (containerStyle instanceof FlatContainerStyle) { FlatContainerStyle style = (FlatContainerStyle) containerStyle; SVGWorkspaceImageFigure fig = new SVGWorkspaceImageFigure(); fig.refreshFigure(style); return fig; } // TODO handle other styles.. return null; }

Target:
public static SVGWorkspaceImageFigure createImageFigure(final ContainerStyle containerStyle) { if (containerStyle instanceof FlatContainerStyle) { FlatContainerStyle style = (FlatContainerStyle) containerStyle; SVGWorkspaceImageFigure fig = new SVGWorkspaceImageFigure(); fig.refreshFigure(style); return fig; } // TODO handle other styles.. return null; }
Source:
public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null) { ImageResourceDeltaVisitor visitor = getImageResourceDeltaVisitor(); try { delta.accept(visitor); } catch (CoreException e) { e.printStackTrace(); } for (String imageFileURI : visitor.changedImageFilesURI) { DiagramUIPlugin.getPlugin().removeImageFileStatusAndURIFromMaps(imageFileURI); } } }

Target:
public void resourceChanged(IResourceChangeEvent event) { // Do nothing. }
Source:
public void trailingSlashes() { assertEquals("/foo/bar/", ServletUtils.getEncodedPathInfo("/s", "/c/s/foo/bar/", "/c")); assertEquals("/foo/bar/", ServletUtils.getEncodedPathInfo("/s", "/c/s/foo/bar///", "/c")); assertEquals("/foo%2Fbar/", ServletUtils.getEncodedPathInfo("/s", "/c/s/foo%2Fbar/", "/c")); assertEquals("/foo%2Fbar/", ServletUtils.getEncodedPathInfo("/s", "/c/s/foo%2Fbar///", "/c")); }

Target:
public void trailingSlashes() { assertEquals("/foo/bar/", ServletUtils.getEncodedPathInfo("/c", "/s", "/c/s/foo/bar/")); assertEquals("/foo/bar/", ServletUtils.getEncodedPathInfo("/c", "/s", "/c/s/foo/bar///")); assertEquals("/foo%2Fbar/", ServletUtils.getEncodedPathInfo("/c", "/s", "/c/s/foo%2Fbar/")); assertEquals("/foo%2Fbar/", ServletUtils.getEncodedPathInfo("/c", "/s", "/c/s/foo%2Fbar///")); }
Source:
private TextTraceEventContent(@NonNull String fieldName) { fName = fieldName; fValue = null; fFields = NonNullUtils.checkNotNull(Collections.EMPTY_LIST); }

Target:
private TextTraceEventContent(@NonNull String fieldName) { fName = fieldName; fValue = null; fFields = checkNotNull(Collections.EMPTY_LIST); }
Source:
public String resolve(ITmfEvent event) { if (!(event instanceof PcapEvent)) { return EMPTY_STRING; } PcapEvent pcapEvent = (PcapEvent) event; TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol(); return NonNullUtils.checkNotNull(protocol.getShortName().toUpperCase()); }

Target:
public String resolve(ITmfEvent event) { if (!(event instanceof PcapEvent)) { return EMPTY_STRING; } PcapEvent pcapEvent = (PcapEvent) event; TmfPcapProtocol protocol = pcapEvent.getMostEncapsulatedProtocol(); return checkNotNull(protocol.getShortName().toUpperCase()); }
Source:
public EObject createObject(EFactory eFactory, EClassifier type) { EFactory factory = eFactory; if (migrationNeeded) { // Handle EClass moved from one package to another, // prefix is not sufficient to retrieve the new package and factory // in // org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(String) // which does factory = // ePackage.getEFactoryInstance(); // The migration participants return the new type with EClassifier // getType(EPackage, String, String). // Then we get the factory instance from the EClassifier's EPackage. if (type != null && type.getEPackage() != null && type.getEPackage().getEFactoryInstance() != null) { factory = type.getEPackage().getEFactoryInstance(); } } EObject newObject = super.createObject(factory, type); if (migrationNeeded) { newObject = RepresentationsFileMigrationService.getInstance().updateCreatedObject(newObject, version); } return newObject; }

Target:
public EObject createObject(EFactory eFactory, EClassifier type) { EFactory factory = eFactory; if (migrationNeeded) { // Handle EClass moved from one package to another, // prefix is not sufficient to retrieve the new package and factory // in // org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(String) // which does factory = // ePackage.getEFactoryInstance(); // The migration participants return the new type with EClassifier // getType(EPackage, String, String). // Then we get the factory instance from the EClassifier's EPackage. if (type != null && type.getEPackage() != null && type.getEPackage().getEFactoryInstance() != null) { factory = type.getEPackage().getEFactoryInstance(); } } return super.createObject(factory, type); }
Source:
public AbstractTmfStateProvider(ITmfTrace trace, Class<? extends ITmfEvent> eventType, String id) { this.fTrace = trace; this.fEventType = eventType; fEventsQueue = new ArrayBlockingQueue<>(DEFAULT_EVENTS_QUEUE_SIZE); fStateSystemAssigned = false; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); //$NON-NLS-1$ }

Target:
public AbstractTmfStateProvider(ITmfTrace trace, Class<? extends ITmfEvent> eventType, String id) { fTrace = trace; fEventType = eventType; fEventsQueue = new ArrayBlockingQueue<>(DEFAULT_EVENTS_QUEUE_SIZE); fStateSystemAssigned = false; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); //$NON-NLS-1$ }
Source:
public void resolveProxyCrossReferences(Resource resource) { if (!initialized) { initialize(); } adapter.resolveProxyCrossReferences(resource); }

Target:
public void resolveProxyCrossReferences(Resource resource) { if (initialized) { // The resolution of proxy is called only is the cross-referencer // has already been initialized. adapter.resolveProxyCrossReferences(resource); } }
Source:
private static void logCorruptPackError(IOException e, PackFile p) { StringBuilder buf = new StringBuilder(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile().getAbsolutePath())); buf.append('\n'); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); buf.append(sw.toString()); System.err.println(buf.toString()); }

Target:
private static void logCorruptPackError(IOException e, PackFile p) { StringBuilder buf = new StringBuilder(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile().getAbsolutePath())); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); buf.append('\n'); buf.append(sw.toString()); // TODO instead of syserr we should use a logging framework System.err.println(buf.toString()); }
Source:
protected ContentHandler createContentHandler(DocumentBuilder builder, boolean asDocument) { if (!asDocument && builder instanceof HtmlDocumentBuilder) { ((HtmlDocumentBuilder) builder).setEmitAsDocument(false); } return new DocumentBuilderAdapter(builder); }

Target:
protected ContentHandler createContentHandler(DocumentBuilder builder, boolean asDocument) { if (builder instanceof HtmlDocumentBuilder) { ((HtmlDocumentBuilder) builder).setEmitAsDocument(asDocument); } return new DocumentBuilderAdapter(builder); }
Source:
protected void updateComboTooltip() { // fBuildConfigCombo might not be loaded when controls are created if (fBuildConfigCombo != null && fBuildConfigCombo.getSelectionIndex() > 0) { String configId = (String) fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())); String tooltip = EMPTY_STRING; if (configId.equals(AUTO_CONFIG)) { tooltip = LaunchMessages.CMainTab_Build_Config_Auto_tooltip; } else if (configId.equals(EMPTY_STRING)) { tooltip = LaunchMessages.CMainTab_Build_Config_Active_tooltip; } fBuildConfigCombo.setToolTipText(tooltip); } }

Target:
protected void updateComboTooltip() { if (fBuildConfigCombo != null) { // fBuildConfigCombo might not be loaded when controls are created String configId = (String) fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())); String tooltip = EMPTY_STRING; if (configId != null) { if (configId.equals(AUTO_CONFIG)) { tooltip = LaunchMessages.CMainTab_Build_Config_Auto_tooltip; } else if (configId.equals(EMPTY_STRING)) { tooltip = LaunchMessages.CMainTab_Build_Config_Active_tooltip; } } fBuildConfigCombo.setToolTipText(tooltip); } }
Source:
public void setFastViewBarVisible(boolean visible) { boolean oldValue = fastViewBarVisible; fastViewBarVisible = visible; if (oldValue != fastViewBarVisible) { } }

Target:
public void setFastViewBarVisible(boolean visible) { // not supported anymore }
Source:
private static List<Variable> removeDuplicates(List<Variable> typeMatches) { HashSet<Variable> set = new HashSet<Variable>(); set.addAll(typeMatches); return Arrays.asList(set.toArray(new Variable[set.size()])); }

Target:
private static List<Variable> removeDuplicates(List<Variable> typeMatches) { HashSet<Variable> set = new HashSet<>(); set.addAll(typeMatches); return Arrays.asList(set.toArray(new Variable[set.size()])); }
Source:
public List<Object> prepend(List<Object> list, Object object) { // TODO use lazy collection final List<Object> result = Lists.newArrayList(); result.add(object); result.addAll(list); return result; }

Target:
public List<Object> prepend(List<Object> list, Object object) { // TODO use lazy collection final List<Object> result = new ArrayList<Object>(list.size() + 1); result.add(object); result.addAll(list); return result; }
Source:
private String initialConnectionName() throws CoreException { String name = DEFAULT_CONNECTION_NAME; int count = 1; while (getSelectedConnectionType().getConnection(name) != null) { name = DEFAULT_CONNECTION_NAME + " " + count++; //$NON-NLS-1$ } return name; }

Target:
private String initialConnectionName() { String name = DEFAULT_CONNECTION_NAME; int count = 1; while (getSelectedConnectionType().getConnection(name) != null) { name = DEFAULT_CONNECTION_NAME + " " + count++; //$NON-NLS-1$ } return name; }
Source:
private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); if (accessorFactory != null && accessorFactory instanceof IModelUpdateStrategyProvider) { ret = (IModelUpdateStrategyProvider)accessorFactory; } else { // if we have no model update strategy provider, we use the following one by default, which will // always provide the tolerant SingleValuedAttributeModelUpdateStrategy ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }

Target:
private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); if (accessorFactory instanceof IModelUpdateStrategyProvider) { ret = (IModelUpdateStrategyProvider)accessorFactory; } else { ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }
Source:
protected void linkClicked(EObject value) { getViewModelContext().getService(ReferenceService.class).openInNewContext(value); }

Target:
private void linkClicked(EObject value) { getViewModelContext().getService(ReferenceService.class).openInNewContext(value); }
Source:
protected final Color getSystemColor(Composite parent, int color) { if (parent == null) { return Display.getDefault().getSystemColor(color); } return parent.getShell().getDisplay().getSystemColor(color); }

Target:
private final Color getSystemColor(Composite parent, int color) { if (parent == null) { return Display.getDefault().getSystemColor(color); } return parent.getShell().getDisplay().getSystemColor(color); }
Source:
public void setTimeBounds(long beginTime, long endTime) { fBeginTime = beginTime; fEndTime = endTime; fTime0Bound = fBeginTime != SWT.DEFAULT ? fBeginTime : fEndTime; fTime1Bound = fEndTime != SWT.DEFAULT ? fEndTime : fBeginTime; if (fTime0Bound > fTime1Bound) { // only possible if both are not default fBeginTime = endTime; fEndTime = beginTime; fTime0Bound = fBeginTime; fTime1Bound = fEndTime; } adjustHorizontalScrollBar(); }

Target:
public void setTimeBounds(long beginTime, long endTime) { fBeginTime = beginTime; fEndTime = endTime; fTime0Bound = (fBeginTime != SWT.DEFAULT ? fBeginTime : fEndTime); fTime1Bound = (fEndTime != SWT.DEFAULT ? fEndTime : fBeginTime); if (fTime0Bound > fTime1Bound) { // only possible if both are not default fBeginTime = endTime; fEndTime = beginTime; fTime0Bound = fBeginTime; fTime1Bound = fEndTime; } adjustHorizontalScrollBar(); }
Source:
public void statusesChanged(Collection<ResourceStatusChange> changes) { /* this may be call in a async thread */ if (session != null) { if (SessionStatus.SYNC.equals(session.getStatus())) { marker = null; } } }

Target:
public void statusesChanged(Collection<ResourceStatusChange> changes) { /* this may be call in a async thread */ if (session != null) { if (SessionStatus.SYNC == session.getStatus()) { marker = null; } } }
Source:
protected String createHttpRequestURL() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) && token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { //$NON-NLS-1$ bugUrl += "&"; //$NON-NLS-1$ } bugUrl += "token=" + token.getToken(); //$NON-NLS-1$ } return baseUrl() + bugUrl; }

Target:
protected String createHttpRequestURL() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if (token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { //$NON-NLS-1$ bugUrl += "&"; //$NON-NLS-1$ } bugUrl += "token=" + token.getToken(); //$NON-NLS-1$ } return baseUrl() + bugUrl; }
Source:
public static void configureFetchNotes(RemoteConfig remoteConfig) { String notesRef = Constants.R_NOTES + "*"; //$NON-NLS-1$ List<RefSpec> fetchRefSpecs = remoteConfig.getFetchRefSpecs(); for (RefSpec refSpec : fetchRefSpecs) { if (refSpec.matchSource(notesRef)) return; } remoteConfig.addFetchRefSpec(new RefSpec(notesRef + ":" + notesRef)); //$NON-NLS-1$ }

Target:
public static void configureFetchNotes(RemoteConfig remoteConfig) { String notesRef = Constants.R_NOTES + "*"; //$NON-NLS-1$ List<RefSpec> fetchRefSpecs = remoteConfig.getFetchRefSpecs(); for (RefSpec refSpec : fetchRefSpecs) { if (refSpec.matchSource(notesRef)) { return; } } remoteConfig.addFetchRefSpec(new RefSpec(notesRef + ":" + notesRef)); //$NON-NLS-1$ }
Source:
public void run() { // the access to the editor needs to be executed in the display // thread Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (!getEditorControl().isDisposed() && KeyPressCommitRunnable.this.toCommit != null && KeyPressCommitRunnable.this.toCommit.equals(getEditorValue())) { commit(MoveDirectionEnum.NONE, false); } } }); }

Target:
public void run() { // the access to the editor needs to be executed in the display // thread Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (getEditorControl() != null && !getEditorControl().isDisposed() && KeyPressCommitRunnable.this.toCommit != null && KeyPressCommitRunnable.this.toCommit.equals(getEditorValue())) { commit(MoveDirectionEnum.NONE, false); } } }); }
Source:
public boolean equals(Object obj) { // do not take "name" into account since it can change on the fly. if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FileAndName)) { return false; } FileAndName other = (FileAndName) obj; if (!NonNullUtils.equalsNullable(fTraceTypeId, other.fTraceTypeId)) { return false; } return NonNullUtils.equalsNullable(fFile, other.fFile); }

Target:
public boolean equals(Object obj) { // do not take "name" into account since it can change on the fly. if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FileAndName)) { return false; } FileAndName other = (FileAndName) obj; if (!equalsNullable(fTraceTypeId, other.fTraceTypeId)) { return false; } if (!equalsNullable(fFile, other.fFile)) { return false; } return true; }
Source:
private String getStorageKey(boolean perInstance) { return (perInstance ? m_instance : "") + (m_category != "" ? "." + m_category : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ }

Target:
private String getStorageKey(boolean perInstance) { return (perInstance ? m_instance : "") + (!m_category.equals("") ? "." + m_category : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ }
Source:
public void initializeVisualizer() { fEventListener = new MulticoreVisualizerEventListener(this); m_cpuCoreContextsCache = new ArrayList<IDMContext>(); m_visualizerInstanceId = getViewer().getView().getViewSite().getSecondaryId(); // The first visualizer view will have a null secondary id - override that if (m_visualizerInstanceId == null) { m_visualizerInstanceId = "0"; //$NON-NLS-1$ } initializePersistentParameters(); }

Target:
public void initializeVisualizer() { fEventListener = new MulticoreVisualizerEventListener(this); m_cpuCoreContextsCache = new ArrayList<IDMContext>(); m_visualizerInstanceId = getViewer().getView().getViewSite().getSecondaryId(); // The first visualizer view will have a null secondary id - override that if (m_visualizerInstanceId == null) { m_visualizerInstanceId = "0"; //$NON-NLS-1$ } initializePersistentParameters(m_visualizerInstanceId); }
Source:
private void persistParameter(T value) { // create memento String memento = MementoUtils.encodeStringIntoMemento(value.toString()); // save memento in store IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore(); if (memento != null) { store.put(m_storeKey, memento); try { store.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } } }

Target:
private void persistParameter(T value) { // create memento String memento = MementoUtils.encodeStringIntoMemento(value.toString()); // save memento in store if (memento != null) { IEclipsePreferences store = MulticoreVisualizerUIPlugin.getEclipsePreferenceStore(); store.put(m_storeKey, memento); try { store.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } } }
Source:
protected void gtk_widget_set_align(long /*int*/ widget, int hAlign, int vAlign) { OS.gtk_widget_set_halign (widget, hAlign); OS.gtk_widget_set_valign (widget, vAlign); }

Target:
void gtk_widget_set_align(long /*int*/ widget, int hAlign, int vAlign) { OS.gtk_widget_set_halign (widget, hAlign); OS.gtk_widget_set_valign (widget, vAlign); }
Source:
public void setInternalJobState(int state) { try { final Field field = InternalJob.class.getDeclaredField("flags"); field.setAccessible(true); // hack for testing field.set(this, new Integer(state)); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }

Target:
public void setInternalJobState(int state) { try { final Field field = InternalJob.class.getDeclaredField("flags"); field.setAccessible(true); // hack for testing field.set(this, new Integer(state)); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
private Image getEnhancedImage(final Image image, final Viewpoint viewpoint) { if (ViewpointRegistry.getInstance().isFromPlugin(viewpoint) && image != null) { return SiriusEditPlugin.getPlugin().getImage(getOverlayedDescriptor(image, "icons/full/decorator/folder_close.gif")); } return image; }

Target:
private Image getEnhancedImage(final Image image, final Viewpoint viewpoint) { // Add decorator if the viewpoint comes from workspace if (!ViewpointRegistry.getInstance().isFromPlugin(viewpoint) && image != null) { return SiriusEditPlugin.getPlugin().getImage(getOverlayedDescriptor(image, "icons/full/decorator/folder_close.gif")); } return image; }
Source:
public Element getElement(Object node) { if (node == null) { return null; } EObject notationElement = getNativeWidget(node); CSSDOMSemanticElementHelper helper = new CSSDOMSemanticElementHelper(); View canonicalNotationElement = helper.findPrimaryView(notationElement); // Orphaned view if (canonicalNotationElement.getDiagram() == null) { return null; } // A View and a Compartment associated to the same Semantic Element // must have the same XML Element. They share the same children. // This is required to map the Semantic model (Used by the CSS selectors) // to the Notation model (Used by the CSS properties) return super.getElement(canonicalNotationElement); }

Target:
public Element getElement(Object node) { if (node == null) { return null; } EObject notationElement = getNativeWidget(node); View canonicalNotationElement = CSSDOMSemanticElementHelper.getInstance().findPrimaryView(notationElement); // Orphaned view if (canonicalNotationElement.getDiagram() == null) { return null; } // A View and a Compartment associated to the same Semantic Element // must have the same XML Element. They share the same children. // This is required to map the Semantic model (Used by the CSS selectors) // to the Notation model (Used by the CSS properties) return super.getElement(canonicalNotationElement); }
Source:
public T value() { if (m_value == null) { // attempt to get the value from the preference store m_value = restoreParameter(); } // parameter has one value for any/all instances else if(!isPerInstance()) { // do not rely on cached value, since another instance might have // changed it - reread from data store m_value = restoreParameter(); } return (m_value!=null)? m_value : m_defaultValue; }

Target:
public T value() { if (m_value == null) { // attempt to get the value from the preference store m_value = restoreParameter(); } // parameter has one value for any/all instances else if(!isPerInstance()) { // do not rely on cached value, since another instance might have // changed it - reread from data store m_value = restoreParameter(); } return (m_value == null)? m_defaultValue : m_value; }
Source:
public PathVariablesGroup(boolean multiSelect, int variableType) { this.multiSelect = multiSelect; this.variableType = variableType; pathVariableManager = ResourcesPlugin.getWorkspace() .getPathVariableManager(); removedVariableNames = new HashSet(); Collator ignoreCaseComparator = Collator.getInstance(); ignoreCaseComparator.setStrength(Collator.TERTIARY); tempPathVariables = new TreeMap(ignoreCaseComparator); // initialize internal model initTemporaryState(); }

Target:
public PathVariablesGroup(boolean multiSelect, int variableType) { this.multiSelect = multiSelect; this.variableType = variableType; pathVariableManager = ResourcesPlugin.getWorkspace() .getPathVariableManager(); removedVariableNames = new HashSet(); Collator ignoreCaseComparator = Collator.getInstance(); tempPathVariables = new TreeMap(ignoreCaseComparator); // initialize internal model initTemporaryState(); }
Source:
public ChooseWorkspaceDialog(Shell parentShell, ChooseWorkspaceData launchData, boolean suppressAskAgain, boolean centerOnMonitor) { super(parentShell); this.launchData = launchData; this.suppressAskAgain = suppressAskAgain; this.centerOnMonitor = centerOnMonitor; // Bug 462707 - [WorkbenchLauncher] dialog not closed on ESC this.parentShell = parentShell; this.keyListener = new Listener() { @Override public void handleEvent(Event event) { if (event.character == SWT.ESC) cancelPressed(); } }; parentShell.getDisplay().addFilter(SWT.KeyDown, keyListener); }

Target:
public ChooseWorkspaceDialog(Shell parentShell, ChooseWorkspaceData launchData, boolean suppressAskAgain, boolean centerOnMonitor) { super(parentShell); this.launchData = launchData; this.suppressAskAgain = suppressAskAgain; this.centerOnMonitor = centerOnMonitor; // Bug 462707 - [WorkbenchLauncher] dialog not closed on ESC this.parentShell = parentShell; this.keyListener = new Listener() { @Override public void handleEvent(Event event) { if (event.character == SWT.ESC) { cancelPressed(); } } }; parentShell.getDisplay().addFilter(SWT.KeyDown, keyListener); }
Source:
private static void checkIfSessionIsAssociatedWithProject(SessionId sessionId, ProjectId projectId) throws AccessControlException { final EList<Adapter> eAdapters = sessionId.eAdapters(); for (final Adapter adapter : eAdapters) { if (ShareProjectAdapter.class.isInstance(adapter)) { final ShareProjectAdapter shareAdapter = (ShareProjectAdapter) adapter; final boolean didRemove = shareAdapter.removeProject(projectId); if (!didRemove) { throw new AccessControlException(Messages.AdminEmfStoreImpl_IllegalRequestToAddInitialRole); } return; } } throw new AccessControlException(Messages.AdminEmfStoreImpl_IllegalRequestToAddInitialRole); }

Target:
private static void checkIfSessionIsAssociatedWithProject(SessionId sessionId, ProjectId projectId) throws AccessControlException { final EList<Adapter> eAdapters = sessionId.eAdapters(); for (final Adapter adapter : eAdapters) { if (ShareProjectAdapter.class.isInstance(adapter)) { final ShareProjectAdapter shareAdapter = (ShareProjectAdapter) adapter; final boolean didRemove = shareAdapter.removeProject(projectId); if (didRemove) { return; } throw new AccessControlException(Messages.AdminEmfStoreImpl_IllegalRequestToAddInitialRole); } } // no ShareProjectAdapter with the correct project found throw new AccessControlException(Messages.AdminEmfStoreImpl_IllegalRequestToAddInitialRole); }
Source:
String getQualifier(Date timestamp) throws MojoFailureException { String qualifier = format.format(timestamp); // parse an empty version with the given qualifier to check if the qualifier is valid try { Version.parseVersion(Version.emptyVersion + "." + qualifier); } catch (IllegalArgumentException e) { throw new MojoFailureException("Invalid build qualifier format '" + format.toPattern() + "', it does not match the OSGi qualifier constraint ([0..9]|[a..zA..Z]|'_'|'-')"); } return qualifier; }

Target:
String getQualifier(Date timestamp) { return format.format(timestamp); }
Source:
public long getBucketStartTime(int index) { // .5 for rounding return fFirstBucketTime + (long) (index * fBucketDuration + .5); }

Target:
public long getBucketStartTime(int index) { return fFirstBucketTime + (long) (index * fBucketDuration); }
Source:
protected boolean batchValidate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { IStatus status = Status.OK_STATUS; // no point in validating if we can't report results if (diagnostics != null) { // if EMF Mode Validation Service already covered the sub-tree, // which it does for efficient computation and error reporting, // then don't repeat (the Diagnostician does the recursion // externally). If there is no context map, then we can't // help it if (!hasProcessed(eObject, context)) { if (canCompareUpperGeLower(eObject)) { status = batchValidator.validate( eObject, new NullProgressMonitor()); processed(eObject, context, status); appendDiagnostics(status, diagnostics); } } } return status.isOK(); }

Target:
protected boolean batchValidate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { IStatus status = Status.OK_STATUS; // no point in validating if we can't report results if (diagnostics != null) { // if EMF Mode Validation Service already covered the sub-tree, // which it does for efficient computation and error reporting, // then don't repeat (the Diagnostician does the recursion // externally). If there is no context map, then we can't // help it if (!hasProcessed(eObject, context)) { status = batchValidator.validate( eObject, new NullProgressMonitor()); processed(eObject, context, status); appendDiagnostics(status, diagnostics); } } return status.isOK(); }
Source:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat( TmfTimePreferences.getTimePattern(), TmfTimePreferences.getTimeZone(), TmfTimePreferences.getLocale()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getIntervalPattern()); }

Target:
public static synchronized void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat( TmfTimePreferences.getTimePattern(), TmfTimePreferences.getTimeZone(), TmfTimePreferences.getLocale()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getIntervalPattern()); }
Source:
public static void parallel(String task, Iterable<Job> jobs) { IProgressMonitor group = getProgressGroup(); try { group.beginTask(task, size(jobs)); for (Job job : jobs) { job.setProgressGroup(group, 1); job.schedule(); } for (Job job : jobs) { job.join(); } } catch (InterruptedException e) { // ignore } finally { group.done(); } }

Target:
public static IProgressMonitor parallel(String task, Iterable<Job> jobs) { IProgressMonitor group = getProgressGroup(); try { group.beginTask(task, size(jobs)); for (Job job : jobs) { job.setProgressGroup(group, 1); job.schedule(); } for (Job job : jobs) { job.join(); } } catch (InterruptedException e) { // ignore } finally { group.done(); } return group; }
Source:
public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (selection == null || part instanceof GenericHistoryView) { return; } IStructuredSelection structuredSelection = SelectionUtils .getStructuredSelection(selection); System.out.println("selectionChanged[" + part + "]: " //$NON-NLS-1$ //$NON-NLS-2$ + structuredSelection.size()); if (structuredSelection.isEmpty()) { return; } setSelection(structuredSelection); }

Target:
public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (selection == null || part instanceof GenericHistoryView) { return; } IStructuredSelection structuredSelection = SelectionUtils .getStructuredSelection(selection); if (structuredSelection.isEmpty()) { return; } setSelection(structuredSelection); }
Source:
protected FS() { gitSystemConfig = new Holder<File>(discoverGitSystemConfig()); }

Target:
protected FS() { // Do nothing by default. }
Source:
public void setSelectedTime(long time, boolean ensureVisible) { /* if there is a pending time selection, ignore this one */ synchronized (fListenerNotifierLock) { if (fListenerNotifier != null && fListenerNotifier.hasTimeSelected()) { return; } } setSelectedTimeInt(time, ensureVisible, false); }

Target:
public void setSelectedTime(long time, boolean ensureVisible) { /* if there is a pending time selection, ignore this one */ if (fListenerNotifier != null && fListenerNotifier.hasTimeSelected()) { return; } setSelectedTimeInt(time, ensureVisible, false); }
Source:
public void setSelectionRange(long beginTime, long endTime) { /* if there is a pending time selection, ignore this one */ synchronized (fListenerNotifierLock) { if (fListenerNotifier != null && fListenerNotifier.hasTimeSelected()) { return; } } fSelectionBegin = Math.max(fTime0Bound, Math.min(fTime1Bound, beginTime)); fSelectionEnd = Math.max(fTime0Bound, Math.min(fTime1Bound, endTime)); fTimeGraphCtrl.redraw(); fTimeScaleCtrl.redraw(); }

Target:
public void setSelectionRange(long beginTime, long endTime) { /* if there is a pending time selection, ignore this one */ if (fListenerNotifier != null && fListenerNotifier.hasTimeSelected()) { return; } fSelectionBegin = Math.max(fTime0Bound, Math.min(fTime1Bound, beginTime)); fSelectionEnd = Math.max(fTime0Bound, Math.min(fTime1Bound, endTime)); fTimeGraphCtrl.redraw(); fTimeScaleCtrl.redraw(); }
Source:
protected boolean hasShortcuts() { return true; }

Target:
protected boolean hasShortcuts() { return false; }
Source:
public Option<String> getNewFragment(String uriFragment) { boolean contains = false; String newUriFragment = uriFragment; // do not directly do a replaceAll on "@firstModelOperations" to avoid // an infinite loop if (uriFragment.endsWith("@firstModelOperations")) { contains = true; newUriFragment = newUriFragment + ".0"; } if (uriFragment.contains("@firstModelOperations/")) { contains = true; newUriFragment = newUriFragment.replaceAll("@firstModelOperations/", "@firstModelOperations.0/"); } if (contains) { return Options.newSome(newUriFragment); } else { return super.getNewFragment(uriFragment); } }

Target:
public Option<String> getNewFragment(String uriFragment) { boolean contains = false; String newUriFragment = uriFragment; // do not directly do a replaceAll on "@firstModelOperations" to avoid // an infinite loop if (uriFragment.endsWith("@firstModelOperations")) { contains = true; newUriFragment = newUriFragment + ".0"; } else if (uriFragment.contains("@firstModelOperations/")) { contains = true; newUriFragment = newUriFragment.replaceAll("@firstModelOperations/", "@firstModelOperations.0/"); } if (contains) { return Options.newSome(newUriFragment); } else { return super.getNewFragment(uriFragment); } }
Source:
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { if (ownsLaunchConfiguration(configuration)) { // we have to ignore notifications from working copies, otherwise // we will be adding them here and not removing destroying the proper cache // change event will be sent to original configuration later if (configuration.isWorkingCopy()) return true; // clear cache, target could have changed launchConfigurationRemoved(configuration); return addLaunchConfiguration(configuration); } else if (ownedConfigs.contains(configuration)) { // something changed that will cause us to loose ownership of this // configuration. Remove and add it back in. ILaunchBarManager manager = getManager(); manager.launchConfigurationRemoved(configuration); manager.launchConfigurationAdded(configuration); return true; } else { return false; } }

Target:
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { if (ownsLaunchConfiguration(configuration)) { // clear cache, target could have changed launchConfigurationRemoved(configuration); return addLaunchConfiguration(configuration); } else if (ownedConfigs.contains(configuration)) { // something changed that will cause us to loose ownership of this // configuration. Remove and add it back in. ILaunchBarManager manager = getManager(); manager.launchConfigurationRemoved(configuration); manager.launchConfigurationAdded(configuration); return true; } else { return false; } }
Source:
private String getLabelProviderContextForTreeFillingConfiguration(final Table table, final Object listenObject) { if (listenObject instanceof EStructuralFeature) { return Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_FEATURE_CONFIGURATION_CONTEXT; } else if (listenObject instanceof EOperation) { return Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_OPERATION_CONFIGURATION_CONTEXT; } else { // TODO return ""; //$NON-NLS-1$ } }

Target:
private String getLabelProviderContextForTreeFillingConfiguration(final Table table, final Object listenObject) { String result = ""; //$NON-NLS-1$ if (listenObject instanceof EStructuralFeature) { result = Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_FEATURE_CONFIGURATION_CONTEXT; } else if (listenObject instanceof EOperation) { result = Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_OPERATION_CONFIGURATION_CONTEXT; } return result; }
Source:
protected View getView() { EditPart host = getHost(); if (host == null) { return null; } Object hostView = host.getModel(); if (hostView instanceof View) { // The mask have to be applied on the label and not on the parent if (((View) getHost().getModel()) instanceof View) { return (View) ((View) getHost().getModel()); } return null; } return null; }

Target:
protected View getView() { EditPart host = getHost(); if (host == null) { return null; } Object hostView = host.getModel(); if (hostView instanceof View) { // The mask have to be applied on the label and not on the parent return (View) hostView; } return null; }
Source:
protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) { if (commentNode != null) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { // because it is asynchronous the comment node's domain maybe become null if (TransactionUtil.getEditingDomain(commentNode) == domain) { DeleteCommand command = new DeleteCommand(commentNode); try { GMFUnsafe.write(domain, command); } catch (Exception e) { Activator.log.error(e); } } } }); } }

Target:
protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) { if (null != commentNode) { Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { // because it is asynchronous the comment node's domain maybe become null if (TransactionUtil.getEditingDomain(commentNode) == domain) { DeleteCommand command = new DeleteCommand(commentNode); try { GMFUnsafe.write(domain, command); } catch (Exception e) { Activator.log.error(e); } } } }); } }
Source:
public void setAccelerator (int accelerator) { checkWidget(); if (this.accelerator == accelerator) return; long /*int*/ accelGroup = getAccelGroup (); if (accelGroup != 0) removeAccelerator (accelGroup); this.accelerator = accelerator; if (accelGroup != 0) { addAccelerator (accelGroup); } }

Target:
public void setAccelerator (int accelerator) { checkWidget(); if (this.accelerator == accelerator) return; long /*int*/ accelGroup = getAccelGroup (); if (accelGroup != 0) removeAccelerator (accelGroup); this.accelerator = accelerator; if (accelGroup != 0) addAccelerator (accelGroup); }
Source:
RGB acquireCurrentColorSelectionGtk3(long /*int*/ handle, GdkRGBA rgba) { int red = 0; int green = 0; int blue = 0; OS.gtk_color_chooser_get_rgba (handle, rgba); red = (int) (rgba.red * 255); green = (int) (rgba.green * 255); blue = (int) (rgba.blue * 255); rgb = new RGB (red, green, blue); return rgb; }

Target:
RGB acquireCurrentColorSelectionGtk3(long /*int*/ handle, GdkRGBA rgba) { int red = 0; int green = 0; int blue = 0; OS.gtk_color_chooser_get_rgba (handle, rgba); red = (int) (rgba.red * 255); green = (int) (rgba.green * 255); blue = (int) (rgba.blue * 255); return new RGB (red, green, blue); }
Source:
public AbstractCriticalPathAlgorithm(TmfGraph graph) { this.fGraph = graph; }

Target:
public AbstractCriticalPathAlgorithm(TmfGraph graph) { fGraph = graph; }
Source:
private static ITmfEventField getRootField(CustomTraceDefinition definition) { ITmfEventField[] fields = new ITmfEventField[definition.outputs.size()]; for (int i = 0; i < fields.length; i++) { fields[i] = new TmfEventField(nullToEmptyString(definition.outputs.get(i).name), null, null); } ITmfEventField rootField = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fields); return rootField; }

Target:
private static ITmfEventField getRootField(CustomTraceDefinition definition) { ITmfEventField[] fields = new ITmfEventField[definition.outputs.size()]; for (int i = 0; i < fields.length; i++) { fields[i] = new TmfEventField(definition.outputs.get(i).name, null, null); } ITmfEventField rootField = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fields); return rootField; }