auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public MethodOutcome createFHIRLocation(@ResourceParam Location location) { location = locationResource.createLocation(location); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdDt(FHIRConstants.LOCATION, location.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); <START> coding.setDisplay("Location is successfully created"); <END> outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }</code><technical_language>move messages constants</technical_language>

Target:
public MethodOutcome createFHIRLocation(@ResourceParam Location location) { location = locationResource.createLocation(location); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdType(FHIRConstants.LOCATION, location.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Location is successfully created with id " + location.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
<code>public boolean isLoggedIn() { if (!"XWiki.XWikiGuest".equals(xWikiContext.getUser())) { return true; } <START> return false; <END> }</code><technical_language>rightsAccess.isLoggedIn() instead of reimplementing method</technical_language>

Target:
public boolean isLoggedIn() { return rightsAccess.isLoggedIn(); }
Source:
<code>public NicProfile createGuestNicProfileForVpcRouter(final RouterDeploymentDefinition vpcRouterDeploymentDefinition, final Network guestNetwork) { final NicProfile guestNic = new NicProfile(); if (vpcRouterDeploymentDefinition.isRedundant()) { <START> guestNic.setIPv4Address(_ipAddrMgr.acquireFirstGuestIpAddress(guestNetwork)); <END> } else { guestNic.setIPv4Address(guestNetwork.getGateway()); } guestNic.setBroadcastUri(guestNetwork.getBroadcastUri()); guestNic.setBroadcastType(guestNetwork.getBroadcastDomainType()); guestNic.setIsolationUri(guestNetwork.getBroadcastUri()); guestNic.setMode(guestNetwork.getMode()); final String gatewayCidr = _networkModel.getValidNetworkCidr(guestNetwork); guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr)); return guestNic; }</code><technical_language>@ArthurHlt acquireGuestIpAddressForVrouterRedundant well</technical_language>

Target:
public NicProfile createGuestNicProfileForVpcRouter(final RouterDeploymentDefinition vpcRouterDeploymentDefinition, final Network guestNetwork) { final NicProfile guestNic = new NicProfile(); if (vpcRouterDeploymentDefinition.isRedundant()) { guestNic.setIPv4Address(this.acquireGuestIpAddressForVrouterRedundant(guestNetwork)); } else { guestNic.setIPv4Address(guestNetwork.getGateway()); } guestNic.setBroadcastUri(guestNetwork.getBroadcastUri()); guestNic.setBroadcastType(guestNetwork.getBroadcastDomainType()); guestNic.setIsolationUri(guestNetwork.getBroadcastUri()); guestNic.setMode(guestNetwork.getMode()); final String gatewayCidr = _networkModel.getValidNetworkCidr(guestNetwork); guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr)); return guestNic; }
Source:
<code>public int compareTo(final Repo repo) { int returnValue; if (repo instanceof MkRepo) { final MkRepo mkRepo = (MkRepo) repo; returnValue = this.self.compareTo(mkRepo.self); if (returnValue == 0) { <START> returnValue = this.coords.compareTo(mkRepo.coords); <END> } } else { returnValue = -1; } return returnValue; }</code><technical_language>Ditto. This method is complicated, checking for instance type is wrong. compare coordinates</technical_language>

Target:
public int compareTo(final Repo repo) { return this.coords.compareTo(repo.coordinates()); }
Source:
<code>void executeInterruptedException() throws InterruptedException { <START> <END> MentionsData data = new MentionsData() .setDocumentReference("xwiki:XWiki.Doc") .setAuthorReference("xwiki:XWiki.Author") .setVersion("1.0") .setWikiId("xwiki"); doThrow(new InterruptedException()).when(this.blockingQueue).put(data); this.executor.execute(new DocumentReference("xwiki", "XWiki", "Doc"), new DocumentReference("xwiki", "XWiki", "Author"), "1.0"); assertEquals(1, this.logCapture.size()); assertEquals(WARN, this.logCapture.getLogEvent(0).getLevel()); assertEquals( "Error while adding the task [documentReference = [xwiki:XWiki.Doc], version = [1.0], " + "authorReference = [xwiki:XWiki.Author], wikiId = [xwiki]] " + "to the mentions analysis queue. Cause [InterruptedException: ]", this.logCapture.getMessage(0)); }</code><technical_language>Useless empty line</technical_language>

Target:
void executeInterruptedException() throws InterruptedException { DocumentReference documentReference = new DocumentReference("xwiki", "XWiki", "Doc"); DocumentReference authorReference = new DocumentReference("xwiki", "XWiki", "Author"); MentionsData data = new MentionsData() .setDocumentReference("xwiki:XWiki.Doc") .setAuthorReference("xwiki:XWiki.Author") .setVersion("1.0") .setWikiId("xwiki"); when(this.serializer.serialize(documentReference)).thenReturn("xwiki:XWiki.Doc"); when(this.serializer.serialize(authorReference)).thenReturn("xwiki:XWiki.Author"); doThrow(new InterruptedException()).when(this.blockingQueue).put(data); this.executor.execute(documentReference, authorReference, "1.0"); assertEquals(1, this.logCapture.size()); assertEquals(WARN, this.logCapture.getLogEvent(0).getLevel()); assertEquals( "Error while adding the task [documentReference = [xwiki:XWiki.Doc], version = [1.0], " + "authorReference = [xwiki:XWiki.Author], wikiId = [xwiki]] " + "to the mentions analysis queue. Cause [InterruptedException: ]", this.logCapture.getMessage(0)); }
Source:
<code>public void close() { <START> scheduler.shutdownNow(); <END> try { scheduler.awaitTermination(30, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Failed to shut down bigtable flush executor service in a timely manner"); } }</code><technical_language>Scheduler null</technical_language>

Target:
public AsyncFuture<Void> close() { if (scheduler == null) { return async.resolved(); } return async.call(() -> { scheduler.shutdownNow(); try { scheduler.awaitTermination(30, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Failed to shut down bigtable flush executor service in a timely manner"); } return null; }); }
Source:
<code>public void smartLockAutoFill() { <START> if (!isSmartLockAvailable()) { <END> return; } CredentialRequest credentialRequest = new CredentialRequest.Builder() .setSupportsPasswordLogin(true) .build(); Auth.CredentialsApi.request(mCredentialsClient, credentialRequest).setResultCallback( new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { Status status = result.getStatus(); if (status.isSuccess()) { Credential credential = result.getCredential(); onCredentialRetrieved(credential); } else { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(getActivity(), SignInActivity.SMART_LOCK_READ); } catch (IntentSender.SendIntentException e) { AppLog.d(T.NUX, "SmartLock: Failed to send resolution for credential " + "request"); } } else { AppLog.d(T.NUX, "SmartLock: Unsuccessful credential request."); } } } }); }</code><technical_language>here, isSmartLockAvailable (this method work mCredentialsClient is disconnected)</technical_language>

Target:
public void smartLockAutoFill() { if (!isGooglePlayServicesAvailable() || mCredentialsClient == null || mSelfHosted) { return; } CredentialRequest credentialRequest = new CredentialRequest.Builder() .setSupportsPasswordLogin(true) .build(); Auth.CredentialsApi.request(mCredentialsClient, credentialRequest).setResultCallback( new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { Status status = result.getStatus(); if (status.isSuccess()) { Credential credential = result.getCredential(); onCredentialRetrieved(credential); } else { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(getActivity(), SignInActivity.SMART_LOCK_READ); } catch (IntentSender.SendIntentException e) { AppLog.d(T.NUX, "SmartLock: Failed to send resolution for credential " + "request"); } } else { AppLog.d(T.NUX, "SmartLock: Unsuccessful credential request."); } } } }); }
Source:
<code>public void addSensorJob(SensorJob sensorJob) { synchronized (sensorJobQueue) { if (!this.sensorJobQueue.contains(sensorJob)) { sensorJobQueue.add(sensorJob); logger.debug("Add sensorJob: to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else if (checkSensorJobPrio(sensorJob)) { logger.debug("add sensorJob: with higher priority to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else { <START> logger.debug("sensorJob: allready exist with a higher priority", sensorJob.getDSID().toString()); <END> } } }</code><technical_language>remove toString()</technical_language>

Target:
public void addSensorJob(SensorJob sensorJob) { synchronized (sensorJobQueue) { if (!this.sensorJobQueue.contains(sensorJob)) { sensorJobQueue.add(sensorJob); logger.debug("Add sensorJob: to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else if (checkSensorJobPrio(sensorJob)) { logger.debug("add sensorJob: with higher priority to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else { logger.debug("sensorJob: allready exist with a higher priority", sensorJob.getDSID()); } } }
Source:
<code>private EntityModel<String> validateName(E entityData) { final int maxNameLength = AsyncDataProvider.getInstance().getMaxVmNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); <START> name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), value -> (entityData.isNameExistsInTheSystem() || !isNameUnique(entityData)) ? ValidationResult.fail(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok() }); <END> return name; }</code><technical_language>I replace a local variable instance class variable. follows: IValidation nameUniqueValidation = (value) -> { (entityData.isNameExistsInTheSystem() || !isNameUnique(entityData)) ? ValidationResult.fail(ConstantsManager.getInstance().getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok() } new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), nameUniqueValidation) };</technical_language>

Target:
private EntityModel<String> validateName(E entityData) { final int maxNameLength = AsyncDataProvider.getInstance().getMaxVmNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), UniqueNameValidation(entityData) }); return name; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RealmConfig other = (RealmConfig) obj; <START> if (authenticationConfig == null) { if (other.authenticationConfig != null) { return false; } } else if (!authenticationConfig.equals(other.authenticationConfig)) { return false; } if (identityConfig == null) { if (other.identityConfig != null) { return false; } } else if (!identityConfig.equals(other.identityConfig)) { return false; } <END> return true; }</code><technical_language>Objects.equals()</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RealmConfig other = (RealmConfig) obj; return Objects.equals(authenticationConfig, other.authenticationConfig) && Objects.equals(identityConfig, other.identityConfig); }
Source:
<code>public static Sensor numberOfFileErrorsSensor(final StreamsMetricsImpl streamsMetrics, final RocksDBMetricContext metricContext) { final Sensor sensor = createSensor(streamsMetrics, metricContext, NUMBER_OF_FILE_ERRORS); <START> addValueMetricToSensor( <END> sensor, STATE_LEVEL_GROUP, streamsMetrics .storeLevelTagMap(metricContext.taskName(), metricContext.metricsScope(), metricContext.storeName()), NUMBER_OF_FILE_ERRORS, NUMBER_OF_FILE_ERRORS_DESCRIPTION ); return sensor; }</code><technical_language>Ah good catch</technical_language>

Target:
public static Sensor numberOfFileErrorsSensor(final StreamsMetricsImpl streamsMetrics, final RocksDBMetricContext metricContext) { final Sensor sensor = createSensor(streamsMetrics, metricContext, NUMBER_OF_FILE_ERRORS); addSumMetricToSensor( sensor, STATE_LEVEL_GROUP, streamsMetrics .storeLevelTagMap(metricContext.taskName(), metricContext.metricsScope(), metricContext.storeName()), NUMBER_OF_FILE_ERRORS, NUMBER_OF_FILE_ERRORS_DESCRIPTION ); return sensor; }
Source:
<code>private static String toHex(byte[] bytes) { <START> StringBuilder builder = new StringBuilder(); <END> for (byte b : bytes) { builder.append(HEX.charAt((b & 0xF0) >> 4)); builder.append(HEX.charAt(b & 0xF)); } return builder.toString(); }</code><technical_language>Optional: Presize 2 * bytes.length</technical_language>

Target:
private static String toHex(byte[] bytes) { StringBuilder builder = new StringBuilder(2 * bytes.length); for (byte b : bytes) { builder.append(HEX.charAt((b & 0xF0) >> 4)); builder.append(HEX.charAt(b & 0xF)); } return builder.toString(); }
Source:
<code>private CommandResponse executeCommand(boolean sensitive, String format, Object... args) throws IOException, MessagingException { List<String> results = new ArrayList<>(); <START> if (format != null) { <END> String command = String.format(Locale.ROOT, format, args); writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } } char c = line.charAt(0); if ((c == '4') || (c == '5')) { if (mEnhancedStatusCodesProvided) { throw buildEnhancedNegativeSmtpReplyException(replyCode, results); } else { String replyText = TextUtils.join(" ", results); throw new NegativeSmtpReplyException(replyCode, replyText); } } return new CommandResponse(replyCode, results); }</code><technical_language>format empty array if this is called format arguments, check for format.length == 0</technical_language>

Target:
private CommandResponse executeCommand(boolean sensitive, String format, Object... args) throws IOException, MessagingException { List<String> results = new ArrayList<>(); if (format != null) { String command = String.format(Locale.ROOT, format, args); writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } } char replyCodeCategory = line.charAt(0); boolean isReplyCodeErrorCategory = (replyCodeCategory == '4') || (replyCodeCategory == '5'); if (isReplyCodeErrorCategory) { if (mEnhancedStatusCodesProvided) { throw buildEnhancedNegativeSmtpReplyException(replyCode, results); } else { String replyText = TextUtils.join(" ", results); throw new NegativeSmtpReplyException(replyCode, replyText); } } return new CommandResponse(replyCode, results); }
Source:
<code>protected void bindParameters() throws StandardException { if (leftOperand.requiresTypeFromContext()) { if (rightOperand.requiresTypeFromContext()) { throw StandardException.newException(SQLState.LANG_BINARY_OPERANDS_BOTH_PARMS, operator); } leftOperand.setType(rightOperand.getTypeServices()); } <START> if (rightOperand.requiresTypeFromContext()) { <END> rightOperand.setType(leftOperand.getTypeServices()); } }</code><technical_language>Change 'else if'</technical_language>

Target:
protected void bindParameters() throws StandardException { if (leftOperand.requiresTypeFromContext()) { if (rightOperand.requiresTypeFromContext()) { throw StandardException.newException(SQLState.LANG_BINARY_OPERANDS_BOTH_PARMS, operator); } leftOperand.setType(rightOperand.getTypeServices()); } else if (rightOperand.requiresTypeFromContext()) { rightOperand.setType(leftOperand.getTypeServices()); } }
Source:
<code>public View onCreateDialogView() { View view = null; LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.layout_preference_distance, null); String[] values=new String[COUNT_KM_STEPS]; for(int i=0;i<values.length;i++){ values[i]=Integer.toString(i); } <START> mCurrentValue = PreferenceManager.getDefaultSharedPreferences(getContext()).getInt(SharedData.LIMIT_DISTANCE, 0); <END> if(mCurrentValue == 0) { mCurrentValue = mDefaultValue; } mNumberPickerMain = (NumberPicker) view.findViewById(R.id.numberPickerMain); mNumberPickerMain.setMaxValue(values.length-1); mNumberPickerMain.setMinValue(0); mNumberPickerMain.setValue(mCurrentValue/1000); mNumberPickerMain.setDisplayedValues(values); mNumberPickerMain.setOnValueChangedListener(this); String[] valuesExtra=new String[COUNT_M_STEPS]; for(int i=0;i<valuesExtra.length;i++){ valuesExtra[i]=Integer.toString(i*STEP_DIVISION); } mNumberPickerExtra = (NumberPicker) view.findViewById(R.id.numberPickerExtra); mNumberPickerExtra.setMaxValue(valuesExtra.length-1); mNumberPickerExtra.setMinValue(0); mNumberPickerExtra.setValue((mCurrentValue%1000)/STEP_DIVISION); mNumberPickerExtra.setDisplayedValues(valuesExtra); mNumberPickerExtra.setOnValueChangedListener(this); return view; }</code><technical_language>mCurrentValue = getPersistedInt(mDefaultValue)</technical_language>

Target:
public View onCreateDialogView() { View view = null; LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.layout_preference_distance, null); String[] values = new String[COUNT_KM_STEPS]; for (int i = 0; i < values.length; i++) { values[i] = Integer.toString(i); } mCurrentValue = getPersistedInt(mDefaultValue); mNumberPickerMain = (NumberPicker) view.findViewById(R.id.numberPickerMain); mNumberPickerMain.setMaxValue(values.length - 1); mNumberPickerMain.setMinValue(0); mNumberPickerMain.setValue(mCurrentValue / 1000); mNumberPickerMain.setDisplayedValues(values); mNumberPickerMain.setOnValueChangedListener(this); String[] valuesExtra = new String[COUNT_M_STEPS]; for (int i = 0; i < valuesExtra.length; i++) { valuesExtra[i] = Integer.toString(i * STEP_DIVISION); } mNumberPickerExtra = (NumberPicker) view.findViewById(R.id.numberPickerExtra); mNumberPickerExtra.setMaxValue(valuesExtra.length - 1); mNumberPickerExtra.setMinValue(0); mNumberPickerExtra.setValue((mCurrentValue % 1000) / STEP_DIVISION); mNumberPickerExtra.setDisplayedValues(valuesExtra); mNumberPickerExtra.setOnValueChangedListener(this); return view; }
Source:
<code>public Object invoke(final MethodInvocation invocation) throws Throwable { final Class<?> returnType = invocation.getMethod().getReturnType(); if (this.asyncExecutor != null) { if (returnType.isAssignableFrom(RunnableFuture.class) || FutureTask.class.equals(returnType)) { return this.asyncExecutor.submit(new AsyncInvocationTask(invocation)); } else if (this.asyncExecutor instanceof AsyncListenableTaskExecutor && (returnType.isAssignableFrom(ListenableFuture.class) <START> || ListenableFutureTask.class.equals(returnType))) { <END> return ((AsyncListenableTaskExecutor) this.asyncExecutor).submitListenable(new AsyncInvocationTask(invocation)); } } if (Promise.class.isAssignableFrom(returnType)) { if (this.reactorEnvironment == null) { throw new IllegalStateException("'reactorEnvironment' is required in case of 'Promise' return type."); } return Promises.<Object>task(Functions.supplier(new AsyncInvocationTask(invocation))) .env(this.reactorEnvironment) .get(); } return this.doInvoke(invocation); }</code><technical_language>I agree restrictions. IMO just: if (returnType.isAssignableFrom(ListenableFuture.class)) { ... } else if (returnType.isAssignableFrom(Future.class)) { ... } user interested in other Future, is achieved Executor impl, e.g. com.google.common.util.concurrent.ListenableFuture com.google.common.util.concurrent.ListeningExecutorService for that</technical_language>

Target:
public Object invoke(final MethodInvocation invocation) throws Throwable { final Class<?> returnType = invocation.getMethod().getReturnType(); if (this.asyncExecutor != null && !Object.class.equals(returnType)) { if (returnType.isAssignableFrom(this.asyncSubmitType)) { return this.asyncExecutor.submit(new AsyncInvocationTask(invocation)); } else if (returnType.isAssignableFrom(asyncSubmitListenableType)) { return ((AsyncListenableTaskExecutor) this.asyncExecutor).submitListenable(new AsyncInvocationTask(invocation)); } else if (Future.class.isAssignableFrom(returnType)) { if (logger.isDebugEnabled()) { logger.debug("AsyncTaskExecutor submit*() return types are incompatible with the method return type; " + "running on calling thread; the downstream flow must return the required Future: " + returnType.getSimpleName()); } } } if (Promise.class.isAssignableFrom(returnType)) { if (this.reactorEnvironment == null) { throw new IllegalStateException("'reactorEnvironment' is required in case of 'Promise' return type."); } return Promises.<Object>task(Functions.supplier(new AsyncInvocationTask(invocation))) .env(this.reactorEnvironment) .get(); } return this.doInvoke(invocation); }
Source:
<code>public void afterPropertiesSet() { eventBus.register(this); <START> connectionState = new SimpleObjectProperty<>(ConnectionState.DISCONNECTED); unreadMessagesCount = new SimpleIntegerProperty(); onChatMessageListeners = new ArrayList<>(); channelUserListListeners = new HashMap<>(); timer = new Timer(true); <END> }</code><technical_language>declaration</technical_language>

Target:
public void afterPropertiesSet() { eventBus.register(this); }
Source:
<code>public ImmutableSortedSet<Path> getRDotJavaFiles() { if (skipPrebuiltRDotJava) { return FluentIterable.from(unionPackage .map(Collections::singletonList) .orElse(Collections.emptyList()) ) .transform(this::getPathToRDotJava) .toSortedSet(natural()); } else { return FluentIterable.from(androidResourceDeps) .transform(HasAndroidResourceDeps::getRDotJavaPackage) .append(unionPackage .map(Collections::singletonList) .orElse(Collections.emptyList()) ) <START> .transform(this::getPathToRDotJava) <END> .toSortedSet(natural()); } }</code><technical_language>duplicating code branches, do below. function of switch clearer eliminates possibility of drift in duplicated code time. FluentIterable<String> packages = FluentIterable.from( unionPackage.map(Collections::singletonList).orElse(Collections.emptyList()); if (!skipPrebuiltRDotJava) { packages = packages.append( FluentIterable.from(androidResourceDeps) .transform(HasAndroidResourceDeps::getRDotJavaPackage)); } return packages .transform(this::getPathToRDotJava) .toSortedSet(natural());</technical_language>

Target:
public ImmutableSortedSet<Path> getRDotJavaFiles() { FluentIterable<String> packages = FluentIterable.from( unionPackage.map(Collections::singletonList).orElse(Collections.emptyList())); if (!skipNonUnionRDotJava) { packages = packages.append( FluentIterable.from(androidResourceDeps) .transform(HasAndroidResourceDeps::getRDotJavaPackage)); } return packages .transform(this::getPathToRDotJava) .toSortedSet(natural()); }
Source:
<code>public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); <START> Assert.state(converter != null, "Converter must not be null"); <END> admin = newCassandraAdminOperations(getObject(), converter); performSchemaAction(); }</code><technical_language>I guess consistent rule for exceptions in afterPropertiesSet - core framework throws IllegalArgument/NullPointer/other exceptions. wondering, good here</technical_language>

Target:
public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(converter != null, "Converter was not properly initialized"); admin = newCassandraAdminOperations(getObject(), converter); performSchemaAction(); }
Source:
<code>private void forgetSuccessfullyCompletedTransaction(RecoveryManager recoveryManager, Xid xid, LocalXaTransaction localTransaction, boolean committedInOnePhase) { final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); if (recoveryEnabled) { recoveryManager.removeRecoveryInformationFromCluster(localTransaction.getRemoteLocksAcquired(), xid, false, gtx, <START> partitionHandlingManager.isTransactionPartiallyCommitted(gtx)); <END> txTable.removeLocalTransaction(localTransaction); } else { releaseLocksForCompletedTransaction(localTransaction, committedInOnePhase); } }</code><technical_language>Lines king of long, stay 120 chars fit in GitHub views. (I noticed wraps lines in side-by-side diff, odd.)</technical_language>

Target:
private void forgetSuccessfullyCompletedTransaction(RecoveryManager recoveryManager, Xid xid, LocalXaTransaction localTransaction, boolean committedInOnePhase) { final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); if (recoveryEnabled) { recoveryManager.removeRecoveryInformation(localTransaction.getRemoteLocksAcquired(), xid, false, gtx, partitionHandlingManager.isTransactionPartiallyCommitted(gtx)); txTable.removeLocalTransaction(localTransaction); } else { releaseLocksForCompletedTransaction(localTransaction, committedInOnePhase); } }
Source:
<code>protected RecordedRequest assertSent(MockWebServer server, String method, String path, String json) throws InterruptedException { RecordedRequest request = assertSent(server, method, path); <START> assertEquals(request.getHeader("Accept"), "application/json; version=" + ctx.getMetadata().get("apiVersion")); <END> assertEquals(parser.parse(new String(request.getBody(), Charsets.UTF_8)), parser.parse(json)); return request; }</code><technical_language>This is checked in method called in line above. This is intended verify requests a body checks right content-type header</technical_language>

Target:
protected RecordedRequest assertSent(MockWebServer server, String method, String path, String json) throws InterruptedException { RecordedRequest request = assertSent(server, method, path); assertEquals(request.getHeader("Content-Type"), "application/json"); assertEquals(parser.parse(new String(request.getBody(), Charsets.UTF_8)), parser.parse(json)); return request; }
Source:
<code>public void testDefault(String suffix) throws FormatException, IOException { <START> outFile = tempDir.resolve("test." + suffix).toFile(); <END> String[] args = {"test.fake", outFile.getAbsolutePath()}; try { ImageConverter.main(args); } catch (ExitException e) { outFile.deleteOnExit(); assertEquals(e.status, 0); checkImage(); } }</code><technical_language>Extra dot in "test." (suffix a leading dot). prevent test working fine though, this change is required</technical_language>

Target:
public void testDefault(String suffix) throws FormatException, IOException { outFile = tempDir.resolve("test" + suffix).toFile(); String[] args = {"test.fake", outFile.getAbsolutePath()}; try { ImageConverter.main(args); } catch (ExitException e) { outFile.deleteOnExit(); assertEquals(e.status, 0); checkImage(); } }
Source:
<code>public void setUp() throws Exception { MockitoAnnotations.initMocks(this); mSession = mockitoSession() .spyStatic(DeviceConfig.class) .strictness(Strictness.WARN) .startMocking(); final Context context = InstrumentationRegistry.getContext(); setDismissPortalInValidatedNetwork(true); <START> NetworkCapabilities nc <END> = new NetworkCapabilities(); doReturn(nc).when(sMockConnectivityManager).getNetworkCapabilities(mNetwork); mActivity = (InstrumentedCaptivePortalLoginActivity) mActivityRule.launchActivity( new Intent(ACTION_CAPTIVE_PORTAL_SIGN_IN) .putExtra(EXTRA_CAPTIVE_PORTAL_URL, TEST_URL) .putExtra(EXTRA_NETWORK, mNetwork) .putExtra(EXTRA_CAPTIVE_PORTAL, new MockCaptivePortal()) ); assertNotNull(mActivity); }</code><technical_language>final</technical_language>

Target:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); mSession = mockitoSession() .spyStatic(DeviceConfig.class) .strictness(Strictness.WARN) .startMocking(); final Context context = InstrumentationRegistry.getContext(); setDismissPortalInValidatedNetwork(true); final NetworkCapabilities nc = new NetworkCapabilities(); doReturn(nc).when(sMockConnectivityManager).getNetworkCapabilities(mNetwork); mActivity = (InstrumentedCaptivePortalLoginActivity) mActivityRule.launchActivity( new Intent(ACTION_CAPTIVE_PORTAL_SIGN_IN) .putExtra(EXTRA_CAPTIVE_PORTAL_URL, TEST_URL) .putExtra(EXTRA_NETWORK, mNetwork) .putExtra(EXTRA_CAPTIVE_PORTAL, new MockCaptivePortal()) ); assertNotNull(mActivity); }
Source:
<code>private void updateMappings(final DragAndDropTarget container) { <START> if (container instanceof DSemanticDecorator && !new DSemanticDecoratorQuery((DSemanticDecorator) container).hasDetachedTarget()) { <END> mappingsManager.iterate(new MappingUpdateVisitor(container), container); for (final DDiagramElement child : DiagramElementsHierarchyVisitor.INSTANCE.getChildren(container)) { if (child instanceof DragAndDropTarget) { updateMappings((DragAndDropTarget) child); } } } }</code><technical_language>remark here. if (! (container instanceof DSemDec && new DSem..hasDetachedTarget()) {</technical_language>

Target:
private void updateMappings(final DragAndDropTarget container) { if (container instanceof DSemanticDecorator) { DSemanticDecorator dSemanticDecorator = (DSemanticDecorator) container; if (!new DSemanticDecoratorQuery(dSemanticDecorator).hasDetachedTarget()) { safeUpdateMappings(container); } } else { safeUpdateMappings(container); } }
Source:
<code>public void onSitePluginsFetched(OnSitePluginsFetched event) { if (isFinishing()) { return; } mProgressBar.setVisibility(View.GONE); if (event.isError()) { <START> ToastUtils.showToast(this, "An error occurred while fetching the plugins: " <END> + event.error.message); return; } refreshPluginList(); }</code><technical_language>text of this toast is hard-coded</technical_language>

Target:
public void onSitePluginsFetched(OnSitePluginsFetched event) { if (isFinishing()) { return; } mProgressBar.setVisibility(View.GONE); if (event.isError()) { AppLog.e(T.API, "An error occurred while fetching the plugins: " + event.error.message); return; } refreshPluginList(); }
Source:
<code>public void merge(AttributeSet attributes) { <START> for (Attribute sourceAttr: attributes.getAttributes()) { <END> attributeMap.put(sourceAttr.getName(), sourceAttr); } }</code><technical_language>a new AttributeSet ? If do AttributeSet immutable</technical_language>

Target:
public AttributeSet merge(AttributeSet attributes) { Map<String, Attribute> merged = new LinkedHashMap<>(); for (Attribute attr : getAttributes()) { merged.put(attr.getCoRELinkParam(), attr); } if (attributes != null) { for (Attribute attr : attributes.getAttributes()) { merged.put(attr.getCoRELinkParam(), attr); } } return new AttributeSet(merged.values()); }
Source:
<code>private void enhanceCommitUpdates(EKBCommit commit) throws EKBException { Map<Object, OpenEngSBModel> updated = new HashMap<Object, OpenEngSBModel>(); <START> commit.getUpdates().addAll(recursiveUpdateEnhancement(commit.getUpdates(), updated, commit)); <END> }</code><technical_language>is this append replace operation</technical_language>

Target:
private void enhanceCommitUpdates(EKBCommit commit) throws EKBException { Map<Object, SimpleModelWrapper> updated = new HashMap<Object, SimpleModelWrapper>(); List<SimpleModelWrapper> result = recursiveUpdateEnhancement( convertOpenEngSBModelList(commit.getUpdates()), updated, commit); commit.getUpdates().addAll(convertSimpleModelWrapperList(result)); }
Source:
<code>public long getTimestamp() { if (timestampField != null) { try { Object eventTimestamp = super.getRecord().get(timestampField); if (eventTimestamp != null) { <START> if ("unix_milliseconds".equals(timestampFormat)){ <END> return getAsLong(eventTimestamp); }else if ("unix_seconds".equals(timestampFormat)){ return getAsLong(eventTimestamp) * 1000; }else if("iso".equals(timestampFormat)){ return isoDateTimeParser.parseDateTime(eventTimestamp.toString()).getMillis(); }else{ return new SimpleDateFormat(timestampFormat).parse(eventTimestamp.toString()).getTime(); } } } catch (ParseException e) { log.error("Error parsing timestamp!", e); } } Record header = (Record) super.getRecord().get("header"); if (header != null && header.get("time") != null) { return (Long) header.get("time"); } else if (super.getRecord().get("timestamp") != null) { return (Long) super.getRecord().get("timestamp"); } else { return System.currentTimeMillis(); } }</code><technical_language>'unix_milliseconds' standard format names</technical_language>

Target:
public long getTimestamp() throws ParseException { Record header = (Record) super.getRecord().get("header"); if (header != null && header.get("time") != null) { return (Long) header.get("time"); } else if (super.getRecord().get(timestampField) != null) { Object eventTimestamp = super.getRecord().get(timestampField); if (UNIX_MILLISECONDS.equals(timestampFormat)){ return getAsLong(eventTimestamp); }else if (UNIX_SECONDS.equals(timestampFormat) || UNIX.equals(timestampFormat)){ return getAsLong(eventTimestamp) * 1000; }else if(ISO_8601.equals(timestampFormat)) { return isoDateTimeParser.parseDateTime(eventTimestamp.toString()).getMillis(); }else { return new SimpleDateFormat(timestampFormat).parse(eventTimestamp.toString()).getTime(); } } else { return System.currentTimeMillis(); } }
Source:
<code>private ZkCacheBaseDataAccessor(Builder builder) { _chrootPath = builder._chrootPath; _wtCachePaths = builder._wtCachePaths; _zkCachePaths = builder._zkCachePaths; RealmAwareZkClient zkClient; switch (builder._realmMode) { case MULTI_REALM: try { zkClient = new FederatedZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig); break; } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { } case SINGLE_REALM: switch (builder._zkClientType) { case DEDICATED: zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder._zkAddress), builder._realmAwareZkClientConfig.createHelixZkClientConfig()); break; case SHARED: default: zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder._zkAddress), builder._realmAwareZkClientConfig.createHelixZkClientConfig()); zkClient.waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS); } break; <START> default: <END> throw new HelixException("Invalid RealmMode given: " + builder._realmMode); } _zkClient = zkClient; _baseAccessor = new ZkBaseDataAccessor<>(_zkClient); start(); }</code><technical_language>Do need validate zk address falling single realm mode</technical_language>

Target:
private ZkCacheBaseDataAccessor(Builder builder) { _chrootPath = builder._chrootPath; _wtCachePaths = builder._wtCachePaths; _zkCachePaths = builder._zkCachePaths; RealmAwareZkClient zkClient; switch (builder._realmMode) { case MULTI_REALM: try { if (builder._zkClientType == ZkBaseDataAccessor.ZkClientType.DEDICATED) { zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig); } else if (builder._zkClientType == ZkBaseDataAccessor.ZkClientType.SHARED) { zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig); } else { zkClient = new FederatedZkClient(builder._realmAwareZkConnectionConfig, builder._realmAwareZkClientConfig); } break; } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Failed to create ZkCacheBaseDataAccessor!", e); } case SINGLE_REALM: switch (builder._zkClientType) { case DEDICATED: zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder._zkAddress), builder._realmAwareZkClientConfig.createHelixZkClientConfig()); break; case SHARED: default: zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder._zkAddress), builder._realmAwareZkClientConfig.createHelixZkClientConfig()); zkClient.waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS); break; } default: throw new HelixException("Invalid RealmMode given: " + builder._realmMode); } _zkClient = zkClient; _baseAccessor = new ZkBaseDataAccessor<>(_zkClient); start(); }
Source:
<code>public List<HasMetadata> buildAccompanyingKubernetesResources() throws IOException { if (!kubernetesJobManagerParameters.isInternalServiceEnabled()) { return Collections.emptyList(); } final String serviceName = KubernetesUtils.getInternalServiceName(kubernetesJobManagerParameters.getClusterId()); final Service headlessService = new ServiceBuilder() .withApiVersion(Constants.API_VERSION) .withNewMetadata() .withName(serviceName) .withLabels(kubernetesJobManagerParameters.getCommonLabels()) .endMetadata() .withNewSpec() <START> .withClusterIP("None") <END> .withSelector(kubernetesJobManagerParameters.getLabels()) .addNewPort() .withName(Constants.JOB_MANAGER_RPC_PORT_NAME) .withPort(kubernetesJobManagerParameters.getRPCPort()) .endPort() .addNewPort() .withName(Constants.BLOB_SERVER_PORT_NAME) .withPort(kubernetesJobManagerParameters.getBlobServerPort()) .endPort() .endSpec() .build(); final String namespace = kubernetesJobManagerParameters.getNamespace(); kubernetesJobManagerParameters.getFlinkConfiguration().setString(JobManagerOptions.ADDRESS, serviceName + "." + namespace); return Collections.singletonList(headlessService); }</code><technical_language>@zhengcanbin this setting refer Headless service? move "None" Constants</technical_language>

Target:
public List<HasMetadata> buildAccompanyingKubernetesResources() throws IOException { if (!kubernetesJobManagerParameters.isInternalServiceEnabled()) { return Collections.emptyList(); } final String serviceName = KubernetesUtils.getInternalServiceName(kubernetesJobManagerParameters.getClusterId()); final Service headlessService = new ServiceBuilder() .withApiVersion(Constants.API_VERSION) .withNewMetadata() .withName(serviceName) .withLabels(kubernetesJobManagerParameters.getCommonLabels()) .endMetadata() .withNewSpec() .withClusterIP(Constants.HEADLESS_SERVICE_CLUSTER_IP) .withSelector(kubernetesJobManagerParameters.getLabels()) .addNewPort() .withName(Constants.JOB_MANAGER_RPC_PORT_NAME) .withPort(kubernetesJobManagerParameters.getRPCPort()) .endPort() .addNewPort() .withName(Constants.BLOB_SERVER_PORT_NAME) .withPort(kubernetesJobManagerParameters.getBlobServerPort()) .endPort() .endSpec() .build(); final String namespace = kubernetesJobManagerParameters.getNamespace(); kubernetesJobManagerParameters.getFlinkConfiguration().setString(JobManagerOptions.ADDRESS, serviceName + "." + namespace); return Collections.singletonList(headlessService); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTranslucentTheme()); super.onCreate(savedInstanceState); StorageUtils.checkStorageAvailability(this); viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); viewBinding.transparentBackground.setOnClickListener(v -> finish()); viewBinding.card.setOnClickListener(null); <START> viewBinding.autoDownloadCheckBox.setChecked(UserPreferences.isEnableAutodownload()); <END> String feedUrl = null; if (getIntent().hasExtra(ARG_FEEDURL)) { feedUrl = getIntent().getStringExtra(ARG_FEEDURL); } else if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) || TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) { feedUrl = TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) ? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString(); } if (feedUrl == null) { Log.e(TAG, "feedUrl is null."); showNoPodcastFoundError(); } else { Log.d(TAG, "Activity was started with url " + feedUrl); setLoadingLayout(); if (feedUrl.contains("subscribeonandroid.com")) { feedUrl = feedUrl.replaceFirst("((www.)?(subscribeonandroid.com/))", ""); } if (savedInstanceState == null) { lookupUrlAndDownload(feedUrl, null, null); } else { lookupUrlAndDownload(feedUrl, savedInstanceState.getString("username"), savedInstanceState.getString("password")); } } }</code><technical_language>Is this needed? I checkbox is displayed if auto download is enabled, anyway</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTranslucentTheme()); super.onCreate(savedInstanceState); StorageUtils.checkStorageAvailability(this); viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); viewBinding.transparentBackground.setOnClickListener(v -> finish()); viewBinding.card.setOnClickListener(null); String feedUrl = null; if (getIntent().hasExtra(ARG_FEEDURL)) { feedUrl = getIntent().getStringExtra(ARG_FEEDURL); } else if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) || TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) { feedUrl = TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) ? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString(); } if (feedUrl == null) { Log.e(TAG, "feedUrl is null."); showNoPodcastFoundError(); } else { Log.d(TAG, "Activity was started with url " + feedUrl); setLoadingLayout(); if (feedUrl.contains("subscribeonandroid.com")) { feedUrl = feedUrl.replaceFirst("((www.)?(subscribeonandroid.com/))", ""); } if (savedInstanceState == null) { lookupUrlAndDownload(feedUrl, null, null); } else { lookupUrlAndDownload(feedUrl, savedInstanceState.getString("username"), savedInstanceState.getString("password")); } } }
Source:
<code><START> @NotNull public CacheFilterEnum cacheFilterEnum() { <END> return cacheFilterEnum; }</code><technical_language>@NotNull annotations <LINK_0></technical_language>

Target:
public CacheFilterEnum cacheFilterEnum() { return cacheFilterEnum; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IndexConfig that = (IndexConfig) o; <START> if (name != null ? !name.equals(that.name) : that.name != null) { <END> return false; } if (type != null ? !type.equals(that.type) : that.type != null) { return false; } return getAttributes().equals(that.getAttributes()); }</code><technical_language>!Objects.equals(...)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IndexConfig that = (IndexConfig) o; if (!Objects.equals(name, that.name)) { return false; } if (!Objects.equals(type, that.type)) { return false; } return getAttributes().equals(that.getAttributes()); }
Source:
<code>@Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync( Set<? extends K> keys, final EntryProcessor<K, V, T> entryProcessor, Object... args) { A.notNull(keys, "keys", entryProcessor, "entryProcessor"); if (keyCheck) validateCacheKeys(keys); <START> checkKeysOrdered(keys, "Invoke All"); <END> final boolean statsEnabled = ctx.statisticsEnabled(); final long start = statsEnabled ? System.nanoTime() : 0L; Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() { @Override public EntryProcessor apply(K k) { return entryProcessor; } }); IgniteInternalFuture fut = updateAllAsync0(null, invokeMap, args, true, false, null); if (statsEnabled) fut.listen(new InvokeAllTimeStatClosure(metrics0(), start)); return fut; }</code><technical_language>"Invoke Sync" operation</technical_language>

Target:
@Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync( Set<? extends K> keys, final EntryProcessor<K, V, T> entryProcessor, Object... args) { A.notNull(keys, "keys", entryProcessor, "entryProcessor"); if (keyCheck) validateCacheKeys(keys); warnIfUnordered(keys, BulkOperation.INVOKE); final boolean statsEnabled = ctx.statisticsEnabled(); final long start = statsEnabled ? System.nanoTime() : 0L; Map<? extends K, EntryProcessor> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor>() { @Override public EntryProcessor apply(K k) { return entryProcessor; } }); IgniteInternalFuture fut = updateAllAsync0(null, invokeMap, args, true, false, null); if (statsEnabled) fut.listen(new InvokeAllTimeStatClosure(metrics0(), start)); return fut; }
Source:
<code>public static int getLayers(ItemStack... items) { int layers = 0; for (ItemStack item : items) { <START> if (item != null && item.getAmount() != 0 && (item.getAmount() < layers || layers == 0)) { <END> layers = item.getAmount(); } } return layers; }</code><technical_language>!InventoryUtil.isEmpty(item) instead of amount/null check</technical_language>

Target:
public static int getLayers(ItemStack... items) { int layers = 0; for (ItemStack item : items) { if (!InventoryUtil.isEmpty(item) && (item.getAmount() < layers || layers == 0)) { layers = item.getAmount(); } } return layers; }
Source:
<code>private void doButtonPressed(int index) { switch (index) { case IDX_ADD: { List<String> existing= fFilterListField.getElements(); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); if (dialog.open() == Window.OK) { String res= (String) dialog.getResult(); fFilterListField.addElement(res); fFilterListField.setChecked(res, true); <START> } break; <END> } case IDX_ADD_PACKAGE: String[] res= choosePackage(); if (res != null) { fFilterListField.addElements(Arrays.asList(res)); for (String re : res) { fFilterListField.setChecked(re, true); } } break; case IDX_EDIT: { List<String> selected= fFilterListField.getSelectedElements(); if (selected.isEmpty()) { return; } String editedEntry= selected.get(0); List<String> existing= fFilterListField.getElements(); existing.remove(editedEntry); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); dialog.setInitialString(editedEntry); if (dialog.open() == Window.OK) { fFilterListField.replaceElement(editedEntry, (String) dialog.getResult()); } break; } default: break; } }</code><technical_language>position of break below</technical_language>

Target:
private void doButtonPressed(int index) { switch (index) { case IDX_ADD:{ List<String> existing= fFilterListField.getElements(); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); if (dialog.open() == Window.OK) { String res= (String) dialog.getResult(); fFilterListField.addElement(res); fFilterListField.setChecked(res, true); } } break; case IDX_ADD_PACKAGE: String[] res= choosePackage(); if (res != null) { fFilterListField.addElements(Arrays.asList(res)); for (String re : res) { fFilterListField.setChecked(re, true); } } break; case IDX_EDIT:{ List<String> selected= fFilterListField.getSelectedElements(); if (selected.isEmpty()) { return; } String editedEntry= selected.get(0); List<String> existing= fFilterListField.getElements(); existing.remove(editedEntry); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); dialog.setInitialString(editedEntry); if (dialog.open() == Window.OK) { fFilterListField.replaceElement(editedEntry, (String) dialog.getResult()); } } break; default: break; } }