01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.nls;
11:
12: import java.lang.reflect.InvocationTargetException;
13:
14: import org.eclipse.core.runtime.CoreException;
15: import org.eclipse.core.runtime.IProgressMonitor;
16: import org.eclipse.core.runtime.OperationCanceledException;
17: import org.eclipse.ltk.core.refactoring.Change;
18: import org.eclipse.ltk.core.refactoring.CompositeChange;
19: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
20: import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
21: import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
22: import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
23: import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
24: import org.eclipse.pde.internal.ui.PDEUIMessages;
25:
26: public class ExternalizeStringsProcessor extends RefactoringProcessor {
27:
28: Object[] fChangeFiles = null;
29:
30: public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
31: CheckConditionsContext context) throws CoreException,
32: OperationCanceledException {
33: RefactoringStatus status = new RefactoringStatus();
34: if (fChangeFiles == null)
35: status
36: .addFatalError(PDEUIMessages.ExternalizeStringsProcessor_errorMessage);
37: return status;
38: }
39:
40: public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
41: throws CoreException, OperationCanceledException {
42: return null;
43: }
44:
45: public Change createChange(IProgressMonitor pm)
46: throws CoreException, OperationCanceledException {
47: CompositeChange change = new CompositeChange(""); //$NON-NLS-1$
48: change.markAsSynthetic();
49: ExternalizeStringsOperation op = new ExternalizeStringsOperation(
50: fChangeFiles, change);
51: try {
52: op.run(pm);
53: } catch (InvocationTargetException e) {
54: } catch (InterruptedException e) {
55: }
56: return change;
57: }
58:
59: public Object[] getElements() {
60: return fChangeFiles;
61: }
62:
63: public String getIdentifier() {
64: return getClass().getName();
65: }
66:
67: public String getProcessorName() {
68: return PDEUIMessages.ExternalizeStringsWizard_title;
69: }
70:
71: public boolean isApplicable() throws CoreException {
72: return true;
73: }
74:
75: public RefactoringParticipant[] loadParticipants(
76: RefactoringStatus status,
77: SharableParticipants sharedParticipants)
78: throws CoreException {
79: return new RefactoringParticipant[0];
80: }
81:
82: public void setChangeFiles(Object[] changeFiles) {
83: fChangeFiles = changeFiles;
84: }
85:
86: }
|