diff options
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/favorites/actions/AbstractFavoritesAction.java')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/favorites/actions/AbstractFavoritesAction.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/favorites/actions/AbstractFavoritesAction.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/favorites/actions/AbstractFavoritesAction.java new file mode 100644 index 000000000..f64e4a7b7 --- /dev/null +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/favorites/actions/AbstractFavoritesAction.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2003 - 2005 University Of British Columbia 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: + * University Of British Columbia - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylar.bugzilla.favorites.actions; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.mylar.bugzilla.BugzillaPlugin; +import org.eclipse.swt.widgets.Shell; + + +/** + * Class that contains shared functions for the favorites actions + */ +public class AbstractFavoritesAction extends Action +{ + + /** + * Set the actions icon + * @param filename The icons file + */ + protected void setIcon(String filename) + { + URL url = null; + try + { + // try to change the default icon + url = new URL(BugzillaPlugin.getDefault().getBundle().getEntry("/"), filename); + setImageDescriptor(ImageDescriptor.createFromURL(url)); + } + catch (MalformedURLException e) + { + // Simply don't change the default icon + } + } + + /** + * Convienience method for getting the current shell + * @return The current shell + */ + protected Shell getShell() + { + return BugzillaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + } + +} |