public NodeInspectableContainer(InspectorView parent, SceneNode target) { super(parent, target); int editorId = editorContext.editorId; addDisposeListener(e -> EventService.unsubscribe(editorId, this)); EventService.subscribe(editorId, this); addDisposeListener(e -> Workbench.deactivate(this)); Workbench.activate(this); FormToolkit toolkit = GurellaStudioPlugin.getToolkit(); toolkit.adapt(this); Composite body = getBody(); GridLayoutFactory.fillDefaults().numColumns(4).extendedMargins(0, 10, 4, 0).applyTo(body); Label nameLabel = toolkit.createLabel(body, " Name: "); nameLabel.setLayoutData(new GridData(BEGINNING, CENTER, false, false)); nameText = UiUtils.createText(body); nameText.setText(target.getName()); nameText.setLayoutData(new GridData(FILL, BEGINNING, true, false)); nameChangedlLstener = e -> nodeNameChanged(); nameText.addListener(SWT.Modify, nameChangedlLstener); enabledCheck = toolkit.createButton(body, "Enabled", CHECK); enabledCheck.setLayoutData(new GridData(END, CENTER, false, false)); enabledCheck.setSelection(target.isEnabled()); nodeEnabledListener = e -> nodeEnabledChanged(); enabledCheck.addListener(SWT.Selection, nodeEnabledListener); menuButton = toolkit.createLabel(body, " ", NONE); menuButton.setImage(GurellaStudioPlugin.createImage("icons/menu.png")); menuButton.setLayoutData(new GridData(END, CENTER, false, false)); menuButton.addListener(SWT.MouseUp, e -> showMenu()); componentsComposite = toolkit.createComposite(body); GridLayout componentsLayout = new GridLayout(1, false); componentsLayout.marginHeight = 0; componentsLayout.marginWidth = 0; componentsComposite.setLayout(componentsLayout); componentsComposite.setLayoutData(new GridData(FILL, FILL, true, true, 4, 1)); UiUtils.paintBordersFor(body); initComponentContainers(); layout(true, true); }
private void scriptMenuSeleted() { Thread current = Thread.currentThread(); ClassLoader contextClassLoader = current.getContextClassLoader(); try { current.setContextClassLoader(editorContext.classLoader); addScriptComponent(); } catch (Exception e) { String message = "Error occurred while adding script component"; GurellaStudioPlugin.showError(e, message); } finally { current.setContextClassLoader(contextClassLoader); } }
private Section createSection(SceneNodeComponent component) { FormToolkit toolkit = GurellaStudioPlugin.getToolkit(); Section section = toolkit.createSection(componentsComposite, TWISTIE | SHORT_TITLE_BAR | NO_TITLE_FOCUS_BOX); section.setText(MetaTypes.getMetaType(component).getName()); section.setLayoutData(new GridData(FILL, FILL, true, false, 1, 1)); section.addExpansionListener(new ExpansionListener(component)); BeanEditor<SceneNodeComponent> editor = createEditor(section, editorContext, component); Signal1<PropertyValueChangedEvent> signal = editor.getContext().propertiesSignal; signal.addListener(e -> notifySceneChanged()); section.setClient(editor); section.setExpanded(getPreferences().getBoolean(component.ensureUuid(), true)); editors.put(component, section); return section; }