Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve GenericPresentationEngine. Cleanup and removing implemented.

Refactoring of renderer infrastructure.
  • Loading branch information...
commit 2e1614660cc35a1856993e0bfc9c5317c72ae5b2 1 parent 0113871
@semanticsoft authored
Showing with 379 additions and 165 deletions.
  1. +1 −1  boundsinfo/.settings/com.vaadin.integration.eclipse.prefs
  2. +0 −1  org.semanticsoft.e4extension/src/org/semanticsoft/e4extension/shared/DefaultPartAddingLogic.java
  3. +167 −13 ...ft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericPresentationEngine.java
  4. +2 −1  ...csoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericRendererFactory.java
  5. +1 −1  ...semanticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/AreaRenderer.java
  6. +18 −130 ...anticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/GenericRenderer.java
  7. +161 −0 ...oft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/GenericVaadinRenderer.java
  8. +1 −1  ...semanticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ItemRenderer.java
  9. +1 −1  ...anticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/MenuBarRenderer.java
  10. +1 −1  ...semanticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PartRenderer.java
  11. +1 −1  ...csoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveRenderer.java
  12. +8 −5 ....vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
  13. +1 −1  ...csoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PlaceholderRenderer.java
  14. +1 −1  ...semanticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/SashRenderer.java
  15. +1 −1  ...emanticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/StackRenderer.java
  16. +1 −1  ...anticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ToolBarRenderer.java
  17. +1 −1  ...csoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ToolControlRenderer.java
  18. +1 −1  ...anticsoft.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/TrimBarRenderer.java
  19. +1 −1  ...t.vaaclipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java
  20. +1 −1  org.semanticsoft.vaaclipse.widgets/.settings/com.vaadin.integration.eclipse.prefs
  21. +8 −0 ...icsoft.vaaclipsedemo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/editors/JavaEditor.java
  22. +0 −1  ...lipsedemo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/processor/TextEditorProcessor.java
  23. +1 −0  ...oft.vaaclipsedemo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/views/PackageExplorer.java
  24. BIN  ...demo.mediaplayer/bin/org/semanticsoft/vaaclipsedemo/mediaplayer/processors/MediaLibrarySetupProcessor.class
View
2  boundsinfo/.settings/com.vaadin.integration.eclipse.prefs
@@ -1,3 +1,3 @@
com.vaadin.integration.eclipse.useLatestNightly=false
-com.vaadin.integration.eclipse.widgetsetDirty=true
+com.vaadin.integration.eclipse.widgetsetDirty=false
eclipse.preferences.version=1
View
1  ...anticsoft.e4extension/src/org/semanticsoft/e4extension/shared/DefaultPartAddingLogic.java
@@ -23,7 +23,6 @@
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.semanticsoft.vaaclipse.presentation.renderers.GenericRenderer;
public class DefaultPartAddingLogic
{
View
180 ...ntation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericPresentationEngine.java
@@ -13,24 +13,33 @@
package org.semanticsoft.vaaclipse.presentation.engine;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.log.Logger;
+import org.eclipse.e4.ui.di.PersistState;
import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationElement;
+import org.eclipse.e4.ui.model.application.MContribution;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.services.internal.events.EventBroker;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
@@ -41,7 +50,6 @@
import org.osgi.service.event.EventHandler;
import org.semanticsoft.vaaclipse.presentation.renderers.GenericRenderer;
-import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
@@ -94,12 +102,12 @@ public void handleEvent(Event event) {
createGui(added);
if (added.getWidget() != null && changedElement.getWidget() != null && added.isToBeRendered())
parentRenderer.addChildGui(added, changedElement);
- }
+ }
else if (UIEvents.EventTypes.REMOVE.equals(eventType))
{
MUIElement removed = (MUIElement) event.getProperty(UIEvents.EventTags.OLD_VALUE);
- if (removed.getWidget() != null && changedElement.getWidget() != null && removed.isToBeRendered())
- parentRenderer.removeChildGui(removed, changedElement);
+ if (removed.isToBeRendered() && removed.getWidget() != null)
+ removeGui(removed);
}
}
};
@@ -143,12 +151,12 @@ public void handleEvent(Event event) {
// selected element
if (parent.getSelectedElement() == changedElement)
parent.setSelectedElement(null);
-
+
// Un-maximize the element before tearing it down
if (changedElement.getTags().contains(MAXIMIZED))
changedElement.getTags().remove(MAXIMIZED);
-
- parentRenderer.removeChildGui(changedElement, (MElementContainer<MUIElement>) parent);
+
+ removeGui(changedElement);
}
}
@@ -273,10 +281,9 @@ public Object createGui(MUIElement element, MElementContainer<MUIElement> parent
System.out.println("GenericPresentationEngine.createGui(): no parent: " + element + " parent: " + parent);
}
renderer.createWidget(element, parent);
- if (element.getWidget() != null && element.getWidget() instanceof AbstractComponent)
+ if (element.getWidget() != null)
{
- AbstractComponent component = (AbstractComponent) element.getWidget();
- component.setData(element);
+ renderer.bindWidget(element);
}
// Does not work: why?
@@ -351,12 +358,159 @@ private IEclipseContext getContext(MUIElement parent) {
}
return modelService.getContainingContext(parent);
}
-
+
@Override
public void removeGui(MUIElement element) {
- System.out.println("GenericPresentationEngine.removeGui(): " + element);
+
+ //((GenericRenderer) element.getRenderer()).removeWidget(element, null);
+
+ //((GenericRenderer) element.getRenderer()).disposeWidget(element);
+
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ // We call 'hideChild' *before* checking if the actual element
+ // has been rendered in order to pick up cases of 'lazy loading'
+ MUIElement parent = element.getParent();
+ GenericRenderer parentRenderer = (GenericRenderer) (parent != null ? parent.getRenderer() : null);
+
+ if (parentRenderer != null && parent.getWidget() != null) {
+ parentRenderer.removeChildGui(element, (MElementContainer<MUIElement>) parent);
+ }
+
+ GenericRenderer renderer = (GenericRenderer) element.getRenderer();
+
+ // If the element hasn't been rendered then this is a NO-OP
+ if (renderer != null) {
+
+ if (element instanceof MElementContainer<?>) {
+ MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element;
+ MUIElement selectedElement = container.getSelectedElement();
+ List<MUIElement> children = container.getChildren();
+ for (MUIElement child : children) {
+ // remove stuff in the "back" first
+ if (child != selectedElement) {
+ removeGui(child);
+ }
+ }
+
+ if (selectedElement != null
+ && children.contains(selectedElement)) {
+ // now remove the selected element
+ removeGui(selectedElement);
+ }
+ }
+ else if (element instanceof MPlaceholder)
+ {
+ MPlaceholder ph = (MPlaceholder) element;
+ MUIElement refElement = ph.getRef();
+
+ int pcount = 0;
+ MWindow window = modelService.getTopLevelWindowFor(element);
+ for (MPlaceholder p : modelService.findElements(window, null, MPlaceholder.class, null)) {
+ if (p.getRef() == refElement)
+ pcount++;
+ }
+
+ assert pcount > 0;
+
+ if (pcount == 1) {
+ removeGui(refElement);
+ }
+ }
- ((GenericRenderer) element.getRenderer()).removeWidget(element, null);
+ if (element instanceof MPerspective) {
+ MPerspective perspective = (MPerspective) element;
+ for (MWindow subWindow : perspective.getWindows()) {
+ removeGui(subWindow);
+ }
+ } else if (element instanceof MWindow) {
+ MWindow window = (MWindow) element;
+ for (MWindow subWindow : window.getWindows()) {
+ removeGui(subWindow);
+ }
+
+ if (window instanceof MTrimmedWindow) {
+ MTrimmedWindow trimmedWindow = (MTrimmedWindow) window;
+ for (MUIElement trimBar : trimmedWindow.getTrimBars()) {
+ removeGui(trimBar);
+ }
+ }
+ }
+
+ if (element instanceof MContribution) {
+ MContribution contribution = (MContribution) element;
+ Object client = contribution.getObject();
+ IEclipseContext parentContext = renderer.getContext(element);
+ if (parentContext != null && client != null) {
+ try {
+ ContextInjectionFactory.invoke(client,
+ PersistState.class, parentContext, null);
+ } catch (Exception e) {
+ if (logger != null) {
+ logger.error(e);
+ }
+ }
+ }
+ }
+
+ if (element instanceof MPart) {
+ MPart part = (MPart) element;
+ MToolBar toolBar = part.getToolbar();
+ if (toolBar != null) {
+
+ if (toolBar.getWidget() != null) {
+ ((GenericRenderer)(toolBar.getRenderer())).unbindWidget(toolBar);
+ }
+ }
+
+ for (MMenu menu : part.getMenus()) {
+ removeGui(menu);
+ }
+ }
+
+ renderer.unbindWidget(element);
+ renderer.disposeWidget(element);
+ element.setRenderer(null);
+ element.setWidget(null);
+
+ // unset the client object
+ if (element instanceof MContribution) {
+ MContribution contribution = (MContribution) element;
+ Object client = contribution.getObject();
+ IEclipseContext parentContext = renderer.getContext(element);
+ if (parentContext != null && client != null) {
+ try {
+ ContextInjectionFactory.uninject(client, parentContext);
+ } catch (Exception e) {
+ if (logger != null) {
+ logger.error(e);
+ }
+ }
+ }
+ contribution.setObject(null);
+ }
+
+ // dispose the context
+ if (element instanceof MContext) {
+ clearContext((MContext) element);
+ }
+ }
+ }
+
+ private void clearContext(MContext contextME) {
+ MContext ctxt = (MContext) contextME;
+ IEclipseContext lclContext = ctxt.getContext();
+ if (lclContext != null) {
+ IEclipseContext parentContext = lclContext.getParent();
+ IEclipseContext child = parentContext.getActiveChild();
+ if (child == lclContext) {
+ child.deactivate();
+ }
+
+ ctxt.setContext(null);
+ lclContext.dispose();
+ }
}
@Override
View
3  ...esentation/src/org/semanticsoft/vaaclipse/presentation/engine/GenericRendererFactory.java
@@ -14,11 +14,12 @@
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.semanticsoft.vaaclipse.presentation.renderers.GenericRenderer;
+import org.semanticsoft.vaaclipse.presentation.renderers.GenericVaadinRenderer;
@SuppressWarnings("restriction")
public class GenericRendererFactory implements RendererFactory {
- GenericRenderer genericRenderer = new GenericRenderer();
+ GenericVaadinRenderer genericRenderer = new GenericVaadinRenderer();
@Override
public GenericRenderer getRenderer(MUIElement uiElement) {
View
2  ...ipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/AreaRenderer.java
@@ -26,7 +26,7 @@
* @author rushan
*
*/
-public class AreaRenderer extends GenericRenderer
+public class AreaRenderer extends GenericVaadinRenderer
{
@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent)
View
148 ...e.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/GenericRenderer.java
@@ -1,146 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2011 Kai Toedter, Rushan R. Gilmullin and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
+/**
*
- * Contributors:
- * Kai Toedter - initial API and implementation
- * Rushan R. Gilmullin - adoption to vaaclipse and other changes
- ******************************************************************************/
-
+ */
package org.semanticsoft.vaaclipse.presentation.renderers;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-
import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
-import org.eclipse.e4.ui.workbench.modeling.EModelService;
-import org.semanticsoft.commons.general.Condition;
-
-import com.vaadin.ui.Component;
-import com.vaadin.ui.ComponentContainer;
/**
- * This renderer was adopted from Kai Toedter's generic renderer project. I place it in vaaclipse packages temproraly -
- * until the generic renderer will be the part of eclipse project.
- * @author Kai Toedter
+ * @author rushan
+ *
*/
-@SuppressWarnings("restriction")
-public class GenericRenderer {
-
- //public static final String OWNING_ME = "modelElement";
-
- protected IEclipseContext context;
- protected EModelService modelService;
-
- @PostConstruct
- public void postConstruct(IEclipseContext context) {
- this.context = context;
- this.modelService = (EModelService) context.get(EModelService.class.getName());
- }
-
- public Object getParentWidget(MUIElement element) {
- if (element.getParent() != null) {
- return element.getParent().getWidget();
- }
- return null;
- }
-
- public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
-
- }
-
- public void removeWidget(MUIElement element, MElementContainer<MUIElement> parent) {
- if (parent.getWidget() instanceof ComponentContainer && element.getWidget() != null)
- {
- ((ComponentContainer)parent.getWidget()).removeComponent((Component) element.getWidget());
- }
- }
-
- public void processContents(MElementContainer<MUIElement> element) {
- System.out.println("GenericRenderer.processContents(): " + element);
- }
-
- public void addChildGui(MUIElement child, MElementContainer<MUIElement> element)
- {
- throw new RuntimeException("addChildGui not implemented for renderer " + this);
- }
-
- public void removeChildGui(MUIElement element, MElementContainer<MUIElement> parent) {
- if (parent.getWidget() instanceof ComponentContainer && element.getWidget() != null)
- {
- ((ComponentContainer)parent.getWidget()).removeComponent((Component) element.getWidget());
- }
- }
-
- protected List<? extends MUIElement> filterRenderableAndVisibleElements(MElementContainer<?> sash)
- {
- List<MUIElement> renderableAndVisible = new ArrayList<>();
- for (MUIElement e : sash.getChildren())
- {
- if (e.isToBeRendered() && e.isVisible())
- renderableAndVisible.add(e);
- }
- return renderableAndVisible;
- }
-
- protected int indexOf(MUIElement element, MElementContainer<MUIElement> parent)
- {
- return indexOf(element, parent, null);
- }
-
- protected int indexOf(MUIElement element, MElementContainer<MUIElement> parent, Condition<MUIElement> condition)
- {
- int i = 0;
- for (MUIElement child : parent.getChildren())
- {
- boolean additionalConditionRes = condition != null ? condition.check(child) : true;
- if (child.isToBeRendered() && additionalConditionRes)
- {
- if (child.equals(element))
- return i;
- i++;
- }
- }
- return -1;
- }
+public interface GenericRenderer
+{
+ Object getParentWidget(MUIElement element);
+ void createWidget(MUIElement element, MElementContainer<MUIElement> parent);
+ void disposeWidget(MUIElement element);
+ void processContents(MElementContainer<MUIElement> element);
+ void addChildGui(MUIElement child, MElementContainer<MUIElement> element);
+ void removeChildGui(MUIElement element, MElementContainer<MUIElement> parent);
/**
* This method will be removed as soon as possible
* @param element
*/
@Deprecated
- public void refreshPlatformElement(MElementContainer<?> element)
- {
-
- }
-
-
- public void hookControllerLogic(MUIElement element) {
- // System.out.println("GenericRenderer.hookControllerLogic(): " +
- // element);
- }
-
- public IEclipseContext getContext(MUIElement part) {
- if (part instanceof MContext) {
- return ((MContext) part).getContext();
- }
- return getContextForParent(part);
- }
-
- protected IEclipseContext getContextForParent(MUIElement element) {
- return modelService.getContainingContext(element);
- }
-
- public void setVisible(MUIElement changedElement, boolean visible) {
- ((Component)changedElement.getWidget()).setVisible(visible);
- }
+ void refreshPlatformElement(MElementContainer<?> element);
+ void hookControllerLogic(MUIElement element);
+ IEclipseContext getContext(MUIElement part);
+ void setVisible(MUIElement changedElement, boolean visible);
+ void bindWidget(MUIElement element);
+ void unbindWidget(MUIElement element);
}
View
161 ...entation/src/org/semanticsoft/vaaclipse/presentation/renderers/GenericVaadinRenderer.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Kai Toedter, Rushan R. Gilmullin and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Kai Toedter - initial API and implementation
+ * Rushan R. Gilmullin - adoption to vaaclipse and other changes
+ ******************************************************************************/
+
+package org.semanticsoft.vaaclipse.presentation.renderers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.model.application.ui.MElementContainer;
+import org.eclipse.e4.ui.model.application.ui.MUIElement;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.semanticsoft.commons.general.Condition;
+
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+/**
+ * This renderer was adopted from Kai Toedter's generic renderer project. I place it in vaaclipse packages temproraly -
+ * until the generic renderer will be the part of eclipse project.
+ * @author Kai Toedter
+ */
+@SuppressWarnings("restriction")
+public class GenericVaadinRenderer implements GenericRenderer {
+
+ //public static final String OWNING_ME = "modelElement";
+
+ protected IEclipseContext context;
+ protected EModelService modelService;
+
+ @PostConstruct
+ public void postConstruct(IEclipseContext context) {
+ this.context = context;
+ this.modelService = (EModelService) context.get(EModelService.class.getName());
+ }
+
+ public Object getParentWidget(MUIElement element) {
+ if (element.getParent() != null) {
+ return element.getParent().getWidget();
+ }
+ return null;
+ }
+
+ public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
+
+ }
+
+ public void disposeWidget(MUIElement element) {
+
+ }
+
+ public void processContents(MElementContainer<MUIElement> element) {
+ System.out.println("GenericRenderer.processContents(): " + element);
+ }
+
+ public void addChildGui(MUIElement child, MElementContainer<MUIElement> element)
+ {
+ throw new RuntimeException("addChildGui not implemented for renderer " + this);
+ }
+
+ public void removeChildGui(MUIElement element, MElementContainer<MUIElement> parent) {
+ if (parent.getWidget() instanceof ComponentContainer && element.getWidget() != null)
+ {
+ ((ComponentContainer)parent.getWidget()).removeComponent((Component) element.getWidget());
+ }
+ }
+
+ protected List<? extends MUIElement> filterRenderableAndVisibleElements(MElementContainer<?> sash)
+ {
+ List<MUIElement> renderableAndVisible = new ArrayList<>();
+ for (MUIElement e : sash.getChildren())
+ {
+ if (e.isToBeRendered() && e.isVisible())
+ renderableAndVisible.add(e);
+ }
+ return renderableAndVisible;
+ }
+
+ protected int indexOf(MUIElement element, MElementContainer<MUIElement> parent)
+ {
+ return indexOf(element, parent, null);
+ }
+
+ protected int indexOf(MUIElement element, MElementContainer<MUIElement> parent, Condition<MUIElement> condition)
+ {
+ int i = 0;
+ for (MUIElement child : parent.getChildren())
+ {
+ boolean additionalConditionRes = condition != null ? condition.check(child) : true;
+ if (child.isToBeRendered() && additionalConditionRes)
+ {
+ if (child.equals(element))
+ return i;
+ i++;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * This method will be removed as soon as possible
+ * @param element
+ */
+ @Deprecated
+ public void refreshPlatformElement(MElementContainer<?> element)
+ {
+
+ }
+
+
+ public void hookControllerLogic(MUIElement element) {
+ // System.out.println("GenericRenderer.hookControllerLogic(): " +
+ // element);
+ }
+
+ public IEclipseContext getContext(MUIElement part) {
+ if (part instanceof MContext) {
+ return ((MContext) part).getContext();
+ }
+ return getContextForParent(part);
+ }
+
+ protected IEclipseContext getContextForParent(MUIElement element) {
+ return modelService.getContainingContext(element);
+ }
+
+ public void setVisible(MUIElement changedElement, boolean visible) {
+ ((Component)changedElement.getWidget()).setVisible(visible);
+ }
+
+ public void unbindWidget(MUIElement element) {
+ if (element.getWidget() != null && element.getWidget() instanceof AbstractComponent)
+ {
+ AbstractComponent component = (AbstractComponent) element.getWidget();
+ component.setData(null);
+ }
+ }
+
+ @Override
+ public void bindWidget(MUIElement element) {
+ if (element.getWidget() != null && element.getWidget() instanceof AbstractComponent)
+ {
+ AbstractComponent component = (AbstractComponent) element.getWidget();
+ component.setData(element);
+ }
+ }
+}
View
2  ...ipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ItemRenderer.java
@@ -35,7 +35,7 @@
@SuppressWarnings("restriction")
-public abstract class ItemRenderer extends GenericRenderer {
+public abstract class ItemRenderer extends GenericVaadinRenderer {
protected String prepareText(MMenuItem model)
{
View
2  ...e.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/MenuBarRenderer.java
@@ -21,7 +21,7 @@
import com.vaadin.ui.MenuBar.MenuItem;
@SuppressWarnings("restriction")
-public class MenuBarRenderer extends GenericRenderer
+public class MenuBarRenderer extends GenericVaadinRenderer
{
@Override
View
2  ...ipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PartRenderer.java
@@ -30,7 +30,7 @@
@SuppressWarnings("restriction")
-public class PartRenderer extends GenericRenderer {
+public class PartRenderer extends GenericVaadinRenderer {
@Inject
IPresentationEngine renderingEngine;
View
2  ...esentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveRenderer.java
@@ -23,7 +23,7 @@
* @author rushan
*
*/
-public class PerspectiveRenderer extends GenericRenderer
+public class PerspectiveRenderer extends GenericVaadinRenderer
{
@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent)
View
13 ...ation/src/org/semanticsoft/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
@@ -51,7 +51,7 @@
* @author rushan
*
*/
-public class PerspectiveStackRenderer extends GenericRenderer
+public class PerspectiveStackRenderer extends GenericVaadinRenderer
{
private Map<MUIElement, HorizontalLayout> perspectivestack_perspectiveswitcher = new HashMap<>();
private Map<MUIElement, TwoStateToolbarButton> perspective_button = new HashMap<>();
@@ -121,12 +121,15 @@ private void connectReferencedElementsToPerspectiveWidgets(MElementContainer<? e
if (e instanceof MPlaceholder)
{
MPlaceholder ph = (MPlaceholder) e;
- ComponentContainer phComponent = (ComponentContainer) ph.getWidget();
- Component refComponent = (Component) ph.getRef().getWidget();
- phComponent.addComponent(refComponent);
+ if (ph.isToBeRendered())
+ {
+ ComponentContainer phComponent = (ComponentContainer) ph.getWidget();
+ Component refComponent = (Component) ph.getRef().getWidget();
+ phComponent.addComponent(refComponent);
+ }
+
ph.getRef().setCurSharedRef(ph);
- System.out.println("sfaf");
MPartStack topLeftStack = HierarchyUtils.findTopLeftFolder(ph.getRef());
if (topLeftStack != null)
{
View
2  ...esentation/src/org/semanticsoft/vaaclipse/presentation/renderers/PlaceholderRenderer.java
@@ -43,7 +43,7 @@
* @author rushan
*
*/
-public class PlaceholderRenderer extends GenericRenderer
+public class PlaceholderRenderer extends GenericVaadinRenderer
{
@Inject
IPresentationEngine renderingEngine;
View
2  ...ipse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/SashRenderer.java
@@ -45,7 +45,7 @@
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.VerticalLayout;
-public class SashRenderer extends GenericRenderer {
+public class SashRenderer extends GenericVaadinRenderer {
@Inject
EventBroker eventBroker;
View
2  ...pse.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/StackRenderer.java
@@ -58,7 +58,7 @@
@SuppressWarnings("restriction")
-public class StackRenderer extends GenericRenderer {
+public class StackRenderer extends GenericVaadinRenderer {
@Inject
private EventBroker eventBroker;
View
2  ...e.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ToolBarRenderer.java
@@ -45,7 +45,7 @@
@SuppressWarnings("restriction")
-public class ToolBarRenderer extends GenericRenderer {
+public class ToolBarRenderer extends GenericVaadinRenderer {
private Map<MToolBar, AbstractLayout> modelToManager = new HashMap<MToolBar, AbstractLayout>();
private Map<AbstractLayout, MToolBar> managerToModel = new HashMap<AbstractLayout, MToolBar>();
View
2  ...esentation/src/org/semanticsoft/vaaclipse/presentation/renderers/ToolControlRenderer.java
@@ -32,7 +32,7 @@
/**
* Create a contribute part.
*/
-public class ToolControlRenderer extends GenericRenderer {
+public class ToolControlRenderer extends GenericVaadinRenderer {
@Inject
EModelService modelService;
View
2  ...e.presentation/src/org/semanticsoft/vaaclipse/presentation/renderers/TrimBarRenderer.java
@@ -43,7 +43,7 @@
@SuppressWarnings("restriction")
-public class TrimBarRenderer extends GenericRenderer {
+public class TrimBarRenderer extends GenericVaadinRenderer {
@Inject
MApplication app;
View
2  ...tation/src/org/semanticsoft/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java
@@ -43,7 +43,7 @@
@SuppressWarnings("restriction")
-public class WorkbenchWindowRenderer extends GenericRenderer {
+public class WorkbenchWindowRenderer extends GenericVaadinRenderer {
@Inject
private IEclipseContext eclipseContext;
View
2  org.semanticsoft.vaaclipse.widgets/.settings/com.vaadin.integration.eclipse.prefs
@@ -1,4 +1,4 @@
com.vaadin.integration.eclipse.useLatestNightly=false
com.vaadin.integration.eclipse.widgetsetCompilationEta=104686
-com.vaadin.integration.eclipse.widgetsetDirty=true
+com.vaadin.integration.eclipse.widgetsetDirty=false
eclipse.preferences.version=1
View
8 ...mo.cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/editors/JavaEditor.java
@@ -11,6 +11,8 @@
package org.semanticsoft.vaaclipsedemo.cassandra.app.editors;
+import javax.annotation.PreDestroy;
+
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
@@ -37,4 +39,10 @@ public JavaEditor(VerticalLayout container, MInputPart inputPart)
e.addComponent(text);
container.addComponent(e);
}
+
+ @PreDestroy
+ public void preDestory()
+ {
+ System.out.println("predestroy");
+ }
}
View
1  ...a.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/processor/TextEditorProcessor.java
@@ -40,7 +40,6 @@
public void handleEvent(Event event)
{
- System.out.println("afdasdfs");
MPart part = (MPart) event.getProperty(UIEvents.EventTags.ELEMENT);
if (part instanceof MInputPart)
{
View
1  ...cassandra.app/src/org/semanticsoft/vaaclipsedemo/cassandra/app/views/PackageExplorer.java
@@ -155,6 +155,7 @@ void registerHandler()
@PreDestroy
void unregisterHandlers()
{
+ System.out.println("pckexplorer destroy");
eventBroker.unsubscribe(activatePartHandler);
}
View
BIN  ...in/org/semanticsoft/vaaclipsedemo/mediaplayer/processors/MediaLibrarySetupProcessor.class
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.