| /* |
| * Copyright 2000-2009 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. |
| */ |
| package com.intellij.compiler.options; |
| |
| import com.intellij.openapi.ui.TextFieldWithBrowseButton; |
| import com.intellij.ui.RawCommandLineEditor; |
| |
| import javax.swing.*; |
| |
| /** |
| * @author Eugene Zhuravlev |
| * Date: Mar 30, 2004 |
| */ |
| public class ComparingUtils { |
| public static boolean isModified(TextFieldWithBrowseButton field, String value) { |
| return !field.getText().equals(value); |
| } |
| |
| public static boolean isModified(JCheckBox checkBox, boolean value) { |
| return checkBox.isSelected() != value; |
| } |
| |
| public static boolean isModified(JTextField textField, int value) { |
| try { |
| int fieldValue = Integer.parseInt(textField.getText().trim()); |
| return fieldValue != value; |
| } |
| catch(NumberFormatException e) { |
| return false; |
| } |
| } |
| |
| public static boolean isModified(RawCommandLineEditor editor, String value) { |
| return !editor.getText().equals(value); |
| } |
| |
| public static boolean isModified(JTextField textField, String value) { |
| return !textField.getText().equals(value); |
| } |
| } |