61 |
61 |
import org.eclipse.ui.IPropertyListener;
|
62 |
62 |
import org.eclipse.ui.IWorkbenchPart;
|
63 |
63 |
import org.eclipse.ui.PlatformUI;
|
|
64 |
import org.eclipse.ui.forms.editor.FormEditor;
|
|
65 |
import org.eclipse.ui.forms.editor.FormPage;
|
|
66 |
import org.eclipse.ui.forms.widgets.TableWrapData;
|
64 |
67 |
import org.eclipse.ui.part.ViewPart;
|
65 |
68 |
import org.txm.rcp.editors.TXMEditor;
|
66 |
69 |
import org.txm.rcp.editors.TXMMultiPageEditor;
|
... | ... | |
132 |
135 |
@Override
|
133 |
136 |
public Object[] getElements(Object inputElement) {
|
134 |
137 |
if (inputElement == null) return new Object[0];
|
135 |
|
|
|
138 |
|
|
139 |
Object[] o = new Object[1];
|
136 |
140 |
if (inputElement instanceof TXMEditor) {
|
137 |
|
Object[] o = new Object[1];
|
|
141 |
|
138 |
142 |
o[0] = ((TXMEditor)inputElement).getContainer();
|
139 |
143 |
return o;
|
|
144 |
} else if (inputElement instanceof Composite) {
|
|
145 |
return ((Composite) inputElement).getChildren();
|
140 |
146 |
}
|
141 |
147 |
return null;
|
142 |
148 |
}
|
... | ... | |
288 |
294 |
|
289 |
295 |
if (layoutData instanceof GridData) {
|
290 |
296 |
GridData data = (GridData)layoutData;
|
291 |
|
return "GD: "+data.heightHint+" "+data.widthHint
|
292 |
|
+" "+data.horizontalAlignment+" "+data.horizontalIndent+" "+data.horizontalSpan
|
293 |
|
+" "+data.minimumHeight+" "+data.minimumWidth
|
294 |
|
+" "+data.verticalAlignment+" "+data.verticalIndent+" "+data.verticalSpan;
|
|
297 |
return "GD: heightHint="+data.heightHint+" widthHint="+data.widthHint
|
|
298 |
+"\n horizontalAlignment="+data.horizontalAlignment+" horizontalIndent="+data.horizontalIndent+" horizontalSpan="+data.horizontalSpan
|
|
299 |
+"\n minimumHeight="+data.minimumHeight+" minimumWidth="+data.minimumWidth
|
|
300 |
+"\n verticalAlignment="+data.verticalAlignment+" verticalIndent="+data.verticalIndent+" verticalSpan="+data.verticalSpan;
|
|
301 |
} else if (layoutData instanceof TableWrapData) {
|
|
302 |
TableWrapData data = (TableWrapData)layoutData;
|
|
303 |
return "TWD: heightHint="+data.heightHint+" align="+data.align
|
|
304 |
+"\n colspan="+data.colspan+" heightHint="+data.heightHint+" indent="+data.indent
|
|
305 |
+"\n maxHeight="+data.maxHeight+" maxWidth="+data.maxWidth
|
|
306 |
+"\n rowspan="+data.rowspan+" valign="+data.valign+" grabHorizontal="+data.grabHorizontal+" grabVertical="+data.grabVertical;
|
295 |
307 |
} else if (layoutData instanceof FormData) {
|
296 |
308 |
FormData data = (FormData)layoutData;
|
297 |
|
return "GD: "+data.height+" "+data.width
|
298 |
|
+" "+data.width+" "+data.bottom+" "+data.left+" "+data.right+" "+data.top;
|
|
309 |
return "FD: height="+data.height+" width="+data.width
|
|
310 |
+"\n bottom="+data.bottom+" left="+data.left+" right="+data.right+" top="+data.top;
|
299 |
311 |
}
|
300 |
312 |
return layoutData.toString();
|
301 |
313 |
}
|
... | ... | |
327 |
339 |
+"\n "+gl.marginBottom+" "+gl.marginLeft+" "+gl.marginRight+" "+gl.marginTop
|
328 |
340 |
+"\n "+gl.numColumns+" "+gl.makeColumnsEqualWidth;
|
329 |
341 |
|
|
342 |
} else if (layout instanceof FormLayout) {
|
|
343 |
FormLayout gl = (FormLayout)layout;
|
|
344 |
return "FL: marginBottom="+gl.marginBottom+" marginHeight="+gl.marginHeight+" marginWidth="+gl.marginWidth
|
|
345 |
+"\n marginLeft="+gl.marginLeft+" marginRight="+gl.marginRight+" marginTop="+gl.marginTop
|
|
346 |
+"\n spacing="+gl.spacing;
|
|
347 |
|
330 |
348 |
} else {
|
331 |
349 |
return layout.toString();
|
332 |
350 |
}
|
... | ... | |
336 |
354 |
public void partActivated(IWorkbenchPart part) {
|
337 |
355 |
if (part == null)
|
338 |
356 |
return;
|
|
357 |
|
339 |
358 |
// System.out.println("partActivated: "+part);
|
340 |
359 |
if (part instanceof TXMEditor) {
|
341 |
360 |
treeViewer.setInput(part);
|
342 |
361 |
} else if (part instanceof TXMMultiPageEditor) {
|
343 |
362 |
TXMMultiPageEditor tmpe = (TXMMultiPageEditor)part;
|
344 |
|
part = tmpe.getMainEditorPart();
|
345 |
|
if (part instanceof TXMEditor) {
|
346 |
|
treeViewer.setInput(part);
|
347 |
|
}
|
|
363 |
treeViewer.setInput(tmpe.getContainer());
|
|
364 |
} else if (part instanceof FormEditor) {
|
|
365 |
FormEditor tmpe = (FormEditor)part;
|
|
366 |
FormPage part2 = (FormPage) tmpe.getSelectedPage();
|
|
367 |
|
|
368 |
treeViewer.setInput(part2.getPartControl());
|
348 |
369 |
}
|
349 |
370 |
}
|
350 |
371 |
|