You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2008/01/08 17:36:50 UTC
svn commit: r610059 [4/7] - in
/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor: ./
src/main/java/org/apache/uima/dde/internal/
src/main/java/org/apache/uima/dde/internal/details/
src/main/java/org/apache/uima/dde/internal/hover/ src/main/ja...
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java Tue Jan 8 08:36:45 2008
@@ -1,325 +1,325 @@
-package org.apache.uima.dde.internal.hover;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.uima.aae.deployment.AEDeploymentDescription;
-import org.apache.uima.aae.deployment.AEDeploymentMetaData;
-import org.apache.uima.aae.deployment.AsyncAEErrorConfiguration;
-import org.apache.uima.aae.deployment.CollectionProcessCompleteErrors;
-import org.apache.uima.aae.deployment.GetMetadataErrors;
-import org.apache.uima.aae.deployment.ProcessCasErrors;
-import org.apache.uima.aae.deployment.RemoteAEDeploymentMetaData;
-import org.apache.uima.analysis_engine.AnalysisEngineDescription;
-import org.apache.uima.tools.debug.util.Trace;
-import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlExtension2;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.widgets.FormText;
-
-
-public class DDEInformationControl extends PopupDialog implements IInformationControl,
- IInformationControlExtension2 {
- private Font boldTextFont;
-
- /** ********************************************************************** */
-
- public DDEInformationControl(Shell parent, int shellStyle, int treeStyle) {
- this(parent, shellStyle, treeStyle, null, false);
- }
-
- public DDEInformationControl(Shell parent, int shellStyle, int treeStyle,
- String invokingCommandId, boolean showStatusField) {
- super(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP, false, false, false, false, null,
- null);
- create();
- boldTextFont = createBoldFont(getShell().getDisplay(), JFaceResources.getTextFont());
- }
-
- public void setVisible(boolean visible) {
-
- if (visible) {
- open();
- } else {
- saveDialogBounds(getShell());
- getShell().setVisible(false);
- }
- }
-
- /** ********************************************************************** */
-
- public void addDisposeListener(DisposeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public void addFocusListener(FocusListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public Point computeSizeHint() {
- int widthHint = 400; // SWT.DEFAULT;
-
- if (getShell() != null) {
- Point pt = getShell().computeSize(widthHint, SWT.DEFAULT, true);
- // Trace.err("computeSizeHint: " + pt.toString());
- return pt;
- } else {
- // Trace.err("getShell() == null");
- return new Point(200, 100);
- }
- }
-
- public void dispose() {
- if (boldTextFont != null) {
- boldTextFont.dispose();
- }
- }
-
- public boolean isFocusControl() {
- return false;
- }
-
- public void removeDisposeListener(DisposeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public void removeFocusListener(FocusListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public void setBackgroundColor(Color background) {
- // TODO Auto-generated method stub
-
- }
-
- public void setFocus() {
- // TODO Auto-generated method stub
-
- }
-
- public void setForegroundColor(Color foreground) {
- // TODO Auto-generated method stub
-
- }
-
- public void setInformation(String information) {
- formText.setText(information, true, false);
- }
-
- public void setLocation(Point location) {
- // Trace.err(location.toString());
- getShell().setLocation(location);
- }
-
- public void setSize(int width, int height) {
- getShell().setSize(width, height);
- // Trace.err("width: " + width + " height:" + height);
- }
-
- public void setSizeConstraints(int maxWidth, int maxHeight) {
- }
-
- public void setInput(Object input) {
- StringBuffer buf = new StringBuffer();
- if (input != null) {
- // Trace.err("input: " + input.getClass().getName());
- if (input instanceof String) {
- formText.setColor("header", formColors.getColor(FormColors.TITLE));
- // formText.setFont("header", JFaceResources.getHeaderFont());
- formText
- .setFont("header", JFaceResources.getFontRegistry().get(JFaceResources.WINDOW_FONT));
- formText.setFont("code", JFaceResources.getTextFont());
- formText.setText(buf.toString(), true, false);
- } else if (input instanceof TreeItem && ((TreeItem) input).getData() != null) {
-// TreeItem item = (TreeItem) input;
- Object obj = ((TreeItem) input).getData();
- String text = null;
- if (obj instanceof AEDeploymentMetaData) {
- text = toStringFromAEDeploymentMetaData((AEDeploymentMetaData) obj);
-
- } else if (obj instanceof RemoteAEDeploymentMetaData) {
- text = toStringFromRemoteAEDeploymentMetaData((RemoteAEDeploymentMetaData) obj);
-
- } else if (obj instanceof AEDeploymentDescription) {
- text = toStringFromAEDeploymentDescription((AEDeploymentDescription) obj);
-
- } else if (obj instanceof KeyValuePair) {
- AEDeploymentDescription dd = (AEDeploymentDescription) ((KeyValuePair) obj).getValue();
- text = toStringFromAEDeploymentDescription(dd);
- }
- if (text != null) {
- formText.setColor("header", formColors.getColor(FormColors.TITLE));
- formText.setFont("header", boldTextFont);
- formText.setText(text, true, false);
- }
- }
- }
- }
-
- protected String toStringFromAEDeploymentDescription(AEDeploymentDescription obj) {
- StringBuffer buf = new StringBuffer();
- buf.append("<form><p><span color=\"header\" font=\"header\">");
- buf.append(obj.getName() + "</span>");
- buf.append("</p>");
-
- // Description
- if (obj.getDescription().trim().length() > 0) {
- buf.append("<p>" + obj.getDescription());
- buf.append("</p>");
- }
-
- buf.append("</form>");
- return buf.toString();
- }
-
-
- protected String toStringFromAEDeploymentMetaData(AEDeploymentMetaData obj) {
- StringBuffer buf = new StringBuffer();
- buf.append("<form><p><span color=\"header\" font=\"header\">");
- buf.append(obj.getKey() + "</span>");
- if (obj.isAsync()) {
- buf.append(" - Async Aggregate");
- }
- buf.append("</p>");
-
- if (obj.isAsync() && obj.getResourceSpecifier() instanceof AnalysisEngineDescription) {
- AnalysisEngineDescription aed = (AnalysisEngineDescription) obj.getResourceSpecifier();
- if (!aed.isPrimitive()) {
- buf.append("<p><b>Delegates</b>\n");
- Map map = aed.getDelegateAnalysisEngineSpecifiersWithImports();
- Set<String> keys = map.keySet();
- for (String key: keys) {
- buf.append(" - " + key);
- }
- buf.append("</p>");
- }
- }
-
- // Number of Replicated Instances
- if (!obj.isTopAnalysisEngine()) {
- buf.append("<p>Number of Replicated Instances: " + obj.getNumberOfInstances());
- buf.append("</p>");
- }
-
- if (obj.isCasMultiplier()) {
- buf.append("<p>CasMultiplierPoolSize: " + obj.getCasMultiplierPoolSize());
- buf.append("</p>");
- }
-
- // Error Config
- toStringFromErrorConfig(buf, obj.getAsyncAEErrorConfiguration());
-
- buf.append("</form>");
- return buf.toString();
- }
-
- protected String toStringFromRemoteAEDeploymentMetaData(RemoteAEDeploymentMetaData obj) {
- StringBuffer buf = new StringBuffer();
- buf.append("<form><p><span color=\"header\" font=\"header\">");
- buf.append(obj.getKey() + "</span> - Remote Service</p>");
- buf.append("<li><b>Broker URL:</b> "
- + (obj.getInputQueue() != null ? obj.getInputQueue().getBrokerURL() : "") + "</li>");
- buf.append("<li><b>Queue Name:</b> "
- + (obj.getInputQueue() != null ? obj.getInputQueue().getEndPoint() : "") + "</li>");
- if (obj.getReplyQueueLocation() != null) {
- buf.append("<li><b>Remote Queue Location:</b> " + obj.getReplyQueueLocation() + "</li>");
- }
- // Error Config
- toStringFromErrorConfig(buf, obj.getAsyncAEErrorConfiguration());
-
- buf.append("</form>");
- return buf.toString();
- }
-
- protected void toStringFromErrorConfig(StringBuffer buf, AsyncAEErrorConfiguration obj) {
- if (obj == null) {
- return;
- }
- GetMetadataErrors getGetMetadataErrors = obj.getGetMetadataErrors();
- if (getGetMetadataErrors != null) {
- buf.append("<li><b>GetMetadataErrors</b></li>");
- buf.append("<li bindent=\"20\">MaxRetries: " + getGetMetadataErrors.getMaxRetries()
- + " ; Timeout: " + getGetMetadataErrors.getTimeout() + " ; ErrorAction: "
- + getGetMetadataErrors.getErrorAction() + "</li>");
- }
-
- ProcessCasErrors processCasErrors = obj.getProcessCasErrors();
- if (processCasErrors != null) {
- buf.append("<li><b>ProcessCasErrors</b></li>");
- buf.append("<li bindent=\"20\">ThresholdCount: " + processCasErrors.getThresholdCount()
- + " ; ThresholdWindow: " + processCasErrors.getThresholdWindow()
- + " ; ThresholdAction: " + processCasErrors.getThresholdAction() + "</li>");
- }
-
- CollectionProcessCompleteErrors collProcessCompleteErrors = obj
- .getCollectionProcessCompleteErrors();
- if (collProcessCompleteErrors != null) {
- buf.append("<li><b>CollectionProcessCompleteErrors</b></li>");
- buf.append("<li bindent=\"20\">Timeout: " + collProcessCompleteErrors.getTimeout()
- + " ; Additional ErrorAction: "
- + collProcessCompleteErrors.getAdditionalErrorAction() + "</li>");
- }
-
- }
-
- public static Font createBoldFont(Display display, Font regularFont) {
- FontData[] fontDatas = regularFont.getFontData();
- for (int i = 0; i < fontDatas.length; i++) {
- fontDatas[i].setStyle(fontDatas[i].getStyle() | SWT.BOLD);
- }
- return new Font(display, fontDatas);
- }
-
- /** ********************************************************************** */
-
- private static final int INNER_BORDER = 1;
-
- private FormText formText;
-
- private FormColors formColors;
-
- protected Control createDialogArea(Composite parent) {
- formColors = new FormColors(parent.getDisplay());
- parent.setLayout(new GridLayout());
- // Text field
- formText = new FormText(parent, SWT.MULTI | SWT.READ_ONLY);
- GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
- gd.horizontalIndent = INNER_BORDER;
- gd.verticalIndent = INNER_BORDER;
- formText.setLayoutData(gd);
- formText.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- if (e.character == 0x1B) // ESC
- close();
- }
-
- public void keyReleased(KeyEvent e) {
- }
- });
- return formText;
- }
-
-}
+package org.apache.uima.dde.internal.hover;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uima.aae.deployment.AEDeploymentDescription;
+import org.apache.uima.aae.deployment.AEDeploymentMetaData;
+import org.apache.uima.aae.deployment.AsyncAEErrorConfiguration;
+import org.apache.uima.aae.deployment.CollectionProcessCompleteErrors;
+import org.apache.uima.aae.deployment.GetMetadataErrors;
+import org.apache.uima.aae.deployment.ProcessCasErrors;
+import org.apache.uima.aae.deployment.RemoteAEDeploymentMetaData;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlExtension2;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.widgets.FormText;
+
+
+public class DDEInformationControl extends PopupDialog implements IInformationControl,
+ IInformationControlExtension2 {
+ private Font boldTextFont;
+
+ /** ********************************************************************** */
+
+ public DDEInformationControl(Shell parent, int shellStyle, int treeStyle) {
+ this(parent, shellStyle, treeStyle, null, false);
+ }
+
+ public DDEInformationControl(Shell parent, int shellStyle, int treeStyle,
+ String invokingCommandId, boolean showStatusField) {
+ super(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP, false, false, false, false, null,
+ null);
+ create();
+ boldTextFont = createBoldFont(getShell().getDisplay(), JFaceResources.getTextFont());
+ }
+
+ public void setVisible(boolean visible) {
+
+ if (visible) {
+ open();
+ } else {
+ saveDialogBounds(getShell());
+ getShell().setVisible(false);
+ }
+ }
+
+ /** ********************************************************************** */
+
+ public void addDisposeListener(DisposeListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addFocusListener(FocusListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Point computeSizeHint() {
+ int widthHint = 400; // SWT.DEFAULT;
+
+ if (getShell() != null) {
+ Point pt = getShell().computeSize(widthHint, SWT.DEFAULT, true);
+ // Trace.err("computeSizeHint: " + pt.toString());
+ return pt;
+ } else {
+ // Trace.err("getShell() == null");
+ return new Point(200, 100);
+ }
+ }
+
+ public void dispose() {
+ if (boldTextFont != null) {
+ boldTextFont.dispose();
+ }
+ }
+
+ public boolean isFocusControl() {
+ return false;
+ }
+
+ public void removeDisposeListener(DisposeListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeFocusListener(FocusListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setBackgroundColor(Color background) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setForegroundColor(Color foreground) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setInformation(String information) {
+ formText.setText(information, true, false);
+ }
+
+ public void setLocation(Point location) {
+ // Trace.err(location.toString());
+ getShell().setLocation(location);
+ }
+
+ public void setSize(int width, int height) {
+ getShell().setSize(width, height);
+ // Trace.err("width: " + width + " height:" + height);
+ }
+
+ public void setSizeConstraints(int maxWidth, int maxHeight) {
+ }
+
+ public void setInput(Object input) {
+ StringBuffer buf = new StringBuffer();
+ if (input != null) {
+ // Trace.err("input: " + input.getClass().getName());
+ if (input instanceof String) {
+ formText.setColor("header", formColors.getColor(FormColors.TITLE));
+ // formText.setFont("header", JFaceResources.getHeaderFont());
+ formText
+ .setFont("header", JFaceResources.getFontRegistry().get(JFaceResources.WINDOW_FONT));
+ formText.setFont("code", JFaceResources.getTextFont());
+ formText.setText(buf.toString(), true, false);
+ } else if (input instanceof TreeItem && ((TreeItem) input).getData() != null) {
+// TreeItem item = (TreeItem) input;
+ Object obj = ((TreeItem) input).getData();
+ String text = null;
+ if (obj instanceof AEDeploymentMetaData) {
+ text = toStringFromAEDeploymentMetaData((AEDeploymentMetaData) obj);
+
+ } else if (obj instanceof RemoteAEDeploymentMetaData) {
+ text = toStringFromRemoteAEDeploymentMetaData((RemoteAEDeploymentMetaData) obj);
+
+ } else if (obj instanceof AEDeploymentDescription) {
+ text = toStringFromAEDeploymentDescription((AEDeploymentDescription) obj);
+
+ } else if (obj instanceof KeyValuePair) {
+ AEDeploymentDescription dd = (AEDeploymentDescription) ((KeyValuePair) obj).getValue();
+ text = toStringFromAEDeploymentDescription(dd);
+ }
+ if (text != null) {
+ formText.setColor("header", formColors.getColor(FormColors.TITLE));
+ formText.setFont("header", boldTextFont);
+ formText.setText(text, true, false);
+ }
+ }
+ }
+ }
+
+ protected String toStringFromAEDeploymentDescription(AEDeploymentDescription obj) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<form><p><span color=\"header\" font=\"header\">");
+ buf.append(obj.getName() + "</span>");
+ buf.append("</p>");
+
+ // Description
+ if (obj.getDescription().trim().length() > 0) {
+ buf.append("<p>" + obj.getDescription());
+ buf.append("</p>");
+ }
+
+ buf.append("</form>");
+ return buf.toString();
+ }
+
+
+ protected String toStringFromAEDeploymentMetaData(AEDeploymentMetaData obj) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<form><p><span color=\"header\" font=\"header\">");
+ buf.append(obj.getKey() + "</span>");
+ if (obj.isAsync()) {
+ buf.append(" - Async Aggregate");
+ }
+ buf.append("</p>");
+
+ if (obj.isAsync() && obj.getResourceSpecifier() instanceof AnalysisEngineDescription) {
+ AnalysisEngineDescription aed = (AnalysisEngineDescription) obj.getResourceSpecifier();
+ if (!aed.isPrimitive()) {
+ buf.append("<p><b>Delegates</b>\n");
+ Map map = aed.getDelegateAnalysisEngineSpecifiersWithImports();
+ Set<String> keys = map.keySet();
+ for (String key: keys) {
+ buf.append(" - " + key);
+ }
+ buf.append("</p>");
+ }
+ }
+
+ // Number of Replicated Instances
+ if (!obj.isTopAnalysisEngine()) {
+ buf.append("<p>Number of Replicated Instances: " + obj.getNumberOfInstances());
+ buf.append("</p>");
+ }
+
+ if (obj.isCasMultiplier()) {
+ buf.append("<p>CasMultiplierPoolSize: " + obj.getCasMultiplierPoolSize());
+ buf.append("</p>");
+ }
+
+ // Error Config
+ toStringFromErrorConfig(buf, obj.getAsyncAEErrorConfiguration());
+
+ buf.append("</form>");
+ return buf.toString();
+ }
+
+ protected String toStringFromRemoteAEDeploymentMetaData(RemoteAEDeploymentMetaData obj) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<form><p><span color=\"header\" font=\"header\">");
+ buf.append(obj.getKey() + "</span> - Remote Service</p>");
+ buf.append("<li><b>Broker URL:</b> "
+ + (obj.getInputQueue() != null ? obj.getInputQueue().getBrokerURL() : "") + "</li>");
+ buf.append("<li><b>Queue Name:</b> "
+ + (obj.getInputQueue() != null ? obj.getInputQueue().getEndPoint() : "") + "</li>");
+ if (obj.getReplyQueueLocation() != null) {
+ buf.append("<li><b>Remote Queue Location:</b> " + obj.getReplyQueueLocation() + "</li>");
+ }
+ // Error Config
+ toStringFromErrorConfig(buf, obj.getAsyncAEErrorConfiguration());
+
+ buf.append("</form>");
+ return buf.toString();
+ }
+
+ protected void toStringFromErrorConfig(StringBuffer buf, AsyncAEErrorConfiguration obj) {
+ if (obj == null) {
+ return;
+ }
+ GetMetadataErrors getGetMetadataErrors = obj.getGetMetadataErrors();
+ if (getGetMetadataErrors != null) {
+ buf.append("<li><b>GetMetadataErrors</b></li>");
+ buf.append("<li bindent=\"20\">MaxRetries: " + getGetMetadataErrors.getMaxRetries()
+ + " ; Timeout: " + getGetMetadataErrors.getTimeout() + " ; ErrorAction: "
+ + getGetMetadataErrors.getErrorAction() + "</li>");
+ }
+
+ ProcessCasErrors processCasErrors = obj.getProcessCasErrors();
+ if (processCasErrors != null) {
+ buf.append("<li><b>ProcessCasErrors</b></li>");
+ buf.append("<li bindent=\"20\">ThresholdCount: " + processCasErrors.getThresholdCount()
+ + " ; ThresholdWindow: " + processCasErrors.getThresholdWindow()
+ + " ; ThresholdAction: " + processCasErrors.getThresholdAction() + "</li>");
+ }
+
+ CollectionProcessCompleteErrors collProcessCompleteErrors = obj
+ .getCollectionProcessCompleteErrors();
+ if (collProcessCompleteErrors != null) {
+ buf.append("<li><b>CollectionProcessCompleteErrors</b></li>");
+ buf.append("<li bindent=\"20\">Timeout: " + collProcessCompleteErrors.getTimeout()
+ + " ; Additional ErrorAction: "
+ + collProcessCompleteErrors.getAdditionalErrorAction() + "</li>");
+ }
+
+ }
+
+ public static Font createBoldFont(Display display, Font regularFont) {
+ FontData[] fontDatas = regularFont.getFontData();
+ for (int i = 0; i < fontDatas.length; i++) {
+ fontDatas[i].setStyle(fontDatas[i].getStyle() | SWT.BOLD);
+ }
+ return new Font(display, fontDatas);
+ }
+
+ /** ********************************************************************** */
+
+ private static final int INNER_BORDER = 1;
+
+ private FormText formText;
+
+ private FormColors formColors;
+
+ protected Control createDialogArea(Composite parent) {
+ formColors = new FormColors(parent.getDisplay());
+ parent.setLayout(new GridLayout());
+ // Text field
+ formText = new FormText(parent, SWT.MULTI | SWT.READ_ONLY);
+ GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
+ gd.horizontalIndent = INNER_BORDER;
+ gd.verticalIndent = INNER_BORDER;
+ formText.setLayoutData(gd);
+ formText.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ if (e.character == 0x1B) // ESC
+ close();
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+ });
+ return formText;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/DDEInformationControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java Tue Jan 8 08:36:45 2008
@@ -1,34 +1,34 @@
-package org.apache.uima.dde.internal.hover;
-
-import org.eclipse.jface.text.AbstractHoverInformationControlManager;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.TreeItem;
-
-public class HoverManager extends AbstractHoverInformationControlManager {
-
- private TreeViewer viewer;
-
- public HoverManager(TreeViewer viewer, IInformationControlCreator creator) {
- super(creator);
- this.viewer = viewer;
- }
-
- @Override
- protected void computeInformation() {
- Point pt = getHoverEventLocation();
- // Trace.err("x: " + pt.x + " y: " + pt.y);
- TreeItem item = viewer.getTree().getItem(pt);
- if (item != null) {
- // Trace.err("Hover");
- setInformation(item, item.getBounds());
- } else {
- // Trace.err("NOT Hover");
- setInformation(null, null);
- }
- }
-
-}
+package org.apache.uima.dde.internal.hover;
+
+import org.eclipse.jface.text.AbstractHoverInformationControlManager;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class HoverManager extends AbstractHoverInformationControlManager {
+
+ private TreeViewer viewer;
+
+ public HoverManager(TreeViewer viewer, IInformationControlCreator creator) {
+ super(creator);
+ this.viewer = viewer;
+ }
+
+ @Override
+ protected void computeInformation() {
+ Point pt = getHoverEventLocation();
+ // Trace.err("x: " + pt.x + " y: " + pt.y);
+ TreeItem item = viewer.getTree().getItem(pt);
+ if (item != null) {
+ // Trace.err("Hover");
+ setInformation(item, item.getBounds());
+ } else {
+ // Trace.err("NOT Hover");
+ setInformation(null, null);
+ }
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/HoverManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java Tue Jan 8 08:36:45 2008
@@ -1,83 +1,83 @@
-package org.apache.uima.dde.internal.hover;
-
-public class KeyValuePair {
-
- protected Object parent;
-
- protected String label;
-
- protected String key;
-
- protected Object value;
-
- public KeyValuePair (String key, Object value) {
-// this.parent = parent;
-// this.label = label;
- this.key = key;
- this.value = value;
- }
-
- public KeyValuePair (String key, Object value, Object parent, String label) {
- this.parent = parent;
- this.label = label;
- this.key = key;
- this.value = value;
- }
-
- /**
- * @return the key
- */
- public String getKey() {
- return key;
- }
-
- /**
- * @param key the key to set
- */
- public void setKey(String key) {
- this.key = key;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the parent
- */
- public Object getParent() {
- return parent;
- }
-
- /**
- * @param parent the parent to set
- */
- public void setParent(Object parent) {
- this.parent = parent;
- }
-
- /**
- * @return the value
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
+package org.apache.uima.dde.internal.hover;
+
+public class KeyValuePair {
+
+ protected Object parent;
+
+ protected String label;
+
+ protected String key;
+
+ protected Object value;
+
+ public KeyValuePair (String key, Object value) {
+// this.parent = parent;
+// this.label = label;
+ this.key = key;
+ this.value = value;
+ }
+
+ public KeyValuePair (String key, Object value, Object parent, String label) {
+ this.parent = parent;
+ this.label = label;
+ this.key = key;
+ this.value = value;
+ }
+
+ /**
+ * @return the key
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * @param key the key to set
+ */
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * @param label the label to set
+ */
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @return the parent
+ */
+ public Object getParent() {
+ return parent;
+ }
+
+ /**
+ * @param parent the parent to set
+ */
+ public void setParent(Object parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * @return the value
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/hover/KeyValuePair.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java Tue Jan 8 08:36:45 2008
@@ -1,95 +1,95 @@
-/**
- *
- * Project UIMA Tooling
- *
- *
- * creation date: Jun 23, 2006, 12:40:24 PM
- * source: TemplatePage.java
- */
-package org.apache.uima.dde.internal.page;
-
-import org.apache.uima.aae.deployment.AEDeploymentDescription;
-import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-
-/**
- *
- *
- */
-public class AEConfigurationPage extends AbstractHeaderPage {
-
- static public final String PAGE_TITLE = "Deployment Configurations";
-
-// static protected AEConfigurationPage instance = null;
-
- private ScrolledForm form;
-
-// private TreeViewer aeConfigViewer;
-
- private MasterDetails md;
-
- private DeploymentDescriptorEditor multiPageEditor;
-
- private AEDeploymentDescription input;
-
- /**
- * @param editor
- * @param id
- * @param title
- */
- public AEConfigurationPage(DeploymentDescriptorEditor editor, String id, String title) {
- super(editor.cde, id, title);
- multiPageEditor = editor;
-
- }
-
- /**
- * @param id
- * @param title
- */
- public AEConfigurationPage(String id, String title) {
- super(id, title);
- // TODO Auto-generated constructor stub
- }
-
-// static public AEConfigurationPage getInstance() {
-// return instance;
-// }
-
- public void refresh() {
- md.refresh();
- }
-
- public void setInput(Object input) {
- if (input instanceof AEDeploymentDescription) {
- if (md != null) {
- md.setInput(input);
- } else {
- this.input = (AEDeploymentDescription) input;
- }
- }
- }
-
- /**
- * Called by the framework to fill in the contents
- */
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
- form = managedForm.getForm();
- form.setText(PAGE_TITLE);
-
- md = new MasterDetails(multiPageEditor, managedForm, getSite());
- md.createContent(managedForm);
- md.init(); // will trigger the display of the details page
- if (input != null) {
- md.setInput(input);
- }
- }
-
- /** ********************************************************************** */
-
-}
+/**
+ *
+ * Project UIMA Tooling
+ *
+ *
+ * creation date: Jun 23, 2006, 12:40:24 PM
+ * source: TemplatePage.java
+ */
+package org.apache.uima.dde.internal.page;
+
+import org.apache.uima.aae.deployment.AEDeploymentDescription;
+import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+
+/**
+ *
+ *
+ */
+public class AEConfigurationPage extends AbstractHeaderPage {
+
+ static public final String PAGE_TITLE = "Deployment Configurations";
+
+// static protected AEConfigurationPage instance = null;
+
+ private ScrolledForm form;
+
+// private TreeViewer aeConfigViewer;
+
+ private MasterDetails md;
+
+ private DeploymentDescriptorEditor multiPageEditor;
+
+ private AEDeploymentDescription input;
+
+ /**
+ * @param editor
+ * @param id
+ * @param title
+ */
+ public AEConfigurationPage(DeploymentDescriptorEditor editor, String id, String title) {
+ super(editor.cde, id, title);
+ multiPageEditor = editor;
+
+ }
+
+ /**
+ * @param id
+ * @param title
+ */
+ public AEConfigurationPage(String id, String title) {
+ super(id, title);
+ // TODO Auto-generated constructor stub
+ }
+
+// static public AEConfigurationPage getInstance() {
+// return instance;
+// }
+
+ public void refresh() {
+ md.refresh();
+ }
+
+ public void setInput(Object input) {
+ if (input instanceof AEDeploymentDescription) {
+ if (md != null) {
+ md.setInput(input);
+ } else {
+ this.input = (AEDeploymentDescription) input;
+ }
+ }
+ }
+
+ /**
+ * Called by the framework to fill in the contents
+ */
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+ form = managedForm.getForm();
+ form.setText(PAGE_TITLE);
+
+ md = new MasterDetails(multiPageEditor, managedForm, getSite());
+ md.createContent(managedForm);
+ md.init(); // will trigger the display of the details page
+ if (input != null) {
+ md.setInput(input);
+ }
+ }
+
+ /** ********************************************************************** */
+
+}
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AEConfigurationPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java Tue Jan 8 08:36:45 2008
@@ -1,133 +1,133 @@
-/**
- *
- * Project UIMA Tooling
- *
- *
- * creation date: Jun 23, 2006, 12:28:00 PM
- * source: AbstractHeaderPage.java
- */
-package org.apache.uima.dde.internal.page;
-
-import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
-import org.apache.uima.tools.images.internal.ImageLoader;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-
-
-/**
- * Abstract class inherited by all editor pages
- *
- */
-public abstract class AbstractHeaderPage extends FormPage {
- static public final int STATUS_IS_VALID = 0;
-
- static public final int STATUS_IS_INVALID = -1;
-
- static public final int STATUS_FILE_NOT_SPECIFIED = 1;
-
- static public final int STATUS_FILE_NOT_EXIST = 2;
-
- /**
- * @param editor
- * @param id
- * @param title
- */
- public AbstractHeaderPage(FormEditor editor, String id, String title) {
- super(editor, id, title);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param id
- * @param title
- */
- public AbstractHeaderPage(String id, String title) {
- super(id, title);
- // TODO Auto-generated constructor stub
- }
-
- public void setFormPageTitle(ScrolledForm sform, String title) {
- sform.setText(title);
- // sform.setBackgroundImage(RepositoryPlugin.getDefault().getImage(
- // RepositoryPlugin.IMG_FORM_BG));
- }
-
- static public void createExpandOrCollapseAllMenu(FormToolkit toolkit, Section section,
- Composite toolbarComposite, final TreeViewer treeViewer, boolean expand) {
- String toolTipText;
- String iconKey;
-
- if (expand) {
- toolTipText = "Expand All";
- iconKey = ImageLoader.ICON_SEARCH_EXPANDALL;
- } else {
- toolTipText = "Collapse All";
- iconKey = ImageLoader.ICON_SEARCH_COLLAPSEALL;
- }
- ImageHyperlink info = new ImageHyperlink(toolbarComposite, SWT.NULL);
- toolkit.adapt(info, true, true);
- Image image = ImageLoader.getInstance().getImage(iconKey);
- info.setImage(image);
- info.setToolTipText(toolTipText);
- // info.setBackground(section.getTitleBarGradientBackground());
- if (expand) {
- info.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- treeViewer.expandAll();
- }
- });
- } else {
- info.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- treeViewer.collapseAll();
- }
- });
- }
- } // createExpandOrCollapseAllMenu
-
- static protected void createToolBarActions(IManagedForm managedForm, final SashForm sashForm,
- boolean selectHorizontal) {
- final ScrolledForm form = managedForm.getForm();
-
- Action haction = new Action("hor", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
- public void run() {
- sashForm.setOrientation(SWT.HORIZONTAL);
- form.reflow(true);
- }
- };
- haction.setChecked(selectHorizontal);
- haction.setToolTipText("Horizontal Orientation");
- haction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
- haction.setDisabledImageDescriptor(TAEConfiguratorPlugin
- .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
-
- Action vaction = new Action("ver", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
- public void run() {
- sashForm.setOrientation(SWT.VERTICAL);
- form.reflow(true);
- }
- };
- vaction.setChecked(!selectHorizontal);
- vaction.setToolTipText("Vertical Orientation");
- vaction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
- vaction.setDisabledImageDescriptor(TAEConfiguratorPlugin
- .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
- form.getToolBarManager().add(haction);
- form.getToolBarManager().add(vaction);
- form.updateToolBar();
- }
-
-} // AbstractHeaderPage
+/**
+ *
+ * Project UIMA Tooling
+ *
+ *
+ * creation date: Jun 23, 2006, 12:28:00 PM
+ * source: AbstractHeaderPage.java
+ */
+package org.apache.uima.dde.internal.page;
+
+import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
+import org.apache.uima.tools.images.internal.ImageLoader;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * Abstract class inherited by all editor pages
+ *
+ */
+public abstract class AbstractHeaderPage extends FormPage {
+ static public final int STATUS_IS_VALID = 0;
+
+ static public final int STATUS_IS_INVALID = -1;
+
+ static public final int STATUS_FILE_NOT_SPECIFIED = 1;
+
+ static public final int STATUS_FILE_NOT_EXIST = 2;
+
+ /**
+ * @param editor
+ * @param id
+ * @param title
+ */
+ public AbstractHeaderPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param id
+ * @param title
+ */
+ public AbstractHeaderPage(String id, String title) {
+ super(id, title);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void setFormPageTitle(ScrolledForm sform, String title) {
+ sform.setText(title);
+ // sform.setBackgroundImage(RepositoryPlugin.getDefault().getImage(
+ // RepositoryPlugin.IMG_FORM_BG));
+ }
+
+ static public void createExpandOrCollapseAllMenu(FormToolkit toolkit, Section section,
+ Composite toolbarComposite, final TreeViewer treeViewer, boolean expand) {
+ String toolTipText;
+ String iconKey;
+
+ if (expand) {
+ toolTipText = "Expand All";
+ iconKey = ImageLoader.ICON_SEARCH_EXPANDALL;
+ } else {
+ toolTipText = "Collapse All";
+ iconKey = ImageLoader.ICON_SEARCH_COLLAPSEALL;
+ }
+ ImageHyperlink info = new ImageHyperlink(toolbarComposite, SWT.NULL);
+ toolkit.adapt(info, true, true);
+ Image image = ImageLoader.getInstance().getImage(iconKey);
+ info.setImage(image);
+ info.setToolTipText(toolTipText);
+ // info.setBackground(section.getTitleBarGradientBackground());
+ if (expand) {
+ info.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ treeViewer.expandAll();
+ }
+ });
+ } else {
+ info.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ treeViewer.collapseAll();
+ }
+ });
+ }
+ } // createExpandOrCollapseAllMenu
+
+ static protected void createToolBarActions(IManagedForm managedForm, final SashForm sashForm,
+ boolean selectHorizontal) {
+ final ScrolledForm form = managedForm.getForm();
+
+ Action haction = new Action("hor", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
+ public void run() {
+ sashForm.setOrientation(SWT.HORIZONTAL);
+ form.reflow(true);
+ }
+ };
+ haction.setChecked(selectHorizontal);
+ haction.setToolTipText("Horizontal Orientation");
+ haction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
+ haction.setDisabledImageDescriptor(TAEConfiguratorPlugin
+ .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
+
+ Action vaction = new Action("ver", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
+ public void run() {
+ sashForm.setOrientation(SWT.VERTICAL);
+ form.reflow(true);
+ }
+ };
+ vaction.setChecked(!selectHorizontal);
+ vaction.setToolTipText("Vertical Orientation");
+ vaction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
+ vaction.setDisabledImageDescriptor(TAEConfiguratorPlugin
+ .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
+ form.getToolBarManager().add(haction);
+ form.getToolBarManager().add(vaction);
+ form.updateToolBar();
+ }
+
+} // AbstractHeaderPage
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/AbstractHeaderPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java?rev=610059&r1=610058&r2=610059&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java (original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java Tue Jan 8 08:36:45 2008
@@ -1,459 +1,459 @@
-package org.apache.uima.dde.internal.page;
-
-import org.apache.uima.aae.deployment.AEDeploymentDescription;
-import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
-import org.apache.uima.dde.internal.Messages;
-import org.apache.uima.dde.internal.details.DetailsPageProvider;
-import org.apache.uima.dde.internal.hover.HoverManager;
-import org.apache.uima.dde.internal.hover.DDEInformationControl;
-import org.apache.uima.dde.internal.provider.DDTreeContentProvider;
-import org.apache.uima.dde.internal.provider.DDTreeLabelProvider;
-import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
-import org.apache.uima.tools.internal.ui.forms.FormSection;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.forms.DetailsPart;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.MasterDetailsBlock;
-import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-
-
-public class MasterDetails extends MasterDetailsBlock { // implements Listener {
-
- private AEDeploymentDescription aeDD;
-
- private TreeViewer aeConfigViewer;
-
- private DeploymentDescriptorEditor multiPageEditor;
-
- private IManagedForm managedForm = null;
-
- private ScrolledForm form;
-
- public MasterDetails(DeploymentDescriptorEditor editor, IManagedForm managedForm,
- IWorkbenchPartSite workbenchPartSite) {
- multiPageEditor = editor;
- this.managedForm = managedForm;
- this.form = managedForm.getForm();
-// _workbenchPartSite = workbenchPartSite;
- aeDD = multiPageEditor.getAEDeploymentDescription();
- }
-
- public void refresh() {
- TreeItem selectedItem = null;
- TreeItem[] selection = aeConfigViewer.getTree().getSelection();
- if (selection.length > 0) {
- selectedItem = selection[0];
- } else {
- selectFirstElement();
- }
- aeConfigViewer.getTree().setRedraw(false);
- aeConfigViewer.refresh();
- if (selectedItem != null) {
- // Restore selection
- aeConfigViewer.setSelection(new StructuredSelection(selectedItem.getData()));
- selection = aeConfigViewer.getTree().getSelection();
- if (selection != null) {
- selection[0].setExpanded(true);
- }
- aeConfigViewer.refresh();
- }
- aeConfigViewer.getTree().setRedraw(true);
- }
-
- public void setInput(Object input) {
- if (input instanceof AEDeploymentDescription) {
- aeDD = (AEDeploymentDescription) input;
- aeConfigViewer.setInput(aeDD);
- refresh();
- }
- }
-
- public void init() {
- selectFirstElement();
- }
-
- @Override
- protected void createMasterPart(IManagedForm managedForm, Composite parentSashForm) {
- FormToolkit toolkit = managedForm.getToolkit();
- Composite body = managedForm.getForm().getBody();
- body.setLayout(new GridLayout(1, false)); // this is required !
- toolkit.paintBordersFor(body);
-
- ScrolledForm form = managedForm.getForm();
- FormColors colors = toolkit.getColors();
- colors.initializeSectionToolBarColors();
- Color gbg = colors.getColor(FormColors.TB_GBG);
- Color bg = colors.getBackground();
- form.getForm().setTextBackground(new Color[] { bg, gbg }, new int[] { 100 }, true);
- // form.getForm().setSeparatorVisible(true);
-
- createAEConfigSection(parentSashForm, toolkit);
-
- sashForm.setBackground(sashForm.getDisplay().getSystemColor(SWT.COLOR_GRAY));
- }
-
- @Override
- protected void createToolBarActions(IManagedForm managedForm) {
- final ScrolledForm form = managedForm.getForm();
-
- Action haction = new Action("hor", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
- public void run() {
- sashForm.setOrientation(SWT.HORIZONTAL);
- form.reflow(true);
- }
- };
- haction.setChecked(true);
- haction.setToolTipText("Horizontal Orientation");
- haction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
- haction.setDisabledImageDescriptor(TAEConfiguratorPlugin
- .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
-
- Action vaction = new Action("ver", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
- public void run() {
- sashForm.setOrientation(SWT.VERTICAL);
- form.reflow(true);
- }
- };
- vaction.setChecked(false);
- vaction.setToolTipText("Vertical Orientation");
- vaction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
- vaction.setDisabledImageDescriptor(TAEConfiguratorPlugin
- .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
- form.getToolBarManager().add(haction);
- form.getToolBarManager().add(vaction);
- form.updateToolBar();
- }
-
- @Override
- protected void registerPages(DetailsPart detailsPart) {
- detailsPart.setPageLimit(10);
- // register static page for the extensions
- // detailsPart.registerPage(AEDeploymentMetaData_Impl.class, new
- // AEMetaDataDetailsPage_V1(managedForm));
- // detailsPart.registerPage(RemoteAEDeploymentMetaData_Impl.class, new
- // RemoteAEMetaDataDetails_V1(managedForm));
- // detailsPart.registerPage(AsyncAggregateErrorConfiguration_Impl.class, new
- // AsyncAEErrorConfigDetailsPage_V0(managedForm));
- // detailsPart.registerPage(AsyncPrimitiveErrorConfiguration_Impl.class, new
- // AsyncAEErrorConfigDetailsPage_V0(managedForm));
-
- // register a dynamic provider for elements
- detailsPart.setPageProvider(new DetailsPageProvider(multiPageEditor, managedForm, this, detailsPart));
- }
-
- /** ********************************************************************** */
- private SectionPart spart;
-
- private Section createAEConfigSection(Composite parent, FormToolkit toolkit) {
- TableWrapData td;
-
- Section section = FormSection.createGridDataSection(toolkit, parent, SWT.NONE,
- Messages.DDE_AEConfigPage_AEConfigTree_Section_Title,
- Messages.DDE_AEConfigPage_AEConfigTree_Section_Description, 10, 10, GridData.FILL_BOTH
- | GridData.VERTICAL_ALIGN_BEGINNING, 1, 1);
- section.clientVerticalSpacing = 10;
- section.setExpanded(true);
- section.addExpansionListener(new ExpansionAdapter() {
- public void expansionStateChanged(ExpansionEvent e) {
- form.reflow(true);
- }
- });
- spart = new SectionPart(section);
- managedForm.addPart(spart);
-
- // Create ToolBar
- Composite sectionToolbarComposite = FormSection.createGridLayoutContainer(toolkit, section, 4,
- 0, 0);
- section.setTextClient(sectionToolbarComposite);
- toolkit.createCompositeSeparator(section);
-
- // //////////////////
-
- Composite sectionClient = toolkit.createComposite(section);
- section.setClient(sectionClient);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- sectionClient.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_BOTH);
- sectionClient.setLayoutData(gd);
- toolkit.paintBordersFor(sectionClient);
-
- // /////////////////////////////////////////////////////////////////////
-
- final Tree tree = toolkit.createTree(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessVerticalSpace = true;
- tree.setLayoutData(gd);
- tree.setLinesVisible(true);
- tree.setHeaderVisible(true);
- String headers[] = { "Element", "Remote", "Instances" };
- final TreeColumn columns[] = new TreeColumn[headers.length];
- for (int i = 0; i < headers.length; i++) {
- int style;
- if (i==0) {
- style = SWT.NONE;
- } else {
- style = SWT.CENTER;
- }
- TreeColumn tc = new TreeColumn(tree, style, i);
- tc.setResizable(true);
- tc.setText(headers[i]);
- if (i == 0) {
- tc.setWidth(200);
- // } else {
- // tc.setWidth(100);
- }
- columns[i] = tc;
- if (i == 1 || i == 2) {
- tc.pack();
- // Trace.err("pack: " + tc.getWidth());
- }
- }
- // tree.addListener(SWT.MouseHover, this);
- tree.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- // int width = tree.getSize().x;
- // ScrollBar vBar = tree.getVerticalBar();
- // if (vBar.isEnabled()) {
- // // Trace.err("vBar.getSize().x: " + vBar.getSize().x);
- // width -= vBar.getSize().x/2;
- // } else {
- // Trace.err("NO vBar");
- // }
- // width = width - tree.computeTrim(0,0,0,0).width ;
- // columns[0].setWidth(width-140);
- // columns[1].setWidth(70);
- // columns[2].setWidth(70);
- }
- });
- /*
- * sectionClient.addControlListener(new ControlAdapter() { public void
- * controlResized(ControlEvent e) { Rectangle area = sectionClient.getClientArea(); Point size =
- * tree.computeSize(SWT.DEFAULT, SWT.DEFAULT); ScrollBar vBar = tree.getVerticalBar(); //
- * Trace.err("vBar.getSize().x: " + vBar.getSize().x); int width = area.width -
- * tree.computeTrim(0,0,0,0).width - vBar.getSize().x; if (size.y > area.height +
- * tree.getHeaderHeight()) { // Subtract the scrollbar width from the total column width // if a
- * vertical scrollbar will be required Point vBarSize = vBar.getSize(); width -= vBarSize.x; }
- * Point oldSize = tree.getSize(); if (oldSize.x > area.width) { // table is getting smaller so
- * make the columns // smaller first and then resize the table to // match the client area width
- * columns[0].setWidth(width-140); columns[1].setWidth(70); columns[2].setWidth(70);
- * tree.setSize(area.width, area.height); } else { // table is getting bigger so make the table //
- * bigger first and then make the columns wider // to match the client area width
- * tree.setSize(area.width, area.height); columns[0].setWidth(width-140);
- * columns[1].setWidth(70); columns[2].setWidth(70); } } });
- */
-
- aeConfigViewer = new TreeViewer(tree);
- // AEConfigContentProvider_V1 contentProvider = new AEConfigContentProvider_V1();
- // AEConfigLabelProvider_V0 labelProvider = new AEConfigLabelProvider_V0();
- DDTreeContentProvider contentProvider = new DDTreeContentProvider();
- DDTreeLabelProvider labelProvider = new DDTreeLabelProvider();
- aeConfigViewer.setContentProvider(contentProvider);
- aeConfigViewer.setLabelProvider(labelProvider);
- aeConfigViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection != null && selection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() > 0) {
- // Trace.err(ssel.getFirstElement().getClass().getName());
- }
- }
- managedForm.fireSelectionChanged(spart, event.getSelection());
- }
- });
-
- AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
- aeConfigViewer, true);
- AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
- aeConfigViewer, false);
-
-// ImageHyperlink info = new ImageHyperlink(sectionToolbarComposite, SWT.NULL);
-// toolkit.adapt(info, true, true);
-// info.setImage(ImageLoader.getInstance().getImage(ImageLoader.ICON_UI_IDE_FILTER));
-// info.setToolTipText("Filters");
-// // info.setBackground(section.getTitleBarGradientBackground());
-// info.addHyperlinkListener(new HyperlinkAdapter() {
-// public void linkActivated(HyperlinkEvent e) {
-// String[] ids = new String[0];
-// FilterDialog dialog = new FilterDialog(aeConfigViewer.getControl().getShell(), ids);
-// if (dialog.open() == Window.OK) {
-//
-// }
-//
-// }
-// });
-
- ///////////////////////////////////////////////////////////////////////////
-
- HoverManager hover = new HoverManager(aeConfigViewer, getPresenterControlCreator("commandId"));
- hover.install(aeConfigViewer.getTree());
-
- if (aeDD != null) {
- aeConfigViewer.setInput(aeDD);
- }
-
- return section;
- } // createDelegatesConfigSection
-
- private IInformationControlCreator getPresenterControlCreator(final String commandId) {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- int shellStyle = SWT.RESIZE;
- int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
- return new DDEInformationControl(parent, SWT.TOOL | SWT.NO_TRIM, 0);
- // DefaultInformationControl(parent, null);
- }
- };
- }
-
- private void createButtons(Composite parent, FormToolkit toolkit) {
- Composite buttonContainer = toolkit.createComposite(parent);
- GridData gd = new GridData(GridData.FILL_VERTICAL);
- buttonContainer.setLayoutData(gd);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonContainer.setLayout(layout);
- toolkit.paintBordersFor(buttonContainer);
-
- createVerticalSpace(toolkit, buttonContainer, 1, 24);
- createButton(toolkit, buttonContainer, "Add...", 1);
- createButton(toolkit, buttonContainer, "Remove", 2);
-
- }
-
- protected Button createButton(FormToolkit toolkit, Composite parent, String label, int index) {
- Button button;
- if (toolkit != null)
- button = toolkit.createButton(parent, label, SWT.PUSH);
- else {
- button = new Button(parent, SWT.PUSH);
- button.setText(label);
- }
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- button.setLayoutData(gd);
- // button.setData(new Integer(index));
- button.setData(Integer.valueOf(index));
- return button;
- }
-
- protected Label createVerticalSpace(FormToolkit toolkit, Composite parent, int span, int spacing) {
- Label label;
- if (toolkit != null) {
- label = toolkit.createLabel(parent, null);
- } else {
- label = new Label(parent, SWT.NULL);
- }
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- gd.verticalIndent = spacing;
- gd.horizontalSpan = span;
- gd.widthHint = 0;
- gd.heightHint = 0;
- label.setLayoutData(gd);
- return label;
- }
-
- /** ********************************************************************** */
-
- private void selectFirstElement() {
- Tree tree = aeConfigViewer.getTree();
- TreeItem[] items = tree.getItems();
- if (items.length == 0) {
- // Tree is EMPTY
- detailsPart.selectionChanged(spart, new StructuredSelection(aeConfigViewer));
- return;
- }
- TreeItem firstItem = items[0];
- Object obj = firstItem.getData();
- aeConfigViewer.setSelection(new StructuredSelection(obj));
- }
-
- void fireSelection() {
- aeConfigViewer.setSelection(aeConfigViewer.getSelection());
- }
-
-// public void handleEvent(Event event) {
-// if (event.type == SWT.MouseHover) {
-// handleHover(event);
-// }
-// }
-/*
- // From CDE
- public void handleHover(Event event) {
- Tree tree = aeConfigViewer.getTree();
- // next getItem call requires that table have SWT.FULL_SELECTION Style
- TreeItem item = tree.getItem(new Point(event.x, event.y));
- if (null != item) {
- Object o = item.getData();
- if (null == o)
- throw new InternalErrorCDE("invalid state");
-
- if (o instanceof AEDeploymentMetaData) {
- setToolTipText(tree, "AEDeploymentMetaData");
- } else if (o instanceof FeatureDescription) {
- }
- } else
- tree.setToolTipText("");
- }
-
- public static void setToolTipText(Control w, String text) {
- if (null != text)
- w.setToolTipText(parseToFitInToolTips(text));
- }
-
- // tool tips seem to require no blanks following /n on Windows.
- protected static String parseToFitInToolTips(String text) {
- if (null == text)
- return "";
- StringBuffer buffer = new StringBuffer();
- final int MAGIC_LENGTH = 65;
- StringTokenizer tokenizer = new StringTokenizer(text);
- int lengthAccumulator = 0;
- while (tokenizer.hasMoreTokens()) {
- if (lengthAccumulator > 0) {
- buffer.append(' ');
- }
- String nextToken = tokenizer.nextToken();
- buffer.append(nextToken);
- lengthAccumulator += (nextToken.length() + 1);
- if (lengthAccumulator > MAGIC_LENGTH && tokenizer.hasMoreTokens()) {
- // this is to avoid a final blank line
- buffer.append("\n"); //$NON-NLS-1$
- lengthAccumulator = 0;
- }
- }
- return new String(buffer);
- }
-*/
-}
+package org.apache.uima.dde.internal.page;
+
+import org.apache.uima.aae.deployment.AEDeploymentDescription;
+import org.apache.uima.dde.internal.DeploymentDescriptorEditor;
+import org.apache.uima.dde.internal.Messages;
+import org.apache.uima.dde.internal.details.DetailsPageProvider;
+import org.apache.uima.dde.internal.hover.HoverManager;
+import org.apache.uima.dde.internal.hover.DDEInformationControl;
+import org.apache.uima.dde.internal.provider.DDTreeContentProvider;
+import org.apache.uima.dde.internal.provider.DDTreeLabelProvider;
+import org.apache.uima.taeconfigurator.TAEConfiguratorPlugin;
+import org.apache.uima.tools.internal.ui.forms.FormSection;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.forms.DetailsPart;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.MasterDetailsBlock;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+
+
+public class MasterDetails extends MasterDetailsBlock { // implements Listener {
+
+ private AEDeploymentDescription aeDD;
+
+ private TreeViewer aeConfigViewer;
+
+ private DeploymentDescriptorEditor multiPageEditor;
+
+ private IManagedForm managedForm = null;
+
+ private ScrolledForm form;
+
+ public MasterDetails(DeploymentDescriptorEditor editor, IManagedForm managedForm,
+ IWorkbenchPartSite workbenchPartSite) {
+ multiPageEditor = editor;
+ this.managedForm = managedForm;
+ this.form = managedForm.getForm();
+// _workbenchPartSite = workbenchPartSite;
+ aeDD = multiPageEditor.getAEDeploymentDescription();
+ }
+
+ public void refresh() {
+ TreeItem selectedItem = null;
+ TreeItem[] selection = aeConfigViewer.getTree().getSelection();
+ if (selection.length > 0) {
+ selectedItem = selection[0];
+ } else {
+ selectFirstElement();
+ }
+ aeConfigViewer.getTree().setRedraw(false);
+ aeConfigViewer.refresh();
+ if (selectedItem != null) {
+ // Restore selection
+ aeConfigViewer.setSelection(new StructuredSelection(selectedItem.getData()));
+ selection = aeConfigViewer.getTree().getSelection();
+ if (selection != null) {
+ selection[0].setExpanded(true);
+ }
+ aeConfigViewer.refresh();
+ }
+ aeConfigViewer.getTree().setRedraw(true);
+ }
+
+ public void setInput(Object input) {
+ if (input instanceof AEDeploymentDescription) {
+ aeDD = (AEDeploymentDescription) input;
+ aeConfigViewer.setInput(aeDD);
+ refresh();
+ }
+ }
+
+ public void init() {
+ selectFirstElement();
+ }
+
+ @Override
+ protected void createMasterPart(IManagedForm managedForm, Composite parentSashForm) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ Composite body = managedForm.getForm().getBody();
+ body.setLayout(new GridLayout(1, false)); // this is required !
+ toolkit.paintBordersFor(body);
+
+ ScrolledForm form = managedForm.getForm();
+ FormColors colors = toolkit.getColors();
+ colors.initializeSectionToolBarColors();
+ Color gbg = colors.getColor(FormColors.TB_GBG);
+ Color bg = colors.getBackground();
+ form.getForm().setTextBackground(new Color[] { bg, gbg }, new int[] { 100 }, true);
+ // form.getForm().setSeparatorVisible(true);
+
+ createAEConfigSection(parentSashForm, toolkit);
+
+ sashForm.setBackground(sashForm.getDisplay().getSystemColor(SWT.COLOR_GRAY));
+ }
+
+ @Override
+ protected void createToolBarActions(IManagedForm managedForm) {
+ final ScrolledForm form = managedForm.getForm();
+
+ Action haction = new Action("hor", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
+ public void run() {
+ sashForm.setOrientation(SWT.HORIZONTAL);
+ form.reflow(true);
+ }
+ };
+ haction.setChecked(true);
+ haction.setToolTipText("Horizontal Orientation");
+ haction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
+ haction.setDisabledImageDescriptor(TAEConfiguratorPlugin
+ .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_HORIZONTAL));
+
+ Action vaction = new Action("ver", Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
+ public void run() {
+ sashForm.setOrientation(SWT.VERTICAL);
+ form.reflow(true);
+ }
+ };
+ vaction.setChecked(false);
+ vaction.setToolTipText("Vertical Orientation");
+ vaction.setImageDescriptor(TAEConfiguratorPlugin.getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
+ vaction.setDisabledImageDescriptor(TAEConfiguratorPlugin
+ .getImageDescriptor(TAEConfiguratorPlugin.IMAGE_TH_VERTICAL));
+ form.getToolBarManager().add(haction);
+ form.getToolBarManager().add(vaction);
+ form.updateToolBar();
+ }
+
+ @Override
+ protected void registerPages(DetailsPart detailsPart) {
+ detailsPart.setPageLimit(10);
+ // register static page for the extensions
+ // detailsPart.registerPage(AEDeploymentMetaData_Impl.class, new
+ // AEMetaDataDetailsPage_V1(managedForm));
+ // detailsPart.registerPage(RemoteAEDeploymentMetaData_Impl.class, new
+ // RemoteAEMetaDataDetails_V1(managedForm));
+ // detailsPart.registerPage(AsyncAggregateErrorConfiguration_Impl.class, new
+ // AsyncAEErrorConfigDetailsPage_V0(managedForm));
+ // detailsPart.registerPage(AsyncPrimitiveErrorConfiguration_Impl.class, new
+ // AsyncAEErrorConfigDetailsPage_V0(managedForm));
+
+ // register a dynamic provider for elements
+ detailsPart.setPageProvider(new DetailsPageProvider(multiPageEditor, managedForm, this, detailsPart));
+ }
+
+ /** ********************************************************************** */
+ private SectionPart spart;
+
+ private Section createAEConfigSection(Composite parent, FormToolkit toolkit) {
+ TableWrapData td;
+
+ Section section = FormSection.createGridDataSection(toolkit, parent, SWT.NONE,
+ Messages.DDE_AEConfigPage_AEConfigTree_Section_Title,
+ Messages.DDE_AEConfigPage_AEConfigTree_Section_Description, 10, 10, GridData.FILL_BOTH
+ | GridData.VERTICAL_ALIGN_BEGINNING, 1, 1);
+ section.clientVerticalSpacing = 10;
+ section.setExpanded(true);
+ section.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+ spart = new SectionPart(section);
+ managedForm.addPart(spart);
+
+ // Create ToolBar
+ Composite sectionToolbarComposite = FormSection.createGridLayoutContainer(toolkit, section, 4,
+ 0, 0);
+ section.setTextClient(sectionToolbarComposite);
+ toolkit.createCompositeSeparator(section);
+
+ // //////////////////
+
+ Composite sectionClient = toolkit.createComposite(section);
+ section.setClient(sectionClient);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ sectionClient.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ sectionClient.setLayoutData(gd);
+ toolkit.paintBordersFor(sectionClient);
+
+ // /////////////////////////////////////////////////////////////////////
+
+ final Tree tree = toolkit.createTree(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.grabExcessVerticalSpace = true;
+ tree.setLayoutData(gd);
+ tree.setLinesVisible(true);
+ tree.setHeaderVisible(true);
+ String headers[] = { "Element", "Remote", "Instances" };
+ final TreeColumn columns[] = new TreeColumn[headers.length];
+ for (int i = 0; i < headers.length; i++) {
+ int style;
+ if (i==0) {
+ style = SWT.NONE;
+ } else {
+ style = SWT.CENTER;
+ }
+ TreeColumn tc = new TreeColumn(tree, style, i);
+ tc.setResizable(true);
+ tc.setText(headers[i]);
+ if (i == 0) {
+ tc.setWidth(200);
+ // } else {
+ // tc.setWidth(100);
+ }
+ columns[i] = tc;
+ if (i == 1 || i == 2) {
+ tc.pack();
+ // Trace.err("pack: " + tc.getWidth());
+ }
+ }
+ // tree.addListener(SWT.MouseHover, this);
+ tree.addControlListener(new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ // int width = tree.getSize().x;
+ // ScrollBar vBar = tree.getVerticalBar();
+ // if (vBar.isEnabled()) {
+ // // Trace.err("vBar.getSize().x: " + vBar.getSize().x);
+ // width -= vBar.getSize().x/2;
+ // } else {
+ // Trace.err("NO vBar");
+ // }
+ // width = width - tree.computeTrim(0,0,0,0).width ;
+ // columns[0].setWidth(width-140);
+ // columns[1].setWidth(70);
+ // columns[2].setWidth(70);
+ }
+ });
+ /*
+ * sectionClient.addControlListener(new ControlAdapter() { public void
+ * controlResized(ControlEvent e) { Rectangle area = sectionClient.getClientArea(); Point size =
+ * tree.computeSize(SWT.DEFAULT, SWT.DEFAULT); ScrollBar vBar = tree.getVerticalBar(); //
+ * Trace.err("vBar.getSize().x: " + vBar.getSize().x); int width = area.width -
+ * tree.computeTrim(0,0,0,0).width - vBar.getSize().x; if (size.y > area.height +
+ * tree.getHeaderHeight()) { // Subtract the scrollbar width from the total column width // if a
+ * vertical scrollbar will be required Point vBarSize = vBar.getSize(); width -= vBarSize.x; }
+ * Point oldSize = tree.getSize(); if (oldSize.x > area.width) { // table is getting smaller so
+ * make the columns // smaller first and then resize the table to // match the client area width
+ * columns[0].setWidth(width-140); columns[1].setWidth(70); columns[2].setWidth(70);
+ * tree.setSize(area.width, area.height); } else { // table is getting bigger so make the table //
+ * bigger first and then make the columns wider // to match the client area width
+ * tree.setSize(area.width, area.height); columns[0].setWidth(width-140);
+ * columns[1].setWidth(70); columns[2].setWidth(70); } } });
+ */
+
+ aeConfigViewer = new TreeViewer(tree);
+ // AEConfigContentProvider_V1 contentProvider = new AEConfigContentProvider_V1();
+ // AEConfigLabelProvider_V0 labelProvider = new AEConfigLabelProvider_V0();
+ DDTreeContentProvider contentProvider = new DDTreeContentProvider();
+ DDTreeLabelProvider labelProvider = new DDTreeLabelProvider();
+ aeConfigViewer.setContentProvider(contentProvider);
+ aeConfigViewer.setLabelProvider(labelProvider);
+ aeConfigViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection != null && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() > 0) {
+ // Trace.err(ssel.getFirstElement().getClass().getName());
+ }
+ }
+ managedForm.fireSelectionChanged(spart, event.getSelection());
+ }
+ });
+
+ AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
+ aeConfigViewer, true);
+ AbstractHeaderPage.createExpandOrCollapseAllMenu(toolkit, section, sectionToolbarComposite,
+ aeConfigViewer, false);
+
+// ImageHyperlink info = new ImageHyperlink(sectionToolbarComposite, SWT.NULL);
+// toolkit.adapt(info, true, true);
+// info.setImage(ImageLoader.getInstance().getImage(ImageLoader.ICON_UI_IDE_FILTER));
+// info.setToolTipText("Filters");
+// // info.setBackground(section.getTitleBarGradientBackground());
+// info.addHyperlinkListener(new HyperlinkAdapter() {
+// public void linkActivated(HyperlinkEvent e) {
+// String[] ids = new String[0];
+// FilterDialog dialog = new FilterDialog(aeConfigViewer.getControl().getShell(), ids);
+// if (dialog.open() == Window.OK) {
+//
+// }
+//
+// }
+// });
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ HoverManager hover = new HoverManager(aeConfigViewer, getPresenterControlCreator("commandId"));
+ hover.install(aeConfigViewer.getTree());
+
+ if (aeDD != null) {
+ aeConfigViewer.setInput(aeDD);
+ }
+
+ return section;
+ } // createDelegatesConfigSection
+
+ private IInformationControlCreator getPresenterControlCreator(final String commandId) {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ int shellStyle = SWT.RESIZE;
+ int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
+ return new DDEInformationControl(parent, SWT.TOOL | SWT.NO_TRIM, 0);
+ // DefaultInformationControl(parent, null);
+ }
+ };
+ }
+
+ private void createButtons(Composite parent, FormToolkit toolkit) {
+ Composite buttonContainer = toolkit.createComposite(parent);
+ GridData gd = new GridData(GridData.FILL_VERTICAL);
+ buttonContainer.setLayoutData(gd);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ buttonContainer.setLayout(layout);
+ toolkit.paintBordersFor(buttonContainer);
+
+ createVerticalSpace(toolkit, buttonContainer, 1, 24);
+ createButton(toolkit, buttonContainer, "Add...", 1);
+ createButton(toolkit, buttonContainer, "Remove", 2);
+
+ }
+
+ protected Button createButton(FormToolkit toolkit, Composite parent, String label, int index) {
+ Button button;
+ if (toolkit != null)
+ button = toolkit.createButton(parent, label, SWT.PUSH);
+ else {
+ button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+ }
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ button.setLayoutData(gd);
+ // button.setData(new Integer(index));
+ button.setData(Integer.valueOf(index));
+ return button;
+ }
+
+ protected Label createVerticalSpace(FormToolkit toolkit, Composite parent, int span, int spacing) {
+ Label label;
+ if (toolkit != null) {
+ label = toolkit.createLabel(parent, null);
+ } else {
+ label = new Label(parent, SWT.NULL);
+ }
+ GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ gd.verticalIndent = spacing;
+ gd.horizontalSpan = span;
+ gd.widthHint = 0;
+ gd.heightHint = 0;
+ label.setLayoutData(gd);
+ return label;
+ }
+
+ /** ********************************************************************** */
+
+ private void selectFirstElement() {
+ Tree tree = aeConfigViewer.getTree();
+ TreeItem[] items = tree.getItems();
+ if (items.length == 0) {
+ // Tree is EMPTY
+ detailsPart.selectionChanged(spart, new StructuredSelection(aeConfigViewer));
+ return;
+ }
+ TreeItem firstItem = items[0];
+ Object obj = firstItem.getData();
+ aeConfigViewer.setSelection(new StructuredSelection(obj));
+ }
+
+ void fireSelection() {
+ aeConfigViewer.setSelection(aeConfigViewer.getSelection());
+ }
+
+// public void handleEvent(Event event) {
+// if (event.type == SWT.MouseHover) {
+// handleHover(event);
+// }
+// }
+/*
+ // From CDE
+ public void handleHover(Event event) {
+ Tree tree = aeConfigViewer.getTree();
+ // next getItem call requires that table have SWT.FULL_SELECTION Style
+ TreeItem item = tree.getItem(new Point(event.x, event.y));
+ if (null != item) {
+ Object o = item.getData();
+ if (null == o)
+ throw new InternalErrorCDE("invalid state");
+
+ if (o instanceof AEDeploymentMetaData) {
+ setToolTipText(tree, "AEDeploymentMetaData");
+ } else if (o instanceof FeatureDescription) {
+ }
+ } else
+ tree.setToolTipText("");
+ }
+
+ public static void setToolTipText(Control w, String text) {
+ if (null != text)
+ w.setToolTipText(parseToFitInToolTips(text));
+ }
+
+ // tool tips seem to require no blanks following /n on Windows.
+ protected static String parseToFitInToolTips(String text) {
+ if (null == text)
+ return "";
+ StringBuffer buffer = new StringBuffer();
+ final int MAGIC_LENGTH = 65;
+ StringTokenizer tokenizer = new StringTokenizer(text);
+ int lengthAccumulator = 0;
+ while (tokenizer.hasMoreTokens()) {
+ if (lengthAccumulator > 0) {
+ buffer.append(' ');
+ }
+ String nextToken = tokenizer.nextToken();
+ buffer.append(nextToken);
+ lengthAccumulator += (nextToken.length() + 1);
+ if (lengthAccumulator > MAGIC_LENGTH && tokenizer.hasMoreTokens()) {
+ // this is to avoid a final blank line
+ buffer.append("\n"); //$NON-NLS-1$
+ lengthAccumulator = 0;
+ }
+ }
+ return new String(buffer);
+ }
+*/
+}
Propchange: incubator/uima/sandbox/trunk/uima-ee/uimaj-ep-deployeditor/src/main/java/org/apache/uima/dde/internal/page/MasterDetails.java
------------------------------------------------------------------------------
svn:eol-style = native