From 95764ecec23c582b5e2cfabe6e4f3c1d9eeab6fb Mon Sep 17 00:00:00 2001 From: Oleg Shpynov Date: Fri, 29 Jan 2010 16:48:55 +0300 Subject: [PATCH] Initial version of extract method for python --- .../com/intellij/psi/util/PsiTreeUtil.java | 3 +- .../extractmethod/ExtractMethodDecorator.java | 23 ++ .../extractmethod/ExtractMethodDialog.java | 214 ++++++++++++ .../extractmethod/ExtractMethodSettings.java | 24 ++ .../extractmethod/ExtractMethodValidator.java | 29 ++ .../extractmethod/ParameterTablePanel.java | 318 ++++++++++++++++++ .../extractmethod/PyExtractMethodDialog.form | 107 ++++++ .../extractmethod/VariableData.java | 37 ++ 8 files changed, 754 insertions(+), 1 deletion(-) create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDecorator.java create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDialog.java create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodSettings.java create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodValidator.java create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/ParameterTablePanel.java create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/PyExtractMethodDialog.form create mode 100644 platform/lang-impl/src/com/intellij/refactoring/extractmethod/VariableData.java diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiTreeUtil.java b/platform/lang-api/src/com/intellij/psi/util/PsiTreeUtil.java index c1fbeafc746a..684e2fc5fb0c 100644 --- a/platform/lang-api/src/com/intellij/psi/util/PsiTreeUtil.java +++ b/platform/lang-api/src/com/intellij/psi/util/PsiTreeUtil.java @@ -576,7 +576,8 @@ public class PsiTreeUtil { return filteredElements.toArray(new PsiElement[filteredElements.size()]); } - public static boolean treeWalkUp(@NotNull final PsiScopeProcessor processor, @NotNull final PsiElement entrance, + public static boolean treeWalkUp(@NotNull final PsiScopeProcessor processor, + @NotNull final PsiElement entrance, @Nullable final PsiElement maxScope, @NotNull final ResolveState state) { PsiElement prevParent = entrance; diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDecorator.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDecorator.java new file mode 100644 index 000000000000..7c28399cf9fd --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDecorator.java @@ -0,0 +1,23 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +/** + * @author oleg + */ +public interface ExtractMethodDecorator { + String createMethodPreview(String methodName, VariableData[] variableDatas); +} diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDialog.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDialog.java new file mode 100644 index 000000000000..26acf72a25d1 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodDialog.java @@ -0,0 +1,214 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +import com.intellij.codeInsight.codeFragment.CodeFragment; +import com.intellij.openapi.help.HelpManager; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.Messages; +import com.intellij.refactoring.RefactoringBundle; +import com.intellij.ui.DocumentAdapter; +import com.intellij.util.containers.HashMap; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class ExtractMethodDialog extends DialogWrapper implements ExtractMethodSettings { + private JPanel myContentPane; + private ParameterTablePanel myParametersPanel; + private JTextField myMethodNameTextField; + private JTextArea mySignaturePreviewTextArea; + private JTextArea myOutputVariablesTextArea; + private final String myDefaultName; + private final ExtractMethodValidator myValidator; + private final ExtractMethodDecorator myDecorator; + + private VariableData[] myVariableData; + private Map myVariablesMap; + + private final List myArguments; + private final ArrayList myOutputVariables; + + public ExtractMethodDialog(final Project project, + final String defaultName, + final CodeFragment fragment, + final ExtractMethodValidator validator, + final ExtractMethodDecorator decorator) { + super(project, true); + myDefaultName = defaultName; + CodeFragment fragment1 = fragment; + myValidator = validator; + myDecorator = decorator; + myArguments = new ArrayList(fragment1.getInputVariables()); + Collections.sort(myArguments); + myOutputVariables = new ArrayList(fragment1.getOutputVariables()); + Collections.sort(myOutputVariables); + setModal(true); + setTitle(RefactoringBundle.message("extract.method.title")); + init(); + } + + @Override + protected void init() { + super.init(); + // Set default name and select it + myMethodNameTextField.setText(myDefaultName); + myMethodNameTextField.setSelectionStart(0); + myMethodNameTextField.setSelectionStart(myDefaultName.length()); + myMethodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() { + @Override + protected void textChanged(DocumentEvent e) { + updateOutputVariables(); + updateSignature(); + updateOkStatus(); + } + }); + + + myVariableData = createVariableData(myArguments); + myVariablesMap = createVariableMap(myVariableData); + myParametersPanel.setVariableData(myVariableData); + myParametersPanel.init(); + + updateOutputVariables(); + updateSignature(); + updateOkStatus(); + } + + public JComponent getPreferredFocusedComponent() { + return myMethodNameTextField; + } + + public static VariableData[] createVariableData(final List args) { + final VariableData[] datas = new VariableData[args.size()]; + for (int i = 0; i < args.size(); i++) { + final VariableData data = new VariableData(); + final String name = args.get(i); + data.originalName = name; + data.name = name; + data.passAsParameter = true; + datas[i] = data; + } + return datas; + } + + public static Map createVariableMap(final VariableData[] data) { + final HashMap map = new HashMap(); + for (VariableData variableData : data) { + map.put(variableData.getOriginalName(), variableData); + } + return map; + } + + @Override + protected Action[] createActions() { + return new Action[]{getOKAction(), getCancelAction(), getHelpAction()}; + } + + @Override + protected void doOKAction() { + final String error = myValidator.check(getMethodName()); + if (error!=null){ + Messages.showInfoMessage(error, RefactoringBundle.message("error.title")); + return; + } + super.doOKAction(); + } + + @Override + protected void doHelpAction() { + HelpManager.getInstance().invokeHelp("refactoring.extractMethod"); + } + + protected JComponent createCenterPanel() { + return myContentPane; + } + + private void createUIComponents() { + myParametersPanel = new ParameterTablePanel(myValidator){ + protected void doCancelAction() { + ExtractMethodDialog.this.doCancelAction(); + } + + protected void doEnterAction() { + doOKAction(); + } + + protected void updateSignature() { + updateOutputVariables(); + ExtractMethodDialog.this.updateSignature(); + } + }; + } + + private void updateOutputVariables() { + final StringBuilder builder = new StringBuilder(); + boolean first = true; + for (String variable : myOutputVariables) { + if (myVariablesMap!=null){ + final VariableData data = myVariablesMap.get(variable); + final String outputName = data != null ? data.getName() : variable; + if (first){ + first = false; + } else { + builder.append(", "); + } + builder.append(outputName); + } + } + myOutputVariablesTextArea.setText(builder.length() > 0 ? builder.toString() : RefactoringBundle.message("Empty output variables")); + } + + private void updateSignature() { + //final StringBuilder builder = new StringBuilder(); + //builder.append(PyTokenTypes.DEF_KEYWORD.toString()).append(' ').append(getMethodName()); + //builder.append("("); + //if (myVariableData!=null){ + // boolean first = true; + // for (VariableData variableData : myVariableData) { + // if (variableData.passAsParameter){ + // if (first){ + // first = false; + // } else { + // builder.append(", "); + // } + // builder.append(variableData.name); + // } + // } + //} + //builder.append(")\nend"); + //mySignaturePreviewTextArea.setText(builder.toString()); + mySignaturePreviewTextArea.setText(myDecorator.createMethodPreview(getMethodName(), myVariableData)); + } + + private void updateOkStatus() { + setOKActionEnabled(myValidator.isValidName(getMethodName())); + } + + public String getMethodName() { + return myMethodNameTextField.getText().trim(); + } + + public VariableData[] getVariableData() { + return myVariableData; + } + +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodSettings.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodSettings.java new file mode 100644 index 000000000000..5916d5af675a --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodSettings.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +/** + * @author oleg + */ +public interface ExtractMethodSettings { + String getMethodName(); + VariableData[] getVariableData(); +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodValidator.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodValidator.java new file mode 100644 index 000000000000..dcc221b2ab4d --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ExtractMethodValidator.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +import org.jetbrains.annotations.Nullable; + +/** + * @author oleg + * This validator should check if name will clash with existing methods + */ +public interface ExtractMethodValidator { + @Nullable + String check(String name); + + boolean isValidName(String name); +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ParameterTablePanel.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ParameterTablePanel.java new file mode 100644 index 000000000000..4a73ce9fadc8 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/ParameterTablePanel.java @@ -0,0 +1,318 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +import com.intellij.ui.ScrollPaneFactory; +import com.intellij.ui.TableUtil; +import com.intellij.ui.UIBundle; +import com.intellij.util.ui.Table; +import org.jetbrains.annotations.NonNls; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; + +/** + * @author oleg + * It`s a modified copy of com.intellij.refactoring.util.ParameterTablePanel + */ +public abstract class ParameterTablePanel extends JPanel { + private VariableData[] myVariableData; + + private Table myTable; + private MyTableModel myTableModel; + private JButton myUpButton; + private JButton myDownButton; + private final ExtractMethodValidator myValidator; + + protected abstract void updateSignature(); + + protected abstract void doEnterAction(); + + protected abstract void doCancelAction(); + + public void setVariableData(VariableData[] variableData) { + myVariableData = variableData; + } + + public ParameterTablePanel(final ExtractMethodValidator validator) { + super(new BorderLayout()); + myValidator = validator; + } + + public void init() { + myTableModel = new MyTableModel(); + myTable = new Table(myTableModel); + DefaultCellEditor defaultEditor = (DefaultCellEditor)myTable.getDefaultEditor(Object.class); + defaultEditor.setClickCountToStart(1); + + myTable.setTableHeader(null); + myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + myTable.getColumnModel().getColumn(MyTableModel.CHECKMARK_COLUMN).setMaxWidth(new JCheckBox().getPreferredSize().width); + myTable.getColumnModel().getColumn(MyTableModel.PARAMETER_NAME_COLUMN).setCellRenderer(new DefaultTableCellRenderer() { + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + VariableData data = myVariableData[row]; + setText(data.name); + return this; + } + }); + + + myTable.setPreferredScrollableViewportSize(new Dimension(250, myTable.getRowHeight() * 5)); + myTable.setShowGrid(false); + myTable.setIntercellSpacing(new Dimension(0, 0)); + @NonNls final InputMap inputMap = myTable.getInputMap(); + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "enable_disable"); + @NonNls final ActionMap actionMap = myTable.getActionMap(); + actionMap.put("enable_disable", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + if (myTable.isEditing()) return; + int[] rows = myTable.getSelectedRows(); + if (rows.length > 0) { + boolean valueToBeSet = false; + for (int row : rows) { + if (!myVariableData[row].passAsParameter) { + valueToBeSet = true; + break; + } + } + for (int row : rows) { + myVariableData[row].passAsParameter = valueToBeSet; + } + myTableModel.fireTableRowsUpdated(rows[0], rows[rows.length - 1]); + TableUtil.selectRows(myTable, rows); + } + } + }); + // F2 should edit the name + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "edit_parameter_name"); + actionMap.put("edit_parameter_name", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + if (!myTable.isEditing()) { + int row = myTable.getSelectedRow(); + if (row >= 0 && row < myTableModel.getRowCount()) { + TableUtil.editCellAt(myTable, row, MyTableModel.PARAMETER_NAME_COLUMN); + } + } + } + }); + + // make ENTER work when the table has focus + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "invokeImpl"); + actionMap.put("invokeImpl", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + TableCellEditor editor = myTable.getCellEditor(); + if (editor != null) { + editor.stopCellEditing(); + } + else { + doEnterAction(); + } + } + }); + + // make ESCAPE work when the table has focus + actionMap.put("doCancel", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + TableCellEditor editor = myTable.getCellEditor(); + if (editor != null) { + editor.stopCellEditing(); + } + else { + doCancelAction(); + } + } + }); + + JPanel listPanel = new JPanel(new BorderLayout()); + JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); + listPanel.add(scrollPane, BorderLayout.CENTER); + listPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + add(listPanel, BorderLayout.CENTER); + + JPanel buttonsPanel = new JPanel(); + buttonsPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); + add(buttonsPanel, BorderLayout.EAST); + + buttonsPanel.setLayout(new GridBagLayout()); + GridBagConstraints gbConstraints = new GridBagConstraints(); + gbConstraints.gridwidth = GridBagConstraints.REMAINDER; + gbConstraints.fill = GridBagConstraints.HORIZONTAL; + gbConstraints.insets = new Insets(2, 4, 2, 4); + + myUpButton = new JButton(); + myUpButton.setText(UIBundle.message("row.move.up")); + myUpButton.setDefaultCapable(false); + buttonsPanel.add(myUpButton, gbConstraints); + + myDownButton = new JButton(); + myDownButton.setText(UIBundle.message("row.move.down")); + myDownButton.setDefaultCapable(false); + buttonsPanel.add(myDownButton, gbConstraints); + + gbConstraints.weighty = 1; + buttonsPanel.add(new JPanel(), gbConstraints); + + myUpButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (myTable.isEditing()) { + final boolean isStopped = myTable.getCellEditor().stopCellEditing(); + if (!isStopped) return; + } + moveSelectedItem(-1); + updateSignature(); + myTable.requestFocus(); + } + }); + + myDownButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (myTable.isEditing()) { + final boolean isStopped = myTable.getCellEditor().stopCellEditing(); + if (!isStopped) return; + } + moveSelectedItem(+1); + updateSignature(); + myTable.requestFocus(); + } + }); + + myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + updateMoveButtons(); + } + }); + if (myVariableData.length <= 1) { + myUpButton.setEnabled(false); + myDownButton.setEnabled(false); + } + else { + myTable.getSelectionModel().setSelectionInterval(0, 0); + } + updateMoveButtons(); + } + + private void updateMoveButtons() { + int row = myTable.getSelectedRow(); + if (0 <= row && row < myVariableData.length) { + myUpButton.setEnabled(row > 0); + myDownButton.setEnabled(row < myVariableData.length - 1); + } + else { + myUpButton.setEnabled(false); + myDownButton.setEnabled(false); + } + } + + private void moveSelectedItem(int moveIncrement) { + int row = myTable.getSelectedRow(); + if (row < 0 || row >= myVariableData.length) return; + int targetRow = row + moveIncrement; + if (targetRow < 0 || targetRow >= myVariableData.length) return; + + VariableData currentItem = myVariableData[row]; + myVariableData[row] = myVariableData[targetRow]; + myVariableData[targetRow] = currentItem; + + myTableModel.fireTableRowsUpdated(Math.min(targetRow, row), Math.max(targetRow, row)); + myTable.getSelectionModel().setSelectionInterval(targetRow, targetRow); + } + + public void setEnabled(boolean enabled) { + myTable.setEnabled(enabled); + if (!enabled) { + myUpButton.setEnabled(false); + myDownButton.setEnabled(false); + } + else { + updateMoveButtons(); + } + super.setEnabled(enabled); + } + + private class MyTableModel extends AbstractTableModel { + public static final int CHECKMARK_COLUMN = 0; + public static final int PARAMETER_NAME_COLUMN = 1; + + public int getRowCount() { + return myVariableData.length; + } + + public int getColumnCount() { + return 2; + } + + public Object getValueAt(int rowIndex, int columnIndex) { + switch (columnIndex) { + case CHECKMARK_COLUMN: { + return myVariableData[rowIndex].passAsParameter ? Boolean.TRUE : Boolean.FALSE; + } + case PARAMETER_NAME_COLUMN: { + return myVariableData[rowIndex].name; + } + } + assert false; + return null; + } + + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + switch (columnIndex) { + case CHECKMARK_COLUMN: { + myVariableData[rowIndex].passAsParameter = ((Boolean)aValue).booleanValue(); + fireTableRowsUpdated(rowIndex, rowIndex); + myTable.getSelectionModel().setSelectionInterval(rowIndex, rowIndex); + updateSignature(); + break; + } + case PARAMETER_NAME_COLUMN: { + VariableData data = myVariableData[rowIndex]; + String name = (String)aValue; + if (myValidator.isValidName(name)) { + data.name = name; + } + updateSignature(); + break; + } + } + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + switch (columnIndex) { + case CHECKMARK_COLUMN: + return isEnabled(); + case PARAMETER_NAME_COLUMN: + return isEnabled() && myVariableData[rowIndex].passAsParameter; + default: + return false; + } + } + + public Class getColumnClass(int columnIndex) { + if (columnIndex == CHECKMARK_COLUMN) { + return Boolean.class; + } + return super.getColumnClass(columnIndex); + } + } +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/PyExtractMethodDialog.form b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/PyExtractMethodDialog.form new file mode 100644 index 000000000000..c27b42145137 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/PyExtractMethodDialog.form @@ -0,0 +1,107 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/platform/lang-impl/src/com/intellij/refactoring/extractmethod/VariableData.java b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/VariableData.java new file mode 100644 index 000000000000..00b9a4343787 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/refactoring/extractmethod/VariableData.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2010 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.refactoring.extractmethod; + +/** +* @author oleg +*/ +public class VariableData { + public String originalName; + public String name; + public boolean passAsParameter; + + public String getName() { + return name; + } + + public String getOriginalName() { + return originalName; + } + + public boolean isPassAsParameter() { + return passAsParameter; + } +}