mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
clarify that ValueEditor#parseValue is supposed to throw exception
This commit is contained in:
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.components.fields.valueEditors;
|
||||
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -37,7 +23,7 @@ public class CommaSeparatedIntegersValueEditor extends TextFieldValueEditor<List
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Integer> parseValue(@Nullable String text) {
|
||||
public List<Integer> parseValue(@Nullable String text) throws InvalidDataException {
|
||||
if (text == null || text.isEmpty()) return Collections.emptyList();
|
||||
String[] chunks = text.split("\\s*,\\s*");
|
||||
List<Integer> values = new ArrayList<>(chunks.length);
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.components.fields.valueEditors;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
@@ -34,7 +20,7 @@ public class IntegerValueEditor extends TextFieldValueEditor<Integer> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Integer parseValue(@Nullable String text) {
|
||||
public Integer parseValue(@Nullable String text) throws InvalidDataException {
|
||||
try {
|
||||
if (StringUtil.isEmpty(text)) {
|
||||
if (!myCanBeEmpty) {
|
||||
|
||||
+4
-17
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ui.components.fields.valueEditors;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -67,10 +54,10 @@ public interface ValueEditor<T> {
|
||||
* Try parsing the text and convert it to the object of type T. Throw InvalidDataException if parsing fails.
|
||||
* @param text The text to parse.
|
||||
* @return Parsed data.
|
||||
* @throws com.intellij.openapi.util.InvalidDataException if parsing fails.
|
||||
* @throws InvalidDataException if parsing fails.
|
||||
*/
|
||||
@NotNull
|
||||
T parseValue(@Nullable String text);
|
||||
T parseValue(@Nullable String text) throws InvalidDataException;
|
||||
|
||||
/**
|
||||
* Convert the value to an equivalent text string.
|
||||
|
||||
Reference in New Issue
Block a user