blob: 85b7f2101d7888f3d3840871974c1d9e6ce0327f (
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
|
/*******************************************************************************
* Copyright (c) 2009 STMicroelectronics.
* 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:
* Marzia Maugeri <marzia.maugeri@st.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.dataviewers.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;
import org.eclipse.linuxtools.dataviewers.STDataViewersActivator;
import org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTViewer;
import org.eclipse.linuxtools.dataviewers.abstractviewers.STDataViewersMessages;
import org.eclipse.linuxtools.dataviewers.dialogs.STDataViewersHideShowColumnsDialog;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* This action allows the user to hide/show some columns.
*/
public class STHideShowColAction extends Action {
private final AbstractSTViewer stViewer;
/**
* Creates the action for the given viewer.
*
* @param stViewer The AbstractSTViewer to create the action for.
*/
public STHideShowColAction(AbstractSTViewer stViewer) {
super(STDataViewersMessages.hideshowAction_title,
AbstractUIPlugin.imageDescriptorFromPlugin(STDataViewersActivator.PLUGIN_ID,
"icons/prop_edt.gif")); //$NON-NLS-1$
this.stViewer = stViewer;
setEnabled(true);
}
@Override
public void run() {
STDataViewersHideShowColumnsDialog dialog = new STDataViewersHideShowColumnsDialog(stViewer);
if (dialog.open() == Window.OK && dialog.isDirty()) {
if (dialog.getManager() != null) {
stViewer.setHideShowManager(dialog.getManager());
}
}
}
}
|