/** * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart, org.eclipse.jface.viewers.ISelection) */ public void selectionChanged(IFormPart part, ISelection newSelection) { // Pre-condition assert (newSelection instanceof NavigableSelection); // Retreieves the node that is provided by the selection. /*if( part != this )*/ { selection = (NavigableSelection) newSelection; Object object = selection.getFirstElement(); Setting setting = (object instanceof Setting) ? (Setting) object : null; String text = setting.getProperty(Setting.TEXT); // Checks that the setting has a text property. if (text == null) { Plugin.log(setting.getIdentifier() + ": missing TEXT property."); text = new String(setting.getIdentifier()); } // Updates the form controls. this.selectNote(setting); this.selectEditor(setting); this.section.setText(text); this.section.layout(true, true); } }
@Override public boolean setInput(Object input) { ColumnLayout layout = new ColumnLayout(); layout.topMargin = 0; layout.bottomMargin = 0; layout.verticalSpacing = 0; layout.maxNumColumns = 4; body.setLayout(layout); if (!(input instanceof EObject)) { return false; } FormToolkit toolkit = getToolkit(); EObject object = (EObject) input; List<IFormPart> formParts = EMFDetailFormPart.getFormParts(toolkit, object, true, selectionProvider); for (IFormPart formPart : formParts) { addPart(formPart); } boolean result = super.setInput(input); ScrolledForm form = getForm(); form.reflow(true); form.setOrigin(0, 0); checkParts(layout, formParts, input); return result; }
private void checkParts(ColumnLayout layout, List<IFormPart> formParts, Object input) { for (IFormPart part : formParts) { Composite composite = null; if (part instanceof EMFDetailFormPart) { EMFDetailFormPart emfDetailFormPart = (EMFDetailFormPart) part; composite = emfDetailFormPart.getComposite(); } if (part instanceof EMFTitleFormPart) { EMFTitleFormPart emfTitleFormPart = (EMFTitleFormPart) part; composite = emfTitleFormPart.getComposite(); } if (composite != null) { checkControl(part, layout, composite, input); } } }
public void selectionChanged(IFormPart part, ISelection selection) { IStructuredSelection sel = (IStructuredSelection) selection; module = (IModule) sel.getFirstElement(); refreshUI(); editorPage.refresh(RefreshArea.DETAIL); }
/** * Page에 추가된 섹션들 반환 * * @return IFormPart[] */ public IFormPart[] getSections() { if (managedForm != null) { return managedForm.getParts(); } return null; }
@Override public void selectionChanged(IFormPart part, ISelection selection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() == 1) { input = (ThemeColor) ssel.getFirstElement(); } else input = null; update(); }
/** * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ public void doubleClick(DoubleClickEvent event) { IManagedForm managedForm = getManagedForm(); // Searchs for the details part in the managed form and set the focus on it. IFormPart parts[] = managedForm.getParts(); for (int i = 0; i < parts.length; ++i) { IFormPart currentPart = parts[i]; if (currentPart instanceof DetailsPart) { currentPart.setFocus(); break; } } }
/** * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart, org.eclipse.jface.viewers.ISelection) */ public void selectionChanged(IFormPart part, ISelection selection) { assert selection instanceof NavigableSelection; currentSelection = (NavigableSelection) selection; // Activates the default filter. activateFilter(defaultFilter); revealObject(currentSelection.getFirstElement()); // Updates the navigation actions. goBack.selectionChanged(selection); goForward.selectionChanged(selection); }
@Override public void selectionChanged(IFormPart part, ISelection selection) { automationBlock.setShowingPage(this); IStructuredSelection ss = (IStructuredSelection) selection; if(!ss.isEmpty()) { TreeNode node = (TreeNode) ss.getFirstElement(); setTreeModelFromSelection(node); setWidgetValues(); addRemoveValidatorMessages(); } }
public static List<IFormPart> getFormParts(FormToolkit toolkit, EObject object, boolean showTitle, ISelectionProvider selectionProvider) { IItemPropertySource source = null; if (object instanceof MultiEObject) { source = ((MultiEObject)object).getSource(); } else { source = EMFUtils.adapt(object, IItemPropertySource.class); } List<IFormPart> formParts = new ArrayList<IFormPart>(); if (source != null) { List<IItemPropertyDescriptor> pds = new ArrayList<IItemPropertyDescriptor>(); for (PropertyDescriptorContributor c : PROPERTY_DESCRIPTOR_CONTRIBUTOR) { pds.addAll(c.getPropertyDescriptors(object)); } pds.addAll(source.getPropertyDescriptors(object)); Map<String, List<IItemPropertyDescriptor>> map = EMFDetailUtils.groupByCategory(object, pds); PropertyDescriptorSorter sorter = getPropertyDescriptorSorter(toolkit, object); if (sorter != null) { sorter.sort(object, (LinkedHashMap<String, List<IItemPropertyDescriptor>>) map); } for (List<IItemPropertyDescriptor> descriptors : map.values()) { if (!EMFDetailUtils.isCategoryEmpty(object, descriptors)) formParts.add(new EMFDetailFormPart(toolkit, descriptors, showTitle, selectionProvider)); showTitle = false; } if (showTitle) { formParts.add(new EMFTitleFormPart()); } } return formParts; }
private void checkControl(IFormPart emfDetailFormPart, Layout layout, Control control, Object input) { Object layoutData = control.getLayoutData(); if (layoutData != null) { String mismatch = null; if ((layout instanceof ColumnLayout) && !(layoutData instanceof ColumnLayoutData)) { mismatch = "ColumnLayout is incompatible with " + layoutData; } if ((layout instanceof GridLayout) && !(layoutData instanceof GridData)) { mismatch = "GridLayout is incompatible with " + layoutData; } if ((layout instanceof TableWrapLayout) && !(layoutData instanceof TableWrapData)) { mismatch = "TableWrapLayout is incompatible with " + layoutData; } if (mismatch != null) { StringBuilder message = new StringBuilder(mismatch); message.append('\n'); message.append("clearing invalid layout data on control " + control + " in form part: " + emfDetailFormPart); message.append('\n'); message.append("the input was: " + input); LogUtil.error(message); control.setLayoutData(null); } } if (control instanceof Composite) { Composite composite = (Composite) control; Control[] children = composite.getChildren(); for (Control child : children) { checkControl(emfDetailFormPart, composite.getLayout(), child, input); } } }
@SuppressWarnings("unchecked") public void selectionChanged(IFormPart part, ISelection selection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() == 1) { input = (T) ssel.getFirstElement(); section.setText(input.getClass().getSimpleName() + " Page"); } else input = null; update(); }
@Override public void selectionChanged(IFormPart part, ISelection selection) { refresh(); }