alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*******************************************************************************
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.pde.internal.ui.refactoring;

import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.internal.ui.PDEUIMessages;

public class RefactoringActionFactory {

	public static PDERefactoringAction createRefactorPluginIdAction() {
		return createRefactorPluginIdAction(PDEUIMessages.RenamePluginAction_label);
	}

	public static PDERefactoringAction createRefactorPluginIdAction(String label) {
		return new PDERefactoringAction(label, new RefactoringPluginInfo()) {

			public RefactoringProcessor getRefactoringProcessor(RefactoringInfo info) {
				return new RenamePluginProcessor(info);
			}

			public RefactoringWizard getRefactoringWizard(PDERefactor refactor, RefactoringInfo info) {
				return new RenamePluginWizard(refactor, info);
			}

		};
	}

	public static PDERefactoringAction createRefactorExtPointAction(String label) {
		return new PDERefactoringAction(label, getExtensionPointInfo()) {

			public RefactoringProcessor getRefactoringProcessor(RefactoringInfo info) {
				return new RenameExtensionPointProcessor(info);
			}

			public RefactoringWizard getRefactoringWizard(PDERefactor refactor, RefactoringInfo info) {
				return new RenameExtensionPointWizard(refactor, info);
			}

		};
	}

	private static RefactoringInfo getExtensionPointInfo() {
		return new RefactoringInfo() {

			public IPluginModelBase getBase() {
				if (fSelection instanceof IPluginExtensionPoint) {
					return ((IPluginExtensionPoint) fSelection).getPluginModel();
				}
				return null;
			}

			public String getCurrentValue() {
				if (fSelection instanceof IPluginExtensionPoint) {
					return ((IPluginExtensionPoint) fSelection).getId();
				}
				return null;
			}

		};
	}

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.