auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Frame decode() { if (headerCnt < HEADER_SIZE) { int headerCount = read(header, headerCnt, HEADER_SIZE - headerCnt); if (headerCount == 0) { return null; } headerCnt += headerCount; if (headerCnt < HEADER_SIZE) <START> return null; <END> streamType = streamType(header[0]); if (streamType.equals(StreamType.RAW)) { return new Frame(streamType, header); } } if (streamType.equals(StreamType.RAW)) { if (payloadCnt == 0) payload = new byte[rawBuffer.readableBytes()]; int count = read(payload, payloadCnt, rawBuffer.readableBytes()); if (count == 0) return null; payloadCnt = 0; return new Frame(StreamType.RAW, payload); } else { int payloadSize = ((header[4] & 0xff) << 24) + ((header[5] & 0xff) << 16) + ((header[6] & 0xff) << 8) + (header[7] & 0xff); if (payloadCnt == 0) payload = new byte[payloadSize]; int count = read(payload, payloadCnt, payloadSize - payloadCnt); if (count == 0) return null; payloadCnt += count; if (payloadCnt < payloadSize) return null; headerCnt = 0; payloadCnt = 0; return new Frame(streamType, payload); } }</code><technical_language>please wrap if placing body new line</technical_language>

Target:
private Frame decode() { if (headerCnt < HEADER_SIZE) { int headerCount = read(header, headerCnt, HEADER_SIZE - headerCnt); if (headerCount == 0) { return null; } headerCnt += headerCount; if (headerCnt < HEADER_SIZE) { return null; } streamType = streamType(header[0]); if (streamType.equals(StreamType.RAW)) { return new Frame(streamType, header); } } if (streamType.equals(StreamType.RAW)) { if (payloadCnt == 0) payload = new byte[rawBuffer.readableBytes()]; int count = read(payload, payloadCnt, rawBuffer.readableBytes()); if (count == 0) { return null; } payloadCnt = 0; return new Frame(StreamType.RAW, payload); } else { int payloadSize = ((header[4] & 0xff) << 24) + ((header[5] & 0xff) << 16) + ((header[6] & 0xff) << 8) + (header[7] & 0xff); if (payloadCnt == 0) { payload = new byte[payloadSize]; } int count = read(payload, payloadCnt, payloadSize - payloadCnt); if (count == 0) { return null; } payloadCnt += count; if (payloadCnt < payloadSize) { return null; } headerCnt = 0; payloadCnt = 0; return new Frame(streamType, payload); } }
Source:
<code>public void start() throws IOException { <START> if (server != null) { <END> server.start(); } }</code><technical_language>nan</technical_language>

Target:
public void start() throws IOException { server.start(); }
Source:
<code>private static void setInfoIncoming(OSCoreCtx oscoreCtx, Message message) { if (message.getSourceContext() instanceof MapBasedEndpointContext == false) { return; } MapBasedEndpointContext endpointContext = (MapBasedEndpointContext) message.getSourceContext(); MapBasedEndpointContext newEndpointContext = setInfo(oscoreCtx, endpointContext); <START> message.setSourceContext(newEndpointContext); <END> }</code><technical_language>Consider use: EndpointContext newEndpointContext = setInfo(oscoreCtx, message.getSourceContext()); message.setSourceContext(newEndpointContext); do it. cast "instanceof" check</technical_language>

Target:
private static void setInfoIncoming(OSCoreCtx oscoreCtx, Message message) { EndpointContext newEndpointContext = setInfo(oscoreCtx, message.getSourceContext()); message.setSourceContext(newEndpointContext); }
Source:
<code><START> public QuotaTypes(Integer quotaType, String name, String unit, String description) { <END> this.quotaType = quotaType; this.description = description; this.quotaName = name; this.quotaUnit = unit; this.discriminator = "None"; }</code><technical_language>user of this class able instantiate it? this constructor private</technical_language>

Target:
private QuotaTypes(Integer quotaType, String name, String unit, String description) { this.quotaType = quotaType; this.description = description; this.quotaName = name; this.quotaUnit = unit; this.discriminator = "None"; }
Source:
<code>public void work() { <START> log.warn(getTitle() + " is running"); <END> if (veryLongString.length() != size) { throw new IllegalStateException("Invalid string size: " + veryLongString.length() + " instead of: " + size); } }</code><technical_language>debug, want pollute test output</technical_language>

Target:
public void work() { log.debug(getTitle() + " is running"); if (veryLongString.length() != size) { throw new IllegalStateException("Invalid string size: " + veryLongString.length() + " instead of: " + size); } }
Source:
<code>public DeviceModel(final Manufacturer manufacturer, final String code, final String name) { <START> super(); <END> this.manufacturer = manufacturer; this.code = code; this.name = name; }</code><technical_language>call super() is unnecessary</technical_language>

Target:
public DeviceModel(final Manufacturer manufacturer, final String code, final String name) { this.manufacturer = manufacturer; this.code = code; this.name = name; }
Source:
<code>private boolean removeVmsInPool() { <START> VdcReturnValueBase result; <END> for (VM vm : getVmsInPool()) { RemoveVmFromPoolParameters removeVmFromPoolParameters = new RemoveVmFromPoolParameters(vm.getId()); removeVmFromPoolParameters.setTransactionScopeOption(TransactionScopeOption.Suppress); result = runInternalActionWithTasksContext( VdcActionType.RemoveVmFromPool, removeVmFromPoolParameters); if (!result.getSucceeded()) { return false; } result = runInternalAction( VdcActionType.RemoveVm, withRootCommandInfo(new RemoveVmParameters(vm.getId(), false), getActionType()), createRemoveVmStepContext(vm)); if (!result.getSucceeded()) { return false; } } return true; }</code><technical_language>please declare in #163</technical_language>

Target:
private boolean removeVmsInPool() { for (VM vm : getCachedVmsInPool()) { RemoveVmFromPoolParameters removeVmFromPoolParameters = new RemoveVmFromPoolParameters(vm.getId()); removeVmFromPoolParameters.setTransactionScopeOption(TransactionScopeOption.Suppress); VdcReturnValueBase result = runInternalActionWithTasksContext( VdcActionType.RemoveVmFromPool, removeVmFromPoolParameters); if (!result.getSucceeded()) { return false; } result = runInternalAction( VdcActionType.RemoveVm, withRootCommandInfo(new RemoveVmParameters(vm.getId(), false), getActionType()), createRemoveVmStepContext(vm)); if (!result.getSucceeded()) { return false; } } return true; }
Source:
<code>public void deleteGroupTest() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); Group parentGroup = null; try { context.turnOffAuthorisationSystem(); <START> parentGroup = groupService.create(context); <END> context.commit(); parentGroup = context.reloadEntity(parentGroup); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isNoContent()); getClient(authToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isNotFound()); } finally { if (parentGroup != null) { GroupBuilder.deleteGroup(parentGroup.getID()); } } }</code><technical_language>GroupBuilder.createGroup() method create *all Groups* in tests. automatically cleaned test completes. In other words, longer need *any* of finally clauses in of tests created, long GroupBuilder test utility</technical_language>

Target:
public void deleteGroupTest() throws Exception { context.turnOffAuthorisationSystem(); Group parentGroup = GroupBuilder.createGroup(context) .withName("test group") .build(); context.restoreAuthSystemState(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isOk()); getClient(authToken).perform( delete("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isNoContent()); getClient(authToken).perform( get("/api/eperson/groups/" + parentGroup.getID()) ).andExpect(status().isNotFound()); }
Source:
<code><START> public void getActivity_shouldCreateIntentForActivity() throws Exception { <END> Intent intent = new Intent(); PendingIntent pendingIntent = PendingIntent.getActivity(RuntimeEnvironment.application, 99, intent, 100); ShadowPendingIntent shadow = shadowOf(pendingIntent); assertThat(shadow.isActivityIntent()).isTrue(); assertThat(shadow.isBroadcastIntent()).isFalse(); assertThat(shadow.isServiceIntent()).isFalse(); assertThat((Context) RuntimeEnvironment.application).isEqualTo(shadow.getSavedContext()); assertThat(shadow.getRequestCode()).isEqualTo(99); assertThat(shadow.getFlags()).isEqualTo(100); }</code><technical_language>Instead of removing assertion, add action intent compare action</technical_language>

Target:
public void getActivity_shouldCreateIntentForActivity() throws Exception { Intent intent = new Intent("ACTION"); PendingIntent pendingIntent = PendingIntent.getActivity(RuntimeEnvironment.application, 99, intent, 100); ShadowPendingIntent shadow = shadowOf(pendingIntent); assertThat(shadow.isActivityIntent()).isTrue(); assertThat(shadow.isBroadcastIntent()).isFalse(); assertThat(shadow.isServiceIntent()).isFalse(); assertThat(shadow.getSavedIntent().filterEquals(intent)).isTrue(); assertThat((Context) RuntimeEnvironment.application).isEqualTo(shadow.getSavedContext()); assertThat(shadow.getRequestCode()).isEqualTo(99); assertThat(shadow.getFlags()).isEqualTo(100); }
Source:
<code>public synchronized void terminateTest(String testID) { logger.info("terminateTest: " + testID); try { BenchFlowTestState testState = testModelDAO.getTestState(testID); switch (testState) { case READY: readyQueue.remove(testID); <START> testModelDAO.setTestState(testID, BenchFlowTestState.TERMINATED); <END> testModelDAO.setTestTerminatedState(testID, TestTerminatedState.PARTIALLY_COMPLETE); handleTestState(testID); break; case WAITING: case START: testModelDAO.setTestState(testID, BenchFlowTestState.TERMINATED); testModelDAO.setTestTerminatedState(testID, TestTerminatedState.PARTIALLY_COMPLETE); handleTestState(testID); break; case RUNNING: TestRunningState runningState = testModelDAO.getTestRunningState(testID); testModelDAO.setTestState(testID, BenchFlowTestState.TERMINATED); testModelDAO.setTestTerminatedState(testID, TestTerminatedState.PARTIALLY_COMPLETE); Future runningTaskFuture = testTasks.get(testID); if (runningTaskFuture != null) { try { runningTaskFuture.get(); } catch (InterruptedException | ExecutionException e) { } } if (runningState == HANDLE_EXPERIMENT_RESULT || runningState == DETERMINE_EXECUTE_VALIDATION_SET) { AbortRunningTestTask abortRunningTestTask = new AbortRunningTestTask(testID); Future abortRunningTestTaskFuture = taskExecutorService.submit(abortRunningTestTask); try { abortRunningTestTaskFuture.get(); } catch (InterruptedException | ExecutionException e) { } } handleTestState(testID); break; case TERMINATED: break; default: break; } } catch (BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }</code><technical_language>method calls refactored in a method, for cases</technical_language>

Target:
public void terminateTest(String testID) { logger.info("terminateTest: " + testID); try { BenchFlowTestState testState = testModelDAO.getTestState(testID); logger.info("Current status: " + testState); switch (testState) { case READY: readyQueue.remove(testID); cancelTask(testID); break; case WAITING: case START: cancelTask(testID); break; case RUNNING: TestRunningState runningState = testModelDAO.getTestRunningState(testID); cancelTask(testID); if (runningState == HANDLE_EXPERIMENT_RESULT || runningState == DETERMINE_EXECUTE_VALIDATION_SET) { logger.info("Need to execute AbortRunningTask"); AbortRunningTestTask abortRunningTestTask = new AbortRunningTestTask(testID); Future abortRunningTestTaskFuture = taskExecutorService.submit(abortRunningTestTask); try { abortRunningTestTaskFuture.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } break; case TERMINATED: break; default: break; } } catch (BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }
Source:
<code>public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { <START> for (TraceTypeHelper helper : TmfTraceType.getInstance().getTraceTypeHelpers()) { <END> if (appliesToTraceType(helper.getTraceClass())) { try { return newModule(helper.getTrace()).getAnalysisRequirements(); } catch (TmfAnalysisException e) { Activator.logError("Error in get analysis requirements", e); } } } return new ArrayList<>(); }</code><technical_language>If this analysis applies more trace types, return list of requirements for encountered (which is ok in default form, do want merge requirements for trace types). this method receive a trace type parameter? do think? is easy do, is ok for (since analysis apply 1 trace type anyway). mention in a TODO. aware of it, implement for lack of time</technical_language>

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { for (TraceTypeHelper helper : TmfTraceType.getInstance().getTraceTypeHelpers()) { if (appliesToTraceType(helper.getTraceClass())) { try { return newModule(helper.getTrace()).getAnalysisRequirements(); } catch (TmfAnalysisException e) { Activator.logError("Error in get analysis requirements", e); } } } return Collections.EMPTY_SET; }
Source:
<code>public ImapFuture<ImapAsyncResponse> terminateCommand(@Nonnull final ImapRequest command) throws ImapAsyncClientException { if (requestsQueue.isEmpty()) { throw new ImapAsyncClientException(FailureType.COMMAND_NOT_ALLOWED); } final ImapCommandEntry entry = requestsQueue.peek(); if (isDebugEnabled()) { <START> logger.debug(CLIENT_LOG_REC, sessionId, command.getLogLine()); <END> } sendRequest(entry.getRequest().getTerminateCommandLine()); return entry.getFuture(); }</code><technical_language>this work logger.debug log if logger.isdebugenabled is true, please test</technical_language>

Target:
public ImapFuture<ImapAsyncResponse> terminateCommand(@Nonnull final ImapRequest command) throws ImapAsyncClientException { if (requestsQueue.isEmpty()) { throw new ImapAsyncClientException(FailureType.COMMAND_NOT_ALLOWED); } final ImapCommandEntry entry = requestsQueue.peek(); sendRequest(entry.getRequest().getTerminateCommandLine(), command.isCommandLineDataSensitive()); return entry.getFuture(); }
Source:
<code><START> public boolean verifyAndSetPolicyFromConf(AllocationConfiguration queueConf) { <END> SchedulingPolicy policy = queueConf.getSchedulingPolicy(getName()); for (FSQueue child : getChildQueues()) { if (!policy.isChildPolicyAllowed( queueConf.getSchedulingPolicy(child.getName()))) { return false; } boolean success = child.verifyAndSetPolicyFromConf(queueConf); if (!success) { return false; } } setPolicy(policy); return true; }</code><technical_language>worthwhile point out intended caller for this method</technical_language>

Target:
public boolean verifyAndSetPolicyFromConf(AllocationConfiguration queueConf) { SchedulingPolicy queuePolicy = queueConf.getSchedulingPolicy(getName()); for (FSQueue child : getChildQueues()) { if (!queuePolicy.isChildPolicyAllowed( queueConf.getSchedulingPolicy(child.getName()))) { return false; } boolean success = child.verifyAndSetPolicyFromConf(queueConf); if (!success) { return false; } } setPolicy(queuePolicy); return true; }
Source:
<code>public void testConstantQuery() throws Exception { <START> int expectedGeneratedSplits = 1; <END> int expectedEvents = 1 + 1 + expectedGeneratedSplits; runQueryAndWaitForEvents("SELECT 1", expectedEvents); QueryCreatedEvent queryCreatedEvent = getOnlyElement(generatedEvents.getQueryCreatedEvents()); assertEquals(queryCreatedEvent.getContext().getServerVersion(), "testversion"); assertEquals(queryCreatedEvent.getContext().getServerAddress(), "127.0.0.1"); assertEquals(queryCreatedEvent.getContext().getEnvironment(), "testing"); assertEquals(queryCreatedEvent.getContext().getClientInfo().get(), "{\"clientVersion\":\"testVersion\"}"); assertEquals(queryCreatedEvent.getMetadata().getQuery(), "SELECT 1"); QueryCompletedEvent queryCompletedEvent = getOnlyElement(generatedEvents.getQueryCompletedEvents()); assertTrue(queryCompletedEvent.getContext().getResourceGroupName().isPresent()); assertEquals(queryCompletedEvent.getContext().getResourceGroupName().get(), "global.user-user"); assertEquals(queryCompletedEvent.getStatistics().getTotalRows(), 0L); assertEquals(queryCompletedEvent.getContext().getClientInfo().get(), "{\"clientVersion\":\"testVersion\"}"); assertEquals(queryCreatedEvent.getMetadata().getQueryId(), queryCompletedEvent.getMetadata().getQueryId()); List<SplitCompletedEvent> splitCompletedEvents = generatedEvents.getSplitCompletedEvents(); assertEquals(splitCompletedEvents.get(0).getQueryId(), queryCompletedEvent.getMetadata().getQueryId()); assertEquals(splitCompletedEvents.get(0).getStatistics().getCompletedPositions(), 1); }</code><technical_language>call expectedSplits</technical_language>

Target:
public void testConstantQuery() throws Exception { int expectedSplits = 2; int expectedEvents = 1 + 1 + expectedSplits; runQueryAndWaitForEvents("SELECT 1", expectedEvents); QueryCreatedEvent queryCreatedEvent = getOnlyElement(generatedEvents.getQueryCreatedEvents()); assertEquals(queryCreatedEvent.getContext().getServerVersion(), "testversion"); assertEquals(queryCreatedEvent.getContext().getServerAddress(), "127.0.0.1"); assertEquals(queryCreatedEvent.getContext().getEnvironment(), "testing"); assertEquals(queryCreatedEvent.getContext().getClientInfo().get(), "{\"clientVersion\":\"testVersion\"}"); assertEquals(queryCreatedEvent.getMetadata().getQuery(), "SELECT 1"); QueryCompletedEvent queryCompletedEvent = getOnlyElement(generatedEvents.getQueryCompletedEvents()); assertTrue(queryCompletedEvent.getContext().getResourceGroupName().isPresent()); assertEquals(queryCompletedEvent.getContext().getResourceGroupName().get(), "global.user-user"); assertEquals(queryCompletedEvent.getStatistics().getTotalRows(), 0L); assertEquals(queryCompletedEvent.getContext().getClientInfo().get(), "{\"clientVersion\":\"testVersion\"}"); assertEquals(queryCreatedEvent.getMetadata().getQueryId(), queryCompletedEvent.getMetadata().getQueryId()); List<SplitCompletedEvent> splitCompletedEvents = generatedEvents.getSplitCompletedEvents(); assertEquals(splitCompletedEvents.get(0).getQueryId(), queryCompletedEvent.getMetadata().getQueryId()); assertEquals(splitCompletedEvents.get(0).getStatistics().getCompletedPositions(), 1); }
Source:
<code>public IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot( int slotIndex, String callingPackage, String aid, int p2) { enforceModifyPermission(); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); if (DBG) { log("iccOpenLogicalChannelBySlot: slot=" + slotIndex + " aid=" + aid + " p2=" + p2); } return <START> iccOpenLogicalChannelWithPermission(slotIndex, callingPackage, <END> aid, p2); }</code><technical_language>This is logical slot, private method passing expects a logical slot index. applies other APIs well</technical_language>

Target:
public IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot( int slotIndex, String callingPackage, String aid, int p2) { enforceModifyPermission(); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); if (DBG) { log("iccOpenLogicalChannelBySlot: slot=" + slotIndex + " aid=" + aid + " p2=" + p2); } return iccOpenLogicalChannelWithPermission(getPhoneIdFromSlotIdOrThrowException(slotIndex), callingPackage, aid, p2); }
Source:
<code>protected void executeCommand() { ResumeGeoRepGlusterVolumeParameters parameters = getParameters(); setGlusterVolumeId(parameters.getVolumeId()); <START> VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResumeGeoRepGlusterVolume, new GlusterVolumeResumeGeoRepVDSParameters(upServer.getId(), getGlusterVolumeName(), parameters.getSlaveHostName(), parameters.getSlaveVolumeName(), parameters.isForce())); <END> setSucceeded(returnValue.getSucceeded()); if(!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, returnValue.getVdsError().getMessage()); return; } }</code><technical_language>resume a session, passing a geo-rep session Id. volumeName, slaveHostName, slaveVolumeName retrieved Db for sessionId</technical_language>

Target:
protected void executeCommand() { GlusterVolumeGeoRepSessionParameters parameters = getParameters(); setGlusterVolumeId(parameters.getVolumeId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResumeGeoRepSession, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), parameters.getSlaveHost(), parameters.getSlaveVolumeName(), parameters.isForce())); setSucceeded(returnValue.getSucceeded()); if(!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED, returnValue.getVdsError().getMessage()); return; } else { getGeoRepSession().setStatus(GeoRepSessionStatus.ACTIVE); getGlusterGeoRepDao().updateSession(getGeoRepSession()); } }
Source:
<code>public Date getLastAlignmentScan() { <START> return lastAlignmentScan; <END> }</code><technical_language>Date is mutable, providing a reference calss's member. This cloned (or unixtime instead)</technical_language>

Target:
public Date getLastAlignmentScan() { return (Date) lastAlignmentScan.clone(); }
Source:
<code>private void add(EPackage ePackage) { if (ePackage!=null) { <START> URI uri = EcoreUtil.getURI(ePackage); <END> if(ePackage.getNsURI() != null){ if (!packageURIs.contains(uri)) { packageURIs.add(uri); listWidget.add(ePackage.getNsURI()); setPageComplete(true); getContainer().updateButtons(); } } else{ MessageDialog.openError(getShell(), "No 'Ns URI' set", "The EPackage you selected has no 'Ns URI' set! This is a general EMF requirement."); setPageComplete(false); getContainer().updateButtons(); } } }</code><technical_language>Move this ePackage.getNsUri() check</technical_language>

Target:
private void add(EPackage ePackage) { if (ePackage!=null) { String nsURI = ePackage.getNsURI(); if(nsURI != null && !nsURI.trim().isEmpty()){ URI uri = EcoreUtil.getURI(ePackage); if (!packageURIs.contains(uri)) { packageURIs.add(uri); listWidget.add(ePackage.getNsURI()); setPageComplete(true); getContainer().updateButtons(); } } else{ MessageDialog.openError(getShell(), "No 'Ns URI' set", "The EPackage you selected has no 'Ns URI' set! This is a general EMF requirement."); setPageComplete(false); getContainer().updateButtons(); } } }
Source:
<code><START> private void followUser() { <END> ViewUtils.setGone(loadingBar, false); setGone(true); new FollowUserTask(this, user.getLogin()) { @Override protected void onSuccess(User fullUser) throws Exception { super.onSuccess(fullUser); isFollowing = !isFollowing; user = fullUser; ViewUtils.setGone(loadingBar, true); setGone(false); } @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); ToastUtils.show(UserViewActivity.this, string.error_following_person); ViewUtils.setGone(loadingBar, true); } }.execute(); }</code><technical_language>This done a progress dialog instead of showing entire activity loading. do extending ProgressDialogTask in FollowUserTask class</technical_language>

Target:
private void followUser() { new FollowUserTask(this, user.getLogin(), isFollowing) { @Override protected void onSuccess(User fullUser) throws Exception { super.onSuccess(fullUser); isFollowing = !isFollowing; user = fullUser; } @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); ToastUtils.show(UserViewActivity.this, string.error_following_person); ViewUtils.setGone(loadingBar, true); } }.start(); }
Source:
<code>public void performMigration(String workspaceProjectsRootFolder) { Map<String, String> workspaceName2id = getId2NameWorkspaceMapping(); for (Entry<String, String> entry : workspaceName2id.entrySet()) { Path workspaceStoredByNameLocation = Paths.get(workspaceProjectsRootFolder).resolve(entry.getValue()); if (!Files.exists(workspaceStoredByNameLocation)) { continue; } LOG.info( "Performing migration of workspace with id '{}' and name '{}'", entry.getKey(), entry.getValue()); Path workspaceStoredByIdLocation = Paths.get(workspaceProjectsRootFolder).resolve(entry.getKey()); try { Files.move( workspaceStoredByNameLocation, workspaceStoredByIdLocation, StandardCopyOption.ATOMIC_MOVE); <START> LOG.info( <END> "Successfully migrated projects of workspace with id '{}' and name '{}'", entry.getKey(), entry.getValue()); } catch (IOException e) { LOG.error( "Failed to migrate projects of workspace with id '{}' and name '{}'", entry.getKey(), entry.getValue()); } } }</code><technical_language>change info level debug</technical_language>

Target:
public void performMigration(String workspaceProjectsRootFolder) { LOG.info("Starting migration of workspace project files"); Map<String, String> workspaceName2id = getId2NameWorkspaceMapping(); for (Entry<String, String> entry : workspaceName2id.entrySet()) { Path workspaceStoredByNameLocation = Paths.get(workspaceProjectsRootFolder).resolve(entry.getValue()); if (!Files.exists(workspaceStoredByNameLocation)) { continue; } Path workspaceStoredByIdLocation = Paths.get(workspaceProjectsRootFolder).resolve(entry.getKey()); try { Files.move( workspaceStoredByNameLocation, workspaceStoredByIdLocation, StandardCopyOption.ATOMIC_MOVE); LOG.info( "Successfully migrated projects of workspace with id '{}' and name '{}'", entry.getKey(), entry.getValue()); } catch (IOException e) { LOG.error( "Failed to migrate projects of workspace with id '{}' and name '{}'", entry.getKey(), entry.getValue()); } } }
Source:
<code>public void qosOnInterface() { Network network = createNetwork(null); VdsNetworkInterface iface = createNic("eth0", null, null, network.getName()); NetworkQoS qos = createQos(); <START> when(qosDao.get(any(Guid.class))).thenReturn(qos); <END> iface.setQosOverridden(true); qos(network, iface, null, true); }</code><technical_language>do expect this called if QoS is overridden</technical_language>

Target:
public void qosOnInterface() { Network network = createNetwork(null); VdsNetworkInterface iface = createNic("eth0", null, null, network.getName()); NetworkQoS qos = createQos(); iface.setQos(qos); iface.setQosOverridden(true); when(qosDao.get(any(Guid.class))).thenReturn(createQos()); qos(network, iface, qos, true); }
Source:
<code>private void checkIfDiscussionsBlackedOut() { createNewPostLayout.setVisibility(View.GONE); discussionService.getCourseDiscussionInfo(courseData.getCourse().getId()) <START> .enqueue(new ErrorHandlingCallback<CourseDiscussionInfo>(getContext(), null, null) { <END> @Override public void onFailure(@NonNull Call<CourseDiscussionInfo> call, @NonNull Throwable t) { markAsBlackedOut(false); } @Override protected void onResponse(@NonNull CourseDiscussionInfo discussionInfo) { final Date today = new Date(); final List<TimePeriod> blackoutTimesList = discussionInfo.getBlackoutList(); for (TimePeriod timePeriod : blackoutTimesList) { if (today.after(timePeriod.getStart()) && today.before(timePeriod.getEnd())) { markAsBlackedOut(true); return; } } markAsBlackedOut(false); } private void markAsBlackedOut(boolean isBlackedOut) { courseData.setDiscussionBlackedOut(isBlackedOut); createNewPostLayout.setEnabled(!isBlackedOut); createNewPostLayout.setVisibility(View.VISIBLE); } }); }</code><technical_language>constructor passing null for code clarity</technical_language>

Target:
private void checkIfDiscussionsBlackedOut() { createNewPostLayout.setVisibility(View.GONE); discussionService.getCourseDiscussionInfo(courseData.getCourse().getId()) .enqueue(new ErrorHandlingCallback<CourseDiscussionInfo>(getContext(), (TaskProgressCallback) null) { @Override public void onFailure(@NonNull Call<CourseDiscussionInfo> call, @NonNull Throwable t) { markAsBlackedOut(false); } @Override protected void onResponse(@NonNull CourseDiscussionInfo discussionInfo) { final Date today = new Date(); final List<TimePeriod> blackoutTimesList = discussionInfo.getBlackoutList(); for (TimePeriod timePeriod : blackoutTimesList) { if (today.after(timePeriod.getStart()) && today.before(timePeriod.getEnd())) { markAsBlackedOut(true); return; } } markAsBlackedOut(false); } private void markAsBlackedOut(boolean isBlackedOut) { courseData.setDiscussionBlackedOut(isBlackedOut); createNewPostLayout.setEnabled(!isBlackedOut); createNewPostLayout.setVisibility(View.VISIBLE); } }); }
Source:
<code>private void validateTsPayloads(List<IkePayload> reqPayloads, List<IkePayload> respPayloads) throws TsUnacceptableException { for (int tsType : <START> new int[] { IkePayload.PAYLOAD_TYPE_TS_INITIATOR, IkePayload.PAYLOAD_TYPE_TS_RESPONDER }) { <END> IkeTsPayload reqPayload = IkePayload.getPayloadForTypeInProvidedList( tsType, IkeTsPayload.class, reqPayloads); IkeTsPayload respPayload = IkePayload.getPayloadForTypeInProvidedList( tsType, IkeTsPayload.class, respPayloads); if (!reqPayload.contains(respPayload)) { throw new TsUnacceptableException(); } } }</code><technical_language>Nit: Suggest move a separate line, more readable</technical_language>

Target:
private void validateTsPayloads(List<IkePayload> reqPayloads, List<IkePayload> respPayloads) throws TsUnacceptableException { for (int tsType : new int[] {PAYLOAD_TYPE_TS_INITIATOR, PAYLOAD_TYPE_TS_RESPONDER}) { IkeTsPayload reqPayload = IkePayload.getPayloadForTypeInProvidedList( tsType, IkeTsPayload.class, reqPayloads); IkeTsPayload respPayload = IkePayload.getPayloadForTypeInProvidedList( tsType, IkeTsPayload.class, respPayloads); if (!reqPayload.contains(respPayload)) { throw new TsUnacceptableException(); } } }
Source:
<code>public void postCollectionAdminGroupCreateAdminGroupSuccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isCreated()) .andDo(result -> idRef .set(UUID.fromString(read(result.getResponse().getContentAsString(), "$.id"))) ); Group adminGroup = groupService.find(context, idRef.get()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(adminGroup.getID(), adminGroup.getName()))); <START> <END> }</code><technical_language>this group deleted in a finally block</technical_language>

Target:
public void postCollectionAdminGroupCreateAdminGroupSuccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isCreated()) .andDo(result -> idRef .set(UUID.fromString(read(result.getResponse().getContentAsString(), "$.id"))) ); Group adminGroup = groupService.find(context, idRef.get()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(adminGroup.getID(), adminGroup.getName()))); }
Source:
<code>public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .subscriptionKey("<replace-with-your-text-analytics-key-here>") .endpoint("<replace-with-your-text-analytics-endpoint-here>") .buildAsyncClient(); String text = "The hotel was dark and unclean."; client.analyzeSentiment(text).subscribe( result -> { final TextSentiment documentSentiment = result.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); <START> final List<TextSentiment> sentiments = result.getSentenceSentiments(); <END> for (TextSentiment textSentiment : sentiments) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }, error -> System.err.println("There was an error analyzing sentiment of the text." + error), () -> System.out.println("Sentiment analyzed.")); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }</code><technical_language>need allocate a variable for this. for (TextSentiment textSentiment : result.getSentenceSentiments()) { work reference once</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .subscriptionKey("{subscription_key}") .endpoint("https://{servicename}.cognitiveservices.azure.com/") .buildAsyncClient(); String text = "The hotel was dark and unclean."; client.analyzeSentiment(text).subscribe( result -> { final TextSentiment documentSentiment = result.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); for (TextSentiment textSentiment : result.getSentenceSentiments()) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }, error -> System.err.println("There was an error analyzing sentiment of the text." + error), () -> System.out.println("Sentiment analyzed.")); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }
Source:
<code>public void removeAllGroupResourceAttributes(PerunSession sess, Resource resource) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { <START> List<Group> groups = this.perunBl.getResourcesManagerBl().getAssignedGroups(sess, resource); <END> List<Attribute> attrs = new ArrayList<>(); for (Group group : groups) { this.getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } this.attributesManagerImpl.removeAllGroupResourceAttributes(sess, resource); log.info("All non-virtual group-resource attributes removed for all groups and {}", resource); }</code><technical_language>good practice getters (like getPerunBl()) accessing attributes</technical_language>

Target:
public void removeAllGroupResourceAttributes(PerunSession sess, Resource resource) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { List<Group> groups = this.getPerunBl().getResourcesManagerBl().getAssignedGroups(sess, resource); for (Group group : groups) { this.getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } this.attributesManagerImpl.removeAllGroupResourceAttributes(sess, resource); this.getPerunBl().getAuditer().log(sess, "All non-virtual group-resource attributes removed for all groups and {}", resource); }
Source:
<code>public static HashMap load(String service) throws Exception { String filename = findPath(); PGServiceFile file = new PGServiceFile(); <START> BufferedReader in = new BufferedReader(new FileReader(filename)); <END> file.parse(in); return file.getService(service); }</code><technical_language>file encoding somewhere. default is reliable</technical_language>

Target:
public static Map load(String service) throws Exception { String filename = findPath(); PGServiceFile file = new PGServiceFile(); Scanner in = new Scanner(new FileInputStream(filename), "UTF-8"); try { file.parse(in); } finally { in.close(); } return file.getService(service); }
Source:
<code>public Boolean getDeathdateEstimated() { <START> return isDeathdateEstimated(); <END> }</code><technical_language>return deathdateEstimated instead of calling isDeathdateEstimated()</technical_language>

Target:
public Boolean getDeathdateEstimated() { return this.deathdateEstimated; }
Source:
<code>public void switchProfileTest() { onView(withText(R.string.preference_access_title_profile_1)).perform(click()); onView(withId(R.id.access_active_profile_title)).check(matches(TextViewMatchers.hasValueEqualTo( resources.getString(R.string.preference_access_title_profile_1)))); onView(withId(R.id.access_active_profile_summary)).check(matches(TextViewMatchers.hasValueEqualTo( resources.getString(R.string.preference_access_summary_profile_1)))); onView(withId(R.id.scratch_project_apply_button)).perform(click()); <START> onView(withText(R.string.ok)).perform(click()); <END> compareValuesToXMLProfile(ACCESS_PROFILE_1); openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getTargetContext()); onView(withText(R.string.settings)).perform(click()); onData(PreferenceMatchers.withTitle(R.string.preference_title_access)) .perform(click()); onView(withId(R.id.access_active_profile_title)).check(matches(TextViewMatchers.hasValueEqualTo( resources.getString(R.string.preference_access_title_profile_1)))); onView(withId(R.id.access_active_profile_summary)).check(matches(TextViewMatchers.hasValueEqualTo( resources.getString(R.string.preference_access_summary_profile_1)))); onView(withId(R.id.access_switch_to_predefined_profiles_button)).perform(click()); onView(withText(R.string.preference_access_title_profile_standard)).perform(click()); onView(withId(R.id.scratch_project_apply_button)).perform(click()); onView(withText(R.string.ok)).perform(click()); }</code><technical_language>for other test. this break stuff, trust me..</technical_language>

Target:
public void switchProfileTest() { Intents.init(); Intent intentResult = new Intent(); Instrumentation.ActivityResult activityResult = new Instrumentation.ActivityResult(Activity.RESULT_OK, intentResult); intending(anyIntent()).respondWith(activityResult); onView(withId(R.id.access_title_profilestandard)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profilestandard)))); onView(withId(R.id.access_title_profilemyprofile)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profilemyprofile)))); onView(withId(R.id.access_title_profile1)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profile1)))); onView(withId(R.id.access_title_profile2)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profile2)))); onView(withId(R.id.access_title_profile3)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profile2)))); onView(withId(R.id.access_title_profile4)) .perform(scrollTo(), click()); intended(allOf(hasExtra(equalTo(AccessibilityProfilesActivity.PROFILE_ID), equalTo(R.id.access_profile4)))); Intents.release(); }
Source:
<code>private static NestedSet<Artifact> createDynamicLibrariesCopyActions( RuleContext ruleContext, Iterable<Artifact> dynamicLibrariesForRuntime) { NestedSetBuilder<Artifact> result = NestedSetBuilder.stableOrder(); CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class); for (Artifact target : dynamicLibrariesForRuntime) { if (!ruleContext .getLabel() .getPackageIdentifier() .equals(target.getOwner().getPackageIdentifier()) <START> || cppConfiguration.isRenameDLL()) { <END> String copyFilename = target.getFilename(); if(cppConfiguration.isRenameDLL()) { String targetPath = ruleContext.getRepository() + "/" + target.getOwnerLabel().getPackageIdentifier().getSourceRoot(); String targetHash = Hashing.sha256() .hashString(targetPath, Charsets.UTF_8) .toString(); String copyFilenameWithoutExtension = copyFilename .replaceAll("." + target.getExtension(), ""); copyFilename = copyFilenameWithoutExtension + "_" + targetHash + "." + target.getExtension(); } Artifact copy = ruleContext.getBinArtifact(copyFilename); ruleContext.registerAction(SymlinkAction.toArtifact( ruleContext.getActionOwner(), target, copy, "Copying Execution Dynamic Library")); result.add(copy); } else { result.add(target); } } return result.build(); }</code><technical_language>I do renaming in CcLibrary generate DLL in CcBinary copy DLLs. - dynamicLibrariesForRuntime DLLs generated CcLibrary DLL imported cc_import rule. If rename DLL, work. - Ww put renamed DLL name in DEF file in CcLibrary, generate a LIB file (interface library) is consistent DLL generated CcLibrary rule. I a good thing. In CcLibrary, add a linkedArtifactNameSuffix pretty easily here: <LINK_0>;l=629?q=CcLibrary.java&ss=bazel%2Fbazel --rename_dll flag affects Windows build, check featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS)</technical_language>

Target:
private static NestedSet<Artifact> createDynamicLibrariesCopyActions( RuleContext ruleContext, Iterable<Artifact> dynamicLibrariesForRuntime) { NestedSetBuilder<Artifact> result = NestedSetBuilder.stableOrder(); for (Artifact target : dynamicLibrariesForRuntime) { if (!ruleContext .getLabel() .getPackageIdentifier() .equals(target.getOwner().getPackageIdentifier())) { Artifact copy = ruleContext.getBinArtifact(target.getFilename()); ruleContext.registerAction(SymlinkAction.toArtifact( ruleContext.getActionOwner(), target, copy, "Copying Execution Dynamic Library")); result.add(copy); } else { result.add(target); } } return result.build(); }
Source:
<code>public static <M, OM> StreamOperatorSpec<M, OM> createMapOperatorSpec( MapFunction<? super M, ? extends OM> mapFn, String opId) { <START> return StreamOperatorSpec.<M, OM>createStreamOperatorSpec((MapFunction<M, OM>) mapFn, OperatorSpec.OpCode.MAP, opId); <END> }</code><technical_language>IMHO cleaner add specs for Filter Map operators instead of StreamOperatorSpec general purpose. overhead of extra classes is trivial helps readability</technical_language>

Target:
public static <M, OM> StreamOperatorSpec<M, OM> createMapOperatorSpec( MapFunction<? super M, ? extends OM> mapFn, String opId) { return new MapOperatorSpec<>((MapFunction<M, OM>) mapFn, opId); }
Source:
<code><START> static void detectLanguageShowStatisticsRunner(BiConsumer<List<DetectLanguageInput>, <END> TextAnalyticsRequestOptions> testRunner) { final List<DetectLanguageInput> detectLanguageInputs = TestUtils.getDetectLanguageInputs(); TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); testRunner.accept(detectLanguageInputs, options); }</code><technical_language>reason runner a static method</technical_language>

Target:
void detectLanguageShowStatisticsRunner(BiConsumer<List<DetectLanguageInput>, TextAnalyticsRequestOptions> testRunner) { final List<DetectLanguageInput> detectLanguageInputs = TestUtils.getDetectLanguageInputs(); TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setShowStatistics(true); testRunner.accept(detectLanguageInputs, options); }
Source:
<code><START> public Map<String, Boolean> asMap() { <END> return featureFlags.stream().collect(toMap(FeatureFlag::getName, FeatureFlag::isEnabled)); }</code><technical_language>why? methods isEnabled()</technical_language>

Target:
private Map<String, Boolean> asMap() { return featureFlags.stream().collect(toMap(FeatureFlag::getName, FeatureFlag::isEnabled)); }
Source:
<code>protected void initBinder(WebDataBinder binder) { StringTrimmerEditor editor = new StringTrimmerEditor(false); binder.registerCustomEditor(String.class, "name", editor); binder.registerCustomEditor(String.class, "nameRu", editor); binder.registerCustomEditor(String.class, "name", new CustomCategoryNameEditor()); <START> binder.registerCustomEditor(String.class, "nameRu", new CustomCategoryNameEditor()); <END> }</code><technical_language>Is instance of editor for fields? In other words, is class thread-safe</technical_language>

Target:
protected void initBinder(WebDataBinder binder) { ReplaceRepeatingSpacesEditor editor = new ReplaceRepeatingSpacesEditor(true); binder.registerCustomEditor(String.class, "name", editor); binder.registerCustomEditor(String.class, "nameRu", editor); }
Source:
<code>public SELF withUrlParam(String paramName, String paramValue) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>implementation of this method pulled here</technical_language>

Target:
public SELF withUrlParam(String paramName, String paramValue) { urlParameters.put(paramName, paramValue); return self(); }
Source:
<code><START> public void openFile(final String file) { <END> IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); for (int i = 0; i < projects.length; i++) { final IProject prj = projects[i]; final URI remoteURI = Util.getLocationURI(prj); if (remoteURI != null) { if(!file.startsWith(remoteURI.getPath())) continue; getStandardDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { String loc = file.substring(remoteURI.getPath().length()+1); IFile file = prj.getFile(loc); IDE.openEditor(page, file); } catch (PartInitException e) { Activator.log(e); } } }); return; } } getStandardDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { IEditorDescriptor editorDesc = IDE.getEditorDescriptor(file); IRemoteFileManager irfm = fRemoteConnection.getFileManager(); URI uri = irfm.toURI(file); String editorId = editorDesc.getId(); boolean activate = true; IDE.openEditor(page, uri, editorId, activate ); } catch (PartInitException e) { Activator.log(e); } } }); return; }</code><technical_language>give example case for this feature? Is idea able work files easily external project</technical_language>

Target:
public void openFile(final String file) { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); for (int i = 0; i < projects.length; i++) { final IProject prj = projects[i]; final URI remoteURI = Util.getLocationURI(prj); if (remoteURI != null) { if(file.startsWith(remoteURI.getPath())) { getStandardDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { String loc = file.substring(remoteURI.getPath().length()+1); IFile file = prj.getFile(loc); IDE.openEditor(page, file); } catch (PartInitException e) { Activator.log(e); } } }); return; } } } getStandardDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { IEditorDescriptor editorDesc = IDE.getEditorDescriptor(file); IRemoteFileManager irfm = fRemoteConnection.getFileManager(); URI uri = irfm.toURI(file); String editorId = editorDesc.getId(); IDE.openEditor(page, uri, editorId, true); } catch (PartInitException e) { Activator.log(e); } } }); return; }