⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constructorfieldrefactoring.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 JAVA
字号:
package org.python.pydev.refactoring.codegenerator.constructorfield;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.python.pydev.refactoring.ast.adapters.IClassDefAdapter;
import org.python.pydev.refactoring.core.AbstractPythonRefactoring;
import org.python.pydev.refactoring.core.RefactoringInfo;
import org.python.pydev.refactoring.core.change.IChangeProcessor;
import org.python.pydev.refactoring.ui.UITexts;
import org.python.pydev.refactoring.ui.model.constructorfield.ClassFieldTreeProvider;
import org.python.pydev.refactoring.ui.pages.ConstructorFieldPage;

public class ConstructorFieldRefactoring extends AbstractPythonRefactoring {

	private ConstructorFieldRequestProcessor requestProcessor;

	private IChangeProcessor changeProcessor;

	public ConstructorFieldRefactoring(String name, RefactoringInfo req) {
		super(name, req);
		try {
			initWizard(name);
		} catch (Throwable e) {
			status.addInfo(UITexts.infoFixCode);
		}
	}

	private void initWizard(String name) throws Throwable {
		ClassFieldTreeProvider provider = new ClassFieldTreeProvider(req.getScopeClass());
		this.requestProcessor = new ConstructorFieldRequestProcessor(this.req.getNewLineDelim());
		this.changeProcessor = new ConstructorFieldChangeProcessor(this.name, this.req, this.requestProcessor);
		this.pages.add(new ConstructorFieldPage(name, provider, requestProcessor));
	}

	@Override
	protected List<IChangeProcessor> getChangeProcessors() {
		List<IChangeProcessor> processors = new ArrayList<IChangeProcessor>();
		processors.add(changeProcessor);
		return processors;
	}

	@Override
	public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
		IClassDefAdapter rootClass = this.req.getScopeClass();

		if (rootClass != null) {
			if (rootClass.getAttributes().size() > 0) {
				return status;
			}
		}

		status.addFatalError(UITexts.constructorFieldUnavailable);

		return status;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -