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