KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > subscriber > CVSActionDelegateWrapper


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.subscriber;
12
13 import org.eclipse.team.internal.ccvs.ui.Policy;
14 import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
15 import org.eclipse.team.internal.ui.Utils;
16 import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
17 import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
18
19 /**
20  * Superclass of CVS participant action delegates that uses the classname as the key
21  * to access the text from the resource bundle
22  */

23 public class CVSActionDelegateWrapper extends ActionDelegateWrapper {
24
25     public CVSActionDelegateWrapper(CVSAction delegate, ISynchronizePageConfiguration configuration) {
26         super(delegate, configuration, delegate.getId());
27         Utils.initAction(this, getBundleKeyPrefix(), Policy.getActionBundle());
28     }
29
30     /**
31      * Return the key to the action text in the resource bundle.
32      * The default is the class name followed by a dot (.).
33      * @return the bundle key prefix
34      */

35     protected String JavaDoc getBundleKeyPrefix() {
36         String JavaDoc name = getDelegate().getClass().getName();
37         int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
38
if (lastDot == -1) {
39             return name;
40         }
41         return name.substring(lastDot + 1) + "."; //$NON-NLS-1$
42
}
43 }
44
Popular Tags