cdt/cdt_6_0_x/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/executables/ExecutablesViewer.java
author wpaul
Fri, 07 Aug 2009 13:47:27 -0500
changeset 60 3982fab6369e
parent 52 42077b7eab6e
permissions -rw-r--r--
fixed executables view merge problems - bug #'s 9562, 9568, 9571.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     1
/*******************************************************************************
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     2
 * Copyright (c) 2008 Nokia and others.
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     3
 * All rights reserved. This program and the accompanying materials
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     4
 * are made available under the terms of the Eclipse Public License v1.0
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     5
 * which accompanies this distribution, and is available at
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     6
 * http://www.eclipse.org/legal/epl-v10.html
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     7
 *
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     8
 * Contributors:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     9
 * Nokia - Initial API and implementation
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    10
 *******************************************************************************/
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    11
package org.eclipse.cdt.debug.internal.ui.views.executables;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    12
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
    13
import java.util.List;
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
    14
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    15
import org.eclipse.cdt.debug.core.executables.Executable;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    16
import org.eclipse.cdt.debug.core.executables.ExecutablesManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    17
import org.eclipse.cdt.debug.core.executables.IExecutablesChangeListener;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    18
import org.eclipse.core.runtime.IProgressMonitor;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    19
import org.eclipse.core.runtime.IStatus;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    20
import org.eclipse.core.runtime.Status;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    21
import org.eclipse.jface.action.IMenuListener;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    22
import org.eclipse.jface.action.IMenuManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    23
import org.eclipse.jface.action.MenuManager;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    24
import org.eclipse.jface.action.Separator;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    25
import org.eclipse.jface.viewers.IStructuredSelection;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    26
import org.eclipse.jface.viewers.Viewer;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    27
import org.eclipse.jface.viewers.ViewerComparator;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    28
import org.eclipse.jface.viewers.ViewerDropAdapter;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    29
import org.eclipse.swt.SWT;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    30
import org.eclipse.swt.dnd.DND;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    31
import org.eclipse.swt.dnd.FileTransfer;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    32
import org.eclipse.swt.dnd.Transfer;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    33
import org.eclipse.swt.dnd.TransferData;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    34
import org.eclipse.swt.widgets.Composite;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    35
import org.eclipse.swt.widgets.Menu;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    36
import org.eclipse.swt.widgets.TreeColumn;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    37
import org.eclipse.ui.IWorkbenchActionConstants;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    38
import org.eclipse.ui.progress.UIJob;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    39
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    40
/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    41
 * Displays the list of executables gathered by the ExecutablesManager
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    42
 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    43
public class ExecutablesViewer extends BaseViewer implements IExecutablesChangeListener {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    44
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    45
	private static final String P_COLUMN_ORDER_KEY_EXE = "columnOrderKeyEXE"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    46
	private static final String P_SORTED_COLUMN_INDEX_KEY_EXE = "sortedColumnIndexKeyEXE"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    47
	private static final String P_COLUMN_SORT_DIRECTION_KEY_EXE = "columnSortDirectionKeyEXE"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    48
	private static final String P_VISIBLE_COLUMNS_KEY_EXE = "visibleColumnsKeyEXE"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    49
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    50
	
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    51
	/**
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    52
	 * Handles dropping executable files into the view
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    53
	 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    54
	public class ExecutablesDropAdapter extends ViewerDropAdapter {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    55
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    56
		protected ExecutablesDropAdapter(Viewer viewer) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    57
			super(viewer);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    58
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    59
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    60
		@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    61
		public boolean performDrop(Object data) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    62
			final String[] fileNames = (String[]) data;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    63
			ExecutablesViewer.this.getExecutablesView().importExecutables(fileNames);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    64
			return true;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    65
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    66
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    67
		@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    68
		public boolean validateDrop(Object target, int operation, TransferData transferType) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    69
			return FileTransfer.getInstance().isSupportedType(transferType);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    70
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    71
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    72
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    73
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    74
	public TreeColumn projectColumn;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    75
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    76
	public ExecutablesViewer(ExecutablesView executablesView, Composite parent, int style) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    77
		super(executablesView, parent, style);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    78
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    79
		// Setup D&D support
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    80
		int ops = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_DEFAULT;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    81
		Transfer[] transfers = new Transfer[] { FileTransfer.getInstance() };
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    82
		ExecutablesDropAdapter adapter = new ExecutablesDropAdapter(this);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    83
		adapter.setFeedbackEnabled(false);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    84
		addDropSupport(ops | DND.DROP_DEFAULT, transfers, adapter);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    85
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    86
		// Setup content provider
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    87
		ExecutablesContentProvider exeContentProvider = new ExecutablesContentProvider(this);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    88
		setContentProvider(exeContentProvider);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    89
		setLabelProvider(exeContentProvider);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    90
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    91
		getTree().setHeaderVisible(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    92
		getTree().setLinesVisible(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    93
		executablesView.getSite().setSelectionProvider(this);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    94
		getTree().setData(".uid", "ExecutablesViewerTree"); //$NON-NLS-1$ //$NON-NLS-2$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    95
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    96
		createColumns();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    97
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    98
		setInput(ExecutablesManager.getExecutablesManager());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    99
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   100
		MenuManager popupMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   101
		IMenuListener listener = new IMenuListener() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   102
			public void menuAboutToShow(IMenuManager manager) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   103
				manager.add(ExecutablesViewer.this.getExecutablesView().refreshAction);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   104
				manager.add(ExecutablesViewer.this.getExecutablesView().importAction);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   105
				manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   106
			}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   107
		};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   108
		popupMenuManager.addMenuListener(listener);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   109
		popupMenuManager.setRemoveAllWhenShown(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   110
		getExecutablesView().getSite().registerContextMenu(popupMenuManager, this.getExecutablesView().getSite().getSelectionProvider());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   111
		Menu menu = popupMenuManager.createContextMenu(getTree());
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   112
		getTree().setMenu(menu);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   113
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   114
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   115
	private void createColumns() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   116
		nameColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   117
		nameColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   118
		nameColumn.setText(Messages.ExecutablesViewer_ExecutableName);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   119
		nameColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   120
		nameColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.NAME));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   121
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   122
		projectColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   123
		projectColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   124
		projectColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   125
		projectColumn.setText(Messages.ExecutablesViewer_Project);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   126
		projectColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.PROJECT));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   127
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   128
		locationColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   129
		locationColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   130
		locationColumn.setText(Messages.ExecutablesViewer_Location);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   131
		locationColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   132
		locationColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.LOCATION));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   133
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   134
		sizeColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   135
		sizeColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   136
		sizeColumn.setText(Messages.ExecutablesViewer_Size);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   137
		sizeColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   138
		sizeColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.SIZE));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   139
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   140
		modifiedColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   141
		modifiedColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   142
		modifiedColumn.setText(Messages.ExecutablesViewer_Modified);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   143
		modifiedColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   144
		modifiedColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.MODIFIED));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   145
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   146
		typeColumn = new TreeColumn(getTree(), SWT.NONE);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   147
		typeColumn.setWidth(100);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   148
		typeColumn.setText(Messages.ExecutablesViewer_Type);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   149
		typeColumn.setMoveable(true);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   150
		typeColumn.addSelectionListener(new ColumnSelectionAdapter(ExecutablesView.TYPE));
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   151
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   152
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   153
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   154
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   155
	protected ViewerComparator getViewerComparator(int sortType) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   156
		if (sortType == ExecutablesView.PROJECT) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   157
			return new ExecutablesViewerComparator(sortType, column_sort_order[ExecutablesView.PROJECT]) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   158
				@SuppressWarnings("unchecked") //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   159
				public int compare(Viewer viewer, Object e1, Object e2) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   160
					Executable entry1 = (Executable) e1;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   161
					Executable entry2 = (Executable) e2;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   162
					return getComparator().compare(entry1.getProject().getName(), entry2.getProject().getName())
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   163
							* column_sort_order[ExecutablesView.PROJECT];
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   164
				}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   165
			};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   166
		}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   167
		return new ExecutablesViewerComparator(sortType, column_sort_order[sortType]);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   168
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   169
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   170
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   171
	protected String getColumnOrderKey() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   172
		return P_COLUMN_ORDER_KEY_EXE;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   173
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   174
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   175
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   176
	protected String getSortedColumnIndexKey() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   177
		return P_SORTED_COLUMN_INDEX_KEY_EXE;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   178
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   179
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   180
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   181
	protected String getSortedColumnDirectionKey() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   182
		return P_COLUMN_SORT_DIRECTION_KEY_EXE;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   183
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   184
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   185
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   186
	protected String getVisibleColumnsKey() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   187
		return P_VISIBLE_COLUMNS_KEY_EXE;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   188
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   189
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   190
	@Override
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   191
	protected String getDefaultVisibleColumnsValue() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   192
		// default visible columns
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   193
		return "1,1,1,0,0,0"; //$NON-NLS-1$
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   194
	}
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   195
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   196
	public void executablesChanged(final List<Executable> executables) {
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   197
		// some executables have been updated.  if one of them is currently
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   198
		// selected, we need to update the source file list
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   199
		UIJob refreshJob = new UIJob(Messages.ExecutablesViewer_RefreshExecutablesView) {
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   200
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   201
			@Override
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   202
			public IStatus runInUIThread(IProgressMonitor monitor) {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   203
				// if the user has selected an executable, they expect its
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   204
				// list of source files to be refreshed automatically
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   205
				if (getSelection() != null &&
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   206
					getSelection() instanceof IStructuredSelection) {
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   207
					IStructuredSelection selection = (IStructuredSelection)getSelection();
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   208
					
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   209
					Object firstElement = selection.getFirstElement();
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   210
					if (firstElement instanceof Executable) {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   211
						Executable executable = (Executable) firstElement;
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   212
						if (executables.contains(executable)) {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   213
							executable.setRefreshSourceFiles(true);
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   214
							setSelection(selection);
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   215
						}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   216
					}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   217
				}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   218
				return Status.OK_STATUS;
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   219
			}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   220
		};
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   221
		refreshJob.schedule();
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   222
	}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   223
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   224
	public void executablesListChanged() {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   225
		// Executables list has changed so refresh the view.
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   226
		UIJob refreshJob = new UIJob(Messages.ExecutablesViewer_RefreshExecutablesView) {
52
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   227
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   228
			@Override
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   229
			public IStatus runInUIThread(IProgressMonitor monitor) {
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   230
				refresh(null);
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   231
				packColumns();
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   232
				return Status.OK_STATUS;
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   233
			}
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   234
		};
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   235
		refreshJob.schedule();
42077b7eab6e Second merge to proper cdt_6_0 branch for CDT bugs 181020, 279844, & Carbide bugs 6152 & 9031.
timkelly
parents: 51
diff changeset
   236
	}
60
3982fab6369e fixed executables view merge problems - bug #'s 9562, 9568, 9571.
wpaul
parents: 52
diff changeset
   237
}