Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-04-30 11:15:07 +0000
committerTom Schindl2014-04-30 11:15:07 +0000
commit663311eb04ced4e84a854c9b867d2066b57c55d8 (patch)
tree91cd7058783bcaa2a1598329c0c82b542f49d4e3
parentdca0d07bd5cf5bf48219155d6af84ad5dc3fa79a (diff)
downloadorg.eclipse.efxclipse-663311eb04ced4e84a854c9b867d2066b57c55d8.tar.gz
org.eclipse.efxclipse-663311eb04ced4e84a854c9b867d2066b57c55d8.tar.xz
org.eclipse.efxclipse-663311eb04ced4e84a854c9b867d2066b57c55d8.zip
javadoc & null info
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/CustomContainerSupport.java85
1 files changed, 49 insertions, 36 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/CustomContainerSupport.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/CustomContainerSupport.java
index c48cd5ff8..994b8f47a 100644
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/CustomContainerSupport.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/CustomContainerSupport.java
@@ -13,7 +13,6 @@ package org.eclipse.fx.ui.workbench.renderers.fx.internal;
import java.util.List;
import javafx.scene.layout.AnchorPane;
-import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
@@ -24,68 +23,82 @@ import javafx.scene.layout.VBox;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.fx.core.log.Logger;
import org.eclipse.fx.ui.panes.FillLayoutPane;
import org.eclipse.fx.ui.panes.GridLayoutPane;
import org.eclipse.fx.ui.panes.RowLayoutPane;
import org.eclipse.fx.ui.panes.SashLayoutPane;
import org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+/**
+ * Helper class to construct the appropriate container
+ */
@SuppressWarnings("restriction")
public class CustomContainerSupport {
- private static final String WIDGET_ANCHORPANE_TAG = "Container:AnchorPane";
- private static final String WIDGET_FLOWPANE_TAG = "Container:FlowPane";
- private static final String WIDGET_GRIDPANE_TAG = "Container:GridPane";
- private static final String WIDGET_HBOX_TAG = "Container:HBox";
- private static final String WIDGET_STACKPANE_TAG = "Container:StackPane";
- private static final String WIDGET_VBOX_TAG = "Container:VBox";
-
- private static final String WIDGET_EFX_FILL_TAG = "Container:FillLayoutPane";
- private static final String WIDGET_EFX_GRID_TAG = "Container:GridLayoutPane";
- private static final String WIDGET_EFX_ROW_TAG = "Container:RowLayoutPane";
- private static final String WIDGET_EFX_SASH_TAG = "Container:SashLayoutPane";
-
- private static final String WIDGET_URLPANE_TAG = "Container:UrlPane:";
-
- public static Pane createContainerPane(Logger logger, IEclipseContext context) {
- List<String> tags = ((MUIElement)context.get(BaseRenderer.CONTEXT_DOM_ELEMENT)).getTags();
+ private static final String WIDGET_ANCHORPANE_TAG = "Container:AnchorPane"; //$NON-NLS-1$
+ private static final String WIDGET_FLOWPANE_TAG = "Container:FlowPane"; //$NON-NLS-1$
+ private static final String WIDGET_GRIDPANE_TAG = "Container:GridPane"; //$NON-NLS-1$
+ private static final String WIDGET_HBOX_TAG = "Container:HBox"; //$NON-NLS-1$
+ private static final String WIDGET_STACKPANE_TAG = "Container:StackPane"; //$NON-NLS-1$
+ private static final String WIDGET_VBOX_TAG = "Container:VBox"; //$NON-NLS-1$
+
+ private static final String WIDGET_EFX_FILL_TAG = "Container:FillLayoutPane"; //$NON-NLS-1$
+ private static final String WIDGET_EFX_GRID_TAG = "Container:GridLayoutPane"; //$NON-NLS-1$
+ private static final String WIDGET_EFX_ROW_TAG = "Container:RowLayoutPane"; //$NON-NLS-1$
+ private static final String WIDGET_EFX_SASH_TAG = "Container:SashLayoutPane"; //$NON-NLS-1$
+
+ private static final String WIDGET_URLPANE_TAG = "Container:UrlPane:"; //$NON-NLS-1$
+
+ /**
+ * Create a container pane
+ *
+ * @param logger
+ * the logger to use for error reporting
+ * @param context
+ * the context the pane is created in
+ * @return the pane
+ */
+ @Nullable
+ public static Pane createContainerPane(@NonNull Logger logger, @NonNull IEclipseContext context) {
+ List<String> tags = ((MUIElement) context.get(BaseRenderer.CONTEXT_DOM_ELEMENT)).getTags();
Pane tmp = null;
- if( tags.contains(WIDGET_ANCHORPANE_TAG) ) {
+ if (tags.contains(WIDGET_ANCHORPANE_TAG)) {
tmp = new AnchorPane();
- } else if( tags.contains(WIDGET_FLOWPANE_TAG) ) {
+ } else if (tags.contains(WIDGET_FLOWPANE_TAG)) {
tmp = new FlowPane();
- } else if( tags.contains(WIDGET_GRIDPANE_TAG) ) {
+ } else if (tags.contains(WIDGET_GRIDPANE_TAG)) {
tmp = new GridPane();
- } else if( tags.contains(WIDGET_HBOX_TAG) ) {
+ } else if (tags.contains(WIDGET_HBOX_TAG)) {
tmp = new HBox();
- } else if( tags.contains(WIDGET_STACKPANE_TAG) ) {
+ } else if (tags.contains(WIDGET_STACKPANE_TAG)) {
tmp = new StackPane();
- } else if( tags.contains(WIDGET_VBOX_TAG) ) {
+ } else if (tags.contains(WIDGET_VBOX_TAG)) {
tmp = new VBox();
- } else if( tags.contains(WIDGET_EFX_FILL_TAG) ) {
+ } else if (tags.contains(WIDGET_EFX_FILL_TAG)) {
tmp = new FillLayoutPane();
- } else if( tags.contains(WIDGET_EFX_GRID_TAG) ) {
+ } else if (tags.contains(WIDGET_EFX_GRID_TAG)) {
tmp = new GridLayoutPane();
- } else if( tags.contains(WIDGET_EFX_ROW_TAG) ) {
+ } else if (tags.contains(WIDGET_EFX_ROW_TAG)) {
tmp = new RowLayoutPane();
- } else if( tags.contains(WIDGET_EFX_SASH_TAG) ) {
+ } else if (tags.contains(WIDGET_EFX_SASH_TAG)) {
tmp = new SashLayoutPane();
}
-
- if( tmp == null ) {
- for( String t : tags ) {
- if( t.startsWith(WIDGET_URLPANE_TAG) ) {
+
+ if (tmp == null) {
+ for (String t : tags) {
+ if (t.startsWith(WIDGET_URLPANE_TAG)) {
try {
tmp = (Pane) context.get(IContributionFactory.class).create(t.substring((WIDGET_URLPANE_TAG).length()), context);
break;
- } catch(Exception e) {
- logger.error("Unable to create pane from URL", e);
- }
+ } catch (Exception e) {
+ logger.error("Unable to create pane from URL", e); //$NON-NLS-1$
+ }
}
}
}
-
+
return tmp;
}
}

Back to the top