Skip to main content
summaryrefslogtreecommitdiffstats
blob: 301cb1b454feef6cd5373da6fdcd572003a466d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * 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.ui.actions;

import org.eclipse.mylar.bugzilla.ui.OfflineView;

/**
 * Action of removing a bookmark
 */
public class DeleteOfflineReportAction extends AbstractOfflineReportsAction 
{
	/** The instance of the offlineReports view */
	private OfflineView view;
	
	/** True if all of the bookmarks are to be deleted */
	private boolean deleteAll;
	
	/**
	 * Constructor
	 * @param offlineReportsView The offlineReports view being used
	 * @param deleteAllOfflineReports <code>true</code> if all of the offlineReports should be deleted, else <code>false</code>
	 */
	public DeleteOfflineReportAction(OfflineView offlineReportsView, boolean deleteAllOfflineReports) 
	{
		deleteAll = deleteAllOfflineReports;
		
		// set the appropriate icons and tool tips for the action depending
		// on whether it will delete all items or not
		if (deleteAll) 
		{
			setToolTipText("Remove all offline reports");
			setText("Remove all");
			setIcon("icons/remove-all.gif");
		}
		else 
		{
			setToolTipText( "Remove selected offline reports" );
			setText( "Remove" );
			setIcon( "icons/remove.gif" );
		}
		
		view = offlineReportsView;
	}
	
	/**
	 * Delete the appropriate offline reports 
	 * @see org.eclipse.jface.action.IAction#run()
	 */
	@Override
	public void run() 
	{
		OfflineView.checkWindow();
		
		// call the appropriate delete function
		if (deleteAll)
			view.deleteAllOfflineReports();
		else
			view.deleteSelectedOfflineReports();
		OfflineView.updateActionEnablement();
	}
}

Back to the top