catch up with development
diff --git a/org.eclipse.osbp.vaaclipse.presentation/META-INF/MANIFEST.MF b/org.eclipse.osbp.vaaclipse.presentation/META-INF/MANIFEST.MF
index de43d64..c49c81e 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.vaaclipse.presentation/META-INF/MANIFEST.MF
@@ -30,7 +30,7 @@
org.eclipse.emf.ecore.xmi;bundle-version="2.10.2",
org.eclipse.osbp.runtime.designer.api;bundle-version="[0.9.0,0.10.0)",
dragdroplayouts.osgi;bundle-version="[1.3.2,1.3.3)",
- contextmenu.osgi;bundle-version="[4.6,4.7)"
+ com.vaadin.addon.vaadin-context-menu
Export-Package: org.eclipse.osbp.vaaclipse.presentation.engine;version="0.9.0",
org.eclipse.osbp.vaaclipse.presentation.renderers;version="0.9.0"
Import-Package: javax.annotation,
diff --git a/org.eclipse.osbp.vaaclipse.presentation/pom.xml b/org.eclipse.osbp.vaaclipse.presentation/pom.xml
index ec6b101..6f81e7a 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/pom.xml
+++ b/org.eclipse.osbp.vaaclipse.presentation/pom.xml
@@ -21,4 +21,17 @@
<version>0.9.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
+ <repositories>
+ <repository>
+ <id>vaadin-addons</id>
+ <url>http://maven.vaadin.com/vaadin-addons</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin.addon</groupId>
+ <artifactId>vaadin-context-menu</artifactId>
+ <version>0.7.5</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PartRenderer.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PartRenderer.java
index 9c146a7..4f870b0 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PartRenderer.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PartRenderer.java
@@ -26,6 +26,7 @@
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MInputPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
@@ -80,6 +81,7 @@
return savePrompts.get(part);
}
+ @SuppressWarnings({ "deprecation", "rawtypes" })
@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
Panel shortcutReceiver = new Panel();
@@ -113,7 +115,7 @@
pane.setExpandRatio(contributionArea, 100);
pane.setStyleName("part");
- element.setWidget(shortcutReceiver);
+ part.setWidget(shortcutReceiver);
final IEclipseContext localContext = part.getContext();
localContext.set(Component.class, contributionArea);
@@ -125,13 +127,41 @@
pane.addLayoutClickListener(e -> {
localContext.activate();
});
-
+
SavePromptSetup savePromptProvider = new SavePromptSetup();
savePrompts.put(part, savePromptProvider);
localContext.set(SavePromptSetup.class, savePromptProvider);
if (part instanceof MInputPart)
localContext.set(MInputPart.class, (MInputPart) part);
+ boolean render = false;
+ if (part.getParent() instanceof MElementContainer) {
+ MElementContainer mParent = part.getParent();
+ // workaround since MElementContainer<...> is not castable to
+ // MPartStack
+ if (mParent instanceof MPartStack) {
+ MPartStack mStack = (MPartStack) mParent;
+ if (mStack.getSelectedElement() == part
+ || !mStack.getChildren().isEmpty() && mStack.getChildren().get(0) == part
+ || mStack.getChildren().size() == 1) {
+ // render the part eager
+ render = true;
+ }
+ } else {
+ // render the part eager
+ render = true;
+ }
+ } else {
+ // render the part eager
+ render = true;
+ }
+
+ if (render) {
+ renderPartContent(part, localContext);
+ }
+ }
+
+ public static void renderPartContent(final MPart part, final IEclipseContext localContext) {
IContributionFactory contributionFactory = (IContributionFactory) localContext
.get(IContributionFactory.class.getName());
Object newPart = contributionFactory.create(part.getContributionURI(), localContext);
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
index 56a7ad6..5d57dd8 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/PerspectiveStackRenderer.java
@@ -69,10 +69,9 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
-import org.vaadin.peter.contextmenu.ContextMenu;
-import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItem;
-import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItemClickEvent;
+import com.vaadin.addon.contextmenu.ContextMenu;
+import com.vaadin.addon.contextmenu.MenuItem;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.event.dd.DragAndDropEvent;
@@ -104,14 +103,13 @@
* @author rushan
*
*/
-public class PerspectiveStackRenderer extends VaadinRenderer implements
- IDesignerService.IDesignListener {
+public class PerspectiveStackRenderer extends VaadinRenderer implements IDesignerService.IDesignListener {
/**
* Removes the perspective from stack if it is closed.
*/
private static final String TAG__REMOVE_ON_CLOSE = "remove_on_close";
-
+
/**
* The perspective is not visible in the open perspective dialog.
*/
@@ -139,36 +137,63 @@
private IDesignerService designerService;
@SuppressWarnings("serial")
- private static class PerspectiveContextMenu extends ContextMenu {
- private ContextMenuItem showTextItem;
- private ContextMenuItem closeItem;
-
+ private class PerspectiveContextMenu extends ContextMenu {
private static final String SHOW_TEXT = "Show Text";
- Resource checkIcon = new ThemeResource(
- "../vaaclipse_default_theme/img/check.png");
- public PerspectiveContextMenu(boolean iconsOnly) {
+ private MenuItem showTextItem;
+ private MenuItem closeItem;
+ private final MPerspective perspective;
+
+// Resource checkIcon = new ThemeResource("../vaaclipse_default_theme/img/check.png");
+
+ public PerspectiveContextMenu(TwoStateToolbarButton button, boolean iconsOnly, MPerspective perspective) {
+ super(button, true);
+ this.perspective = perspective;
createItems(iconsOnly);
- setIconsOnly(iconsOnly);
+// setIconsOnly(iconsOnly);
}
private void createItems(boolean iconsOnly) {
- closeItem = addItem("Close");
- closeItem.setSeparatorVisible(true);
- showTextItem = addItem(SHOW_TEXT, checkIcon);
+ closeItem = addItem("Close", this::menuSelected);
+ showTextItem = addItem(SHOW_TEXT, this::menuSelected);
}
- public ContextMenuItem getShowTextItem() {
+ public MenuItem getShowTextItem() {
return showTextItem;
}
- public ContextMenuItem getCloseItem() {
+ public MenuItem getCloseItem() {
return closeItem;
}
- void setIconsOnly(boolean iconsOnly) {
- showTextItem.setIcon(!iconsOnly ? checkIcon : null);
+// void setIconsOnly(boolean iconsOnly) {
+// showTextItem.setIcon(!iconsOnly ? checkIcon : null);
+// }
+
+ void menuSelected(MenuItem clickedItem) {
+
+ if (clickedItem == getCloseItem()) {
+ if (perspective.getTags().contains(TAG__REMOVE_ON_CLOSE)) {
+ // sends new messages
+ modelService.removePerspectiveModel(perspective, perspective.getContext().get(MWindow.class));
+
+ switchToPreviousPerspective(perspective);
+
+ } else if (perspective == activePerspective) {
+ switchToPreviousPerspective(perspective);
+ }
+
+ perspective.setToBeRendered(false);
+
+ } else if (clickedItem == getShowTextItem()) {
+ if (perspectiveStackForSwitcher.getTags().contains(Tags.ICONS_ONLY))
+ perspectiveStackForSwitcher.getTags().remove(Tags.ICONS_ONLY);
+ else
+ perspectiveStackForSwitcher.getTags().add(Tags.ICONS_ONLY);
+ }
+
}
+
}
public HorizontalLayout getPerspectiveSwitcher() {
@@ -206,39 +231,28 @@
final MPerspectiveStack changedElement = (MPerspectiveStack) changedObj;
- String eventType = (String) event
- .getProperty(UIEvents.EventTags.TYPE);
- String tag = (String) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
- String oldVal = (String) event
- .getProperty(UIEvents.EventTags.OLD_VALUE);
+ String eventType = (String) event.getProperty(UIEvents.EventTags.TYPE);
+ String tag = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ String oldVal = (String) event.getProperty(UIEvents.EventTags.OLD_VALUE);
- if (UIEvents.EventTypes.ADD.equals(eventType)
- && Tags.ICONS_ONLY.equals(tag)) {
- for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button
- .entrySet()) {
+ if (UIEvents.EventTypes.ADD.equals(eventType) && Tags.ICONS_ONLY.equals(tag)) {
+ for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button.entrySet()) {
MPerspective perspective = entry.getKey();
TwoStateToolbarButton button = entry.getValue();
- button.setLabelAndIcon(null,
- Commons.trim(perspective.getIconURI()));
+ button.setLabelAndIcon(null, Commons.trim(perspective.getIconURI()));
- PerspectiveContextMenu menu = button2ContextMenu
- .get(button);
- menu.setIconsOnly(true);
+ PerspectiveContextMenu menu = button2ContextMenu.get(button);
+// menu.setIconsOnly(true);
}
- } else if (UIEvents.EventTypes.REMOVE.equals(eventType)
- && Tags.ICONS_ONLY.equals(oldVal)) {
- for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button
- .entrySet()) {
+ } else if (UIEvents.EventTypes.REMOVE.equals(eventType) && Tags.ICONS_ONLY.equals(oldVal)) {
+ for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button.entrySet()) {
MPerspective perspective = entry.getKey();
TwoStateToolbarButton button = entry.getValue();
- button.setLabelAndIcon(
- Commons.trim(perspective.getLabel()),
+ button.setLabelAndIcon(Commons.trim(perspective.getLabel()),
Commons.trim(perspective.getIconURI()));
- PerspectiveContextMenu menu = button2ContextMenu
- .get(button);
- menu.setIconsOnly(false);
+ PerspectiveContextMenu menu = button2ContextMenu.get(button);
+// menu.setIconsOnly(false);
}
}
}
@@ -256,12 +270,10 @@
if (stack.getRenderer() != PerspectiveStackRenderer.this)
return;
@SuppressWarnings("unused")
- PerspectiveStackRenderer psr = (PerspectiveStackRenderer) stack
- .getRenderer();
+ PerspectiveStackRenderer psr = (PerspectiveStackRenderer) stack.getRenderer();
// Gather up the elements that are being 'hidden' by this change
- MUIElement oldSel = (MUIElement) event
- .getProperty(UIEvents.EventTags.OLD_VALUE);
+ MUIElement oldSel = (MUIElement) event.getProperty(UIEvents.EventTags.OLD_VALUE);
if (oldSel != null) {
@SuppressWarnings("unused")
List<MUIElement> goingHidden = new ArrayList<MUIElement>();
@@ -269,8 +281,7 @@
if (oldSel != null) {
perspective_button.get(oldSel).setCheckedState(false);
- perspective_button.get(oldSel)
- .setSwitchStateByUserClickEnabled(true);
+ perspective_button.get(oldSel).setSwitchStateByUserClickEnabled(true);
hideElementRecursive(oldSel);
}
@@ -279,13 +290,9 @@
if (stack.getSelectedElement() != null) {
showElementRecursive(stack.getSelectedElement());
- ((VerticalLayout) stack.getWidget())
- .addComponent((Component) stack.getSelectedElement()
- .getWidget());
- perspective_button.get(stack.getSelectedElement())
- .setCheckedState(true);
- perspective_button.get(stack.getSelectedElement())
- .setSwitchStateByUserClickEnabled(false);
+ ((VerticalLayout) stack.getWidget()).addComponent((Component) stack.getSelectedElement().getWidget());
+ perspective_button.get(stack.getSelectedElement()).setCheckedState(true);
+ perspective_button.get(stack.getSelectedElement()).setSwitchStateByUserClickEnabled(false);
// mark the perspective as active
switchPerspective(stack.getSelectedElement());
@@ -306,11 +313,9 @@
MPerspective perspective = (MPerspective) element;
- String newValue = (String) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
+ String newValue = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
- boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(
- Tags.ICONS_ONLY);
+ boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(Tags.ICONS_ONLY);
String label = iconsOnly ? null : Commons.trim(newValue);
String iconURI = Commons.trim(perspective.getIconURI());
@@ -331,8 +336,7 @@
MPerspective perspective = (MPerspective) element;
- String newValue = (String) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
+ String newValue = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
TwoStateToolbarButton button = perspective_button.get(perspective);
if (button != null) {
@@ -352,10 +356,8 @@
MPerspective perspective = (MPerspective) element;
if (perspective.getTooltip() != null) {
- String newValue = (String) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
- TwoStateToolbarButton button = perspective_button
- .get(perspective);
+ String newValue = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ TwoStateToolbarButton button = perspective_button.get(perspective);
if (button != null) {
button.setDescription(newValue);
}
@@ -363,16 +365,13 @@
}
};
- private void disconnectReferencedElementsFromPerspectiveWidgets(
- MElementContainer<? extends MUIElement> container) {
+ private void disconnectReferencedElementsFromPerspectiveWidgets(MElementContainer<? extends MUIElement> container) {
for (MUIElement e : container.getChildren()) {
if (e instanceof MPlaceholder) {
MPlaceholder ph = (MPlaceholder) e;
if (ph.isToBeRendered()) {
- ComponentContainer phComponent = (ComponentContainer) ph
- .getWidget();
- Component refComponent = (Component) ph.getRef()
- .getWidget();
+ ComponentContainer phComponent = (ComponentContainer) ph.getWidget();
+ Component refComponent = (Component) ph.getRef().getWidget();
phComponent.removeComponent(refComponent);
}
}
@@ -381,19 +380,14 @@
@PostConstruct
public void postConstruct() {
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT,
- selectPerspectiveHandler);
- eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS,
- tagListener);
- eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_LABEL,
- localizeLabel);
- eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_TOOLTIP,
- localizeTooltip);
+ eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT, selectPerspectiveHandler);
+ eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS, tagListener);
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_LABEL, localizeLabel);
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_TOOLTIP, localizeTooltip);
eventBroker.subscribe(UIEvents.UILabel.TOPIC_LABEL, localizeLabel);
eventBroker.subscribe(UIEvents.UILabel.TOPIC_TOOLTIP, localizeTooltip);
eventBroker.subscribe(UIEvents.UILabel.TOPIC_ICONURI, iconURI);
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN,
- childrenMoveUpdater);
+ eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, childrenMoveUpdater);
}
@PreDestroy
@@ -425,8 +419,7 @@
// on move, we unrender an render the UI again
//
if (UIEvents.EventTypes.MOVE.equals(type)) {
- MUIElement newValue = (MUIElement) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
+ MUIElement newValue = (MUIElement) event.getProperty(UIEvents.EventTags.NEW_VALUE);
removeChildGui(newValue, stack);
addChildGui(newValue, stack);
}
@@ -440,8 +433,7 @@
}
@Override
- public void createWidget(MUIElement element,
- MElementContainer<MUIElement> parent) {
+ public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
if (perspectiveSwitcherPanel == null)
initializePerspectiveSwticherPanel((MPerspectiveStack) element);
@@ -458,9 +450,7 @@
}
}
- @SuppressWarnings("serial")
- private void initializePerspectiveSwticherPanel(
- MPerspectiveStack perspectiveStack) {
+ private void initializePerspectiveSwticherPanel(MPerspectiveStack perspectiveStack) {
if (perspectiveSwitcherPanel != null)
return;
// initialize perspective switcher panel
@@ -470,36 +460,6 @@
perspectiveSwitcherPanel.setStyleName("perspectivepanel");
perspectiveSwitcherPanel.setSizeUndefined();
-// Button openPerspectiveButton = new Button("Open");
-// openPerspectiveButton.addStyleName("vaaclipsebutton");
-// openPerspectiveButton.addStyleName("icononly");
-// openPerspectiveButton.setIcon(new ThemeResource(
-// "../vaaclipse_default_theme/img/open_perspective.png"));
-//
-// html5Drop = new DragAndDropWrapper(openPerspectiveButton);
-// html5Drop.setDropHandler(new PerspectiveDropHandler());
-//
-// perspectiveSwitcherPanel.addComponent(html5Drop);
-//
-// openPerspectiveButton.addClickListener(new Button.ClickListener() {
-//
-// @Override
-// public void buttonClick(ClickEvent event) {
-// openOpenPerspectiveWindow();
-//
-// // change focus
-// Component parent = event.getButton().getParent();
-// while (parent != null) {
-// if (parent instanceof Component.Focusable) {
-// ((Component.Focusable) parent).focus();
-// break;
-// } else {
-// parent = parent.getParent();
-// }
-// }
-// }
-// });
-
// add separator between openPerspectiveButton and perspective's buttons
Label separator = new Label();
separator.setSizeUndefined();
@@ -508,8 +468,7 @@
perspectiveSwitcherPanel.addComponent(separator);
// add buttons to perspective switch panel
- for (final MPerspective perspective : perspectiveStackForSwitcher
- .getChildren()) {
+ for (final MPerspective perspective : perspectiveStackForSwitcher.getChildren()) {
if (perspective.isToBeRendered()) {
Component button = createPerspectiveButton(perspective);
if (button != null) {
@@ -523,14 +482,11 @@
private Component createPerspectiveButton(final MPerspective perspective) {
if (!perspective.isVisible())
return null;
- boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(
- Tags.ICONS_ONLY);
- String label = iconsOnly ? null : Commons.trim(perspective
- .getLocalizedLabel());
+ boolean iconsOnly = perspectiveStackForSwitcher.getTags().contains(Tags.ICONS_ONLY);
+ String label = iconsOnly ? null : Commons.trim(perspective.getLocalizedLabel());
String iconURI = Commons.trim(perspective.getIconURI());
- final TwoStateToolbarButton button = new TwoStateToolbarButton(label,
- iconURI);
+ final TwoStateToolbarButton button = new TwoStateToolbarButton(label, iconURI);
if (perspective.getTooltip() != null) {
button.setDescription(perspective.getLocalizedTooltip());
@@ -539,11 +495,8 @@
button.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (editingDomain != null) {
- SimpleCommand command = new SimpleCommand(
- "Switch perspective: "
- + activePerspective.getLocalizedLabel()
- + " <--> "
- + perspective.getLocalizedLabel()) {
+ SimpleCommand command = new SimpleCommand("Switch perspective: "
+ + activePerspective.getLocalizedLabel() + " <--> " + perspective.getLocalizedLabel()) {
final MPerspective oldPerspective = activePerspective;
final MPerspective newPerspective = perspective;
@@ -566,45 +519,8 @@
});
// Create context menu
- final PerspectiveContextMenu menu = new PerspectiveContextMenu(
- iconsOnly);
+ final PerspectiveContextMenu menu = new PerspectiveContextMenu(button, iconsOnly, perspective);
- // closeItem.setSeparatorVisible(true);
-
- // showTextItem.addStyleName("close-perspective-item"); //bugfixing
- // style for ie9 (context menu addon has bug for ie9)
-
- menu.addItemClickListener(new ContextMenu.ContextMenuItemClickListener() {
- @Override
- public void contextMenuItemClicked(ContextMenuItemClickEvent event) {
- ContextMenuItem clickedItem = (ContextMenuItem) event
- .getSource();
-
- if (clickedItem == menu.getCloseItem()) {
- if (perspective.getTags().contains(TAG__REMOVE_ON_CLOSE)) {
- // sends new messages
- modelService.removePerspectiveModel(perspective,
- perspective.getContext().get(MWindow.class));
-
- switchToPreviousPerspective(perspective);
-
- } else if (perspective == activePerspective) {
- switchToPreviousPerspective(perspective);
- }
-
- perspective.setToBeRendered(false);
-
- } else if (clickedItem == menu.getShowTextItem()) {
- if (perspectiveStackForSwitcher.getTags().contains(
- Tags.ICONS_ONLY))
- perspectiveStackForSwitcher.getTags().remove(
- Tags.ICONS_ONLY);
- else
- perspectiveStackForSwitcher.getTags().add(
- Tags.ICONS_ONLY);
- }
- }
- });
menu.setAsContextMenuOf(button);
button2ContextMenu.put(button, menu);
@@ -618,13 +534,10 @@
}
private void updateDesigner(boolean enabled) {
- IWidgetDesignConfigurator designConfigurator = context
- .get(IWidgetDesignConfigurator.class);
+ IWidgetDesignConfigurator designConfigurator = context.get(IWidgetDesignConfigurator.class);
if (designConfigurator != null) {
- for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button
- .entrySet()) {
- designConfigurator.configure(entry.getValue(),
- (EObject) entry.getKey(), enabled);
+ for (Map.Entry<MPerspective, TwoStateToolbarButton> entry : perspective_button.entrySet()) {
+ designConfigurator.configure(entry.getValue(), (EObject) entry.getKey(), enabled);
}
}
}
@@ -635,18 +548,14 @@
return;
MPerspectiveStack perspectiveStack = (MPerspectiveStack) (MElementContainer<?>) element;
- MPerspective selectedPerspective = perspectiveStack
- .getSelectedElement();
+ MPerspective selectedPerspective = perspectiveStack.getSelectedElement();
if (selectedPerspective == null) {
// try to find by registry
if (perspectiveRegistry != null) {
- String userId = (String) context
- .get(AuthenticationConstants.USER_ID);
- String perspectiveId = perspectiveRegistry
- .getDefaultPerspective(userId);
+ String userId = (String) context.get(AuthenticationConstants.USER_ID);
+ String perspectiveId = perspectiveRegistry.getDefaultPerspective(userId);
if (perspectiveId != null) {
- selectedPerspective = perspectiveRegistry
- .findPerspectiveWithId(perspectiveId);
+ selectedPerspective = perspectiveRegistry.findPerspectiveWithId(perspectiveId);
}
if (selectedPerspective == null) {
selectedPerspective = (MPerspective) findFirstRenderableAndVisibleElement(perspectiveStack);
@@ -658,8 +567,7 @@
}
if (selectedPerspective != null) {
- if (!selectedPerspective.isToBeRendered()
- || !selectedPerspective.isVisible()) {
+ if (!selectedPerspective.isToBeRendered() || !selectedPerspective.isVisible()) {
selectedPerspective = (MPerspective) findFirstRenderableAndVisibleElement(perspectiveStack);
if (selectedPerspective != null) {
switchPerspective(selectedPerspective);
@@ -693,8 +601,7 @@
}
@Override
- public void addChildGui(MUIElement child,
- MElementContainer<MUIElement> element) {
+ public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) {
MPerspectiveStack stack = (MPerspectiveStack) (MElementContainer<?>) element;
MPerspective p = (MPerspective) child;
@@ -702,15 +609,14 @@
// shift on 2 - the first child - open perspective button, the second
// child - is separator
int index = indexOf(child, element) + 2;
- perspectiveSwitcherPanel.addComponent(button, Math.min(index,
- perspectiveSwitcherPanel.getComponentCount() - 1));
+ perspectiveSwitcherPanel.addComponent(button,
+ Math.min(index, perspectiveSwitcherPanel.getComponentCount() - 1));
refreshPerspectiveStackVisibility(stack);
}
@Override
- public void removeChildGui(MUIElement child,
- MElementContainer<MUIElement> element) {
+ public void removeChildGui(MUIElement child, MElementContainer<MUIElement> element) {
MPerspectiveStack stack = (MPerspectiveStack) (MElementContainer<?>) element;
MPerspective p = (MPerspective) child;
@@ -727,15 +633,13 @@
OptionDialog dlg = new OptionDialog();
dlg.setCaption("Open perspective");
- ServiceReference<ResourceInfoProvider> resourceInfoProviderRef = Activator
- .getInstance().getContext()
+ ServiceReference<ResourceInfoProvider> resourceInfoProviderRef = Activator.getInstance().getContext()
.getServiceReference(ResourceInfoProvider.class);
if (resourceInfoProviderRef != null) {
- ResourceInfoProvider resourceInfoProvider = Activator.getInstance()
- .getContext().getService(resourceInfoProviderRef);
+ ResourceInfoProvider resourceInfoProvider = Activator.getInstance().getContext()
+ .getService(resourceInfoProviderRef);
if (resourceInfoProvider.getApplicationHeaderIcon() != null) {
- dlg.setIcon(BundleResource.valueOf(resourceInfoProvider
- .getApplicationHeaderIcon()));
+ dlg.setIcon(BundleResource.valueOf(resourceInfoProvider.getApplicationHeaderIcon()));
}
}
@@ -760,30 +664,24 @@
public Component getComponent(OptionDialog optionDialog) {
if (panel == null) {
container = new IndexedContainer();
- container.addContainerProperty(PERSPECTIVE_ICON,
- Resource.class, null);
- container.addContainerProperty(PERSPECTIVE_LABEL,
- String.class, null);
+ container.addContainerProperty(PERSPECTIVE_ICON, Resource.class, null);
+ container.addContainerProperty(PERSPECTIVE_LABEL, String.class, null);
- for (MPerspective p : perspectiveStackForSwitcher
- .getChildren()) {
+ for (MPerspective p : perspectiveStackForSwitcher.getChildren()) {
if (!p.isVisible()) {
continue;
}
-
- if(p.getTags().contains(TAG__NOT_IN_OPEN_PERSPECTIVE_DIALOG)) {
+
+ if (p.getTags().contains(TAG__NOT_IN_OPEN_PERSPECTIVE_DIALOG)) {
continue;
}
-
+
Item item = container.addItem(p.getElementId());
- Resource icon = ResourceHelper.createResource(p
- .getIconURI());
+ Resource icon = ResourceHelper.createResource(p.getIconURI());
if (icon != null) {
- item.getItemProperty(PERSPECTIVE_ICON).setValue(
- icon);
+ item.getItemProperty(PERSPECTIVE_ICON).setValue(icon);
}
- item.getItemProperty(PERSPECTIVE_LABEL).setValue(
- p.getLabel());
+ item.getItemProperty(PERSPECTIVE_LABEL).setValue(p.getLabel());
}
panel = new Panel();
@@ -809,9 +707,8 @@
// selected perspective's elementId
String perspectiveId = (String) list.getValue();
if (perspectiveId != null) {
- MPerspective perspective = (MPerspective) modelService
- .find(perspectiveId,
- perspectiveStackForSwitcher);
+ MPerspective perspective = (MPerspective) modelService.find(perspectiveId,
+ perspectiveStackForSwitcher);
if (!perspective.isToBeRendered())
perspective.setToBeRendered(true);
switchPerspective(perspective);
@@ -870,16 +767,14 @@
MUIElement ref = ph.getRef();
ref.setCurSharedRef(ph);
- ComponentContainer phComponent = (ComponentContainer) ph
- .getWidget();
+ ComponentContainer phComponent = (ComponentContainer) ph.getWidget();
Component refComponent = (Component) ph.getRef().getWidget();
phComponent.addComponent(refComponent);
element = ref;
// top right folder
- MPartStack topLeftStack = HierarchyUtils.findTopLeftFolder(ph
- .getRef());
+ MPartStack topLeftStack = HierarchyUtils.findTopLeftFolder(ph.getRef());
if (topLeftStack != null) {
if (ph.getTags().contains(IPresentationEngine.MAXIMIZED))
((StackWidget) topLeftStack.getWidget()).setState(1);
@@ -897,8 +792,7 @@
if (element instanceof MContext) {
IEclipseContext context = ((MContext) element).getContext();
if (context != null) {
- IEclipseContext newParentContext = modelService
- .getContainingContext(element);
+ IEclipseContext newParentContext = modelService.getContainingContext(element);
if (context.getParent() != newParentContext) {
context.setParent(newParentContext);
}
@@ -918,8 +812,7 @@
if (element instanceof MElementContainer<?>) {
MElementContainer<?> container = (MElementContainer<?>) element;
- List<MUIElement> kids = new ArrayList<MUIElement>(
- container.getChildren());
+ List<MUIElement> kids = new ArrayList<MUIElement>(container.getChildren());
for (MUIElement childElement : kids) {
showElementRecursive(childElement);
}
@@ -940,10 +833,8 @@
private void switchToPreviousPerspective(final MPerspective perspective) {
MPerspective prevRenderableAndVisiblePerspective = null, nextRenderableAndVisiblePerspective = null;
boolean startSearch = false;
- for (MPerspective p : perspectiveStackForSwitcher
- .getChildren()) {
- if (startSearch && p.isToBeRendered()
- && p.isVisible()) {
+ for (MPerspective p : perspectiveStackForSwitcher.getChildren()) {
+ if (startSearch && p.isToBeRendered() && p.isVisible()) {
nextRenderableAndVisiblePerspective = p;
break;
}
@@ -951,14 +842,13 @@
if (p == perspective)
startSearch = true;
- if (!startSearch && p.isToBeRendered()
- && p.isVisible()) {
+ if (!startSearch && p.isToBeRendered() && p.isVisible()) {
prevRenderableAndVisiblePerspective = p;
}
}
- MPerspective newSelectedPerspective = nextRenderableAndVisiblePerspective != null ? nextRenderableAndVisiblePerspective
- : prevRenderableAndVisiblePerspective;
+ MPerspective newSelectedPerspective = nextRenderableAndVisiblePerspective != null
+ ? nextRenderableAndVisiblePerspective : prevRenderableAndVisiblePerspective;
if (newSelectedPerspective != null) {
switchPerspective(newSelectedPerspective);
@@ -974,8 +864,7 @@
@Override
public void drop(final DragAndDropEvent dropEvent) {
// expecting this to be an html5 drag
- final WrapperTransferable tr = (WrapperTransferable) dropEvent
- .getTransferable();
+ final WrapperTransferable tr = (WrapperTransferable) dropEvent.getTransferable();
final Html5File[] files = tr.getFiles();
if (files != null) {
for (final Html5File html5File : files) {
@@ -984,9 +873,8 @@
// continue;
// }
if (html5File.getFileSize() > FILE_SIZE_LIMIT) {
- Notification
- .show("File rejected. Max 2Mb files are accepted by Sampler",
- Notification.Type.WARNING_MESSAGE);
+ Notification.show("File rejected. Max 2Mb files are accepted by Sampler",
+ Notification.Type.WARNING_MESSAGE);
} else {
final ByteArrayOutputStream bas = new ByteArrayOutputStream();
final StreamVariable streamVariable = new StreamVariable() {
@@ -1001,28 +889,21 @@
}
@Override
- public void onProgress(
- final StreamingProgressEvent event) {
+ public void onProgress(final StreamingProgressEvent event) {
}
@Override
- public void streamingStarted(
- final StreamingStartEvent event) {
+ public void streamingStarted(final StreamingStartEvent event) {
}
@Override
- public void streamingFinished(
- final StreamingEndEvent event) {
- addPerspective(
- fileName,
- html5File.getType(),
- new ByteArrayInputStream(bas
- .toByteArray()));
+ public void streamingFinished(final StreamingEndEvent event) {
+ addPerspective(fileName, html5File.getType(),
+ new ByteArrayInputStream(bas.toByteArray()));
}
@Override
- public void streamingFailed(
- final StreamingErrorEvent event) {
+ public void streamingFailed(final StreamingErrorEvent event) {
}
@Override
@@ -1037,27 +918,20 @@
}
@SuppressWarnings("restriction")
- private void addPerspective(final String name, final String type,
- final InputStream stream) {
- XMIResource resource = new XMIResourceImpl(
- URI.createURI("perspective" + name));
+ private void addPerspective(final String name, final String type, final InputStream stream) {
+ XMIResource resource = new XMIResourceImpl(URI.createURI("perspective" + name));
try {
resource.load(stream, null);
- final MPerspective perspective = (MPerspective) resource
- .getContents().get(0);
- ChangeCommand command = new ChangeCommand("Drop perspective: "
- + perspective.getLocalizedLabel(),
- ((EObject) getPerspectiveStackForSwitcher())
- .eResource()) {
+ final MPerspective perspective = (MPerspective) resource.getContents().get(0);
+ ChangeCommand command = new ChangeCommand("Drop perspective: " + perspective.getLocalizedLabel(),
+ ((EObject) getPerspectiveStackForSwitcher()).eResource()) {
@Override
protected void doExecute() {
// add the perspective
//
- getPerspectiveStackForSwitcher().getChildren().add(
- perspective);
- getPerspectiveStackForSwitcher().setSelectedElement(
- perspective);
+ getPerspectiveStackForSwitcher().getChildren().add(perspective);
+ getPerspectiveStackForSwitcher().setSelectedElement(perspective);
}
};
editingDomain.getCommandStack().execute(command);
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/StackRenderer.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/StackRenderer.java
index c265792..42fbe57 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/StackRenderer.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/StackRenderer.java
@@ -63,8 +63,7 @@
import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode;
@SuppressWarnings("restriction")
-public class StackRenderer extends VaadinRenderer implements
- IDesignerService.IDesignListener {
+public class StackRenderer extends VaadinRenderer implements IDesignerService.IDesignListener {
@Inject
private EventBroker eventBroker;
@@ -89,15 +88,11 @@
public void handleEvent(Event event) {
Object changedObj = event.getProperty(EventTags.ELEMENT);
- String eventType = (String) event
- .getProperty(UIEvents.EventTags.TYPE);
- String tag = (String) event
- .getProperty(UIEvents.EventTags.NEW_VALUE);
+ String eventType = (String) event.getProperty(UIEvents.EventTags.TYPE);
+ String tag = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
- int location = modelService
- .getElementLocation((MUIElement) changedObj);
- if (!(changedObj instanceof MPartStack)
- || location == EModelService.IN_SHARED_AREA) {
+ int location = modelService.getElementLocation((MUIElement) changedObj);
+ if (!(changedObj instanceof MPartStack) || location == EModelService.IN_SHARED_AREA) {
return;
}
@@ -130,8 +125,7 @@
if (stack.getSelectedElement() != null) {
if (stack.getSelectedElement().getWidget() == null) {
- IPresentationEngine engine = (IPresentationEngine) context
- .get(IPresentationEngine.class.getName());
+ IPresentationEngine engine = (IPresentationEngine) context.get(IPresentationEngine.class.getName());
engine.createGui(stack.getSelectedElement());
int i = 0;
@@ -143,13 +137,18 @@
i++;
}
- addTab((TabSheet) stack.getWidget(),
- stack.getSelectedElement(), i);
+ addTab((TabSheet) stack.getWidget(), stack.getSelectedElement(), i);
+ }
+
+ if (stack.getSelectedElement() instanceof MPart) {
+ MPart selected = (MPart) stack.getSelectedElement();
+ if (selected.getObject() == null) {
+ PartRenderer.renderPartContent(selected, selected.getContext());
+ }
}
ignoreTabSelChanges = true;
- ((TabSheet) stack.getWidget()).setSelectedTab((Component) stack
- .getSelectedElement().getWidget());
+ ((TabSheet) stack.getWidget()).setSelectedTab((Component) stack.getSelectedElement().getWidget());
ignoreTabSelChanges = false;
}
}
@@ -157,29 +156,25 @@
EventHandler itemUpdater = new EventHandler() {
public void handleEvent(Event event) {
- MUIElement element = (MUIElement) event
- .getProperty(UIEvents.EventTags.ELEMENT);
+ MUIElement element = (MUIElement) event.getProperty(UIEvents.EventTags.ELEMENT);
if (!(element instanceof MPart))
return;
MPart part = (MPart) element;
- String attName = (String) event
- .getProperty(UIEvents.EventTags.ATTNAME);
+ String attName = (String) event.getProperty(UIEvents.EventTags.ATTNAME);
Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE);
MPartStack stack = null;
// is this a direct child of the stack?
MPlaceholder placeholder = null;
- if (element.getParent() != null
- && element.getParent().getRenderer() == StackRenderer.this) {
+ if (element.getParent() != null && element.getParent().getRenderer() == StackRenderer.this) {
stack = (MPartStack) (MElementContainer<?>) element.getParent();
} else {
// Do we have any stacks with place holders for the element
// that's changed?
MWindow win = modelService.getTopLevelWindowFor(part);
- List<MPlaceholder> refs = modelService.findElements(win, null,
- MPlaceholder.class, null);
+ List<MPlaceholder> refs = modelService.findElements(win, null, MPlaceholder.class, null);
if (refs != null) {
for (MPlaceholder ref : refs) {
if (ref.getRef() != part)
@@ -187,8 +182,7 @@
MElementContainer<?> refParent = ref.getParent();
// can be null, see bug 328296
- if (refParent != null
- && refParent.getRenderer() instanceof StackRenderer) {
+ if (refParent != null && refParent.getRenderer() instanceof StackRenderer) {
placeholder = ref;
stack = (MPartStack) refParent;
}
@@ -198,8 +192,7 @@
if (stack != null) {
Tab tab = ((StackWidget) stack.getWidget())
- .getTab((Component) (placeholder == null ? part
- .getWidget() : placeholder.getWidget()));
+ .getTab((Component) (placeholder == null ? part.getWidget() : placeholder.getWidget()));
if (tab != null)
updateTab(tab, part, attName, newValue);
}
@@ -211,8 +204,7 @@
String newName = (String) newValue;
tab.setCaption(getLabel(part, newName));
} else if (UIEvents.UILabel.ICONURI.equals(attName)) {
- Resource icon = part.getIconURI() != null ? ResourceHelper
- .createResource(part.getIconURI()) : null;
+ Resource icon = part.getIconURI() != null ? ResourceHelper.createResource(part.getIconURI()) : null;
tab.setIcon(icon);
} else if (UIEvents.UILabel.TOOLTIP.equals(attName)) {
String newTTip = (String) newValue;
@@ -249,14 +241,11 @@
@PostConstruct
public void postConstruct() {
- eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS,
- tagListener);
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT,
- selectElementHandler);
+ eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS, tagListener);
+ eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT, selectElementHandler);
eventBroker.subscribe(UIEvents.UILabel.TOPIC_ALL, itemUpdater);
eventBroker.subscribe(UIEvents.Dirtyable.TOPIC_DIRTY, itemUpdater);
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN,
- childrenMoveUpdater);
+ eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, childrenMoveUpdater);
}
@Override
@@ -265,13 +254,10 @@
}
private void updateDesigner(boolean enabled) {
- IWidgetDesignConfigurator designConfigurator = context
- .get(IWidgetDesignConfigurator.class);
+ IWidgetDesignConfigurator designConfigurator = context.get(IWidgetDesignConfigurator.class);
if (designConfigurator != null) {
- for (Entry<Component, MStackElement> entry : vaatab2Element
- .entrySet()) {
- designConfigurator.configure(entry.getKey(),
- (EObject) entry.getValue(), enabled);
+ for (Entry<Component, MStackElement> entry : vaatab2Element.entrySet()) {
+ designConfigurator.configure(entry.getKey(), (EObject) entry.getValue(), enabled);
}
}
}
@@ -311,8 +297,7 @@
};
@Override
- public void createWidget(MUIElement element,
- MElementContainer<MUIElement> parent) {
+ public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
if (!(element instanceof MPartStack))
return;
@@ -323,14 +308,12 @@
stackWidget.setSizeFull();
element.setWidget(stackWidget);
- IEclipseContext context = modelService.getContainingContext(stack)
- .createChild();
+ IEclipseContext context = modelService.getContainingContext(stack).createChild();
context.set(MPartStack.class, stack);
- VaadinDropHandler dropHandler = ContextInjectionFactory.make(
- VaadinDropHandler.class, context);
+ VaadinDropHandler dropHandler = ContextInjectionFactory.make(VaadinDropHandler.class, context);
stackWidget.setDropHandler(dropHandler);
-
+
if (designerService != null) {
designerService.addListener(this);
@@ -346,23 +329,19 @@
StackWidget stackWidget = (StackWidget) stack.getWidget();
for (MStackElement element : stack.getChildren()) {
if (element.isToBeRendered())
- addTab(stackWidget, (MStackElement) element,
- stackWidget.getComponentCount());
+ addTab(stackWidget, (MStackElement) element, stackWidget.getComponentCount());
}
// if there are childs in stack and the selected element is not
// specified for stack, set the first child as selected
- if (stack.getChildren().size() > 0
- && stack.getSelectedElement() == null) {
- if (stack.getChildren().get(0).isVisible()
- && stack.getChildren().get(0).isToBeRendered()) {
+ if (stack.getChildren().size() > 0 && stack.getSelectedElement() == null) {
+ if (stack.getChildren().get(0).isVisible() && stack.getChildren().get(0).isToBeRendered()) {
stack.setSelectedElement(stack.getChildren().get(0));
}
}
if (stack.getSelectedElement() != null) {
- Component stackSelectedComponent = (Component) stack
- .getSelectedElement().getWidget();
+ Component stackSelectedComponent = (Component) stack.getSelectedElement().getWidget();
stackWidget.setSelectedTab(stackSelectedComponent);
}
}
@@ -380,12 +359,10 @@
// Tab tab = parentPane.addTab((com.vaadin.ui.Component)
// element.getWidget(), mLabel.getLocalizedLabel(), icon, pos);
- Tab tab = parentPane.addTab(
- (com.vaadin.ui.Component) element.getWidget(), pos);
+ Tab tab = parentPane.addTab((com.vaadin.ui.Component) element.getWidget(), pos);
tab.setCaption(mLabel.getLocalizedLabel());
- Resource icon = (mLabel.getIconURI() != null && !mLabel.getIconURI()
- .trim().equals("")) ? ResourceHelper.createResource(mLabel
- .getIconURI()) : null;
+ Resource icon = (mLabel.getIconURI() != null && !mLabel.getIconURI().trim().equals(""))
+ ? ResourceHelper.createResource(mLabel.getIconURI()) : null;
if (icon != null) {
tab.setIcon(icon);
}
@@ -393,8 +370,8 @@
tab.setDescription(mLabel.getLocalizedTooltip());
vaatab2Element.put((Component) element.getWidget(), element);
-
- if(designerService != null && designerService.isDesignMode()) {
+
+ if (designerService != null && designerService.isDesignMode()) {
updateDesigner(designerService.isDesignMode());
}
}
@@ -421,16 +398,14 @@
element.getTags().remove(IPresentationEngine.MAXIMIZED);
element.getTags().add(IPresentationEngine.MINIMIZED);
} else if (oldState == -1 && newState == 0) {
- element.getTags().remove(
- IPresentationEngine.MINIMIZED_BY_ZOOM);
+ element.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM);
element.getTags().remove(IPresentationEngine.MINIMIZED);
} else if (oldState == 0 && newState == -1)
setState(element, IPresentationEngine.MINIMIZED);
}
private void setState(MUIElement element, String state) {
- element.getTags().remove(
- IPresentationEngine.MINIMIZED_BY_ZOOM);
+ element.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM);
if (IPresentationEngine.MINIMIZED.equals(state)) {
element.getTags().remove(IPresentationEngine.MAXIMIZED);
element.getTags().add(IPresentationEngine.MINIMIZED);
@@ -447,21 +422,16 @@
sw.addSelectedTabChangeListener(new SelectedTabChangeListener() {
public void selectedTabChange(SelectedTabChangeEvent event) {
- final MStackElement stackElement = vaatab2Element.get(sw
- .getSelectedTab());
+ final MStackElement stackElement = vaatab2Element.get(sw.getSelectedTab());
if (stackElement != null) {
if (ignoreTabSelChanges)
return;
- final MPartStack stack = (MPartStack) (MElementContainer<?>) stackElement
- .getParent();
- if (stack != null
- && stack.getSelectedElement() != stackElement) {
+ final MPartStack stack = (MPartStack) (MElementContainer<?>) stackElement.getParent();
+ if (stack != null && stack.getSelectedElement() != stackElement) {
- SimpleCommand command = new SimpleCommand(
- "Switch stack element") {
- final MStackElement oldStackElement = stack
- .getSelectedElement();
+ SimpleCommand command = new SimpleCommand("Switch stack element") {
+ final MStackElement oldStackElement = stack.getSelectedElement();
@Override
protected void doUndo() {
@@ -519,13 +489,11 @@
return;
if (stackElement instanceof MPlaceholder)
- stackElement = (MStackElement) ((MPlaceholder) stackElement)
- .getRef();
+ stackElement = (MStackElement) ((MPlaceholder) stackElement).getRef();
IEclipseContext curContext = getContext(stackElement);
if (curContext != null) {
- EPartService ps = (EPartService) curContext
- .get(EPartService.class.getName());
+ EPartService ps = (EPartService) curContext.get(EPartService.class.getName());
if (ps != null)
ps.activate((MPart) stackElement, true);
}
@@ -550,8 +518,7 @@
if (parent == null) {
// might be a shared part, try to find the placeholder
MWindow window = modelService.getTopLevelWindowFor(element);
- return window == null ? false : isValid(modelService
- .findPlaceholderFor(window, element));
+ return window == null ? false : isValid(modelService.findPlaceholderFor(window, element));
}
return isValid(parent);
@@ -560,8 +527,7 @@
private boolean isClosable(MPart part) {
// if it's a shared part check its current ref
if (part.getCurSharedRef() != null) {
- return !(part.getCurSharedRef().getTags()
- .contains(IPresentationEngine.NO_CLOSE));
+ return !(part.getCurSharedRef().getTags().contains(IPresentationEngine.NO_CLOSE));
}
return part.isCloseable();
@@ -569,8 +535,7 @@
private boolean closePart(MStackElement stackElement) {
- MPart part = (MPart) ((stackElement instanceof MPart) ? stackElement
- : ((MPlaceholder) stackElement).getRef());
+ MPart part = (MPart) ((stackElement instanceof MPart) ? stackElement : ((MPlaceholder) stackElement).getRef());
if (!isClosable(part)) {
return false;
}
@@ -578,11 +543,9 @@
IEclipseContext partContext = part.getContext();
IEclipseContext parentContext = getContextForParent(part);
// a part may not have a context if it hasn't been rendered
- IEclipseContext context = partContext == null ? parentContext
- : partContext;
+ IEclipseContext context = partContext == null ? parentContext : partContext;
// Allow closes to be 'canceled'
- EPartService partService = (EPartService) context
- .get(EPartService.class.getName());
+ EPartService partService = (EPartService) context.get(EPartService.class.getName());
if (partService.savePart(part, true)) {
partService.hidePart(part);
return true;
@@ -599,8 +562,7 @@
}
@Override
- public void addChildGui(MUIElement child,
- MElementContainer<MUIElement> element) {
+ public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) {
if (!(child instanceof MStackElement))
return;
diff --git a/org.eclipse.osbp.vaaclipse.widgets/pom-compileWidgetset.xml b/org.eclipse.osbp.vaaclipse.widgets/pom-compileWidgetset.xml
index 58f8805..fa26a5e 100644
--- a/org.eclipse.osbp.vaaclipse.widgets/pom-compileWidgetset.xml
+++ b/org.eclipse.osbp.vaaclipse.widgets/pom-compileWidgetset.xml
@@ -19,11 +19,6 @@
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
- <artifactId>contextmenu</artifactId>
- <version>4.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
<artifactId>dragdroplayouts</artifactId>
<version>1.1.3</version>
</dependency>
diff --git a/org.eclipse.osbp.vaaclipse.widgets/pom.xml b/org.eclipse.osbp.vaaclipse.widgets/pom.xml
index 80d7be4..fff08c6 100644
--- a/org.eclipse.osbp.vaaclipse.widgets/pom.xml
+++ b/org.eclipse.osbp.vaaclipse.widgets/pom.xml
@@ -26,11 +26,6 @@
<dependencies>
<dependency>
<groupId>org.vaadin.addons</groupId>
- <artifactId>contextmenu</artifactId>
- <version>4.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
<artifactId>dragdroplayouts</artifactId>
<version>1.3.2</version>
</dependency>
diff --git a/org.eclipse.osbp.vaaclipse.widgetset.default/META-INF/MANIFEST.MF b/org.eclipse.osbp.vaaclipse.widgetset.default/META-INF/MANIFEST.MF
index 03f8850..e94f53f 100644
--- a/org.eclipse.osbp.vaaclipse.widgetset.default/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.vaaclipse.widgetset.default/META-INF/MANIFEST.MF
@@ -9,4 +9,6 @@
Require-Bundle: com.vaadin.server;bundle-version="[7.7.6,7.8.0)",
com.vaadin.client;bundle-version="[7.7.6,7.8.0)",
com.vaadin.shared;bundle-version="[7.7.6,7.8.0)",
- org.jsoup;bundle-version="1.7.2"
+ org.jsoup;bundle-version="1.7.2",
+ com.vaadin.addon.vaadin-context-menu
+
diff --git a/org.eclipse.osbp.vaaclipse.widgetset.default/pom-compileWidgetset.xml b/org.eclipse.osbp.vaaclipse.widgetset.default/pom-compileWidgetset.xml
index d7ac410..9587d8b 100644
--- a/org.eclipse.osbp.vaaclipse.widgetset.default/pom-compileWidgetset.xml
+++ b/org.eclipse.osbp.vaaclipse.widgetset.default/pom-compileWidgetset.xml
@@ -19,11 +19,6 @@
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
- <artifactId>contextmenu</artifactId>
- <version>4.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
<artifactId>dragdroplayouts</artifactId>
<version>1.1.3</version>
</dependency>
diff --git a/org.eclipse.osbp.vaaclipse.widgetset.default/pom-superdev.xml b/org.eclipse.osbp.vaaclipse.widgetset.default/pom-superdev.xml
index f7057f9..fd2cdc7 100644
--- a/org.eclipse.osbp.vaaclipse.widgetset.default/pom-superdev.xml
+++ b/org.eclipse.osbp.vaaclipse.widgetset.default/pom-superdev.xml
@@ -20,11 +20,6 @@
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
- <artifactId>contextmenu</artifactId>
- <version>4.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
<artifactId>dragdroplayouts</artifactId>
<version>1.1.1</version>
</dependency>
diff --git a/org.eclipse.osbp.vaaclipse.widgetset.default/pom.xml b/org.eclipse.osbp.vaaclipse.widgetset.default/pom.xml
index 67a64d2..8dba97e 100644
--- a/org.eclipse.osbp.vaaclipse.widgetset.default/pom.xml
+++ b/org.eclipse.osbp.vaaclipse.widgetset.default/pom.xml
@@ -1,208 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Rushan R. Gilmullin - initial API and implementation
- *******************************************************************************/
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.osbp.vaaclipse</groupId>
- <artifactId>org.eclipse.osbp.vaaclipse</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.osbp.vaaclipse.widgetset.default</artifactId>
- <packaging>eclipse-plugin</packaging>
+<!-- /*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Rushan R. Gilmullin - initial API and implementation *******************************************************************************/ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.vaaclipse</groupId>
+ <artifactId>org.eclipse.osbp.vaaclipse</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.osbp.vaaclipse.widgetset.default</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <repositories>
+ <repository>
+ <id>vaadin-addons</id>
+ <url>http://maven.vaadin.com/vaadin-addons</url>
+ </repository>
+ </repositories>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.osbp.vaaclipse</groupId>
- <artifactId>org.eclipse.osbp.vaaclipse.widgets</artifactId>
- <version>0.9.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
- <artifactId>contextmenu</artifactId>
- <version>4.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
- <artifactId>dragdroplayouts</artifactId>
- <version>1.3.2</version>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addon</groupId>
- <artifactId>easyuploads</artifactId>
- <version>7.4.2</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-server</artifactId>
- <scope>provided</scope>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client</artifactId>
- <scope>provided</scope>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client-compiled</artifactId>
- <scope>provided</scope>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-shared</artifactId>
- <scope>provided</scope>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client-compiler</artifactId>
- <scope>provided</scope>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-themes</artifactId>
- <version>${vaadin.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.osbp.vaaclipse</groupId>
+ <artifactId>org.eclipse.osbp.vaaclipse.widgets</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.vaadin.addons</groupId>
+ <artifactId>dragdroplayouts</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.vaadin.addon</groupId>
+ <artifactId>easyuploads</artifactId>
+ <version>7.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin.addon</groupId>
+ <artifactId>vaadin-context-menu</artifactId>
+ <version>0.7.5</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-maven-plugin</artifactId>
- <version>${vaadin.plugin.version}</version>
- <configuration>
- <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
- <!-- <runTarget>mobilemail</runTarget> -->
- <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
+ <!-- <runTarget>mobilemail</runTarget> -->
+ <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
way compatible with Vaadin eclipse plugin. -->
- <webappDirectory>${basedir}/resources
- </webappDirectory>
- <hostedWebapp>${basedir}/resources
- </hostedWebapp>
- <noServer>true</noServer>
- <!-- Remove draftCompile when project is ready -->
- <draftCompile>true</draftCompile>
- <strict>true</strict>
- <compileReport>false</compileReport>
- <style>PRETTY</style>
- <runTarget>http://localhost:8080/</runTarget>
-
- <!-- Remove these when going to release dependencies -->
- <force>true</force>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>resources</goal>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
- <!-- directory is cleaned properly -->
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>/resources</directory>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.12</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
+ <webappDirectory>${basedir}/resources
+ </webappDirectory>
+ <hostedWebapp>${basedir}/resources
+ </hostedWebapp>
+ <noServer>true</noServer>
+ <!-- Remove draftCompile when project is ready -->
+ <draftCompile>true</draftCompile>
+ <strict>true</strict>
+ <compileReport>false</compileReport>
+ <style>PRETTY</style>
+ <runTarget>http://localhost:8080/</runTarget>
+
+ <!-- Remove these when going to release dependencies -->
+ <force>true</force>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
+ <!-- directory is cleaned properly -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>/resources</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.12</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-maven-plugin</artifactId>
- <versionRange>[2.3.0-1,)</versionRange>
- <goals>
- <goal>resources</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore/>
- </action>
- </pluginExecution>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-maven-plugin</artifactId>
- <versionRange>[1.0.2,)</versionRange>
- <goals>
- <goal>update-widgetset</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore/>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
diff --git a/org.eclipse.osbp.vaaclipse.widgetset.default/src/org/eclipse/osbp/vaaclipse/widgetset/DefaultWidgetset.gwt.xml b/org.eclipse.osbp.vaaclipse.widgetset.default/src/org/eclipse/osbp/vaaclipse/widgetset/DefaultWidgetset.gwt.xml
index 251d981..64ff7b6 100644
--- a/org.eclipse.osbp.vaaclipse.widgetset.default/src/org/eclipse/osbp/vaaclipse/widgetset/DefaultWidgetset.gwt.xml
+++ b/org.eclipse.osbp.vaaclipse.widgetset.default/src/org/eclipse/osbp/vaaclipse/widgetset/DefaultWidgetset.gwt.xml
@@ -3,7 +3,7 @@
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
- <inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
+ <inherits name="com.vaadin.addon.contextmenu.WidgetSet" />
<!-- <inherits name="fi.jasoft.dragdroplayouts.DragDropLayoutsWidgetSet" /> -->
<inherits
name="org.eclipse.osbp.vaaclipse.widgets.org_eclipse_osbp_vaaclipse_widgetsWidgetset" />