auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object getAdapter(@SuppressWarnings("rawtypes") final Class adapter) { /* @SuppressWarnings("rawtypes"): gdupe> Imposed by the super class */ Object result; if ("interface org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetProvider".equals(adapter.toString())) { System.out.println(); } if (adapter.isInstance(this)) { result = this; } else { result = this.widget.getAdapter(adapter); if (result == null) { result = super.getAdapter(adapter); } } return result; }

Target:
public Object getAdapter(@SuppressWarnings("rawtypes") final Class adapter) { /* @SuppressWarnings("rawtypes"): gdupe> Imposed by the super class */ Object result; if (adapter.isInstance(this)) { result = this; } else { result = this.widget.getAdapter(adapter); if (result == null) { result = super.getAdapter(adapter); } } return result; }
Source:
private boolean isFormatValid(String format) { String formatToCheck = format.replace("'(.*?)'", ""); return !formatToCheck.contains("w") && !formatToCheck.contains("W") && !formatToCheck.contains("MMM") && !formatToCheck.contains("G") && !formatToCheck.contains("E") && !formatToCheck.contains("Z"); }

Target:
private boolean isFormatValid(String format) { if (format == null) { return true; } String formatToCheck = format.replace("'(.*?)'", ""); return !formatToCheck.contains("w") && !formatToCheck.contains("W") && !formatToCheck.contains("MMM") && !formatToCheck.contains("G") && !formatToCheck.contains("E") && !formatToCheck.contains("Z"); }
Source:
public void setData(@Nullable LatencyAnalysis analysis) { if (analysis == null) { return; } ISegmentStore<ISegment> results = analysis.getResults(); // If results are not null, then analysis is completed and model can be // updated if (results != null) { updateModel(LatencyViewerUtils.storeAndGet(results)); return; } LatencyViewerUtils.runAnalysis(fListener); }

Target:
public void setData(@Nullable LatencyAnalysis analysis) { if (analysis == null) { updateModel(null); return; } ISegmentStore<ISegment> results = analysis.getResults(); // If results are not null, then analysis is completed and model can be // updated if (results != null) { updateModel(LatencyViewerUtils.storeAndGet(results)); return; } updateModel(null); LatencyViewerUtils.runAnalysis(fListener); }
Source:
public void traceSelected(@Nullable TmfTraceSelectedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); if (analysis != null) { analysis.addListener(fListener); // Check if latency analysis was performed on selected trace if (analysis.getResults() == null) { // Run analysis if (LatencyViewerUtils.runAnalysis()) { return; } } fData = LatencyViewerUtils.getResultsFromAnalysis(analysis); // Update model is analysis was already performed updateModel(fData); } }

Target:
public void traceSelected(@Nullable TmfTraceSelectedSignal signal) { LatencyAnalysis analysis = LatencyViewerUtils.getAnalysisFromSignal(signal); fData = LatencyViewerUtils.getResultsFromAnalysis(analysis); updateModel(fData); }
Source:
public void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); // Ignore update if disposed if (viewerControl.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }

Target:
protected void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); // Ignore update if disposed if (viewerControl.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }
Source:
public void modelComplete(boolean global) { refreshTree(); waitCursor(false); }

Target:
protected void modelComplete(boolean global) { refreshTree(); waitCursor(false); }
Source:
public void refreshTree(){ final Control viewerControl = getControl(); // Ignore update if disposed if (viewerControl.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fTreeViewer.refresh(); } } }); }

Target:
private void refreshTree(){ final Control viewerControl = getControl(); // Ignore update if disposed if (viewerControl.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fTreeViewer.refresh(); } } }); }
Source:
public void init(Composite parent, String viewerName, ITmfTrace trace) { super.init(parent, viewerName); // Increment a counter to make sure the tree ID is unique. fCountInstance++; fInstanceNb = fCountInstance; fTrace = trace; fModel = new TmfStatisticsModel(); // The viewer will process all events if he is assigned to an experiment fProcessAll = (trace instanceof TmfExperiment); initContent(parent); initInput(); }

Target:
public void init(Composite parent, String viewerName, ITmfTrace trace) { super.init(parent, viewerName); // Increment a counter to make sure the tree ID is unique. fCountInstance++; fInstanceNb = fCountInstance; fTrace = trace; // The viewer will process all events if he is assigned to an experiment fProcessAll = (trace instanceof TmfExperiment); initContent(parent); initInput(); }
Source:
public Boolean exists(Collection<Object> collection, LambdaValue lambda) { Boolean result = Boolean.FALSE; if (collection != null && lambda == null) { result = Boolean.FALSE; } else { for (Object input : collection) { try { if (Boolean.TRUE.equals(lambda.eval(new Object[] {input }))) { result = Boolean.TRUE; break; } // CHECKSTYLE:OFF } catch (Exception e) { // TODO: log the exception. } // CHECKSTYLE:ON } } return result; }

Target:
public Boolean exists(Collection<Object> collection, LambdaValue lambda) { Boolean result = Boolean.FALSE; if (collection != null && lambda != null) { for (Object input : collection) { try { if (Boolean.TRUE.equals(lambda.eval(new Object[] {input }))) { result = Boolean.TRUE; break; } // CHECKSTYLE:OFF } catch (Exception e) { // TODO: log the exception. } // CHECKSTYLE:ON } } return result; }
Source:
private void updateTitle(String brand) { IBrandManager brandManager = TasksUiPlugin.getDefault().getBrandManager(); setTitle(brandManager.getConnectorLabel(getConnector(), brand)); }

Target:
protected void updateTitle(String brand) { IBrandManager brandManager = TasksUiPlugin.getDefault().getBrandManager(); setTitle(brandManager.getConnectorLabel(getConnector(), brand)); }
Source:
public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); /* Check if directory exists, otherwise create it */ File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } dir.deleteOnExit(); return path; }

Target:
public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); /* Check if directory exists, otherwise create it */ File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } return path; }
Source:
public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", //$NON-NLS-1$ WizardMessages.getString("ImageSearchPage.title"), //$NON-NLS-1$ SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); //$NON-NLS-1$ setPageComplete(true); this.model = model; }

Target:
public ImageSearchPage(final ImageSearchModel model) { super("ImageSearchPage", //$NON-NLS-1$ WizardMessages.getString("ImageSearchPage.title"), //$NON-NLS-1$ SWTImagesFactory.DESC_BANNER_REPOSITORY); setMessage(WizardMessages.getString("ImageSearchPage.title")); //$NON-NLS-1$ this.model = model; }
Source:
public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { // Get filtered notifications List<Notification> filteredNotificationsList = event.getNotifications(); CompoundCommand commands = new CompoundCommand(); // Handle each filtered notification for (Notification notification : filteredNotificationsList) { Command refactorCommand = handleFilteredNotification(notification); if (null != refactorCommand) { commands.append(refactorCommand); } } return commands.isEmpty() ? null : commands; }

Target:
public Command transactionAboutToCommit(ResourceSetChangeEvent event) throws RollbackException { // Get filtered notifications List<Notification> filteredNotificationsList = event.getNotifications(); Command refactorCommand = null; // Handle each filtered notification if (!filteredNotificationsList.isEmpty()) { refactorCommand = handleFilteredNotification(filteredNotificationsList.get(0)); } return refactorCommand; }
Source:
public Tree createListControl(Composite parent) { Tree table = (Tree) getTreeControl(); if (table == null) { listParent = parent; treeViewer = doCreateTreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); table = treeViewer.getTree(); table.setFont(parent.getFont()); treeViewer.setComparator(new ViewerComparator()); treeViewer.addCheckStateListener(this); } else { //checkParent(table, parent); // Bug 471967 this seems to be not necessary and causing issues } return table; }

Target:
public Tree createListControl(Composite parent) { Tree table = (Tree) getTreeControl(); if (table == null) { listParent = parent; treeViewer = doCreateTreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); table = treeViewer.getTree(); table.setFont(parent.getFont()); treeViewer.setComparator(new ViewerComparator()); treeViewer.addCheckStateListener(this); } return table; }
Source:
private void selectRepresentationElements(ISelection selection, DialectEditor dialectEditor) { List<DRepresentationElement> representationElements = getRepresentationElements(dialectEditor.getRepresentation(), ((IStructuredSelection) selection).toList()); if (!representationElements.isEmpty()) { DialectUIManager.INSTANCE.selectAndReveal(dialectEditor, representationElements); } }

Target:
private void selectRepresentationElements(ISelection selection, DialectEditor dialectEditor) { List<DRepresentationElement> representationElements = getRepresentationElements(dialectEditor.getRepresentation(), ((IStructuredSelection) selection).toList()); // if (!representationElements.isEmpty()) { DialectUIManager.INSTANCE.selectAndReveal(dialectEditor, representationElements); // } }
Source:
public Adapter createStoragePathAdapter(String path, boolean isLocal) { IFileRevision findFileRevision = findFileRevision((ITypedElement)accessor); IFile file = findFile((ITypedElement)accessor); // The parameter isLocal is overwritten because more informations are available here to determine // whether the file is local or remote boolean local; if (file == null) { local = false; } else { local = true; } if (!isLocal && findFileRevision != null) { return new StoragePathAdapter(path, local, findFileRevision.getContentIdentifier(), findFileRevision.getAuthor()); } else { return new StoragePathAdapter(path, local); } }

Target:
public Adapter createStoragePathAdapter(String path, boolean isLocal) { IFileRevision findFileRevision = findFileRevision((ITypedElement)accessor); IFile file = findFile((ITypedElement)accessor); // The parameter isLocal is overwritten because more informations are available here to determine // whether the file is local or remote boolean local = file != null; if (!isLocal && findFileRevision != null) { return new StoragePathAdapter(path, local, findFileRevision.getContentIdentifier(), findFileRevision.getAuthor()); } else { return new StoragePathAdapter(path, local); } }
Source:
public void setContainer(final IWizardContainer wizardContainer) { super.setContainer(wizardContainer); // Bug 476838: the container was null using getShell() of this wizard. wizardContainer.getShell().setImage(Activator.getDefault().getImage(ImageConstants.PAPYRUS_ICON_PATH)); // $NON-NLS-1$ }

Target:
public void setContainer(final IWizardContainer wizardContainer) { super.setContainer(wizardContainer); // Bug 476838: the container was null using getShell() of this wizard. if (null != wizardContainer) { wizardContainer.getShell().setImage(Activator.getDefault().getImage(ImageConstants.PAPYRUS_ICON_PATH)); // $NON-NLS-1$ } }
Source:
public void testCall() throws Exception { // Run test ListBranchesCommand listBranchesCommand = fGerrit.listBranches(Common.TEST_PROJECT); BranchInfo[] listBranchesResult = null; try { listBranchesResult = listBranchesCommand.call(); } catch (EGerritException e) { fail(e.getMessage()); } System.out.println(listBranchesResult[0].getRef()); // Verify result assertEquals(listBranchesResult[0].getRef(), "HEAD"); }

Target:
public void testCall() throws Exception { // Run test ListBranchesCommand listBranchesCommand = fGerrit.listBranches(Common.TEST_PROJECT); BranchInfo[] listBranchesResult = null; try { listBranchesResult = listBranchesCommand.call(); } catch (EGerritException e) { fail(e.getMessage()); } // Verify result assertEquals(listBranchesResult[0].getRef(), "HEAD"); }
Source:
public void run(IProgressMonitor monitor) throws CoreException { ArrayList<TextFileChange> list = new ArrayList<>(); if (fDesc != null) { SubMonitor subMonitor = SubMonitor.convert(monitor, "", 3); //$NON-NLS-1$ findRequireBundleReferences(list, subMonitor.newChild(1)); findFragmentReferences(list, subMonitor.newChild(1)); findXFriendReferences(list, subMonitor.newChild(1)); } fChanges = list.toArray(new Change[list.size()]); }

Target:
public void run(IProgressMonitor monitor) throws CoreException { ArrayList<TextFileChange> list = new ArrayList<>(); if (fDesc != null) { SubMonitor subMonitor = SubMonitor.convert(monitor, 3); findRequireBundleReferences(list, subMonitor.newChild(1)); findFragmentReferences(list, subMonitor.newChild(1)); findXFriendReferences(list, subMonitor.newChild(1)); } fChanges = list.toArray(new Change[list.size()]); }
Source:
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(MessageFormat.format(PDEUIMessages.RenameExtensionPointProcessor_changeTitle, new Object[] {fInfo.getCurrentValue(), fInfo.getNewValue()})); SubMonitor subMonitor = SubMonitor.convert(pm, "", 2); //$NON-NLS-1$ changeExtensionPoint(change, subMonitor.newChild(1)); if (fInfo.isUpdateReferences()) findReferences(change, subMonitor.newChild(1)); return change; }

Target:
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { CompositeChange change = new CompositeChange(MessageFormat.format(PDEUIMessages.RenameExtensionPointProcessor_changeTitle, new Object[] {fInfo.getCurrentValue(), fInfo.getNewValue()})); SubMonitor subMonitor = SubMonitor.convert(pm, 2); changeExtensionPoint(change, subMonitor.newChild(1)); if (fInfo.isUpdateReferences()) findReferences(change, subMonitor.newChild(1)); return change; }
Source:
public void addReviewData(ITask review, String description) { TaskData reviewData = new TaskData(new TaskAttributeMapper(new TaskRepository("", "")), "", review.getUrl(), review.getTaskId()); reviewData.getRoot().createMappedAttribute(TaskAttribute.DESCRIPTION).setValue(description); try { when(taskDataManager.getTaskData(review)).thenReturn(reviewData); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

Target:
public void addReviewData(ITask review, String description) throws CoreException { TaskData reviewData = new TaskData(new TaskAttributeMapper(new TaskRepository("", "")), "", review.getUrl(), review.getTaskId()); reviewData.getRoot().createMappedAttribute(TaskAttribute.DESCRIPTION).setValue(description); when(taskDataManager.getTaskData(review)).thenReturn(reviewData); }
Source:
public void testNull() { org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester tableRequirementTester = new org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester(); IStatus emptyNotAllowed = tableRequirementTester.isAllowed(null); Assert.assertEquals("The tester should not work on a null entry", IStatus.ERROR, emptyNotAllowed.getSeverity()); }

Target:
public void testNull() { RequirementTableTester tableRequirementTester = new RequirementTableTester(); IStatus emptyNotAllowed = tableRequirementTester.isAllowed(null); Assert.assertEquals("The tester should not work on a null entry", IStatus.ERROR, emptyNotAllowed.getSeverity()); //$NON-NLS-1$ }
Source:
public void testMissingProfile() { org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester tableRequirementTester = new org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester(); org.eclipse.uml2.uml.Package pck = UMLFactory.eINSTANCE.createPackage(); IStatus missingStereotypeNotAllowed = tableRequirementTester.isAllowed(pck); Assert.assertEquals("The tester should not work on a non profiled entry", IStatus.ERROR, missingStereotypeNotAllowed.getSeverity()); }

Target:
public void testMissingProfile() { RequirementTableTester tableRequirementTester = new RequirementTableTester(); org.eclipse.uml2.uml.Package pck = UMLFactory.eINSTANCE.createPackage(); IStatus missingStereotypeNotAllowed = tableRequirementTester.isAllowed(pck); Assert.assertEquals("The tester should not work on a non profiled entry", IStatus.ERROR, missingStereotypeNotAllowed.getSeverity()); //$NON-NLS-1$ }
Source:
protected SelectRootNodeWizardPage(TmfExperimentElement experiment) { super(""); //$NON-NLS-1$ setTitle(Messages.SelectRootNodeWizardPage_WindowTitle); setDescription(Messages.SelectRootNodeWizardPage_Description); fExperiment = experiment; }

Target:
protected SelectRootNodeWizardPage(TmfExperimentElement experiment) { super(""); //$NON-NLS-1$ fExperiment = experiment; }
Source:
private SaveablesProvider createSaveablesProvider(NavigatorContentDescriptor descriptor) { NavigatorContentExtension extension = contentService .getExtension(descriptor, true); // Use getContentProvider to get the client objects, this is important // for the adaptation below. See bug 306545 ITreeContentProvider contentProvider = extension .getContentProvider(); return (SaveablesProvider)Adapters.getAdapter(contentProvider, SaveablesProvider.class, true); }

Target:
private SaveablesProvider createSaveablesProvider(NavigatorContentDescriptor descriptor) { NavigatorContentExtension extension = contentService .getExtension(descriptor, true); // Use getContentProvider to get the client objects, this is important // for the adaptation below. See bug 306545 ITreeContentProvider contentProvider = extension .getContentProvider(); return Adapters.getAdapter(contentProvider, SaveablesProvider.class, true); }
Source:
protected String getFileName() { final String fileText = getFileText(); String[] extensions = getFileExtensions(); for (int i = 0; i < extensions.length; ++i) { String extension = extensions[i]; if (extension.isEmpty() || (!extension.isEmpty() && fileText.endsWith("." + extension))) { //$NON-NLS-1$ return fileText; } } return fileText + "." + extensions[0]; //$NON-NLS-1$ }

Target:
protected String getFileName() { final String fileText = getFileText(); String[] extensions = getFileExtensions(); for (int i = 0; i < extensions.length; ++i) { String extension = extensions[i]; if (!extension.isEmpty() && fileText.endsWith("." + extension)) { //$NON-NLS-1$ return fileText; } } if (extensions[0].isEmpty()) { return fileText; } return fileText + "." + extensions[0]; //$NON-NLS-1$ }
Source:
public void testRgb() { E4ThemeColor e4ThemeColor = new E4ThemeColor(); RGB rgb = E4ThemeColor.getRGBFromCssString("rgb(238, 238, 238)"); assertEquals(new RGB(238, 238, 238), rgb); }

Target:
public void testRgb() { RGB rgb = E4ThemeColor.getRGBFromCssString("rgb(238, 238, 238)"); //$NON-NLS-1$ assertEquals(new RGB(238, 238, 238), rgb); }
Source:
int nextSpan(int distanceFromTip) { if (distanceFromTip < 0) throw new IllegalArgumentException(); // Commits more toward the start will have more bitmaps. if (distanceFromTip <= recentCommitCount) return recentCommitSpan; int next = Math.min(distanceFromTip - recentCommitCount, distantCommitSpan); return Math.max(next, recentCommitSpan); }

Target:
int nextSpan(int distanceFromTip) { if (distanceFromTip < 0) { throw new IllegalArgumentException(); } // Commits more toward the start will have more bitmaps. if (distanceFromTip <= recentCommitCount) { return recentCommitSpan; } int next = Math.min(distanceFromTip - recentCommitCount, distantCommitSpan); return Math.max(next, recentCommitSpan); }
Source:
private void traceContainers(String action, long start) { Long delta = Long.valueOf(System.currentTimeMillis() - start); Long length = Long.valueOf(getContainersFile().length()); String pattern = "{0} {1} bytes in containers.dat in {2}ms"; //$NON-NLS-1$ String message = NLS.bind(pattern, new Object[] { action, length, delta }); System.out.println(message); }

Target:
private void traceContainers(String action, long start) { Long delta = System.currentTimeMillis() - start; Long length = getContainersFile().length(); String pattern = "{0} {1} bytes in containers.dat in {2}ms"; //$NON-NLS-1$ String message = NLS.bind(pattern, new Object[] { action, length, delta }); System.out.println(message); }
Source:
protected IPapyrusMarker getMarkerA() { if (markerA == null) { // create new marker for node A markerA = new NodeAMarker(getView()); } return markerA; }

Target:
protected IPapyrusMarker getMarkerA() { if (null == markerA) { // create new marker for node A markerA = new NodeAMarker(getView()); } return markerA; }
Source:
public boolean provides(final IOperation operation) { boolean provide = false; // it needs to be a CreateDecoratorsOperation if (operation instanceof CreateDecoratorsOperation) { final IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); final View view = decoratorTarget.getAdapter(View.class); // Test if the decoratorTarget element is a CallBehavoirAction if (view != null && ActivityDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view)) && view.getElement() instanceof CallBehaviorAction) { provide = true; } else { provide = false; } } return provide; }

Target:
public boolean provides(final IOperation operation) { boolean provide = false; // it needs to be a CreateDecoratorsOperation if (operation instanceof CreateDecoratorsOperation) { final IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget(); final View view = decoratorTarget.getAdapter(View.class); // Test if the decoratorTarget element is a CallBehavoirAction if (null != view && ActivityDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view)) && view.getElement() instanceof CallBehaviorAction) { provide = true; } else { provide = false; } } return provide; }
Source:
public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); File userConfig = new File(home, ".gitconfig"); try { userConfig.canRead(); } catch (AccessControlException e) { return new FileBasedConfig(null, fs) { public void load() { // empty, do not load } public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, userConfig, fs); //$NON-NLS-1$ }

Target:
public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); File userConfig = new File(home, ".gitconfig"); try { userConfig.canRead(); } catch (AccessControlException e) { return new FileBasedConfig(parent, null, fs) { public void load() { // empty, do not load } public boolean isOutdated() { // regular class would bomb here return false; } }; } return new FileBasedConfig(parent, userConfig, fs); //$NON-NLS-1$ }
Source:
final public List<IDecoration> setDecorationsNode(List<IPapyrusDecoration> pDecorations, int margin, boolean isVolatile) { decorations = new BasicEList<IDecoration>(); for (IPapyrusDecoration pDecoration : pDecorations) { Image image = addDecorationNode(pDecoration, margin, isVolatile); if (image != null) { margin += image.getBounds().width; } } // this.pDecorations = pDecorations; return decorations; }

Target:
final public List<IDecoration> setDecorationsNode(List<IPapyrusDecoration> pDecorations, int margin, boolean isVolatile) { decorations.clear(); for (IPapyrusDecoration pDecoration : pDecorations) { Image image = addDecorationNode(pDecoration, margin, isVolatile); if (image != null) { margin += image.getBounds().width; } } // this.pDecorations = pDecorations; return decorations; }
Source:
private boolean isArtifact(ITask task) { // If it has associated task and has no context, scheduled date, or due date; artifact // TODO: This will require work on Blaine's part.. pending boolean hasAssosciatedTask = true; boolean hasContext = TasksUiPlugin.getContextStore().hasContext(task); // Two kludgy options here... // A) Cast to AbstractTask; do a direct comparison... but requires knowledge of the "concrete implementation" // B) Seems like we could delegate out to TaskActivityManager (better option?) // TODO: Figure out the best course of action for this; using the kludge for now (since I know it'l be replaced // and it'll give me a push to actually come back) boolean hasScheduledDate = false; AbstractTask abstractTask = (AbstractTask) task; if (abstractTask != null) { hasScheduledDate = abstractTask.getScheduledForDate() != null; } boolean hasDueDate = task.getDueDate() != null; return hasAssosciatedTask && !(hasAssosciatedTask || hasScheduledDate || hasDueDate); }

Target:
private boolean isArtifact(ITask task) { // If it has associated task and has no context, scheduled date, or due date; artifact // TODO: This will require work on Blaine's part.. pending boolean hasAssosciatedTask = true; boolean hasContext = TasksUiPlugin.getContextStore().hasContext(task); boolean hasScheduledDate = false; if (task instanceof AbstractTask) { AbstractTask abstractTask = (AbstractTask) task; hasScheduledDate = abstractTask.getScheduledForDate() != null; } boolean hasDueDate = task.getDueDate() != null; return hasAssosciatedTask && !(hasContext || hasScheduledDate || hasDueDate); }
Source:
public void setToolTipText(ILaunchTarget target) { String text = Messages.TargetSelector_ToolTipPrefix + ": " + targetManager.getStatus(target).getMessage(); //$NON-NLS-1$ setToolTipText(text); System.out.println(text); }

Target:
public void setToolTipText(ILaunchTarget target) { String text = Messages.TargetSelector_ToolTipPrefix + ": " + targetManager.getStatus(target).getMessage(); //$NON-NLS-1$ setToolTipText(text); }
Source:
private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); //$NON-NLS-1$ reader = revPool.getObjectReader(); treeWalk = new TreeWalk(getRepository(), reader); treeWalk.setRecursive(true); }

Target:
private void initRevPool(boolean reverse) { if (queue != null) throw new IllegalStateException(); if (revPool != null) revPool.close(); if (reverse) revPool = new ReverseWalk(getRepository()); else revPool = new RevWalk(getRepository()); SEEN = revPool.newFlag("SEEN"); //$NON-NLS-1$ reader = revPool.getObjectReader(); treeWalk = new TreeWalk(reader); treeWalk.setRecursive(true); }
Source:
protected int getSpecificHeaderSize() { int maxChildren = getConfig().getMaxChildren(); int specificSize = SIZE_INT /* 1x int (extension node) */ + SIZE_INT /* 1x int (nbChildren) */ /* MAX_NB * int ('children' table) */ + SIZE_INT * maxChildren /* MAX_NB * Timevalue ('childStart' table) */ + SIZE_LONG * maxChildren /* MAX_NB * Timevalue ('childEnd' table) */ + SIZE_LONG * maxChildren /* MAX_NB * Timevalue ('childMin' table) */ + SIZE_INT * maxChildren /* MAX_NB * Timevalue ('childMax' table) */ + SIZE_INT * maxChildren; return specificSize; }

Target:
protected int getSpecificHeaderSize() { int maxChildren = getConfig().getMaxChildren(); int specificSize = SIZE_INT /* 1x int (extension node) */ + SIZE_INT /* 1x int (nbChildren) */ /* MAX_NB * int ('children' table) */ + SIZE_INT * maxChildren /* MAX_NB * Timevalue ('childStart' table) */ + SIZE_LONG * maxChildren /* MAX_NB * Timevalue ('childEnd' table) */ + SIZE_LONG * maxChildren; return specificSize; }
Source:
public String getDescription(AbstractOperation op) { if (op instanceof CompositeOperation) { final CompositeOperation compositeOperation = (CompositeOperation) op; // artificial composite because of opposite ref, take description of // main operation if (compositeOperation.getMainOperation() != null) { return getDescription(compositeOperation.getMainOperation()); } } // check of a custom operation label provider can provide a label final OperationCustomLabelProvider customLabelProvider = getLabelProvider(); final String decorate = decorate(customLabelProvider, op); customLabelProvider.dispose(); return decorate; }

Target:
public String getDescription(AbstractOperation op) { if (op instanceof CompositeOperation) { final CompositeOperation compositeOperation = (CompositeOperation) op; // artificial composite because of opposite ref, take description of // main operation if (compositeOperation.getMainOperation() != null) { return getDescription(compositeOperation.getMainOperation()); } } // check of a custom operation label provider can provide a label final OperationCustomLabelProvider customLabelProvider = getLabelProvider(); String decorate; try { decorate = decorate(customLabelProvider, op); return decorate; } finally { customLabelProvider.dispose(); } }
Source:
private static DropStrategy findStrategy(Map<DropStrategy, Command> matchingStrategies, Command command) { for (Map.Entry<DropStrategy, Command> entry : matchingStrategies.entrySet()) { if (entry.getValue() == command ) { return entry.getKey(); } } return null; }

Target:
protected static DropStrategy findStrategy(Map<DropStrategy, Command> matchingStrategies, Command command) { for (Map.Entry<DropStrategy, Command> entry : matchingStrategies.entrySet()) { if (entry.getValue() == command ) { return entry.getKey(); } } return null; }
Source:
public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List items; if (root == null) { items = Collections.emptyList(); } else { // remember checked elements items = getAllWhiteCheckedItems(); // reset all caches for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; // select (if any) previously checked elements again in the new model for (Object object : items) { setTreeChecked(object, true); } }

Target:
public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List<?> items; if (root == null) { items = Collections.emptyList(); } else { // remember checked elements items = getAllWhiteCheckedItems(); // reset all caches for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; // select (if any) previously checked elements again in the new model for (Object object : items) { setTreeChecked(object, true); } }
Source:
public URL getURL() { try { return new URL(url.toString()); } catch (MalformedURLException e) { // shouldn't happen since we checked this in the constructor already return null; } }

Target:
public URL getURL() { return url; }
Source:
private void doPaint(GC gc) { if (fCanvas.isVisible()) { return; } ILineRange visibleModelLines= computeVisibleModelLines(); if (visibleModelLines == null) return; fSensitiveToTextChanges= isViewerCompletelyShown(); fScrollPos= fCachedTextWidget.getTopPixel(); fRevisionPainter.paint(gc, visibleModelLines); if (!fRevisionPainter.hasInformation()) // don't paint quick diff colors if revisions are painted fDiffPainter.paint(gc, visibleModelLines); }

Target:
private void doPaint(GC gc) { if (!fCanvas.isVisible()) { return; } ILineRange visibleModelLines= computeVisibleModelLines(); if (visibleModelLines == null) return; fSensitiveToTextChanges= isViewerCompletelyShown(); fScrollPos= fCachedTextWidget.getTopPixel(); fRevisionPainter.paint(gc, visibleModelLines); if (!fRevisionPainter.hasInformation()) // don't paint quick diff colors if revisions are painted fDiffPainter.paint(gc, visibleModelLines); }
Source:
protected Object doGetValue() { CapsulePartKindEnum kind = null; setUMLPropertiesValue(); // Define what is the kind of the capsulePart based on the multiplicity and the aggregation value if (capsulePartElement.getLower() == capsulePartElement.getUpper()) { kind = CapsulePartKindEnum.FIXED; } else if (capsulePartElement.getLower() == 0) { if (AggregationKind.COMPOSITE_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.OPTIONAL; } else if (AggregationKind.SHARED_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.PLUGIN; } } return kind; }

Target:
protected Object doGetValue() { CapsulePartKindEnum kind = null; setUMLPropertiesValue(); // Define what is the kind of the capsulePart based on the multiplicity and the aggregation value if (capsulePartElement.getLower() == capsulePartElement.getUpper()) { kind = CapsulePartKindEnum.FIXED; } else if (0 == capsulePartElement.getLower()) { if (AggregationKind.COMPOSITE_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.OPTIONAL; } else if (AggregationKind.SHARED_LITERAL.equals(aggregation)) { kind = CapsulePartKindEnum.PLUGIN; } } return kind; }
Source:
private void updateTaskWithIncomingReviewState(ITask task, boolean hasIncomingReviews) { task.setAttribute(ReviewsCoreConstants.INCOMING_REVIEW_STATE, hasIncomingReviews ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ }

Target:
private void updateTaskWithIncomingReviewState(ITask task, boolean hasIncomingReviews) { task.setAttribute(ReviewsCoreConstants.INCOMING_REVIEW_STATE, Boolean.toString(hasIncomingReviews)); }
Source:
public void testCreateSymlink() throws IOException { FS fs = FS.DETECTED; // show test as ignored if the FS doesn't support symlinks Assume.assumeTrue(fs.supportsSymlinks()); fs.createSymLink(new File(trash, "x"), "y"); assertTrue(fs.supportsSymlinks()); String target = fs.readSymLink(new File(trash, "x")); assertEquals("y", target); }

Target:
public void testCreateSymlink() throws IOException { FS fs = FS.DETECTED; // show test as ignored if the FS doesn't support symlinks Assume.assumeTrue(fs.supportsSymlinks()); fs.createSymLink(new File(trash, "x"), "y"); String target = fs.readSymLink(new File(trash, "x")); assertEquals("y", target); }
Source:
public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; // show test as ignored if the FS doesn't support symlinks Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); assertTrue(fs.supportsSymlinks()); String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }

Target:
public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; // show test as ignored if the FS doesn't support symlinks Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }
Source:
public ITmfStateValue getValue(ITmfEvent event) { if (fStateValue != null) { return fStateValue; } if (fType.equals(TmfXmlStrings.TYPE_NULL)) { return TmfStateValue.nullValue(); } try { return checkNotNull(fXmlStateValue).getValue(event); } catch (AttributeNotFoundException e) { Activator.logError("Failed to get the state value", e); //$NON-NLS-1$ } throw new IllegalStateException("Failed to get the value for the segment field " + fName); //$NON-NLS-1$ }

Target:
public ITmfStateValue getValue(ITmfEvent event) { if (fStateValue != null) { return fStateValue; } try { return checkNotNull(fXmlStateValue).getValue(event); } catch (AttributeNotFoundException e) { Activator.logError("Failed to get the state value", e); //$NON-NLS-1$ } throw new IllegalStateException("Failed to get the value for the segment field " + fName); //$NON-NLS-1$ }
Source:
public void addMouseListener(MouseListener listener) { // only add the mouse listener to the dropdown, as clicking in the text // control should not trigger anything else than it is handled by the // text control itself. if (this.dropdownTableViewer != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }

Target:
public void addMouseListener(MouseListener listener) { // only add the mouse listener to the dropdown, as clicking in the text // control should not trigger anything else than it is handled by the // text control itself. if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }
Source:
public void doLaunch(String programName) throws Exception { setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName); super.doLaunch(); }

Target:
protected void doLaunch(String programName) throws Exception { setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName); super.doLaunch(); }
Source:
public static boolean dialogCancellable(IEditCommandRequest request) { Object value = request.getParameter(RequestParameterConstants.DIALOG_CANCELLABLE); if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { Boolean booleanObject = Boolean.valueOf((String) value); return booleanObject.booleanValue(); } return true; // Default }

Target:
public static boolean dialogCancellable(IEditCommandRequest request) { Object value = request.getParameter(RequestParameterConstants.DIALOG_CANCELLABLE); if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { Boolean booleanObject = Boolean.valueOf((String) value); return booleanObject.booleanValue(); } return false; // Default }
Source:
public void setUp() throws Exception { // Automated Test logFileName = Platform.getInstallLocation().getURL().getPath() + ".." + File.separator + ".." + File.separator + "results" + File.separator + "chkpii"; // A tad bogus but this is where // the build wants to copy the // results from! // Runtime Workbench - TODO Put me back to Automated status // logFileName = "d:\\results"; // sourceDirectoryName = "d:\\sourceFetch"; }

Target:
public void setUp() { // Automated Test logFileName = Platform.getInstallLocation().getURL().getPath() + ".." + File.separator + ".." + File.separator + "results" + File.separator + "chkpii"; // A tad bogus but this is where // the build wants to copy the // results from! // Runtime Workbench - TODO Put me back to Automated status // logFileName = "d:\\results"; // sourceDirectoryName = "d:\\sourceFetch"; }
Source:
public boolean isProviderFor(CSSDiagram diagram) { if(diagram.getElement() instanceof Element){ //Retrieve the UML2 element Element element = (Element)diagram.getElement(); //Introspect its packages to check if SysML profile is applied if (SysMLResource.isSysMLProfileApplied(element)){ return true; } } return false; }

Target:
public boolean isProviderFor(CSSDiagram diagram) { if(diagram.getElement() instanceof Element){ //Retrieve the UML2 element Element element = (Element)diagram.getElement(); //Introspect its packages to check if SysML profile is applied return SysMLResource.isSysMLProfileApplied(element); } return false; }
Source:
public ThreadedHistoryTreeBackendTest(Boolean reOpen) { super(reOpen); }

Target:
public ThreadedHistoryTreeBackendTest(Boolean reOpen) { /* There is no notion of "reopening" for the threaded backend */ super(false); }
Source:
public @NonNull String eventKmemPageAlloc() { return "kmem:page_alloc"; //$NON-NLS-1$ }

Target:
public String eventKmemPageAlloc() { return "kmem:page_alloc"; //$NON-NLS-1$ }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[TimeLineEvent Values=").append(getValues()) //$NON-NLS-1$ .append(", Entry=").append(getEntry()) //$NON-NLS-1$ .append(", fTime=").append(getTime()) //$NON-NLS-1$ .append(", Duration=").append(getDuration()) //$NON-NLS-1$ .append(']'); return builder.toString(); }

Target:
public String toString() { return new StringBuilder().append("[TimeLineEvent Values=").append(getValues()) //$NON-NLS-1$ .append(", Entry=").append(getEntry()) //$NON-NLS-1$ .append(", fTime=").append(getTime()) //$NON-NLS-1$ .append(", Duration=").append(getDuration()) //$NON-NLS-1$ .append(']').toString(); }
Source:
public String getLabel() { String label = fLabel; if (label == null) { StringJoiner sj = new StringJoiner(", "); //$NON-NLS-1$ getValues().forEach((Long value) -> sj.add(NumberFormat.getNumberInstance(Locale.getDefault()).format(value))); label = sj.toString(); fLabel = label; } return label; }

Target:
public String getLabel() { String label = fLabel; if (label == null) { StringJoiner sj = new StringJoiner(", "); //$NON-NLS-1$ getValues().forEach((Long value) -> sj.add(value == null ? String.valueOf(value) : NumberFormat.getNumberInstance(Locale.getDefault()).format(value))); label = sj.toString(); fLabel = label; } return label; }
Source:
private void gtk_swt_set_border_color (GdkColor color) { //Convert GtkColor to GdkRGBA //TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code. GdkRGBA rgba = null; if (color != null) { rgba = new GdkRGBA (); rgba = display.toGdkRGBA (color); } //Construct CSS String //TODO : Reactor in future commit. // This and Control:setBackgroundColorGradient(..). as there is similar code. // ideally we should have a 'constructCssString(..) that accepts attribute-value pairs. String css_string = "* {\n"; if (rgba != null) { String css_color = gtk_rgba_to_css_string (rgba); css_string += "border-color: " + css_color + ";\n"; } css_string += "}\n"; //Apply CSS to widget. long /*int*/context = OS.gtk_widget_get_style_context (handle); gtk_css_provider_load_from_css (context, css_string); }

Target:
private void gtk_swt_set_border_color (GdkColor color) { //Convert GtkColor to GdkRGBA //TODO : Reactor in future commit. This and widget:setForegroundColor have duplicate code. GdkRGBA rgba = null; if (color != null) { rgba = display.toGdkRGBA (color); } //Construct CSS String //TODO : Reactor in future commit. // This and Control:setBackgroundColorGradient(..). as there is similar code. // ideally we should have a 'constructCssString(..) that accepts attribute-value pairs. String css_string = "* {\n"; if (rgba != null) { String css_color = gtk_rgba_to_css_string (rgba); css_string += "border-color: " + css_color + ";\n"; } css_string += "}\n"; //Apply CSS to widget. long /*int*/context = OS.gtk_widget_get_style_context (handle); gtk_css_provider_load_from_css (context, css_string); }
Source:
private static TmfTreeViewerEntry createTraceEntry(ITmfTrace trace) { TmfTreeViewerEntry traceEntry = new TmfTreeViewerEntry(trace.getName()); Iterable<ITmfAnalysisModuleWithStateSystems> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class); for (ITmfAnalysisModuleWithStateSystems module : modules) { /* Just schedule the module, the data will be filled when available */ module.schedule(); if (!module.waitForInitialization()) { return traceEntry; } for (ITmfStateSystem ss : module.getStateSystems()) { traceEntry.addChild(new StateSystemEntry(ss)); } } return traceEntry; }

Target:
private static TmfTreeViewerEntry createTraceEntry(ITmfTrace trace) { TmfTreeViewerEntry traceEntry = new TmfTreeViewerEntry(trace.getName()); Iterable<ITmfAnalysisModuleWithStateSystems> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class); for (ITmfAnalysisModuleWithStateSystems module : modules) { /* Just schedule the module, the data will be filled when available */ module.schedule(); if (!module.waitForInitialization()) { continue; } for (ITmfStateSystem ss : module.getStateSystems()) { traceEntry.addChild(new StateSystemEntry(ss)); } } return traceEntry; }
Source:
public @NonNull String getSymbolText(long address) { if ((address & (0xFFFFFFFF << 32)) != 0) { return String.format("%08x", address); //$NON-NLS-1$ } return String.format("%016x", address); //$NON-NLS-1$ }

Target:
public @NonNull String getSymbolText(long address) { if ((address & (0xFFFFFFFF << 32)) == 0) { return String.format("%08x", address); //$NON-NLS-1$ } return String.format("%016x", address); //$NON-NLS-1$ }
Source:
protected void parseReverseMethod(String output) { if (output.toString().contains("Processor")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.toString().contains("Branch")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.toString().contains("full")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }

Target:
protected void parseReverseMethod(String output) { if (output.contains("Processor")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.PROCESSOR_TRACE; } else if (output.contains("Branch")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.BRANCH_TRACE; } else if (output.contains("full")) { //$NON-NLS-1$ fReverseMethod = ReverseTraceMethod.FULL_TRACE; } else { fReverseMethod = ReverseTraceMethod.STOP_TRACE; } }
Source:
public Iterable<ITmfEventAspect> getEventAspects() { ImmutableSet.Builder<ITmfEventAspect> builder = ImmutableSet.builder(); builder.addAll(super.getEventAspects()); builder.add(KernelTidAspect.INSTANCE); builder.add(ThreadPriorityAspect.INSTANCE); return NonNullUtils.checkNotNull(builder.build()); }

Target:
public Iterable<ITmfEventAspect> getEventAspects() { /* * This method needs to fill the aspects dynamically because aspects in * the parent class are not all present at the beginning of the trace */ ImmutableSet.Builder<ITmfEventAspect> builder = ImmutableSet.builder(); builder.addAll(super.getEventAspects()); builder.add(KernelTidAspect.INSTANCE); builder.add(ThreadPriorityAspect.INSTANCE); return builder.build(); }
Source:
protected MasterObjectAxisProvider getMasterObjectAxisProvider(final TableConfiguration configuration) { MasterObjectAxisProvider master = null; // Try to get an existing master axis provider if (0 < configuration.getRowAxisProviders().size()) { final Iterator<AbstractAxisProvider> rowAxisProvidersIterator = configuration.getRowAxisProviders().iterator(); while (rowAxisProvidersIterator.hasNext() && null == master) { AbstractAxisProvider axisProvider = rowAxisProvidersIterator.next(); if (axisProvider instanceof MasterObjectAxisProvider) { master = (MasterObjectAxisProvider) axisProvider; } } } return master; }

Target:
protected MasterObjectAxisProvider getMasterObjectAxisProvider(final TableConfiguration configuration) { MasterObjectAxisProvider master = null; // Try to get an existing master axis provider if (0 < configuration.getRowAxisProviders().size()) { final Iterator<AbstractAxisProvider> rowAxisProvidersIterator = configuration.getRowAxisProviders().iterator(); while (rowAxisProvidersIterator.hasNext() && null == master) { final AbstractAxisProvider axisProvider = rowAxisProvidersIterator.next(); if (axisProvider instanceof MasterObjectAxisProvider) { master = (MasterObjectAxisProvider) axisProvider; } } } return master; }