imakerplugin/com.nokia.s60tools.imaker/src/com/nokia/s60tools/imaker/internal/viewers/DebugTab.java
author haismail <hussein.ismail@nokia.com>
Thu, 18 Feb 2010 08:20:36 +0200
changeset 5 d5efbe6c22e8
parent 2 a91cb670dd8e
child 6 7f60f3388609
permissions -rw-r--r--
Ticket #1245: Update target selection required to avoid yellow warnings on content tab Ticket #1135: As a iMaker plugin user i want to reload available configurations (reload the current configuration)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     1
/*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     3
* All rights reserved.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     4
* This component and the accompanying materials are made available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     6
* which accompanies this distribution, and is available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     8
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     9
* Initial Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    11
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    12
* Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    13
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    14
* Description:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    15
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    16
*/
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    17
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    18
package com.nokia.s60tools.imaker.internal.viewers;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    19
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    20
import java.io.File;
5
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
    21
import java.util.ArrayList;
1
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
    22
import java.util.List;
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    23
import java.util.regex.Pattern;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    24
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    25
import org.eclipse.emf.common.util.EList;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    26
import org.eclipse.jface.resource.ImageRegistry;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    27
import org.eclipse.jface.viewers.ColumnLabelProvider;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    28
import org.eclipse.jface.viewers.ISelection;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    29
import org.eclipse.jface.viewers.IStructuredContentProvider;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    30
import org.eclipse.jface.viewers.IStructuredSelection;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    31
import org.eclipse.jface.viewers.TableViewer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    32
import org.eclipse.jface.viewers.TableViewerColumn;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    33
import org.eclipse.jface.viewers.Viewer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    34
import org.eclipse.jface.window.Window;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    35
import org.eclipse.swt.SWT;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    36
import org.eclipse.swt.custom.CTabFolder;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    37
import org.eclipse.swt.custom.CTabItem;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    38
import org.eclipse.swt.events.KeyEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    39
import org.eclipse.swt.events.KeyListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    40
import org.eclipse.swt.events.SelectionEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    41
import org.eclipse.swt.events.SelectionListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    42
import org.eclipse.swt.graphics.Image;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    43
import org.eclipse.swt.layout.GridData;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    44
import org.eclipse.swt.layout.GridLayout;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    45
import org.eclipse.swt.widgets.Button;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    46
import org.eclipse.swt.widgets.Composite;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    47
import org.eclipse.swt.widgets.Control;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    48
import org.eclipse.swt.widgets.Table;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    49
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    50
import com.nokia.s60tools.imaker.IMakerPlugin;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    51
import com.nokia.s60tools.imaker.IMakerKeyConstants;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    52
import com.nokia.s60tools.imaker.Messages;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    53
import com.nokia.s60tools.imaker.UIConfiguration;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    54
import com.nokia.s60tools.imaker.UITarget;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    55
import com.nokia.s60tools.imaker.internal.managers.ProjectManager;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    56
import com.nokia.s60tools.imaker.internal.model.FileToImage;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    57
import com.nokia.s60tools.imaker.internal.model.ImakerProperties;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    58
import com.nokia.s60tools.imaker.internal.model.iContent.IContentFactory;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    59
import com.nokia.s60tools.imaker.internal.model.iContent.IbyEntry;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    60
import com.nokia.s60tools.imaker.internal.model.iContent.ImageContent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    61
import com.nokia.s60tools.imaker.internal.providers.CheckBoxEditingSupport;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    62
import com.nokia.s60tools.imaker.internal.providers.ComboEditingSupport;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    63
import com.nokia.s60tools.imaker.internal.providers.TextEditingSupport;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    64
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    65
public class DebugTab extends CTabItem implements IPropertyViewer {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    66
	public static final String CHECKED_IMAGE 	= "checked";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    67
	public static final String UNCHECKED_IMAGE  = "unchecked";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    68
	public static final String WARNING_IMAGE    = "warning";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    69
	public static final String ERROR_IMAGE      = "error";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    70
	public static final String REL_PATTERN      = ".*epoc32.release.+?(urel).*";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    71
	public static final String DEBUG_PATTERN    = ".*epoc32.release.+?(udeb).*";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    72
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    73
	// For the checkbox images
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    74
	private static ImageRegistry imageRegistry = IMakerPlugin.getDefault().getImageRegistry();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    75
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    76
	private IMakerTabsViewer tabsViewer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    77
	private ProjectManager projectManager;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    78
	private TableViewer tableViewer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    79
	private PreferencesTab mainTab;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    80
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    81
	static {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    82
		String iconPath = "icons/"; 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    83
		imageRegistry.put(CHECKED_IMAGE, IMakerPlugin.getImageDescriptor( 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    84
				iconPath + CHECKED_IMAGE + ".gif"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    85
		)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    86
		);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    87
		imageRegistry.put(UNCHECKED_IMAGE, IMakerPlugin.getImageDescriptor( 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    88
				iconPath + UNCHECKED_IMAGE + ".gif"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    89
		)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    90
		);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    91
		imageRegistry.put(WARNING_IMAGE, IMakerPlugin.getImageDescriptor( 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    92
				iconPath + WARNING_IMAGE + ".gif"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    93
		)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    94
		);	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    95
		imageRegistry.put(ERROR_IMAGE, IMakerPlugin.getImageDescriptor( 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    96
				iconPath + ERROR_IMAGE + ".gif"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    97
		)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    98
		);	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    99
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   100
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   101
	public DebugTab(CTabFolder parent, int style, IMakerTabsViewer viewer, PreferencesTab main) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   102
		super(parent, style);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   103
		this.tabsViewer = viewer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   104
		this.projectManager = tabsViewer.getProjectManager();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   105
		setControl(createControl(parent));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   106
		this.mainTab = main;		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   107
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   108
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   109
	private void deleteSelection() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   110
		ISelection selection = tableViewer.getSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   111
		if(selection!=null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   112
			IStructuredSelection ss = (IStructuredSelection) selection;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   113
			Object[] objects = ss.toArray();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   114
			for (int i = 0; i < objects.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   115
				IbyEntry fe = (IbyEntry) objects[i];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   116
				ImageContent ic = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   117
				ic.getEntries().remove(fe);						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   118
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   119
			tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   120
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   121
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   122
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   123
	private Control createControl(CTabFolder parent) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   124
		Composite top = new Composite(parent,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   125
		top.setLayout(new GridLayout(2,false));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   126
		top.setLayoutData(new GridData(GridData.FILL_BOTH));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   127
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   128
		// create table
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   129
		Composite tableComp = getNewComposite(top);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   130
		Table table = new Table(tableComp,SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   131
		GridData gridData = new GridData(GridData.FILL,GridData.FILL,true,true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   132
		gridData.heightHint = 180;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   133
		table.setLayoutData(gridData);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   134
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   135
		// create controls
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   136
		Composite controls = getNewComposite(top);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   137
		Button button = new Button(controls,SWT.PUSH|SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   138
		button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   139
		button.setText(Messages.getString("DebugTab.2"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   140
		button.setToolTipText(Messages.getString("DebugTab.3"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   141
		button.addSelectionListener(new SelectionListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   142
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   143
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   144
			public void widgetSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   145
				IbyEntry entry = IContentFactory.eINSTANCE.createIbyEntry();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   146
				ImageContent input = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   147
				FileToImage file = new FileToImage();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   148
				AddEditFileToTransferDialog dialog= new AddEditFileToTransferDialog(getControl().getShell(), file);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   149
				dialog.setTitle(Messages.getString("FileTransferTab.8"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   150
				if (dialog.open() != Window.OK) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   151
					return;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   152
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   153
				entry.setEnabled(file.getEnabled());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   154
				entry.setFile(file.getHostPath().substring(2));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   155
				entry.setTarget(file.getTargetPath());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   156
				entry.setDebug(isDebug(entry.getFile()));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   157
				input.getEntries().add(entry);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   158
				tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   159
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   160
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   161
			private boolean isDebug(String file) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   162
				Pattern p = Pattern.compile(DEBUG_PATTERN);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   163
				return p.matcher(file).find();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   164
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   165
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   166
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   167
			public void widgetDefaultSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   168
				widgetSelected(e);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   169
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   170
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   171
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   172
		button = new Button(controls,SWT.PUSH|SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   173
		button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   174
		button.setText(Messages.getString("DebugTab.4"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   175
		button.setToolTipText(Messages.getString("DebugTab.5"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   176
		button.addSelectionListener(new SelectionListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   177
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   178
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   179
			public void widgetSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   180
				deleteSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   181
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   182
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   183
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   184
			public void widgetDefaultSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   185
				widgetSelected(e);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   186
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   187
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   188
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   189
		button = new Button(controls,SWT.PUSH|SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   190
		button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   191
		button.setText(Messages.getString("DebugTab.6"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   192
		button.setToolTipText(Messages.getString("DebugTab.7"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   193
		button.addSelectionListener(new SelectionListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   194
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   195
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   196
			public void widgetSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   197
				ImageContent input = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   198
				if(input!=null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   199
					projectManager.populate(input);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   200
					tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   201
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   202
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   203
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   204
//			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   205
			public void widgetDefaultSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   206
				widgetSelected(e);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   207
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   208
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   209
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   210
		Composite enableButtons = new Composite(top,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   211
		GridLayout layout = new GridLayout(2, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   212
		layout.marginWidth = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   213
		layout.marginHeight = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   214
		enableButtons.setLayout(layout);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   215
		enableButtons.setLayoutData(new GridData());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   216
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   217
		button = new Button(enableButtons,SWT.PUSH|SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   218
		button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   219
		button.setText(Messages.getString("DebugTab.8"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   220
		button.setToolTipText(Messages.getString("DebugTab.9"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   221
		button.addSelectionListener(new SelectionListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   222
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   223
			public void widgetSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   224
				ImageContent ic = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   225
				if(ic!=null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   226
					for (IbyEntry entry: ic.getEntries()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   227
						entry.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   228
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   229
					tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   230
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   231
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   232
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   233
			public void widgetDefaultSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   234
				widgetSelected(e);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   235
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   236
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   237
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   238
		button = new Button(enableButtons,SWT.PUSH|SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   239
		button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   240
		button.setText(Messages.getString("DebugTab.10"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   241
		button.setToolTipText(Messages.getString("DebugTab.11"));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   242
		button.addSelectionListener(new SelectionListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   243
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   244
			public void widgetSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   245
				ImageContent ic = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   246
				if(ic!=null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   247
					for (IbyEntry entry: ic.getEntries()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   248
						entry.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   249
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   250
					tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   251
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   252
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   253
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   254
			public void widgetDefaultSelected(SelectionEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   255
				widgetSelected(e);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   256
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   257
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   258
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   259
		tableViewer = new TableViewer(table);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   260
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   261
		tableViewer.getTable().setHeaderVisible(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   262
		tableViewer.getTable().setLinesVisible(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   263
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   264
		tableViewer.setContentProvider(new DebugContentProvider());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   265
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   266
		createColumns(tableViewer);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   267
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   268
		tableViewer.getTable().addKeyListener(new KeyListener() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   269
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   270
			public void keyReleased(KeyEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   271
				if(e.character == SWT.DEL) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   272
					deleteSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   273
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   274
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   275
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   276
			public void keyPressed(KeyEvent e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   277
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   278
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   279
		tableViewer.setInput(getDefaultInput());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   280
		return top;	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   281
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   282
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   283
	private Object getDefaultInput() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   284
		IContentFactory factory = IContentFactory.eINSTANCE;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   285
		ImageContent ic = factory.createImageContent();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   286
		return ic;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   287
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   288
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   289
	private Composite getNewComposite(Composite top) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   290
		Composite comp = new Composite(top,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   291
		GridLayout layout = new GridLayout(1, true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   292
		layout.marginWidth = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   293
		layout.marginHeight = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   294
		comp.setLayout(layout);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   295
		GridData layoutData = new GridData(GridData.FILL_BOTH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   296
		layoutData.grabExcessHorizontalSpace = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   297
		comp.setLayoutData(layoutData);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   298
		return comp;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   299
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   300
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   301
	private void createColumns(TableViewer viewer) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   302
		int columnSizes[] = {20,50,130,130,60,50};
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   303
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   304
		TableViewerColumn column = new TableViewerColumn(viewer,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   305
		column.getColumn().setText("!");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   306
		column.getColumn().setWidth(columnSizes[0]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   307
		column.setLabelProvider(new ColumnLabelProvider() {	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   308
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   309
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   310
			public Image getImage(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   311
				if(isWarning(element)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   312
					return imageRegistry.get(WARNING_IMAGE);					
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   313
				} else if(isError(element)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   314
					return imageRegistry.get(ERROR_IMAGE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   315
				} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   316
					return null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   317
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   318
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   319
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   320
			private IbyEntry getEntry(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   321
				return (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   322
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   323
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   324
			private boolean isWarning(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   325
				IbyEntry entry = getEntry(element);
2
a91cb670dd8e iMaker plugin updated
haismail <hussein.ismail@nokia.com>
parents: 1
diff changeset
   326
				String location = " "+entry.getLocation().toString().toUpperCase()+" ";
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   327
				String targets[] = mainTab.getSelectedTargets();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   328
				UIConfiguration pr = mainTab.getSelectedProduct();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   329
				for (int i = 0; i < targets.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   330
					String t = targets[i];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   331
					UITarget target = pr.getTarget(t);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   332
					if(target!=null&&target.getSteps()!=null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   333
						int index = target.getSteps().indexOf(location);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   334
						if(index!=-1) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   335
							return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   336
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   337
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   338
				}
5
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
   339
				mainTab.addTarget(entry.getLocation().getName());
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
   340
				return false;
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   341
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   342
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   343
			private boolean isError(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   344
				IbyEntry entry = getEntry(element);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   345
				String path = projectManager.getRoot()+entry.getFile();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   346
				File f = new File(path);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   347
				if(!f.exists()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   348
					String message = Messages.getString("DebugTab.1");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   349
					entry.setStatusMessage(message.replace("xxx", f.getAbsolutePath()));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   350
					return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   351
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   352
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   353
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   354
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   355
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   356
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   357
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   358
				if(isWarning(element) || isError(element)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   359
					return getEntry(element).getStatusMessage();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   360
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   361
				return "";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   362
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   363
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   364
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   365
		column.setEditingSupport(new CheckBoxEditingSupport(viewer, 0));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   366
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   367
		column = new TableViewerColumn(viewer,SWT.CENTER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   368
		column.getColumn().setText("Enable");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   369
		column.getColumn().setWidth(columnSizes[1]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   370
		column.setLabelProvider( new ColumnLabelProvider() {	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   371
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   372
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   373
			public Image getImage(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   374
				IbyEntry ie = (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   375
				String key = ie.isEnabled() ? CHECKED_IMAGE : UNCHECKED_IMAGE;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   376
				return imageRegistry.get(key);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   377
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   378
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   379
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   380
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   381
				return "";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   382
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   383
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   384
		column.setEditingSupport(new CheckBoxEditingSupport(viewer, 1));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   385
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   386
		column = new TableViewerColumn(viewer,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   387
		column.getColumn().setText("File");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   388
		column.getColumn().setWidth(columnSizes[2]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   389
		column.setLabelProvider(new ColumnLabelProvider() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   390
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   391
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   392
				IbyEntry e = (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   393
				return e.getFile();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   394
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   395
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   396
		column.setEditingSupport(new TextEditingSupport(viewer,2));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   397
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   398
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   399
		column = new TableViewerColumn(viewer,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   400
		column.getColumn().setText("Target");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   401
		column.getColumn().setWidth(columnSizes[3]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   402
		column.setLabelProvider(new ColumnLabelProvider() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   403
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   404
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   405
				IbyEntry e = (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   406
				return e.getTarget();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   407
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   408
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   409
		column.setEditingSupport(new TextEditingSupport(viewer,3));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   410
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   411
		column = new TableViewerColumn(viewer,SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   412
		column.getColumn().setText("Location");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   413
		column.getColumn().setWidth(columnSizes[4]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   414
		column.setLabelProvider(new ColumnLabelProvider() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   415
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   416
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   417
				IbyEntry e = (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   418
				return e.getLocation().getLiteral();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   419
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   420
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   421
		column.setEditingSupport(new ComboEditingSupport(viewer,4));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   422
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   423
		column = new TableViewerColumn(viewer,SWT.CENTER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   424
		column.getColumn().setText("Debug");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   425
		column.getColumn().setWidth(columnSizes[5]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   426
		column.setLabelProvider( new ColumnLabelProvider() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   427
					
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   428
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   429
			public Image getImage(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   430
				IbyEntry ie = (IbyEntry) element;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   431
				String key = ie.isDebug() ? CHECKED_IMAGE : UNCHECKED_IMAGE;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   432
				return imageRegistry.get(key);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   433
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   434
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   435
			@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   436
			public String getText(Object element) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   437
				return "";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   438
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   439
		});
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   440
		column.setEditingSupport(new CheckBoxEditingSupport(viewer, 5));		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   441
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   442
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   443
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   444
	private class DebugContentProvider  implements IStructuredContentProvider {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   445
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   446
//		@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   447
		public Object[] getElements(Object inputElement) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   448
			ImageContent ic = (ImageContent) inputElement;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   449
			return ic.getEntries().toArray();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   450
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   451
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   452
//		@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   453
		public void dispose() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   454
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   455
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   456
//		@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   457
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   458
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   459
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   460
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   461
	/* (non-Javadoc)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   462
	 * @see com.nokia.s60tools.imaker.internal.viewers.IPropertyViewer#addToProperties(com.nokia.s60tools.imaker.internal.model.ImakerProperties)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   463
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   464
	public void addToProperties(ImakerProperties prop) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   465
		ImageContent input = getInput();
5
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
   466
		List<IbyEntry> ls = new ArrayList<IbyEntry>();
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
   467
		ls.addAll(input.getEntries());
d5efbe6c22e8 Ticket #1245: Update target selection required to avoid yellow warnings on content tab
haismail <hussein.ismail@nokia.com>
parents: 2
diff changeset
   468
		prop.put(IMakerKeyConstants.DEBUGFILES, ls);			
1
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   469
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   470
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   471
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   472
	/* (non-Javadoc)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   473
	 * @see com.nokia.s60tools.imaker.internal.viewers.IPropertyViewer#restoreFromProperties(com.nokia.s60tools.imaker.internal.model.ImakerProperties)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   474
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   475
	public void restoreFromProperties(ImakerProperties prop) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   476
		ImageContent input = getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   477
		EList<IbyEntry> entries = input.getEntries();
1
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   478
		entries.clear();
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   479
		Object ents = prop.get(IMakerKeyConstants.DEBUGFILES);
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   480
		if(ents!=null) {
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   481
			List<IbyEntry> ls = (List<IbyEntry>) ents;
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   482
			entries.addAll(ls);
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   483
		}
1
7ff23301fe22 iMaker plugin updated:
haismail <hussein.ismail@nokia.com>
parents: 0
diff changeset
   484
		tableViewer.refresh();
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   485
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   486
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   487
	private ImageContent getInput() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   488
		return (ImageContent) tableViewer.getInput();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   489
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   490
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   491
	public void refesh() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   492
		tableViewer.refresh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   493
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   494
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   495
//	@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   496
	public void clear() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   497
		getInput().getEntries().clear();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   498
		refesh();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   499
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   500
}