diff options
author | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-04-11 15:30:43 -0400 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-04-11 15:30:43 -0400 |
commit | ee4f0bb6b23599d83c79fb3b20fab9ba5aea3678 (patch) | |
tree | d194662c5a14f43000c5178883b755a5a60d93b3 | |
parent | 61d3fcafc6913ab75f5e11bcd4fbea9e08995c42 (diff) | |
download | eclipse.platform.swt-ee4f0bb6b23599d83c79fb3b20fab9ba5aea3678.tar.gz eclipse.platform.swt-ee4f0bb6b23599d83c79fb3b20fab9ba5aea3678.tar.xz eclipse.platform.swt-ee4f0bb6b23599d83c79fb3b20fab9ba5aea3678.zip |
Convert all files with CRLF and CR to LF
19 files changed, 2613 insertions, 2450 deletions
diff --git a/bundles/org.eclipse.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.swt/.settings/org.eclipse.jdt.core.prefs index b0cfbaec03..887df88193 100644 --- a/bundles/org.eclipse.swt/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.swt/.settings/org.eclipse.jdt.core.prefs @@ -1,22 +1,22 @@ -eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.source=1.3
+eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeCursor.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeCursor.java index a15f4041c9..8c01ac4934 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeCursor.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/TreeCursor.java @@ -1,963 +1,963 @@ -/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.custom;
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.accessibility.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A TreeCursor provides a way for the user to navigate around a Tree with columns using the
- * keyboard. It also provides a mechanism for selecting an individual cell in a tree.
- * <p>
- * For a detailed example of using a TreeCursor to navigate to a cell and then edit it see
- * http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java .
- *
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection, DefaultSelection</dd>
- * </dl>
- *
- * @since 3.8
- */
-public class TreeCursor extends Canvas {
- Tree tree;
- TreeItem row;
- TreeColumn column;
- Listener listener, treeListener, resizeListener, disposeItemListener, disposeColumnListener;
-
- Color background = null;
- Color foreground = null;
-
- /* By default, invert the list selection colors */
- static final int BACKGROUND = SWT.COLOR_LIST_SELECTION_TEXT;
- static final int FOREGROUND = SWT.COLOR_LIST_SELECTION;
-
-/**
- * Constructs a new instance of this class given its parent tree and a style value describing
- * its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in class <code>SWT</code> which
- * is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing
- * together (that is, using the <code>int</code> "|" operator) two or more of those
- * <code>SWT</code> style constants. The class description lists the style constants that are
- * applicable to the class. Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a Tree control which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- *
- * @see SWT#BORDER
- * @see Widget#checkSubclass()
- * @see Widget#getStyle()
- */
-public TreeCursor(Tree parent, int style) {
- super(parent, style);
- tree = parent;
- setBackground(null);
- setForeground(null);
-
- listener = new Listener() {
- public void handleEvent(Event event) {
- if (row != null) {
- /*
- * Detect cases where the cursor position has become invalid and fix it.
- * The typical cause of this is programmatic tree changes, such as
- * expanding/collapsing and item and creating/disposing items.
- */
- if (row.isDisposed()) {
- unhookRowColumnListeners();
- _resize();
- tree.setFocus();
- return;
- }
- TreeItem current = row;
- TreeItem parentItem = row.getParentItem();
- while (parentItem != null && !parentItem.getExpanded()) {
- current = parentItem;
- parentItem = current.getParentItem();
- }
- if (current != row) {
- setRowColumn(current, column, false);
- }
- }
- switch (event.type) {
- case SWT.Dispose:
- onDispose(event);
- break;
- case SWT.FocusIn:
- case SWT.FocusOut:
- redraw();
- break;
- case SWT.KeyDown:
- keyDown(event);
- break;
- case SWT.Paint:
- paint(event);
- break;
- case SWT.Traverse:
- event.doit = true;
- switch (event.detail) {
- case SWT.TRAVERSE_ARROW_NEXT:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_RETURN:
- event.doit = false;
- break;
- }
- break;
- }
- }
- };
- int[] events = new int[] { SWT.Dispose, SWT.FocusIn, SWT.FocusOut, SWT.KeyDown, SWT.Paint, SWT.Traverse };
- for (int i = 0; i < events.length; i++) {
- addListener(events[i], listener);
- }
-
- treeListener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Collapse:
- treeCollapse(event);
- break;
- case SWT.Expand:
- treeExpand(event);
- break;
- case SWT.FocusIn:
- treeFocusIn(event);
- break;
- case SWT.MouseDown:
- treeMouseDown(event);
- break;
- }
- }
- };
- tree.addListener(SWT.Collapse, treeListener);
- tree.addListener(SWT.Expand, treeListener);
- tree.addListener(SWT.FocusIn, treeListener);
- tree.addListener(SWT.MouseDown, treeListener);
-
- disposeItemListener = new Listener() {
- public void handleEvent(Event event) {
- TreeItem currentItem = row;
- while (currentItem != null) {
- currentItem.removeListener(SWT.Dispose, disposeItemListener);
- currentItem = currentItem.getParentItem();
- }
- TreeItem disposedItem = (TreeItem)event.widget;
- TreeItem parentItem = disposedItem.getParentItem();
- if (parentItem != null) {
- setRowColumn(parentItem, column, true);
- } else {
- if (tree.getItemCount() == 1) {
- unhookRowColumnListeners();
- } else {
- TreeItem newFocus = null;
- int rowIndex = tree.indexOf(disposedItem);
- if (rowIndex != 0) {
- TreeItem previousItem = tree.getItem(rowIndex - 1);
- if (!previousItem.isDisposed()) {
- newFocus = previousItem;
- }
- }
- if (newFocus == null && rowIndex + 1 < tree.getItemCount()) {
- TreeItem nextItem = tree.getItem(rowIndex + 1);
- if (!nextItem.isDisposed()) {
- newFocus = nextItem;
- }
- }
- if (newFocus != null) {
- setRowColumn(newFocus, column, true);
- } else {
- unhookRowColumnListeners();
- }
- }
- }
- _resize();
- }
- };
- disposeColumnListener = new Listener() {
- public void handleEvent(Event event) {
- if (column != null) {
- if (tree.getColumnCount() == 1) {
- column = null;
- } else {
- int columnIndex = tree.indexOf(column);
- int positionIndex = columnIndex;
- int[] columnOrder = tree.getColumnOrder();
- for (int i = 0; i < columnOrder.length; i++) {
- if (columnOrder[i] == columnIndex) {
- positionIndex = i;
- break;
- }
- }
- if (positionIndex == columnOrder.length - 1) {
- setRowColumn(row, tree.getColumn(columnOrder[positionIndex - 1]), true);
- } else {
- setRowColumn(row, tree.getColumn(columnOrder[positionIndex + 1]), true);
- }
- }
- }
- _resize();
- }
- };
- resizeListener = new Listener() {
- public void handleEvent(Event event) {
- _resize();
- }
- };
- ScrollBar hBar = tree.getHorizontalBar();
- if (hBar != null) {
- hBar.addListener(SWT.Selection, resizeListener);
- }
- ScrollBar vBar = tree.getVerticalBar();
- if (vBar != null) {
- vBar.addListener(SWT.Selection, resizeListener);
- }
-
- getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
- public void getRole(AccessibleControlEvent e) {
- e.detail = ACC.ROLE_TABLECELL;
- }
- });
- getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- if (row == null) return;
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- e.result = row.getText(columnIndex);
- }
- });
-}
-
-/**
- * Adds the listener to the collection of listeners who will be notified when the receiver's
- * selection changes, by sending it one of the messages defined in the
- * <code>SelectionListener</code> interface.
- * <p>
- * When <code>widgetSelected</code> is called, the item field of the event object is valid. If
- * the receiver has <code>SWT.CHECK</code> style set and the check selection changes, the event
- * object detail field contains the value <code>SWT.CHECK</code>.
- * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see SelectionEvent
- * @see #removeSelectionListener(SelectionListener)
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
-}
-
-int countSubTreePages(TreeItem root) {
- int pages = 1;
- if (root == null) return 0;
- if (root.getItemCount() == 0) return 1;
- if (!root.getExpanded()) return 1;
- TreeItem[] items = root.getItems();
- for (int i = 0; i < items.length; i++) {
- pages += countSubTreePages(items[i]);
- }
- return pages;
-}
-
-int findIndex(TreeItem[] items, TreeItem treeItem) {
- if (items == null || treeItem == null) return -1;
- Rectangle rect = treeItem.getBounds();
- int index = 0;
- for (int i = 0; i < items.length; i++) {
- TreeItem previousItem = null;
- TreeItem currentItem = items[i];
- if (i > 0) previousItem = items[i - 1];
- Rectangle rect1 = currentItem.getBounds();
- if (rect.y == rect1.y) return index;
- if (rect.y < rect1.y) {
- return index - 1 + findIndex(previousItem.getItems(), treeItem);
- }
- if (rect.y > rect1.y && i == items.length - 1) {
- return index + findIndex(currentItem.getItems(), treeItem);
- }
- if (rect.y >= rect1.y + (1 + currentItem.getItemCount()) * tree.getItemHeight() && currentItem.getExpanded()) {
- index += countSubTreePages(currentItem);
- continue;
- }
- index++;
- }
- return -1;
-}
-
-TreeItem findItem(TreeItem[] items, Point pt) {
- int start = 0, end = items.length - 1;
- int index = end / 2;
- while (end - start > 1) {
- TreeItem currentItem = items[index];
- Rectangle bounds = currentItem.getBounds();
- if (pt.y < bounds.y) {
- end = index;
- index = (end - start) / 2;
- } else {
- start = index;
- index = start + ((end - start) / 2);
- }
- }
-
- Rectangle endBounds = items[end].getBounds();
- if (endBounds.y < pt.y) {
- if (endBounds.y + endBounds.height < pt.y) {
- if (!items[end].getExpanded()) return null;
- return findItem(items[end].getItems(), pt);
- }
- int[] columnOrder = tree.getColumnOrder();
- Rectangle bounds = null;
- if (columnOrder.length > 0) {
- Rectangle rect1 = items[end].getBounds(columnOrder[0]);
- Rectangle rect2 = items[end].getBounds(columnOrder[columnOrder.length - 1]);
- bounds = rect1.union(rect2);
- bounds.height += tree.getLinesVisible() ? tree.getGridLineWidth() : 0;
- } else {
- bounds = items[end].getBounds();
- }
- return bounds.contains(pt) ? items[end] : null;
- }
-
- Rectangle startBounds = items[start].getBounds();
- if (startBounds.y + startBounds.height < pt.y) {
- return findItem(items[start].getItems(), pt);
- }
- int[] columnOrder = tree.getColumnOrder();
- Rectangle bounds = null;
- if (columnOrder.length > 0) {
- Rectangle rect1 = items[start].getBounds(columnOrder[0]);
- Rectangle rect2 = items[start].getBounds(columnOrder[columnOrder.length - 1]);
- bounds = rect1.union(rect2);
- bounds.height += tree.getLinesVisible() ? tree.getGridLineWidth() : 0;
- } else {
- bounds = items[start].getBounds();
- }
- return bounds.contains(pt) ? items[start] : null;
-}
-
-/**
- * Returns the background color that the receiver will use to draw.
- *
- * @return the receiver's background color
- */
-public Color getBackground() {
- checkWidget();
- if (background == null) {
- return getDisplay().getSystemColor(BACKGROUND);
- }
- return background;
-}
-
-/**
- * Returns the index of the column over which the TreeCursor is positioned.
- *
- * @return the column index for the current position
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getColumn() {
- checkWidget();
- return column == null ? 0 : tree.indexOf(column);
-}
-
-/**
- * Returns the foreground color that the receiver will use to draw.
- *
- * @return the receiver's foreground color
- */
-public Color getForeground() {
- checkWidget();
- if (foreground == null) {
- return getDisplay().getSystemColor(FOREGROUND);
- }
- return foreground;
-}
-
-TreeItem getLastVisibleItem(TreeItem[] items) {
- if (items == null) return null;
- TreeItem last = items[items.length - 1];
- if (last.getExpanded() && last.getItemCount() > 0) {
- return getLastVisibleItem(last.getItems());
- }
- return last;
-}
-
-TreeItem getNextItem(TreeItem item) {
- if (item == null) return null;
- if (item.getExpanded() && item.getItemCount() > 0) {
- return item.getItem(0);
- }
-
- TreeItem parentItem = item.getParentItem();
- while (parentItem != null) {
- int index = parentItem.indexOf(item);
- if (index == -1) return null;
- if (index < parentItem.getItemCount() - 1) {
- return parentItem.getItem(index + 1);
- }
- item = parentItem;
- parentItem = item.getParentItem();
- }
- int index = tree.indexOf(item);
- if (index == -1) return null;
- if (index == tree.getItemCount() - 1) return null;
- return tree.getItem(index + 1);
-}
-
-TreeItem getPreviousItem(TreeItem item) {
- if (item == null) return null;
- TreeItem parentItem = item.getParentItem();
- if (parentItem == null) {
- int index = tree.indexOf(item);
- if (index == -1 || index == 0) return null;
- item = tree.getItem(index - 1);
- if (item.getExpanded() && item.getItemCount() > 0) {
- return getLastVisibleItem(item.getItems());
- }
- return item;
- }
- int index = parentItem.indexOf(item);
- if (index == -1) return null;
- if (index == 0) return parentItem;
- item = parentItem.getItem(index - 1);
- if (item.getExpanded() && item.getItemCount() > 0) {
- return getLastVisibleItem(item.getItems());
- }
- return item;
-}
-
-/**
- * Returns the row over which the TreeCursor is positioned.
- *
- * @return the item for the current position, or <code>null</code> if none
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public TreeItem getRow() {
- checkWidget();
- return row;
-}
-
-void keyDown(Event event) {
- if (row == null) return;
- switch (event.character) {
- case SWT.CR:
- notifyListeners(SWT.DefaultSelection, new Event());
- return;
- }
- switch (event.keyCode) {
- case SWT.ARROW_UP:
- TreeItem previousItem = getPreviousItem(row);
- if (previousItem != null) {
- setRowColumn(previousItem, column, true);
- }
- break;
- case SWT.ARROW_DOWN:
- TreeItem nextItem = getNextItem(row);
- if (nextItem != null) {
- setRowColumn(nextItem, column, true);
- }
- break;
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT: {
- if ((event.stateMask & SWT.MOD1) != 0) {
- row.setExpanded (event.keyCode == SWT.ARROW_RIGHT);
- break;
- }
- int columnCount = tree.getColumnCount();
- if (columnCount == 0) break;
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- int[] columnOrder = tree.getColumnOrder();
- int index = 0;
- while (index < columnOrder.length) {
- if (columnOrder[index] == columnIndex) break;
- index++;
- }
- if (index == columnOrder.length) index = 0;
- int leadKey = (getStyle() & SWT.RIGHT_TO_LEFT) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT;
- TreeItem parentRow = row.getParentItem();
- int rowIndex = tree.indexOf(row);
- if (event.keyCode == leadKey) {
- if (parentRow != null) {
- setRowColumn(row, tree.getColumn(columnOrder[Math.max(0, index - 1)]), true);
- } else {
- setRowColumn(rowIndex, columnOrder[Math.max(0, index - 1)], true);
- }
- } else {
- if (parentRow != null) {
- setRowColumn(row, tree.getColumn(columnOrder[Math.min(columnCount - 1, index + 1)]), true);
- } else {
- setRowColumn(rowIndex, columnOrder[Math.min(columnCount - 1, index + 1)], true);
- }
- }
- break;
- }
- case SWT.HOME:
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- setRowColumn(0, columnIndex, true);
- break;
- case SWT.END: {
- TreeItem[] items = tree.getItems();
- setRowColumn(getLastVisibleItem(items), column, true);
- break;
- }
- case SWT.PAGE_UP: {
- Rectangle rect = tree.getClientArea();
- Rectangle itemRect = tree.getTopItem().getBounds();
- TreeItem item = row;
- int index = findIndex(tree.getItems(), item);
- int itemHeight = tree.getItemHeight();
- rect.height -= itemRect.y;
- int page = Math.max(1, rect.height / itemHeight);
- if (index - page <= 0) {
- TreeItem first = tree.getItem(0);
- setRowColumn(first, column, true);
- break;
- }
- for (int i = 0; i < page; i++) {
- item = getPreviousItem(item);
- }
- setRowColumn(item, column, true);
- break;
- }
- case SWT.PAGE_DOWN: {
- Rectangle rect = tree.getClientArea();
- Rectangle itemRect = tree.getTopItem().getBounds();
- TreeItem item = row;
- int index = findIndex(tree.getItems(), item);
- int height = tree.getItemHeight();
- rect.height -= itemRect.y;
- TreeItem last = getLastVisibleItem(tree.getItems());
- int page = Math.max(1, rect.height / height);
- int end = findIndex(tree.getItems(), last);
- if (end <= index + page) {
- setRowColumn(last, column, true);
- break;
- }
- for (int i = 0; i < page; i++) {
- item = getNextItem(item);
- }
- setRowColumn(item, column, true);
- break;
- }
- }
-}
-
-void onDispose(Event event) {
- removeListener(SWT.Dispose, listener);
- notifyListeners(SWT.Dispose, event);
- event.type = SWT.None;
-
- tree.removeListener(SWT.Collapse, treeListener);
- tree.removeListener(SWT.Expand, treeListener);
- tree.removeListener(SWT.FocusIn, treeListener);
- tree.removeListener(SWT.MouseDown, treeListener);
- unhookRowColumnListeners();
- ScrollBar hBar = tree.getHorizontalBar();
- if (hBar != null) {
- hBar.removeListener(SWT.Selection, resizeListener);
- }
- ScrollBar vBar = tree.getVerticalBar();
- if (vBar != null) {
- vBar.removeListener(SWT.Selection, resizeListener);
- }
-}
-
-void paint(Event event) {
- if (row == null) return;
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- int orderedIndex = columnIndex;
- int[] columnOrder = tree.getColumnOrder();
- for (int i = 0; i < columnOrder.length; i++) {
- if (columnOrder[i] == columnIndex) {
- orderedIndex = i;
- break;
- }
- }
- GC gc = event.gc;
- gc.setBackground(getBackground());
- gc.setForeground(getForeground());
- gc.fillRectangle(event.x, event.y, event.width, event.height);
- Image image = row.getImage(columnIndex);
- int x = 0;
- // Temporary code - need a better way to determine trim
- String platform = SWT.getPlatform();
- if (image != null) {
- if ("win32".equals(platform)) { //$NON-NLS-1$
- if (orderedIndex > 0) {
- x += 2;
- }
- } else {
- x += 2;
- }
- }
- Point size = getSize();
- if (image != null) {
- Rectangle imageSize = image.getBounds();
- int imageY = (size.y - imageSize.height) / 2;
- gc.drawImage(image, x, imageY);
- x += imageSize.width;
- }
- String text = row.getText(columnIndex);
- if (text.length() > 0) {
- Rectangle bounds = row.getBounds(columnIndex);
- Point extent = gc.stringExtent(text);
- // Temporary code - need a better way to determine trim
- if ("win32".equals(platform)) { //$NON-NLS-1$
- if (tree.getColumnCount() == 0 || orderedIndex == 0) {
- x += image == null ? 2 : 5;
- } else {
- int alignmnent = column.getAlignment();
- switch (alignmnent) {
- case SWT.LEFT:
- x += image == null ? 5 : 3;
- break;
- case SWT.RIGHT:
- x = bounds.width - extent.x - 2;
- break;
- case SWT.CENTER:
- x += Math.ceil((bounds.width - x - extent.x) / 2.0);
- break;
- }
- }
- } else {
- if (tree.getColumnCount() == 0) {
- x += image == null ? 4 : 3;
- } else {
- int alignmnent = column.getAlignment();
- switch (alignmnent) {
- case SWT.LEFT:
- x += image == null ? 5 : 3;
- break;
- case SWT.RIGHT:
- x = bounds.width - extent.x - 2;
- break;
- case SWT.CENTER:
- x += (bounds.width - x - extent.x) / 2 + 2;
- break;
- }
- }
- }
- int textY = (size.y - extent.y) / 2;
- gc.drawString(text, x, textY);
- }
- if (isFocusControl()) {
- Display display = getDisplay();
- gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.drawFocus(0, 0, size.x, size.y);
- }
-}
-
-/**
- * Removes the listener from the collection of listeners who will be notified when the
- * receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener(SelectionListener)
- */
-public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
-}
-
-void _resize() {
- if (row == null) {
- setBounds(-200, -200, 0, 0);
- } else {
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- setBounds(row.getBounds(columnIndex));
- }
-}
-
-/**
- * Sets the receiver's background color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- * <p>
- * Note: This operation is a hint and may be overridden by the platform.
- * For example, on Windows the background of a Button cannot be changed.
- * </p>
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setBackground (Color color) {
- background = color;
- super.setBackground(getBackground());
- redraw();
-}
-/**
- * Sets the receiver's foreground color to the color specified
- * by the argument, or to the default system color for the control
- * if the argument is null.
- * <p>
- * Note: This operation is a hint and may be overridden by the platform.
- * </p>
- * @param color the new color (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setForeground (Color color) {
- foreground = color;
- super.setForeground(getForeground());
- redraw();
-}
-
-void setRowColumn(int row, int column, boolean notify) {
- TreeItem item = row == -1 ? null : tree.getItem(row);
- TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column);
- setRowColumn(item, col, notify);
-}
-
-void setRowColumn(TreeItem row, TreeColumn column, boolean notify) {
- if (this.row != null && this.row != row) {
- TreeItem currentItem = this.row;
- while (currentItem != null) {
- currentItem.removeListener(SWT.Dispose, disposeItemListener);
- currentItem = currentItem.getParentItem();
- }
- this.row = null;
- }
- if (this.column != null && this.column != column) {
- this.column.removeListener(SWT.Dispose, disposeColumnListener);
- this.column.removeListener(SWT.Move, resizeListener);
- this.column.removeListener(SWT.Resize, resizeListener);
- this.column = null;
- }
- if (row != null) {
- if (this.row != row) {
- this.row = row;
- TreeItem currentItem = row;
- while (currentItem != null) {
- currentItem.addListener(SWT.Dispose, disposeItemListener);
- currentItem = currentItem.getParentItem();
- }
- tree.showItem(row);
- }
- if (this.column != column && column != null) {
- this.column = column;
- column.addListener(SWT.Dispose, disposeColumnListener);
- column.addListener(SWT.Move, resizeListener);
- column.addListener(SWT.Resize, resizeListener);
- tree.showColumn(column);
- }
- int columnIndex = column == null ? 0 : tree.indexOf(column);
- setBounds(row.getBounds(columnIndex));
- redraw();
- if (notify) notifyListeners(SWT.Selection, new Event());
- }
-}
-
-/**
- * Positions the TreeCursor over the root-level cell at the given row and column in the parent tree.
- *
- * @param row the index of the root-level row for the cell to select
- * @param column the index of column for the cell to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection(int row, int column) {
- checkWidget();
- int columnCount = tree.getColumnCount();
- int maxColumnIndex = columnCount == 0 ? 0 : columnCount - 1;
- if (row < 0 || row >= tree.getItemCount() || column < 0 || column > maxColumnIndex) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- setRowColumn(row, column, false);
-}
-
-/**
- * Positions the TreeCursor over the cell at the given row and column in the parent tree.
- *
- * @param row the TreeItem of the row for the cell to select
- * @param column the index of column for the cell to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection(TreeItem row, int column) {
- checkWidget();
- int columnCount = tree.getColumnCount();
- int maxColumnIndex = columnCount == 0 ? 0 : columnCount - 1;
- if (row == null || row.isDisposed() || column < 0 || column > maxColumnIndex) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- TreeColumn col = tree.getColumnCount() == 0 ? null : tree.getColumn(column);
- setRowColumn(row, col, false);
-}
-
-public void setVisible(boolean visible) {
- checkWidget();
- if (visible) {
- _resize();
- }
- super.setVisible(visible);
-}
-
-void treeCollapse(Event event) {
- if (row == null) return;
- TreeItem root = (TreeItem)event.item;
- TreeItem parentItem = row.getParentItem();
- while (parentItem != null) {
- if (parentItem == root) {
- setRowColumn(root, column, true);
- return;
- }
- parentItem = parentItem.getParentItem();
- }
-
- getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (isDisposed()) return;
- setRowColumn(row, column, true);
- }
- });
-}
-
-void treeExpand(Event event) {
- getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (isDisposed()) return;
- setRowColumn(row, column, true);
- }
- });
-}
-
-void treeFocusIn(Event event) {
- if (isVisible()) {
- if (row == null && column == null) return;
- setFocus();
- }
-}
-
-void treeMouseDown(Event event) {
- if (tree.getItemCount() == 0) return;
- Point pt = new Point(event.x, event.y);
- TreeItem item = tree.getItem(pt);
- if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) {
- TreeItem currentItem = tree.getTopItem();
- TreeItem parentItem = currentItem.getParentItem();
- while (parentItem != null) {
- currentItem = parentItem;
- parentItem = currentItem.getParentItem();
- }
- int start = tree.indexOf(currentItem);
- int viewportItemCount = tree.getClientArea().height / tree.getItemHeight();
- int end = Math.min(start + viewportItemCount, tree.getItemCount() - 1);
- TreeItem[] allItems = tree.getItems();
- TreeItem[] items = new TreeItem[end - start + 1];
- System.arraycopy(allItems, start, items, 0, end - start + 1);
- item = findItem(items, pt);
- }
- if (item == null) return;
-
- TreeColumn newColumn = null;
- int lineWidth = tree.getLinesVisible() ? tree.getGridLineWidth() : 0;
- int columnCount = tree.getColumnCount();
- if (columnCount > 0) {
- for (int i = 0; i < columnCount; i++) {
- Rectangle rect = item.getBounds(i);
- rect.width += lineWidth;
- rect.height += lineWidth;
- if (rect.contains(pt)) {
- newColumn = tree.getColumn(i);
- break;
- }
- }
- if (newColumn == null) {
- newColumn = tree.getColumn(0);
- }
- }
- setRowColumn(item, newColumn, true);
- setFocus();
-}
-
-void unhookRowColumnListeners() {
- if (column != null && !column.isDisposed()) {
- column.removeListener(SWT.Dispose, disposeColumnListener);
- column.removeListener(SWT.Move, resizeListener);
- column.removeListener(SWT.Resize, resizeListener);
- }
- column = null;
- if (row != null && !row.isDisposed()) {
- TreeItem currentItem = row;
- while (currentItem != null) {
- currentItem.removeListener(SWT.Dispose, disposeItemListener);
- currentItem = currentItem.getParentItem();
- }
- }
- row = null;
-}
-
-}
+/******************************************************************************* + * Copyright (c) 2011 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.custom; + + +import org.eclipse.swt.*; +import org.eclipse.swt.accessibility.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.widgets.*; + +/** + * A TreeCursor provides a way for the user to navigate around a Tree with columns using the + * keyboard. It also provides a mechanism for selecting an individual cell in a tree. + * <p> + * For a detailed example of using a TreeCursor to navigate to a cell and then edit it see + * http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java . + * + * <dl> + * <dt><b>Styles:</b></dt> + * <dd>BORDER</dd> + * <dt><b>Events:</b></dt> + * <dd>Selection, DefaultSelection</dd> + * </dl> + * + * @since 3.8 + */ +public class TreeCursor extends Canvas { + Tree tree; + TreeItem row; + TreeColumn column; + Listener listener, treeListener, resizeListener, disposeItemListener, disposeColumnListener; + + Color background = null; + Color foreground = null; + + /* By default, invert the list selection colors */ + static final int BACKGROUND = SWT.COLOR_LIST_SELECTION_TEXT; + static final int FOREGROUND = SWT.COLOR_LIST_SELECTION; + +/** + * Constructs a new instance of this class given its parent tree and a style value describing + * its behavior and appearance. + * <p> + * The style value is either one of the style constants defined in class <code>SWT</code> which + * is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing + * together (that is, using the <code>int</code> "|" operator) two or more of those + * <code>SWT</code> style constants. The class description lists the style constants that are + * applicable to the class. Style bits are also inherited from superclasses. + * </p> + * + * @param parent a Tree control which will be the parent of the new instance (cannot be null) + * @param style the style of control to construct + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> + * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> + * </ul> + * + * @see SWT#BORDER + * @see Widget#checkSubclass() + * @see Widget#getStyle() + */ +public TreeCursor(Tree parent, int style) { + super(parent, style); + tree = parent; + setBackground(null); + setForeground(null); + + listener = new Listener() { + public void handleEvent(Event event) { + if (row != null) { + /* + * Detect cases where the cursor position has become invalid and fix it. + * The typical cause of this is programmatic tree changes, such as + * expanding/collapsing and item and creating/disposing items. + */ + if (row.isDisposed()) { + unhookRowColumnListeners(); + _resize(); + tree.setFocus(); + return; + } + TreeItem current = row; + TreeItem parentItem = row.getParentItem(); + while (parentItem != null && !parentItem.getExpanded()) { + current = parentItem; + parentItem = current.getParentItem(); + } + if (current != row) { + setRowColumn(current, column, false); + } + } + switch (event.type) { + case SWT.Dispose: + onDispose(event); + break; + case SWT.FocusIn: + case SWT.FocusOut: + redraw(); + break; + case SWT.KeyDown: + keyDown(event); + break; + case SWT.Paint: + paint(event); + break; + case SWT.Traverse: + event.doit = true; + switch (event.detail) { + case SWT.TRAVERSE_ARROW_NEXT: + case SWT.TRAVERSE_ARROW_PREVIOUS: + case SWT.TRAVERSE_RETURN: + event.doit = false; + break; + } + break; + } + } + }; + int[] events = new int[] { SWT.Dispose, SWT.FocusIn, SWT.FocusOut, SWT.KeyDown, SWT.Paint, SWT.Traverse }; + for (int i = 0; i < events.length; i++) { + addListener(events[i], listener); + } + + treeListener = new Listener() { + public void handleEvent(Event event) { + switch (event.type) { + case SWT.Collapse: + treeCollapse(event); + break; + case SWT.Expand: + treeExpand(event); + break; + case SWT.FocusIn: + treeFocusIn(event); + break; + case SWT.MouseDown: + treeMouseDown(event); + break; + } + } + }; + tree.addListener(SWT.Collapse, treeListener); + tree.addListener(SWT.Expand, treeListener); + tree.addListener(SWT.FocusIn, treeListener); + tree.addListener(SWT.MouseDown, treeListener); + + disposeItemListener = new Listener() { + public void handleEvent(Event event) { + TreeItem currentItem = row; + while (currentItem != null) { + currentItem.removeListener(SWT.Dispose, disposeItemListener); + currentItem = currentItem.getParentItem(); + } + TreeItem disposedItem = (TreeItem)event.widget; + TreeItem parentItem = disposedItem.getParentItem(); + if (parentItem != null) { + setRowColumn(parentItem, column, true); + } else { + if (tree.getItemCount() == 1) { + unhookRowColumnListeners(); + } else { + TreeItem newFocus = null; + int rowIndex = tree.indexOf(disposedItem); + if (rowIndex != 0) { + TreeItem previousItem = tree.getItem(rowIndex - 1); + if (!previousItem.isDisposed()) { + newFocus = previousItem; + } + } + if (newFocus == null && rowIndex + 1 < tree.getItemCount()) { + TreeItem nextItem = tree.getItem(rowIndex + 1); + if (!nextItem.isDisposed()) { + newFocus = nextItem; + } + } + if (newFocus != null) { + setRowColumn(newFocus, column, true); + } else { + unhookRowColumnListeners(); + } + } + } + _resize(); + } + }; + disposeColumnListener = new Listener() { + public void handleEvent(Event event) { + if (column != null) { + if (tree.getColumnCount() == 1) { + column = null; + } else { + int columnIndex = tree.indexOf(column); + int positionIndex = columnIndex; + int[] columnOrder = tree.getColumnOrder(); + for (int i = 0; i < columnOrder.length; i++) { + if (columnOrder[i] == columnIndex) { + positionIndex = i; + break; + } + } + if (positionIndex == columnOrder.length - 1) { + setRowColumn(row, tree.getColumn(columnOrder[positionIndex - 1]), true); + } else { + setRowColumn(row, tree.getColumn(columnOrder[positionIndex + 1]), true); + } + } + } + _resize(); + } + }; + resizeListener = new Listener() { + public void handleEvent(Event event) { + _resize(); + } + }; + ScrollBar hBar = tree.getHorizontalBar(); + if (hBar != null) { + hBar.addListener(SWT.Selection, resizeListener); + } + ScrollBar vBar = tree.getVerticalBar(); + if (vBar != null) { + vBar.addListener(SWT.Selection, resizeListener); + } + + getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() { + public void getRole(AccessibleControlEvent e) { + e.detail = ACC.ROLE_TABLECELL; + } + }); + getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + if (row == null) return; + int columnIndex = column == null ? 0 : tree.indexOf(column); + e.result = row.getText(columnIndex); + } + }); +} + +/** + * Adds the listener to the collection of listeners who will be notified when the receiver's + * selection changes, by sending it one of the messages defined in the + * <code>SelectionListener</code> interface. + * <p> + * When <code>widgetSelected</code> is called, the item field of the event object is valid. If + * the receiver has <code>SWT.CHECK</code> style set and the check selection changes, the event + * object detail field contains the value <code>SWT.CHECK</code>. + * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see SelectionListener + * @see SelectionEvent + * @see #removeSelectionListener(SelectionListener) + */ +public void addSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Selection, typedListener); + addListener(SWT.DefaultSelection, typedListener); +} + +int countSubTreePages(TreeItem root) { + int pages = 1; + if (root == null) return 0; + if (root.getItemCount() == 0) return 1; + if (!root.getExpanded()) return 1; + TreeItem[] items = root.getItems(); + for (int i = 0; i < items.length; i++) { + pages += countSubTreePages(items[i]); + } + return pages; +} + +int findIndex(TreeItem[] items, TreeItem treeItem) { + if (items == null || treeItem == null) return -1; + Rectangle rect = treeItem.getBounds(); + int index = 0; + for (int i = 0; i < items.length; i++) { + TreeItem previousItem = null; + TreeItem currentItem = items[i]; + if (i > 0) previousItem = items[i - 1]; + Rectangle rect1 = currentItem.getBounds(); + if (rect.y == rect1.y) return index; + if (rect.y < rect1.y) { + return index - 1 + findIndex(previousItem.getItems(), treeItem); + } + if (rect.y > rect1.y && i == items.length - 1) { + return index + findIndex(currentItem.getItems(), treeItem); + } + if (rect.y >= rect1.y + (1 + currentItem.getItemCount()) * tree.getItemHeight() && currentItem.getExpanded()) { + index += countSubTreePages(currentItem); + continue; + } + index++; + } + return -1; +} + +TreeItem findItem(TreeItem[] items, Point pt) { + int start = 0, end = items.length - 1; + int index = end / 2; + while (end - start > 1) { + TreeItem currentItem = items[index]; + Rectangle bounds = currentItem.getBounds(); + if (pt.y < bounds.y) { + end = index; + index = (end - start) / 2; + } else { + start = index; + index = start + ((end - start) / 2); + } + } + + Rectangle endBounds = items[end].getBounds(); + if (endBounds.y < pt.y) { + if (endBounds.y + endBounds.height < pt.y) { + if (!items[end].getExpanded()) return null; + return findItem(items[end].getItems(), pt); + } + int[] columnOrder = tree.getColumnOrder(); + Rectangle bounds = null; + if (columnOrder.length > 0) { + Rectangle rect1 = items[end].getBounds(columnOrder[0]); + Rectangle rect2 = items[end].getBounds(columnOrder[columnOrder.length - 1]); + bounds = rect1.union(rect2); + bounds.height += tree.getLinesVisible() ? tree.getGridLineWidth() : 0; + } else { + bounds = items[end].getBounds(); + } + return bounds.contains(pt) ? items[end] : null; + } + + Rectangle startBounds = items[start].getBounds(); + if (startBounds.y + startBounds.height < pt.y) { + return findItem(items[start].getItems(), pt); + } + int[] columnOrder = tree.getColumnOrder(); + Rectangle bounds = null; + if (columnOrder.length > 0) { + Rectangle rect1 = items[start].getBounds(columnOrder[0]); + Rectangle rect2 = items[start].getBounds(columnOrder[columnOrder.length - 1]); + bounds = rect1.union(rect2); + bounds.height += tree.getLinesVisible() ? tree.getGridLineWidth() : 0; + } else { + bounds = items[start].getBounds(); + } + return bounds.contains(pt) ? items[start] : null; +} + +/** + * Returns the background color that the receiver will use to draw. + * + * @return the receiver's background color + */ +public Color getBackground() { + checkWidget(); + if (background == null) { + return getDisplay().getSystemColor(BACKGROUND); + } + return background; +} + +/** + * Returns the index of the column over which the TreeCursor is positioned. + * + * @return the column index for the current position + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public int getColumn() { + checkWidget(); + return column == null ? 0 : tree.indexOf(column); +} + +/** + * Returns the foreground color that the receiver will use to draw. + * + * @return the receiver's foreground color + */ +public Color getForeground() { + checkWidget(); + if (foreground == null) { + return getDisplay().getSystemColor(FOREGROUND); + } + return foreground; +} + +TreeItem getLastVisibleItem(TreeItem[] items) { + if (items == null) return null; + TreeItem last = items[items.length - 1]; + if (last.getExpanded() && last.getItemCount() > 0) { + return getLastVisibleItem(last.getItems()); + } + return last; +} + +TreeItem getNextItem(TreeItem item) { + if (item == null) return null; + if (item.getExpanded() && item.getItemCount() > 0) { + return item.getItem(0); + } + + TreeItem parentItem = item.getParentItem(); + while (parentItem != null) { + int index = parentItem.indexOf(item); + if (index == -1) return null; + if (index < parentItem.getItemCount() - 1) { + return parentItem.getItem(index + 1); + } + item = parentItem; + parentItem = item.getParentItem(); + } + int index = tree.indexOf(item); + if (index == -1) return null; + if (index == tree.getItemCount() - 1) return null; + return tree.getItem(index + 1); +} + +TreeItem getPreviousItem(TreeItem item) { + if (item == null) return null; + TreeItem parentItem = item.getParentItem(); + if (parentItem == null) { + int index = tree.indexOf(item); + if (index == -1 || index == 0) return null; + item = tree.getItem(index - 1); + if (item.getExpanded() && item.getItemCount() > 0) { + return getLastVisibleItem(item.getItems()); + } + return item; + } + int index = parentItem.indexOf(item); + if (index == -1) return null; + if (index == 0) return parentItem; + item = parentItem.getItem(index - 1); + if (item.getExpanded() && item.getItemCount() > 0) { + return getLastVisibleItem(item.getItems()); + } + return item; +} + +/** + * Returns the row over which the TreeCursor is positioned. + * + * @return the item for the current position, or <code>null</code> if none + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public TreeItem getRow() { + checkWidget(); + return row; +} + +void keyDown(Event event) { + if (row == null) return; + switch (event.character) { + case SWT.CR: + notifyListeners(SWT.DefaultSelection, new Event()); + return; + } + switch (event.keyCode) { + case SWT.ARROW_UP: + TreeItem previousItem = getPreviousItem(row); + if (previousItem != null) { + setRowColumn(previousItem, column, true); + } + break; + case SWT.ARROW_DOWN: + TreeItem nextItem = getNextItem(row); + if (nextItem != null) { + setRowColumn(nextItem, column, true); + } + break; + case SWT.ARROW_LEFT: + case SWT.ARROW_RIGHT: { + if ((event.stateMask & SWT.MOD1) != 0) { + row.setExpanded (event.keyCode == SWT.ARROW_RIGHT); + break; + } + int columnCount = tree.getColumnCount(); + if (columnCount == 0) break; + int columnIndex = column == null ? 0 : tree.indexOf(column); + int[] columnOrder = tree.getColumnOrder(); + int index = 0; + while (index < columnOrder.length) { + if (columnOrder[index] == columnIndex) break; + index++; + } + if (index == columnOrder.length) index = 0; + int leadKey = (getStyle() & SWT.RIGHT_TO_LEFT) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT; + TreeItem parentRow = row.getParentItem(); + int rowIndex = tree.indexOf(row); + if (event.keyCode == leadKey) { + if (parentRow != null) { + setRowColumn(row, tree.getColumn(columnOrder[Math.max(0, index - 1)]), true); + } else { + setRowColumn(rowIndex, columnOrder[Math.max(0, index - 1)], true); + } + } else { + if (parentRow != null) { + setRowColumn(row, tree.getColumn(columnOrder[Math.min(columnCount - 1, index + 1)]), true); + } else { + setRowColumn(rowIndex, columnOrder[Math.min(columnCount - 1, index + 1)], true); + } + } + break; + } + case SWT.HOME: + int columnIndex = column == null ? 0 : tree.indexOf(column); + setRowColumn(0, columnIndex, true); + break; + case SWT.END: { + TreeItem[] items = tree.getItems(); + setRowColumn(getLastVisibleItem(items), column, true); + break; + } + case SWT.PAGE_UP: { + Rectangle rect = tree.getClientArea(); + Rectangle itemRect = tree.getTopItem().getBounds(); + TreeItem item = row; + int index = findIndex(tree.getItems(), item); + int itemHeight = tree.getItemHeight(); + rect.height -= itemRect.y; + int page = Math.max(1, rect.height / itemHeight); + if (index - page <= 0) { + TreeItem first = tree.getItem(0); + setRowColumn(first, column, true); + break; + } + for (int i = 0; i < page; i++) { + item = getPreviousItem(item); + } + setRowColumn(item, column, true); + break; + } + case SWT.PAGE_DOWN: { + Rectangle rect = tree.getClientArea(); + Rectangle itemRect = tree.getTopItem().getBounds(); + TreeItem item = row; + int index = findIndex(tree.getItems(), item); + int height = tree.getItemHeight(); + rect.height -= itemRect.y; + TreeItem last = getLastVisibleItem(tree.getItems()); + int page = Math.max(1, rect.height / height); + int end = findIndex(tree.getItems(), last); + if (end <= index + page) { + setRowColumn(last, column, true); + break; + } + for (int i = 0; i < page; i++) { + item = getNextItem(item); + } + setRowColumn(item, column, true); + break; + } + } +} + +void onDispose(Event event) { + removeListener(SWT.Dispose, listener); + notifyListeners(SWT.Dispose, event); + event.type = SWT.None; + + tree.removeListener(SWT.Collapse, treeListener); + tree.removeListener(SWT.Expand, treeListener); + tree.removeListener(SWT.FocusIn, treeListener); + tree.removeListener(SWT.MouseDown, treeListener); + unhookRowColumnListeners(); + ScrollBar hBar = tree.getHorizontalBar(); + if (hBar != null) { + hBar.removeListener(SWT.Selection, resizeListener); + } + ScrollBar vBar = tree.getVerticalBar(); + if (vBar != null) { + vBar.removeListener(SWT.Selection, resizeListener); + } +} + +void paint(Event event) { + if (row == null) return; + int columnIndex = column == null ? 0 : tree.indexOf(column); + int orderedIndex = columnIndex; + int[] columnOrder = tree.getColumnOrder(); + for (int i = 0; i < columnOrder.length; i++) { + if (columnOrder[i] == columnIndex) { + orderedIndex = i; + break; + } + } + GC gc = event.gc; + gc.setBackground(getBackground()); + gc.setForeground(getForeground()); + gc.fillRectangle(event.x, event.y, event.width, event.height); + Image image = row.getImage(columnIndex); + int x = 0; + // Temporary code - need a better way to determine trim + String platform = SWT.getPlatform(); + if (image != null) { + if ("win32".equals(platform)) { //$NON-NLS-1$ + if (orderedIndex > 0) { + x += 2; + } + } else { + x += 2; + } + } + Point size = getSize(); + if (image != null) { + Rectangle imageSize = image.getBounds(); + int imageY = (size.y - imageSize.height) / 2; + gc.drawImage(image, x, imageY); + x += imageSize.width; + } + String text = row.getText(columnIndex); + if (text.length() > 0) { + Rectangle bounds = row.getBounds(columnIndex); + Point extent = gc.stringExtent(text); + // Temporary code - need a better way to determine trim + if ("win32".equals(platform)) { //$NON-NLS-1$ + if (tree.getColumnCount() == 0 || orderedIndex == 0) { + x += image == null ? 2 : 5; + } else { + int alignmnent = column.getAlignment(); + switch (alignmnent) { + case SWT.LEFT: + x += image == null ? 5 : 3; + break; + case SWT.RIGHT: + x = bounds.width - extent.x - 2; + break; + case SWT.CENTER: + x += Math.ceil((bounds.width - x - extent.x) / 2.0); + break; + } + } + } else { + if (tree.getColumnCount() == 0) { + x += image == null ? 4 : 3; + } else { + int alignmnent = column.getAlignment(); + switch (alignmnent) { + case SWT.LEFT: + x += image == null ? 5 : 3; + break; + case SWT.RIGHT: + x = bounds.width - extent.x - 2; + break; + case SWT.CENTER: + x += (bounds.width - x - extent.x) / 2 + 2; + break; + } + } + } + int textY = (size.y - extent.y) / 2; + gc.drawString(text, x, textY); + } + if (isFocusControl()) { + Display display = getDisplay(); + gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); + gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); + gc.drawFocus(0, 0, size.x, size.y); + } +} + +/** + * Removes the listener from the collection of listeners who will be notified when the + * receiver's selection changes. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see SelectionListener + * @see #addSelectionListener(SelectionListener) + */ +public void removeSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Selection, listener); + removeListener(SWT.DefaultSelection, listener); +} + +void _resize() { + if (row == null) { + setBounds(-200, -200, 0, 0); + } else { + int columnIndex = column == null ? 0 : tree.indexOf(column); + setBounds(row.getBounds(columnIndex)); + } +} + +/** + * Sets the receiver's background color to the color specified + * by the argument, or to the default system color for the control + * if the argument is null. + * <p> + * Note: This operation is a hint and may be overridden by the platform. + * For example, on Windows the background of a Button cannot be changed. + * </p> + * @param color the new color (or null) + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public void setBackground (Color color) { + background = color; + super.setBackground(getBackground()); + redraw(); +} +/** + * Sets the receiver's foreground color to the color specified + * by the argument, or to the default system color for the control + * if the argument is null. + * <p> + * Note: This operation is a hint and may be overridden by the platform. + * </p> + * @param color the new color (or null) + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public void setForeground (Color color) { + foreground = color; + super.setForeground(getForeground()); + redraw(); +} + +void setRowColumn(int row, int column, boolean notify) { + TreeItem item = row == -1 ? null : tree.getItem(row); + TreeColumn col = column == -1 || tree.getColumnCount() == 0 ? null : tree.getColumn(column); + setRowColumn(item, col, notify); +} + +void setRowColumn(TreeItem row, TreeColumn column, boolean notify) { + if (this.row != null && this.row != row) { + TreeItem currentItem = this.row; + while (currentItem != null) { + currentItem.removeListener(SWT.Dispose, disposeItemListener); + currentItem = currentItem.getParentItem(); + } + this.row = null; + } + if (this.column != null && this.column != column) { + this.column.removeListener(SWT.Dispose, disposeColumnListener); + this.column.removeListener(SWT.Move, resizeListener); + this.column.removeListener(SWT.Resize, resizeListener); + this.column = null; + } + if (row != null) { + if (this.row != row) { + this.row = row; + TreeItem currentItem = row; + while (currentItem != null) { + currentItem.addListener(SWT.Dispose, disposeItemListener); + currentItem = currentItem.getParentItem(); + } + tree.showItem(row); + } + if (this.column != column && column != null) { + this.column = column; + column.addListener(SWT.Dispose, disposeColumnListener); + column.addListener(SWT.Move, resizeListener); + column.addListener(SWT.Resize, resizeListener); + tree.showColumn(column); + } + int columnIndex = column == null ? 0 : tree.indexOf(column); + setBounds(row.getBounds(columnIndex)); + redraw(); + if (notify) notifyListeners(SWT.Selection, new Event()); + } +} + +/** + * Positions the TreeCursor over the root-level cell at the given row and column in the parent tree. + * + * @param row the index of the root-level row for the cell to select + * @param column the index of column for the cell to select + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public void setSelection(int row, int column) { + checkWidget(); + int columnCount = tree.getColumnCount(); + int maxColumnIndex = columnCount == 0 ? 0 : columnCount - 1; + if (row < 0 || row >= tree.getItemCount() || column < 0 || column > maxColumnIndex) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + setRowColumn(row, column, false); +} + +/** + * Positions the TreeCursor over the cell at the given row and column in the parent tree. + * + * @param row the TreeItem of the row for the cell to select + * @param column the index of column for the cell to select + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + */ +public void setSelection(TreeItem row, int column) { + checkWidget(); + int columnCount = tree.getColumnCount(); + int maxColumnIndex = columnCount == 0 ? 0 : columnCount - 1; + if (row == null || row.isDisposed() || column < 0 || column > maxColumnIndex) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + TreeColumn col = tree.getColumnCount() == 0 ? null : tree.getColumn(column); + setRowColumn(row, col, false); +} + +public void setVisible(boolean visible) { + checkWidget(); + if (visible) { + _resize(); + } + super.setVisible(visible); +} + +void treeCollapse(Event event) { + if (row == null) return; + TreeItem root = (TreeItem)event.item; + TreeItem parentItem = row.getParentItem(); + while (parentItem != null) { + if (parentItem == root) { + setRowColumn(root, column, true); + return; + } + parentItem = parentItem.getParentItem(); + } + + getDisplay().asyncExec(new Runnable() { + public void run() { + if (isDisposed()) return; + setRowColumn(row, column, true); + } + }); +} + +void treeExpand(Event event) { + getDisplay().asyncExec(new Runnable() { + public void run() { + if (isDisposed()) return; + setRowColumn(row, column, true); + } + }); +} + +void treeFocusIn(Event event) { + if (isVisible()) { + if (row == null && column == null) return; + setFocus(); + } +} + +void treeMouseDown(Event event) { + if (tree.getItemCount() == 0) return; + Point pt = new Point(event.x, event.y); + TreeItem item = tree.getItem(pt); + if (item == null && (tree.getStyle() & SWT.FULL_SELECTION) == 0) { + TreeItem currentItem = tree.getTopItem(); + TreeItem parentItem = currentItem.getParentItem(); + while (parentItem != null) { + currentItem = parentItem; + parentItem = currentItem.getParentItem(); + } + int start = tree.indexOf(currentItem); + int viewportItemCount = tree.getClientArea().height / tree.getItemHeight(); + int end = Math.min(start + viewportItemCount, tree.getItemCount() - 1); + TreeItem[] allItems = tree.getItems(); + TreeItem[] items = new TreeItem[end - start + 1]; + System.arraycopy(allItems, start, items, 0, end - start + 1); + item = findItem(items, pt); + } + if (item == null) return; + + TreeColumn newColumn = null; + int lineWidth = tree.getLinesVisible() ? tree.getGridLineWidth() : 0; + int columnCount = tree.getColumnCount(); + if (columnCount > 0) { + for (int i = 0; i < columnCount; i++) { + Rectangle rect = item.getBounds(i); + rect.width += lineWidth; + rect.height += lineWidth; + if (rect.contains(pt)) { + newColumn = tree.getColumn(i); + break; + } + } + if (newColumn == null) { + newColumn = tree.getColumn(0); + } + } + setRowColumn(item, newColumn, true); + setFocus(); +} + +void unhookRowColumnListeners() { + if (column != null && !column.isDisposed()) { + column.removeListener(SWT.Dispose, disposeColumnListener); + column.removeListener(SWT.Move, resizeListener); + column.removeListener(SWT.Resize, resizeListener); + } + column = null; + if (row != null && !row.isDisposed()) { + TreeItem currentItem = row; + while (currentItem != null) { + currentItem.removeListener(SWT.Dispose, disposeItemListener); + currentItem = currentItem.getParentItem(); + } + } + row = null; +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java index 2e9f646515..139ab98968 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/URLTransfer.java @@ -1,4 +1,18 @@ -/*******************************************************************************
* Copyright (c) 20007 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.dnd;
import org.eclipse.swt.internal.carbon.*;
/** +/******************************************************************************* + * Copyright (c) 20007 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.dnd; + +import org.eclipse.swt.internal.carbon.*; + +/** * The class <code>URLTransfer</code> provides a platform specific mechanism * for converting text in URL format represented as a java <code>String</code> * to a platform specific representation of the data and vice versa. The string @@ -12,11 +26,27 @@ * * @see Transfer * @since 3.4 - */
public class URLTransfer extends ByteArrayTransfer {
static URLTransfer _instance = new URLTransfer();
static final String URL = "url "; //$NON-NLS-1$
static final int URL_ID = registerType(URL);
static final String URLN = "urln"; //$NON-NLS-1$
static final int URLN_ID = registerType(URLN);
private URLTransfer() {}
/** + */ +public class URLTransfer extends ByteArrayTransfer { + + static URLTransfer _instance = new URLTransfer(); + static final String URL = "url "; //$NON-NLS-1$ + static final int URL_ID = registerType(URL); + static final String URLN = "urln"; //$NON-NLS-1$ + static final int URLN_ID = registerType(URLN); + +private URLTransfer() {} + +/** * Returns the singleton instance of the URLTransfer class. * * @return the singleton instance of the URLTransfer class - */
public static URLTransfer getInstance () {
return _instance;
}
/** + */ +public static URLTransfer getInstance () { + return _instance; +} + +/** * This implementation of <code>javaToNative</code> converts a URL * represented by a java <code>String</code> to a platform specific representation. * @@ -25,7 +55,36 @@ * be filled in on return with the platform specific format of the data * * @see Transfer#nativeToJava - */
public void javaToNative (Object object, TransferData transferData){
if (!checkURL(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
transferData.result = -1;
String url = (String)object;
int count = url.length();
char[] chars = new char[count];
url.getChars(0, count, chars, 0);
int cfstring = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, chars, count);
if (cfstring == 0) return;
try {
CFRange range = new CFRange();
range.length = chars.length;
int encoding = OS.kCFStringEncodingUTF8;
int[] size = new int[1];
int numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, null, 0, size);
if (numChars == 0 || size[0] == 0) return;
byte[] buffer = new byte[size[0]];
numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, buffer, size [0], size);
if (numChars == 0) return;
transferData.data = new byte[][] {buffer};
transferData.result = 0;
} finally {
OS.CFRelease(cfstring);
}
}
/** + */ +public void javaToNative (Object object, TransferData transferData){ + if (!checkURL(object) || !isSupportedType(transferData)) { + DND.error(DND.ERROR_INVALID_DATA); + } + transferData.result = -1; + String url = (String)object; + int count = url.length(); + char[] chars = new char[count]; + url.getChars(0, count, chars, 0); + int cfstring = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, chars, count); + if (cfstring == 0) return; + try { + CFRange range = new CFRange(); + range.length = chars.length; + int encoding = OS.kCFStringEncodingUTF8; + int[] size = new int[1]; + int numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, null, 0, size); + if (numChars == 0 || size[0] == 0) return; + byte[] buffer = new byte[size[0]]; + numChars = OS.CFStringGetBytes(cfstring, range, encoding, (byte)'?', true, buffer, size [0], size); + if (numChars == 0) return; + transferData.data = new byte[][] {buffer}; + transferData.result = 0; + } finally { + OS.CFRelease(cfstring); + } +} + +/** * This implementation of <code>nativeToJava</code> converts a platform * specific representation of a URL to a java <code>String</code>. * @@ -34,4 +93,46 @@ * otherwise null * * @see Transfer#javaToNative - */
public Object nativeToJava(TransferData transferData){
if (!isSupportedType(transferData) || transferData.data == null) return null;
if (transferData.data.length == 0) return null;
byte[] buffer = transferData.data[0];
int encoding = OS.kCFStringEncodingUTF8;
int cfstring = OS.CFStringCreateWithBytes(OS.kCFAllocatorDefault, buffer, buffer.length, encoding, true);
if (cfstring == 0) return null;
char[] unescapedChars = new char[] {'%'};
int unescapedStr = OS.CFStringCreateWithCharacters(0, unescapedChars, unescapedChars.length);
int str = OS.CFURLCreateStringByReplacingPercentEscapes(OS.kCFAllocatorDefault, cfstring, unescapedStr);
OS.CFRelease(unescapedStr);
OS.CFRelease(cfstring);
if (str == 0) return null;
try {
int length = OS.CFStringGetLength(str);
if (length == 0) return null;
char[] chars = new char[length];
CFRange range = new CFRange();
range.length = length;
OS.CFStringGetCharacters(str, range, chars);
return new String(chars);
} finally {
OS.CFRelease(str);
}
}
protected int[] getTypeIds(){
return new int[] {URL_ID, URLN_ID};
}
protected String[] getTypeNames(){
return new String[] {URL, URLN};
}
boolean checkURL(Object object) {
return object != null && (object instanceof String) && ((String)object).length() > 0;
}
protected boolean validate(Object object) {
return checkURL(object);
}
}
\ No newline at end of file + */ +public Object nativeToJava(TransferData transferData){ + if (!isSupportedType(transferData) || transferData.data == null) return null; + if (transferData.data.length == 0) return null; + byte[] buffer = transferData.data[0]; + int encoding = OS.kCFStringEncodingUTF8; + int cfstring = OS.CFStringCreateWithBytes(OS.kCFAllocatorDefault, buffer, buffer.length, encoding, true); + if (cfstring == 0) return null; + char[] unescapedChars = new char[] {'%'}; + int unescapedStr = OS.CFStringCreateWithCharacters(0, unescapedChars, unescapedChars.length); + int str = OS.CFURLCreateStringByReplacingPercentEscapes(OS.kCFAllocatorDefault, cfstring, unescapedStr); + OS.CFRelease(unescapedStr); + OS.CFRelease(cfstring); + if (str == 0) return null; + try { + int length = OS.CFStringGetLength(str); + if (length == 0) return null; + char[] chars = new char[length]; + CFRange range = new CFRange(); + range.length = length; + OS.CFStringGetCharacters(str, range, chars); + return new String(chars); + } finally { + OS.CFRelease(str); + } +} + +protected int[] getTypeIds(){ + return new int[] {URL_ID, URLN_ID}; +} + +protected String[] getTypeNames(){ + return new String[] {URL, URLN}; +} + +boolean checkURL(Object object) { + return object != null && (object instanceof String) && ((String)object).length() > 0; +} + +protected boolean validate(Object object) { + return checkURL(object); +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java index cc23c227ff..2982c0a69c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java @@ -1,4 +1,18 @@ -/*******************************************************************************
* Copyright (c) 20007 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.dnd;
import org.eclipse.swt.internal.cocoa.*;
/** +/******************************************************************************* + * Copyright (c) 20007 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.dnd; + +import org.eclipse.swt.internal.cocoa.*; + +/** * The class <code>URLTransfer</code> provides a platform specific mechanism * for converting text in URL format represented as a java <code>String</code> * to a platform specific representation of the data and vice versa. The string @@ -12,11 +26,25 @@ * * @see Transfer * @since 3.4 - */
public class URLTransfer extends ByteArrayTransfer {
static URLTransfer _instance = new URLTransfer();
static final String URL = OS.NSURLPboardType.getString();
static final int URL_ID = registerType(URL);
private URLTransfer() {}
/** + */ +public class URLTransfer extends ByteArrayTransfer { + + static URLTransfer _instance = new URLTransfer(); + static final String URL = OS.NSURLPboardType.getString(); + static final int URL_ID = registerType(URL); + +private URLTransfer() {} + +/** * Returns the singleton instance of the URLTransfer class. * * @return the singleton instance of the URLTransfer class - */
public static URLTransfer getInstance () {
return _instance;
}
/** + */ +public static URLTransfer getInstance () { + return _instance; +} + +/** * This implementation of <code>javaToNative</code> converts a URL * represented by a java <code>String</code> to a platform specific representation. * @@ -25,7 +53,18 @@ * be filled in on return with the platform specific format of the data * * @see Transfer#nativeToJava - */
public void javaToNative (Object object, TransferData transferData){
if (!checkURL(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
String url = (String)object;
NSString nsString = NSString.stringWith(url);
NSString escapedString = nsString.stringByAddingPercentEscapesUsingEncoding(OS.NSUTF8StringEncoding);
transferData.data = NSURL.URLWithString(escapedString);
}
/** + */ +public void javaToNative (Object object, TransferData transferData){ + if (!checkURL(object) || !isSupportedType(transferData)) { + DND.error(DND.ERROR_INVALID_DATA); + } + String url = (String)object; + NSString nsString = NSString.stringWith(url); + NSString escapedString = nsString.stringByAddingPercentEscapesUsingEncoding(OS.NSUTF8StringEncoding); + transferData.data = NSURL.URLWithString(escapedString); +} + +/** * This implementation of <code>nativeToJava</code> converts a platform * specific representation of a URL to a java <code>String</code>. * @@ -34,4 +73,27 @@ * otherwise null * * @see Transfer#javaToNative - */
public Object nativeToJava(TransferData transferData){
if (!isSupportedType(transferData) || transferData.data == null) return null;
NSURL nsUrl = (NSURL) transferData.data;
NSString nsString = nsUrl.absoluteString();
return nsString.getString();
}
protected int[] getTypeIds(){
return new int[] {URL_ID};
}
protected String[] getTypeNames(){
return new String[] {URL};
}
boolean checkURL(Object object) {
return object != null && (object instanceof String) && ((String)object).length() > 0;
}
protected boolean validate(Object object) {
return checkURL(object);
}
}
\ No newline at end of file + */ +public Object nativeToJava(TransferData transferData){ + if (!isSupportedType(transferData) || transferData.data == null) return null; + NSURL nsUrl = (NSURL) transferData.data; + NSString nsString = nsUrl.absoluteString(); + return nsString.getString(); +} + +protected int[] getTypeIds(){ + return new int[] {URL_ID}; +} + +protected String[] getTypeNames(){ + return new String[] {URL}; +} + +boolean checkURL(Object object) { + return object != null && (object instanceof String) && ((String)object).length() > 0; +} + +protected boolean validate(Object object) { + return checkURL(object); +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker_10.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker_10.java index 4affcfc61e..b976233bab 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker_10.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/FilePicker_10.java @@ -1,49 +1,49 @@ -/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.mozilla.*;
-
-class FilePicker_10 extends FilePicker_1_8 {
-
-void createCOMInterfaces () {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject (new int[] {2, 0, 0}) {
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
- public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
- public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- };
-
- filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
- public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
- public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], (short)args[2]);}
- public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters ((int)/*64*/args[0]);}
- public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);}
- public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);}
- public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);}
- public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);}
- public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);}
- public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);}
- public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex ((int)/*64*/args[0]);}
- public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);}
- public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);}
- public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);}
- public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args[0]);}
- public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args[0]);}
- public int /*long*/ method17 (int /*long*/[] args) {return XPCOM.NS_ERROR_NOT_IMPLEMENTED;}
- public int /*long*/ method18 (int /*long*/[] args) {return XPCOM.NS_ERROR_NOT_IMPLEMENTED;}
- public int /*long*/ method19 (int /*long*/[] args) {return Show (args[0]);}
- };
-}
-
-}
+/******************************************************************************* + * Copyright (c) 2012 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.internal.mozilla.*; + +class FilePicker_10 extends FilePicker_1_8 { + +void createCOMInterfaces () { + /* Create each of the interfaces that this object implements */ + supports = new XPCOMObject (new int[] {2, 0, 0}) { + public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} + public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} + public int /*long*/ method2 (int /*long*/[] args) {return Release ();} + }; + + filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) { + public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);} + public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();} + public int /*long*/ method2 (int /*long*/[] args) {return Release ();} + public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], (short)args[2]);} + public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters ((int)/*64*/args[0]);} + public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);} + public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);} + public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);} + public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);} + public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);} + public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);} + public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex ((int)/*64*/args[0]);} + public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);} + public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);} + public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);} + public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args[0]);} + public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args[0]);} + public int /*long*/ method17 (int /*long*/[] args) {return XPCOM.NS_ERROR_NOT_IMPLEMENTED;} + public int /*long*/ method18 (int /*long*/[] args) {return XPCOM.NS_ERROR_NOT_IMPLEMENTED;} + public int /*long*/ method19 (int /*long*/[] args) {return Show (args[0]);} + }; +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMDocument.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMDocument.java index e2dbda418d..6bda020537 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMDocument.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMDocument.java @@ -1,349 +1,349 @@ -/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by Netscape are Copyright (C) 1998-1999
- * Netscape Communications Corporation. All Rights Reserved.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
-
-public class nsIDOMDocument extends nsIDOMNode {
-
- static final int LAST_METHOD_ID = nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 61 : 17);
-
- public static final String NS_IDOMDOCUMENT_IID_STR =
- "a6cf9075-15b3-11d2-932e-00805f8add32";
-
- public static final String NS_IDOMDOCUMENT_10_IID_STR =
- "5c3bff4d-ae7f-4c93-948c-519589672c30";
-
- public static final nsID NS_IDOMDOCUMENT_IID =
- new nsID(NS_IDOMDOCUMENT_IID_STR);
-
- public static final nsID NS_IDOMDOCUMENT_10_IID =
- new nsID(NS_IDOMDOCUMENT_10_IID_STR);
-
- public nsIDOMDocument(int /*long*/ address) {
- super(address);
- }
-
- public int GetDoctype(int /*long*/[] aDoctype) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 1, getAddress(), aDoctype);
- }
-
- public int GetImplementation(int /*long*/[] aImplementation) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 2, getAddress(), aImplementation);
- }
-
- public int GetDocumentElement(int /*long*/[] aDocumentElement) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 3, getAddress(), aDocumentElement);
- }
-
- public int CreateElement(int /*long*/ tagName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 4, getAddress(), tagName, _retval);
- }
-
- public int CreateDocumentFragment(int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 5, getAddress(), _retval);
- }
-
- public int CreateTextNode(int /*long*/ data, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 6, getAddress(), data, _retval);
- }
-
- public int CreateComment(int /*long*/ data, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 7, getAddress(), data, _retval);
- }
-
- public int CreateCDATASection(int /*long*/ data, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 8, getAddress(), data, _retval);
- }
-
- public int CreateProcessingInstruction(int /*long*/ target, int /*long*/ data, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 9, getAddress(), target, data, _retval);
- }
-
- public int CreateAttribute(int /*long*/ name, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 10, getAddress(), name, _retval);
- }
-
- public int CreateEntityReference(int /*long*/ name, int /*long*/[] _retval) {
- if (IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 11, getAddress(), name, _retval);
- }
-
- public int GetElementsByTagName(int /*long*/ tagname, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 11 : 12), getAddress(), tagname, _retval);
- }
-
- public int ImportNode(int /*long*/ importedNode, int deep, int /*long*/[] _retval) {
- if (IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 13, getAddress(), importedNode, deep, _retval);
- }
-
- public int ImportNode(int /*long*/ importedNode, int deep, int _argc, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 12, getAddress(), importedNode, deep, _argc, _retval);
- }
-
- public int CreateElementNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 13 : 14), getAddress(), namespaceURI, qualifiedName, _retval);
- }
-
- public int CreateAttributeNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 14 : 15), getAddress(), namespaceURI, qualifiedName, _retval);
- }
-
- public int GetElementsByTagNameNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 15 : 16), getAddress(), namespaceURI, localName, _retval);
- }
-
- public int GetElementById(int /*long*/ elementId, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 16 : 17), getAddress(), elementId, _retval);
- }
-
- public int GetInputEncoding(int /*long*/ aInputEncoding) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 17, getAddress(), aInputEncoding);
- }
-
- public int GetDocumentURI(int /*long*/ aDocumentURI) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 18, getAddress(), aDocumentURI);
- }
-
- public int AdoptNode(int /*long*/ source, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 19, getAddress(), source, _retval);
- }
-
- public int CreateRange(int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 20, getAddress(), _retval);
- }
-
- public int CreateNodeIterator(int /*long*/ root, int whatToShow, int /*long*/ filter, int entityReferenceExpansion, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 21, getAddress(), root, whatToShow, filter, entityReferenceExpansion, _retval);
- }
-
- public int CreateTreeWalker(int /*long*/ root, int whatToShow, int /*long*/ filter, int entityReferenceExpansion, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 22, getAddress(), root, whatToShow, filter, entityReferenceExpansion, _retval);
- }
-
- public int CreateEvent(int /*long*/ eventType, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 23, getAddress(), eventType, _retval);
- }
-
- public int GetDefaultView(int /*long*/[] aDefaultView) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 24, getAddress(), aDefaultView);
- }
-
- public int GetCharacterSet(int /*long*/ aCharacterSet) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 25, getAddress(), aCharacterSet);
- }
-
- public int GetDir(int /*long*/ aDir) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 26, getAddress(), aDir);
- }
-
- public int SetDir(int /*long*/ aDir) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 27, getAddress(), aDir);
- }
-
- public int GetLocation(int /*long*/[] aLocation) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 28, getAddress(), aLocation);
- }
-
- public int GetTitle(int /*long*/ aTitle) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 29, getAddress(), aTitle);
- }
-
- public int SetTitle(int /*long*/ aTitle) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 30, getAddress(), aTitle);
- }
-
- public int GetReadyState(int /*long*/ aReadyState) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 31, getAddress(), aReadyState);
- }
-
- public int GetLastModified(int /*long*/ aLastModified) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 32, getAddress(), aLastModified);
- }
-
- public int GetReferrer(int /*long*/ aReferrer) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 33, getAddress(), aReferrer);
- }
-
- public int HasFocus(int[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 34, getAddress(), _retval);
- }
-
- public int GetActiveElement(int /*long*/[] aActiveElement) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 35, getAddress(), aActiveElement);
- }
-
- public int GetElementsByClassName(int /*long*/ classes, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 36, getAddress(), classes, _retval);
- }
-
- public int GetStyleSheets(int /*long*/[] aStyleSheets) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 37, getAddress(), aStyleSheets);
- }
-
- public int GetPreferredStyleSheetSet(int /*long*/ aPreferredStyleSheetSet) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 38, getAddress(), aPreferredStyleSheetSet);
- }
-
- public int GetSelectedStyleSheetSet(int /*long*/ aSelectedStyleSheetSet) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 39, getAddress(), aSelectedStyleSheetSet);
- }
-
- public int SetSelectedStyleSheetSet(int /*long*/ aSelectedStyleSheetSet) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 40, getAddress(), aSelectedStyleSheetSet);
- }
-
- public int GetLastStyleSheetSet(int /*long*/ aLastStyleSheetSet) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 41, getAddress(), aLastStyleSheetSet);
- }
-
- public int GetStyleSheetSets(int /*long*/[] aStyleSheetSets) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 42, getAddress(), aStyleSheetSets);
- }
-
- public int EnableStyleSheetsForSet(int /*long*/ name) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 43, getAddress(), name);
- }
-
- public int ElementFromPoint(float x, float y, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 44, getAddress(), x, y, _retval);
- }
-
- public int GetContentType(int /*long*/ aContentType) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 45, getAddress(), aContentType);
- }
-
- public int GetMozSyntheticDocument(int[] aMozSyntheticDocument) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 46, getAddress(), aMozSyntheticDocument);
- }
-
- public int GetCurrentScript(int /*long*/[] aCurrentScript) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 47, getAddress(), aCurrentScript);
- }
-
- public int ReleaseCapture() {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 48, getAddress());
- }
-
- public int MozSetImageElement(int /*long*/ aImageElementId, int /*long*/ aImageElement) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 49, getAddress(), aImageElementId, aImageElement);
- }
-
- public int GetMozFullScreenElement(int /*long*/[] aMozFullScreenElement) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 50, getAddress(), aMozFullScreenElement);
- }
-
- public int MozCancelFullScreen() {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 51, getAddress());
- }
-
- public int GetMozFullScreen(int[] aMozFullScreen) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 52, getAddress(), aMozFullScreen);
- }
-
- public int GetMozFullScreenEnabled(int[] aMozFullScreenEnabled) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 53, getAddress(), aMozFullScreenEnabled);
- }
-
- public int GetOnreadystatechange(int /*long*/ cx, int /*long*/ aOnreadystatechange) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 54, getAddress(), cx, aOnreadystatechange);
- }
-
- public int SetOnreadystatechange(int /*long*/ cx, int /*long*/ aOnreadystatechange) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 55, getAddress(), cx, aOnreadystatechange);
- }
-
- public int GetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 56, getAddress(), cx, aOnmouseenter);
- }
-
- public int SetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 57, getAddress(), cx, aOnmouseenter);
- }
-
- public int GetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 58, getAddress(), cx, aOnmouseleave);
- }
-
- public int SetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 59, getAddress(), cx, aOnmouseleave);
- }
-
- public int GetMozHidden(int[] aMozHidden) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 60, getAddress(), aMozHidden);
- }
-
- public int GetMozVisibilityState(int /*long*/ aMozVisibilityState) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 61, getAddress(), aMozVisibilityState);
- }
-}
+/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2011 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIDOMDocument extends nsIDOMNode { + + static final int LAST_METHOD_ID = nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 61 : 17); + + public static final String NS_IDOMDOCUMENT_IID_STR = + "a6cf9075-15b3-11d2-932e-00805f8add32"; + + public static final String NS_IDOMDOCUMENT_10_IID_STR = + "5c3bff4d-ae7f-4c93-948c-519589672c30"; + + public static final nsID NS_IDOMDOCUMENT_IID = + new nsID(NS_IDOMDOCUMENT_IID_STR); + + public static final nsID NS_IDOMDOCUMENT_10_IID = + new nsID(NS_IDOMDOCUMENT_10_IID_STR); + + public nsIDOMDocument(int /*long*/ address) { + super(address); + } + + public int GetDoctype(int /*long*/[] aDoctype) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 1, getAddress(), aDoctype); + } + + public int GetImplementation(int /*long*/[] aImplementation) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 2, getAddress(), aImplementation); + } + + public int GetDocumentElement(int /*long*/[] aDocumentElement) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 3, getAddress(), aDocumentElement); + } + + public int CreateElement(int /*long*/ tagName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 4, getAddress(), tagName, _retval); + } + + public int CreateDocumentFragment(int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 5, getAddress(), _retval); + } + + public int CreateTextNode(int /*long*/ data, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 6, getAddress(), data, _retval); + } + + public int CreateComment(int /*long*/ data, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 7, getAddress(), data, _retval); + } + + public int CreateCDATASection(int /*long*/ data, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 8, getAddress(), data, _retval); + } + + public int CreateProcessingInstruction(int /*long*/ target, int /*long*/ data, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 9, getAddress(), target, data, _retval); + } + + public int CreateAttribute(int /*long*/ name, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 10, getAddress(), name, _retval); + } + + public int CreateEntityReference(int /*long*/ name, int /*long*/[] _retval) { + if (IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 11, getAddress(), name, _retval); + } + + public int GetElementsByTagName(int /*long*/ tagname, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 11 : 12), getAddress(), tagname, _retval); + } + + public int ImportNode(int /*long*/ importedNode, int deep, int /*long*/[] _retval) { + if (IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 13, getAddress(), importedNode, deep, _retval); + } + + public int ImportNode(int /*long*/ importedNode, int deep, int _argc, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 12, getAddress(), importedNode, deep, _argc, _retval); + } + + public int CreateElementNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 13 : 14), getAddress(), namespaceURI, qualifiedName, _retval); + } + + public int CreateAttributeNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 14 : 15), getAddress(), namespaceURI, qualifiedName, _retval); + } + + public int GetElementsByTagNameNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 15 : 16), getAddress(), namespaceURI, localName, _retval); + } + + public int GetElementById(int /*long*/ elementId, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 16 : 17), getAddress(), elementId, _retval); + } + + public int GetInputEncoding(int /*long*/ aInputEncoding) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 17, getAddress(), aInputEncoding); + } + + public int GetDocumentURI(int /*long*/ aDocumentURI) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 18, getAddress(), aDocumentURI); + } + + public int AdoptNode(int /*long*/ source, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 19, getAddress(), source, _retval); + } + + public int CreateRange(int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 20, getAddress(), _retval); + } + + public int CreateNodeIterator(int /*long*/ root, int whatToShow, int /*long*/ filter, int entityReferenceExpansion, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 21, getAddress(), root, whatToShow, filter, entityReferenceExpansion, _retval); + } + + public int CreateTreeWalker(int /*long*/ root, int whatToShow, int /*long*/ filter, int entityReferenceExpansion, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 22, getAddress(), root, whatToShow, filter, entityReferenceExpansion, _retval); + } + + public int CreateEvent(int /*long*/ eventType, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 23, getAddress(), eventType, _retval); + } + + public int GetDefaultView(int /*long*/[] aDefaultView) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 24, getAddress(), aDefaultView); + } + + public int GetCharacterSet(int /*long*/ aCharacterSet) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 25, getAddress(), aCharacterSet); + } + + public int GetDir(int /*long*/ aDir) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 26, getAddress(), aDir); + } + + public int SetDir(int /*long*/ aDir) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 27, getAddress(), aDir); + } + + public int GetLocation(int /*long*/[] aLocation) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 28, getAddress(), aLocation); + } + + public int GetTitle(int /*long*/ aTitle) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 29, getAddress(), aTitle); + } + + public int SetTitle(int /*long*/ aTitle) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 30, getAddress(), aTitle); + } + + public int GetReadyState(int /*long*/ aReadyState) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 31, getAddress(), aReadyState); + } + + public int GetLastModified(int /*long*/ aLastModified) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 32, getAddress(), aLastModified); + } + + public int GetReferrer(int /*long*/ aReferrer) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 33, getAddress(), aReferrer); + } + + public int HasFocus(int[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 34, getAddress(), _retval); + } + + public int GetActiveElement(int /*long*/[] aActiveElement) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 35, getAddress(), aActiveElement); + } + + public int GetElementsByClassName(int /*long*/ classes, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 36, getAddress(), classes, _retval); + } + + public int GetStyleSheets(int /*long*/[] aStyleSheets) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 37, getAddress(), aStyleSheets); + } + + public int GetPreferredStyleSheetSet(int /*long*/ aPreferredStyleSheetSet) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 38, getAddress(), aPreferredStyleSheetSet); + } + + public int GetSelectedStyleSheetSet(int /*long*/ aSelectedStyleSheetSet) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 39, getAddress(), aSelectedStyleSheetSet); + } + + public int SetSelectedStyleSheetSet(int /*long*/ aSelectedStyleSheetSet) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 40, getAddress(), aSelectedStyleSheetSet); + } + + public int GetLastStyleSheetSet(int /*long*/ aLastStyleSheetSet) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 41, getAddress(), aLastStyleSheetSet); + } + + public int GetStyleSheetSets(int /*long*/[] aStyleSheetSets) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 42, getAddress(), aStyleSheetSets); + } + + public int EnableStyleSheetsForSet(int /*long*/ name) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 43, getAddress(), name); + } + + public int ElementFromPoint(float x, float y, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 44, getAddress(), x, y, _retval); + } + + public int GetContentType(int /*long*/ aContentType) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 45, getAddress(), aContentType); + } + + public int GetMozSyntheticDocument(int[] aMozSyntheticDocument) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 46, getAddress(), aMozSyntheticDocument); + } + + public int GetCurrentScript(int /*long*/[] aCurrentScript) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 47, getAddress(), aCurrentScript); + } + + public int ReleaseCapture() { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 48, getAddress()); + } + + public int MozSetImageElement(int /*long*/ aImageElementId, int /*long*/ aImageElement) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 49, getAddress(), aImageElementId, aImageElement); + } + + public int GetMozFullScreenElement(int /*long*/[] aMozFullScreenElement) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 50, getAddress(), aMozFullScreenElement); + } + + public int MozCancelFullScreen() { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 51, getAddress()); + } + + public int GetMozFullScreen(int[] aMozFullScreen) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 52, getAddress(), aMozFullScreen); + } + + public int GetMozFullScreenEnabled(int[] aMozFullScreenEnabled) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 53, getAddress(), aMozFullScreenEnabled); + } + + public int GetOnreadystatechange(int /*long*/ cx, int /*long*/ aOnreadystatechange) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 54, getAddress(), cx, aOnreadystatechange); + } + + public int SetOnreadystatechange(int /*long*/ cx, int /*long*/ aOnreadystatechange) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 55, getAddress(), cx, aOnreadystatechange); + } + + public int GetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 56, getAddress(), cx, aOnmouseenter); + } + + public int SetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 57, getAddress(), cx, aOnmouseenter); + } + + public int GetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 58, getAddress(), cx, aOnmouseleave); + } + + public int SetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 59, getAddress(), cx, aOnmouseleave); + } + + public int GetMozHidden(int[] aMozHidden) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 60, getAddress(), aMozHidden); + } + + public int GetMozVisibilityState(int /*long*/ aMozVisibilityState) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 61, getAddress(), aMozVisibilityState); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMElement.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMElement.java index 87f630e5c2..5748b9d6c0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMElement.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMElement.java @@ -1,133 +1,133 @@ -/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by Netscape are Copyright (C) 1998-1999
- * Netscape Communications Corporation. All Rights Reserved.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
-
-public class nsIDOMElement extends nsIDOMNode {
-
- static final int LAST_METHOD_ID = nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 20 : 16);
-
- public static final String NS_IDOMELEMENT_IID_STR =
- "a6cf9078-15b3-11d2-932e-00805f8add32";
-
- public static final String NS_IDOMELEMENT_10_IID_STR =
- "1f249e8b-7b41-44c0-a8d5-15298c1198cd";
-
- public static final nsID NS_IDOMELEMENT_IID =
- new nsID(NS_IDOMELEMENT_IID_STR);
-
- public static final nsID NS_IDOMELEMENT_10_IID =
- new nsID(NS_IDOMELEMENT_10_IID_STR);
-
- public nsIDOMElement(int /*long*/ address) {
- super(address);
- }
-
- public int GetTagName(int /*long*/ aTagName) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 1, getAddress(), aTagName);
- }
-
- public int GetAttribute(int /*long*/ name, int /*long*/ _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 2, getAddress(), name, _retval);
- }
-
- public int SetAttribute(int /*long*/ name, int /*long*/ value) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 3, getAddress(), name, value);
- }
-
- public int RemoveAttribute(int /*long*/ name) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 4, getAddress(), name);
- }
-
- public int GetAttributeNode(int /*long*/ name, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 5, getAddress(), name, _retval);
- }
-
- public int SetAttributeNode(int /*long*/ newAttr, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 6, getAddress(), newAttr, _retval);
- }
-
- public int RemoveAttributeNode(int /*long*/ oldAttr, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 7, getAddress(), oldAttr, _retval);
- }
-
- public int GetElementsByTagName(int /*long*/ name, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 8, getAddress(), name, _retval);
- }
-
- public int GetAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/ _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 9, getAddress(), namespaceURI, localName, _retval);
- }
-
- public int SetAttributeNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/ value) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 10, getAddress(), namespaceURI, qualifiedName, value);
- }
-
- public int RemoveAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 11, getAddress(), namespaceURI, localName);
- }
-
- public int GetAttributeNodeNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 12, getAddress(), namespaceURI, localName, _retval);
- }
-
- public int SetAttributeNodeNS(int /*long*/ newAttr, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 13, getAddress(), newAttr, _retval);
- }
-
- public int GetElementsByTagNameNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 14, getAddress(), namespaceURI, localName, _retval);
- }
-
- public int HasAttribute(int /*long*/ name, int[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 15, getAddress(), name, _retval);
- }
-
- public int HasAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName, int[] _retval) {
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 16, getAddress(), namespaceURI, localName, _retval);
- }
-
- public int GetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 17, getAddress(), cx, aOnmouseenter);
- }
-
- public int SetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 18, getAddress(), cx, aOnmouseenter);
- }
-
- public int GetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 19, getAddress(), cx, aOnmouseleave);
- }
-
- public int SetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 20, getAddress(), cx, aOnmouseleave);
- }
-}
+/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2011 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIDOMElement extends nsIDOMNode { + + static final int LAST_METHOD_ID = nsIDOMNode.LAST_METHOD_ID + (IsXULRunner10 ? 20 : 16); + + public static final String NS_IDOMELEMENT_IID_STR = + "a6cf9078-15b3-11d2-932e-00805f8add32"; + + public static final String NS_IDOMELEMENT_10_IID_STR = + "1f249e8b-7b41-44c0-a8d5-15298c1198cd"; + + public static final nsID NS_IDOMELEMENT_IID = + new nsID(NS_IDOMELEMENT_IID_STR); + + public static final nsID NS_IDOMELEMENT_10_IID = + new nsID(NS_IDOMELEMENT_10_IID_STR); + + public nsIDOMElement(int /*long*/ address) { + super(address); + } + + public int GetTagName(int /*long*/ aTagName) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 1, getAddress(), aTagName); + } + + public int GetAttribute(int /*long*/ name, int /*long*/ _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 2, getAddress(), name, _retval); + } + + public int SetAttribute(int /*long*/ name, int /*long*/ value) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 3, getAddress(), name, value); + } + + public int RemoveAttribute(int /*long*/ name) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 4, getAddress(), name); + } + + public int GetAttributeNode(int /*long*/ name, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 5, getAddress(), name, _retval); + } + + public int SetAttributeNode(int /*long*/ newAttr, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 6, getAddress(), newAttr, _retval); + } + + public int RemoveAttributeNode(int /*long*/ oldAttr, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 7, getAddress(), oldAttr, _retval); + } + + public int GetElementsByTagName(int /*long*/ name, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 8, getAddress(), name, _retval); + } + + public int GetAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/ _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 9, getAddress(), namespaceURI, localName, _retval); + } + + public int SetAttributeNS(int /*long*/ namespaceURI, int /*long*/ qualifiedName, int /*long*/ value) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 10, getAddress(), namespaceURI, qualifiedName, value); + } + + public int RemoveAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 11, getAddress(), namespaceURI, localName); + } + + public int GetAttributeNodeNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 12, getAddress(), namespaceURI, localName, _retval); + } + + public int SetAttributeNodeNS(int /*long*/ newAttr, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 13, getAddress(), newAttr, _retval); + } + + public int GetElementsByTagNameNS(int /*long*/ namespaceURI, int /*long*/ localName, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 14, getAddress(), namespaceURI, localName, _retval); + } + + public int HasAttribute(int /*long*/ name, int[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 15, getAddress(), name, _retval); + } + + public int HasAttributeNS(int /*long*/ namespaceURI, int /*long*/ localName, int[] _retval) { + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 16, getAddress(), namespaceURI, localName, _retval); + } + + public int GetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 17, getAddress(), cx, aOnmouseenter); + } + + public int SetOnmouseenter(int /*long*/ cx, int /*long*/ aOnmouseenter) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 18, getAddress(), cx, aOnmouseenter); + } + + public int GetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 19, getAddress(), cx, aOnmouseleave); + } + + public int SetOnmouseleave(int /*long*/ cx, int /*long*/ aOnmouseleave) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsIDOMNode.LAST_METHOD_ID + 20, getAddress(), cx, aOnmouseleave); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMNode.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMNode.java index 61e02ad138..088908bed2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMNode.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIDOMNode.java @@ -1,231 +1,231 @@ -/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by Netscape are Copyright (C) 1998-1999
- * Netscape Communications Corporation. All Rights Reserved.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
-
-public class nsIDOMNode extends nsISupports {
-
- static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 36 : 25);
-
- public static final String NS_IDOMNODE_IID_STR =
- "a6cf907c-15b3-11d2-932e-00805f8add32";
-
- public static final String NS_IDOMNODE_10_IID_STR =
- "ce82fb71-60f2-4c38-be31-de5f2f90dada";
-
- public static final nsID NS_IDOMNODE_IID =
- new nsID(NS_IDOMNODE_IID_STR);
-
- public static final nsID NS_IDOMNODE_10_IID =
- new nsID(NS_IDOMNODE_10_IID_STR);
-
- public nsIDOMNode(int /*long*/ address) {
- super(address);
- }
-
- public static final int ELEMENT_NODE = 1;
- public static final int ATTRIBUTE_NODE = 2;
- public static final int TEXT_NODE = 3;
- public static final int CDATA_SECTION_NODE = 4;
- public static final int ENTITY_REFERENCE_NODE = 5;
- public static final int ENTITY_NODE = 6;
- public static final int PROCESSING_INSTRUCTION_NODE = 7;
- public static final int COMMENT_NODE = 8;
- public static final int DOCUMENT_NODE = 9;
- public static final int DOCUMENT_TYPE_NODE = 10;
- public static final int DOCUMENT_FRAGMENT_NODE = 11;
- public static final int NOTATION_NODE = 12;
-
- public int GetNodeName(int /*long*/ aNodeName) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aNodeName);
- }
-
- public int GetNodeValue(int /*long*/ aNodeValue) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aNodeValue);
- }
-
- public int SetNodeValue(int /*long*/ aNodeValue) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aNodeValue);
- }
-
- public int GetNodeType(short[] aNodeType) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aNodeType);
- }
-
- public int GetParentNode(int /*long*/[] aParentNode) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aParentNode);
- }
-
- public int GetParentElement(int /*long*/[] aParentElement) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aParentElement);
- }
-
- public int GetChildNodes(int /*long*/[] aChildNodes) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 7 : 6), getAddress(), aChildNodes);
- }
-
- public int GetFirstChild(int /*long*/[] aFirstChild) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 8 : 7), getAddress(), aFirstChild);
- }
-
- public int GetLastChild(int /*long*/[] aLastChild) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 9 : 8), getAddress(), aLastChild);
- }
-
- public int GetPreviousSibling(int /*long*/[] aPreviousSibling) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 10 : 9), getAddress(), aPreviousSibling);
- }
-
- public int GetNextSibling(int /*long*/[] aNextSibling) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 11 : 10), getAddress(), aNextSibling);
- }
-
- public int GetAttributes(int /*long*/[] aAttributes) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 12 : 11), getAddress(), aAttributes);
- }
-
- public int GetOwnerDocument(int /*long*/[] aOwnerDocument) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 13 : 12), getAddress(), aOwnerDocument);
- }
-
- public int InsertBefore(int /*long*/ newChild, int /*long*/ refChild, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 14 : 13), getAddress(), newChild, refChild, _retval);
- }
-
- public int ReplaceChild(int /*long*/ newChild, int /*long*/ oldChild, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 15 : 14), getAddress(), newChild, oldChild, _retval);
- }
-
- public int RemoveChild(int /*long*/ oldChild, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 16 : 15), getAddress(), oldChild, _retval);
- }
-
- public int AppendChild(int /*long*/ newChild, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 17 : 16), getAddress(), newChild, _retval);
- }
-
- public int HasChildNodes(int[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 18 : 17), getAddress(), _retval);
- }
-
- public int CloneNode(int deep, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 19 : 18), getAddress(), deep, _retval);
- }
-
- public int Normalize() {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 20 : 19), getAddress());
- }
-
- public int IsSupported(int /*long*/ feature, int /*long*/ version, int[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 21 : 20), getAddress(), feature, version, _retval);
- }
-
- public int GetNamespaceURI(int /*long*/ aNamespaceURI) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 22 : 21), getAddress(), aNamespaceURI);
- }
-
- public int GetPrefix(int /*long*/ aPrefix) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 23 : 22), getAddress(), aPrefix);
- }
-
- public int SetPrefix(int /*long*/ aPrefix) {
- if (IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aPrefix);
- }
-
- public int GetLocalName(int /*long*/ aLocalName) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aLocalName);
- }
-
- public int HasAttributes(int[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), _retval);
- }
-
- public int GetDOMBaseURI(int /*long*/ aBaseURI) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aBaseURI);
- }
-
- /* the following constants are defined in Mozilla 10 */
- public static final int DOCUMENT_POSITION_DISCONNECTED = 1;
- public static final int DOCUMENT_POSITION_PRECEDING = 2;
- public static final int DOCUMENT_POSITION_FOLLOWING = 4;
- public static final int DOCUMENT_POSITION_CONTAINS = 8;
- public static final int DOCUMENT_POSITION_CONTAINED_BY = 16;
- public static final int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
-
- public int CompareDocumentPosition(int /*long*/ other, short[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), other, _retval);
- }
-
- public int GetTextContent(int /*long*/ aTextContent) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aTextContent);
- }
-
- public int SetTextContent(int /*long*/ aTextContent) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aTextContent);
- }
-
- public int LookupPrefix(int /*long*/ namespaceURI, int /*long*/ _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), namespaceURI, _retval);
- }
-
- public int IsDefaultNamespace(int /*long*/ namespaceURI, int[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), namespaceURI, _retval);
- }
-
- public int LookupNamespaceURI(int /*long*/ prefix, int /*long*/ _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), prefix, _retval);
- }
-
- public int IsEqualNode(int /*long*/ arg, int[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), arg, _retval);
- }
-
- public int SetUserData(int /*long*/ key, int /*long*/ data, int /*long*/ handler, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), key, data, handler, _retval);
- }
-
- public int GetUserData(int /*long*/ key, int /*long*/[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), key, _retval);
- }
-
- public int Contains(int /*long*/ aOther, int[] _retval) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aOther, _retval);
- }
-}
+/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2011 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIDOMNode extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 36 : 25); + + public static final String NS_IDOMNODE_IID_STR = + "a6cf907c-15b3-11d2-932e-00805f8add32"; + + public static final String NS_IDOMNODE_10_IID_STR = + "ce82fb71-60f2-4c38-be31-de5f2f90dada"; + + public static final nsID NS_IDOMNODE_IID = + new nsID(NS_IDOMNODE_IID_STR); + + public static final nsID NS_IDOMNODE_10_IID = + new nsID(NS_IDOMNODE_10_IID_STR); + + public nsIDOMNode(int /*long*/ address) { + super(address); + } + + public static final int ELEMENT_NODE = 1; + public static final int ATTRIBUTE_NODE = 2; + public static final int TEXT_NODE = 3; + public static final int CDATA_SECTION_NODE = 4; + public static final int ENTITY_REFERENCE_NODE = 5; + public static final int ENTITY_NODE = 6; + public static final int PROCESSING_INSTRUCTION_NODE = 7; + public static final int COMMENT_NODE = 8; + public static final int DOCUMENT_NODE = 9; + public static final int DOCUMENT_TYPE_NODE = 10; + public static final int DOCUMENT_FRAGMENT_NODE = 11; + public static final int NOTATION_NODE = 12; + + public int GetNodeName(int /*long*/ aNodeName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aNodeName); + } + + public int GetNodeValue(int /*long*/ aNodeValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aNodeValue); + } + + public int SetNodeValue(int /*long*/ aNodeValue) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aNodeValue); + } + + public int GetNodeType(short[] aNodeType) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aNodeType); + } + + public int GetParentNode(int /*long*/[] aParentNode) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aParentNode); + } + + public int GetParentElement(int /*long*/[] aParentElement) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aParentElement); + } + + public int GetChildNodes(int /*long*/[] aChildNodes) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 7 : 6), getAddress(), aChildNodes); + } + + public int GetFirstChild(int /*long*/[] aFirstChild) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 8 : 7), getAddress(), aFirstChild); + } + + public int GetLastChild(int /*long*/[] aLastChild) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 9 : 8), getAddress(), aLastChild); + } + + public int GetPreviousSibling(int /*long*/[] aPreviousSibling) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 10 : 9), getAddress(), aPreviousSibling); + } + + public int GetNextSibling(int /*long*/[] aNextSibling) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 11 : 10), getAddress(), aNextSibling); + } + + public int GetAttributes(int /*long*/[] aAttributes) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 12 : 11), getAddress(), aAttributes); + } + + public int GetOwnerDocument(int /*long*/[] aOwnerDocument) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 13 : 12), getAddress(), aOwnerDocument); + } + + public int InsertBefore(int /*long*/ newChild, int /*long*/ refChild, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 14 : 13), getAddress(), newChild, refChild, _retval); + } + + public int ReplaceChild(int /*long*/ newChild, int /*long*/ oldChild, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 15 : 14), getAddress(), newChild, oldChild, _retval); + } + + public int RemoveChild(int /*long*/ oldChild, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 16 : 15), getAddress(), oldChild, _retval); + } + + public int AppendChild(int /*long*/ newChild, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 17 : 16), getAddress(), newChild, _retval); + } + + public int HasChildNodes(int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 18 : 17), getAddress(), _retval); + } + + public int CloneNode(int deep, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 19 : 18), getAddress(), deep, _retval); + } + + public int Normalize() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 20 : 19), getAddress()); + } + + public int IsSupported(int /*long*/ feature, int /*long*/ version, int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 21 : 20), getAddress(), feature, version, _retval); + } + + public int GetNamespaceURI(int /*long*/ aNamespaceURI) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 22 : 21), getAddress(), aNamespaceURI); + } + + public int GetPrefix(int /*long*/ aPrefix) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 23 : 22), getAddress(), aPrefix); + } + + public int SetPrefix(int /*long*/ aPrefix) { + if (IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aPrefix); + } + + public int GetLocalName(int /*long*/ aLocalName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aLocalName); + } + + public int HasAttributes(int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), _retval); + } + + public int GetDOMBaseURI(int /*long*/ aBaseURI) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aBaseURI); + } + + /* the following constants are defined in Mozilla 10 */ + public static final int DOCUMENT_POSITION_DISCONNECTED = 1; + public static final int DOCUMENT_POSITION_PRECEDING = 2; + public static final int DOCUMENT_POSITION_FOLLOWING = 4; + public static final int DOCUMENT_POSITION_CONTAINS = 8; + public static final int DOCUMENT_POSITION_CONTAINED_BY = 16; + public static final int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32; + + public int CompareDocumentPosition(int /*long*/ other, short[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), other, _retval); + } + + public int GetTextContent(int /*long*/ aTextContent) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aTextContent); + } + + public int SetTextContent(int /*long*/ aTextContent) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aTextContent); + } + + public int LookupPrefix(int /*long*/ namespaceURI, int /*long*/ _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), namespaceURI, _retval); + } + + public int IsDefaultNamespace(int /*long*/ namespaceURI, int[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), namespaceURI, _retval); + } + + public int LookupNamespaceURI(int /*long*/ prefix, int /*long*/ _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), prefix, _retval); + } + + public int IsEqualNode(int /*long*/ arg, int[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), arg, _retval); + } + + public int SetUserData(int /*long*/ key, int /*long*/ data, int /*long*/ handler, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), key, data, handler, _retval); + } + + public int GetUserData(int /*long*/ key, int /*long*/[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), key, _retval); + } + + public int Contains(int /*long*/ aOther, int[] _retval) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aOther, _retval); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java index 6c4bd5b0b6..ae74cec393 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIFocusManager.java @@ -1,137 +1,137 @@ -/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by Netscape are Copyright (C) 1998-1999
- * Netscape Communications Corporation. All Rights Reserved.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2011 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
-
-public class nsIFocusManager extends nsISupports {
-
- static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 18 : 17);
-
- public static final String NS_IFOCUSMANAGER_IID_STR =
- "cd6040a8-243f-412a-8a16-0bf2aa1083b9";
-
- public static final String NS_IFOCUSMANAGER_10_IID_STR =
- "51db277b-7ee7-4bce-9b84-fd2efcd2c8bd";
-
- public static final nsID NS_IFOCUSMANAGER_IID =
- new nsID(NS_IFOCUSMANAGER_IID_STR);
-
- public static final nsID NS_IFOCUSMANAGER_10_IID =
- new nsID(NS_IFOCUSMANAGER_10_IID_STR);
-
- public nsIFocusManager(int /*long*/ address) {
- super(address);
- }
-
- public int GetActiveWindow(int /*long*/[] aActiveWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aActiveWindow);
- }
-
- public int SetActiveWindow(int /*long*/ aActiveWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aActiveWindow);
- }
-
- public int GetFocusedWindow(int /*long*/[] aFocusedWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aFocusedWindow);
- }
-
- public int SetFocusedWindow(int /*long*/ aFocusedWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aFocusedWindow);
- }
-
- public int GetFocusedElement(int /*long*/[] aFocusedElement) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aFocusedElement);
- }
-
- public int GetLastFocusMethod(int /*long*/ window, int[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), window, _retval);
- }
-
- public int SetFocus(int /*long*/ aElement, int aFlags) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aElement, aFlags);
- }
-
- public int MoveFocus(int /*long*/ aWindow, int /*long*/ aStartElement, int aType, int aFlags, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aWindow, aStartElement, aType, aFlags, _retval);
- }
-
- public int ClearFocus(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aWindow);
- }
-
- public int GetFocusedElementForWindow(int /*long*/ aWindow, int aDeep, int /*long*/[] aFocusedWindow, int /*long*/[] _retval) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aWindow, aDeep, aFocusedWindow, _retval);
- }
-
- public int MoveCaretToFocus(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aWindow);
- }
-
- public static final int FLAG_RAISE = 1;
- public static final int FLAG_NOSCROLL = 2;
- public static final int FLAG_NOSWITCHFRAME = 4;
- public static final int FLAG_BYMOUSE = 4096;
- public static final int FLAG_BYKEY = 8192;
- public static final int FLAG_BYMOVEFOCUS = 16384;
- public static final int MOVEFOCUS_FORWARD = 1;
- public static final int MOVEFOCUS_BACKWARD = 2;
- public static final int MOVEFOCUS_FORWARDDOC = 3;
- public static final int MOVEFOCUS_BACKWARDDOC = 4;
- public static final int MOVEFOCUS_FIRST = 5;
- public static final int MOVEFOCUS_LAST = 6;
- public static final int MOVEFOCUS_ROOT = 7;
- public static final int MOVEFOCUS_CARET = 8;
-
- public int WindowRaised(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aWindow);
- }
-
- public int WindowLowered(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aWindow);
- }
-
- public int ContentRemoved(int /*long*/ aDocument, int /*long*/ aElement) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aDocument, aElement);
- }
-
- public int WindowShown(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aWindow);
- }
-
- public int WindowHidden(int /*long*/ aWindow) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aWindow);
- }
-
- public int FireDelayedEvents(int /*long*/ aDocument) {
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aDocument);
- }
-
- public int FocusPlugin(int /*long*/ aPlugin) {
- if (!IsXULRunner10) return XPCOM.NS_COMFALSE;
- return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aPlugin);
- }
-}
+/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2011 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIFocusManager extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + (IsXULRunner10 ? 18 : 17); + + public static final String NS_IFOCUSMANAGER_IID_STR = + "cd6040a8-243f-412a-8a16-0bf2aa1083b9"; + + public static final String NS_IFOCUSMANAGER_10_IID_STR = + "51db277b-7ee7-4bce-9b84-fd2efcd2c8bd"; + + public static final nsID NS_IFOCUSMANAGER_IID = + new nsID(NS_IFOCUSMANAGER_IID_STR); + + public static final nsID NS_IFOCUSMANAGER_10_IID = + new nsID(NS_IFOCUSMANAGER_10_IID_STR); + + public nsIFocusManager(int /*long*/ address) { + super(address); + } + + public int GetActiveWindow(int /*long*/[] aActiveWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aActiveWindow); + } + + public int SetActiveWindow(int /*long*/ aActiveWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aActiveWindow); + } + + public int GetFocusedWindow(int /*long*/[] aFocusedWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aFocusedWindow); + } + + public int SetFocusedWindow(int /*long*/ aFocusedWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aFocusedWindow); + } + + public int GetFocusedElement(int /*long*/[] aFocusedElement) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aFocusedElement); + } + + public int GetLastFocusMethod(int /*long*/ window, int[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), window, _retval); + } + + public int SetFocus(int /*long*/ aElement, int aFlags) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aElement, aFlags); + } + + public int MoveFocus(int /*long*/ aWindow, int /*long*/ aStartElement, int aType, int aFlags, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aWindow, aStartElement, aType, aFlags, _retval); + } + + public int ClearFocus(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aWindow); + } + + public int GetFocusedElementForWindow(int /*long*/ aWindow, int aDeep, int /*long*/[] aFocusedWindow, int /*long*/[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aWindow, aDeep, aFocusedWindow, _retval); + } + + public int MoveCaretToFocus(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aWindow); + } + + public static final int FLAG_RAISE = 1; + public static final int FLAG_NOSCROLL = 2; + public static final int FLAG_NOSWITCHFRAME = 4; + public static final int FLAG_BYMOUSE = 4096; + public static final int FLAG_BYKEY = 8192; + public static final int FLAG_BYMOVEFOCUS = 16384; + public static final int MOVEFOCUS_FORWARD = 1; + public static final int MOVEFOCUS_BACKWARD = 2; + public static final int MOVEFOCUS_FORWARDDOC = 3; + public static final int MOVEFOCUS_BACKWARDDOC = 4; + public static final int MOVEFOCUS_FIRST = 5; + public static final int MOVEFOCUS_LAST = 6; + public static final int MOVEFOCUS_ROOT = 7; + public static final int MOVEFOCUS_CARET = 8; + + public int WindowRaised(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aWindow); + } + + public int WindowLowered(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aWindow); + } + + public int ContentRemoved(int /*long*/ aDocument, int /*long*/ aElement) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aDocument, aElement); + } + + public int WindowShown(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aWindow); + } + + public int WindowHidden(int /*long*/ aWindow) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aWindow); + } + + public int FireDelayedEvents(int /*long*/ aDocument) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aDocument); + } + + public int FocusPlugin(int /*long*/ aPlugin) { + if (!IsXULRunner10) return XPCOM.NS_COMFALSE; + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aPlugin); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_8.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_8.java index ac10eead2d..a593aa0022 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_8.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIHelperAppLauncher_8.java @@ -1,87 +1,87 @@ -/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by Netscape are Copyright (C) 1998-1999
- * Netscape Communications Corporation. All Rights Reserved.
- *
- * Contributor(s):
- *
- * IBM
- * - Binding to permit interfacing between Mozilla and SWT
- * - Copyright (C) 2012 IBM Corp. All Rights Reserved.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.eclipse.swt.internal.mozilla;
-
-public class nsIHelperAppLauncher_8 extends nsICancelable {
-
- static final int LAST_METHOD_ID = nsICancelable.LAST_METHOD_ID + 11;
-
- public static final String NS_IHELPERAPPLAUNCHER_IID_STR =
- "d9a19faf-497b-408c-b995-777d956b72c0";
-
- public static final nsID NS_IHELPERAPPLAUNCHER_IID =
- new nsID(NS_IHELPERAPPLAUNCHER_IID_STR);
-
- public nsIHelperAppLauncher_8(int /*long*/ address) {
- super(address);
- }
-
- public int GetMIMEInfo(int /*long*/[] aMIMEInfo) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo);
- }
-
- public int GetSource(int /*long*/[] aSource) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 2, getAddress(), aSource);
- }
-
- public int GetSuggestedFileName(int /*long*/ aSuggestedFileName) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName);
- }
-
- public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference);
- }
-
- public int LaunchWithApplication(int /*long*/ aApplication, int aRememberThisPreference) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference);
- }
-
- public int SetWebProgressListener(int /*long*/ aWebProgressListener) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 6, getAddress(), aWebProgressListener);
- }
-
- public int CloseProgressWindow() {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 7, getAddress());
- }
-
- public int GetTargetFile(int /*long*/[] aTargetFile) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 8, getAddress(), aTargetFile);
- }
-
- public int GetTargetFileIsExecutable(int[] aTargetFileIsExecutable) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 9, getAddress(), aTargetFileIsExecutable);
- }
-
- public int GetTimeDownloadStarted(int /*long*/ aTimeDownloadStarted) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 10, getAddress(), aTimeDownloadStarted);
- }
-
- public int GetContentLength(int /*long*/ aContentLength) {
- return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 11, getAddress(), aContentLength);
- }
-}
+/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2012 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIHelperAppLauncher_8 extends nsICancelable { + + static final int LAST_METHOD_ID = nsICancelable.LAST_METHOD_ID + 11; + + public static final String NS_IHELPERAPPLAUNCHER_IID_STR = + "d9a19faf-497b-408c-b995-777d956b72c0"; + + public static final nsID NS_IHELPERAPPLAUNCHER_IID = + new nsID(NS_IHELPERAPPLAUNCHER_IID_STR); + + public nsIHelperAppLauncher_8(int /*long*/ address) { + super(address); + } + + public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo); + } + + public int GetSource(int /*long*/[] aSource) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 2, getAddress(), aSource); + } + + public int GetSuggestedFileName(int /*long*/ aSuggestedFileName) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName); + } + + public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference); + } + + public int LaunchWithApplication(int /*long*/ aApplication, int aRememberThisPreference) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference); + } + + public int SetWebProgressListener(int /*long*/ aWebProgressListener) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 6, getAddress(), aWebProgressListener); + } + + public int CloseProgressWindow() { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 7, getAddress()); + } + + public int GetTargetFile(int /*long*/[] aTargetFile) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 8, getAddress(), aTargetFile); + } + + public int GetTargetFileIsExecutable(int[] aTargetFileIsExecutable) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 9, getAddress(), aTargetFileIsExecutable); + } + + public int GetTimeDownloadStarted(int /*long*/ aTimeDownloadStarted) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 10, getAddress(), aTimeDownloadStarted); + } + + public int GetContentLength(int /*long*/ aContentLength) { + return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 11, getAddress(), aContentLength); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java index 224d91df4e..cf9aef46b8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/DTTOPTS.java @@ -1,32 +1,32 @@ -/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.win32;
-
-
-public class DTTOPTS {
- public int dwSize;
- public int dwFlags;
- public int /*long*/ crText;
- public int /*long*/ crBorder;
- public int /*long*/ crShadow;
- public int iTextShadowType;
- public POINT ptShadowOffset;
- public int iBorderSize;
- public int iFontPropId;
- public int iColorPropId;
- public int iStateId;
- public boolean fApplyOverlay;
- public int iGlowSize;
- /** @field cast=(DTT_CALLBACK_PROC) */
- public int /*long*/ pfnDrawTextCallback;
- public int /*long*/ lParam;
- public static final int sizeof = OS.DTTOPTS_sizeof ();
+/******************************************************************************* + * Copyright (c) 2011 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.win32; + + +public class DTTOPTS { + public int dwSize; + public int dwFlags; + public int /*long*/ crText; + public int /*long*/ crBorder; + public int /*long*/ crShadow; + public int iTextShadowType; + public POINT ptShadowOffset; + public int iBorderSize; + public int iFontPropId; + public int iColorPropId; + public int iStateId; + public boolean fApplyOverlay; + public int iGlowSize; + /** @field cast=(DTT_CALLBACK_PROC) */ + public int /*long*/ pfnDrawTextCallback; + public int /*long*/ lParam; + public static final int sizeof = OS.DTTOPTS_sizeof (); }
\ No newline at end of file diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentEvent.java index 336cebf359..34226bcc46 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentEvent.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentEvent.java @@ -1,100 +1,100 @@ -/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.events;
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * This event is sent to SegmentListeners when a text content is to be modified.
- * The segments field can be used in conjunction with the segmentsChars field or
- * by itself. Setting only the segmentsChars field has no effect. When used by
- * itself, the segments field specify text ranges that should be treated as
- * separate segments.
- * <p>
- * The elements in the segments field specify the start offset of a segment
- * relative to the start of the text. They must follow the following rules:
- * <ul>
- * <li>elements must be in ascending order and must not have duplicates
- * <li>elements must not exceed the text length
- * </ul>
- * In addition, the first element may be set to zero and the last element may
- * be set to the end of the line but this is not required.
- *
- * The segments field may be left null if the entire text content doesn't
- * require segmentation.
- * </p>
- * A SegmentListener may be used when adjacent segments of right-to-left text
- * should not be reordered relative to each other. For example, within a Java
- * editor, you may wish multiple right-to-left string literals to be reordered
- * differently than the bidi algorithm specifies.
- *
- * Example:
- * <pre>
- * stored text = "R1R2R3" + "R4R5R6"
- * R1 to R6 are right-to-left characters. The quotation marks
- * are part of the text. The text is 13 characters long.
- *
- * segments = null:
- * entire text content will be reordered and thus the two R2L segments
- * swapped (as per the bidi algorithm).
- * visual display (rendered on screen) = "R6R5R4" + "R3R2R1"
- *
- * segments = [0, 5, 8]
- * "R1R2R3" will be reordered, followed by [blank]+[blank] and
- * "R4R5R6".
- * visual display = "R3R2R1" + "R6R5R4"
- * </pre>
- *
- * <p>
- * The segments and segementsChars fields can be used together to obtain different
- * types of bidi reordering and text display. The application can use these two fields
- * to insert Unicode Control Characters in specific offsets in the text, the character
- * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields
- * are set, the rules for the segments field are less restrictive:
- * <ul>
- * <li>elements must be in ascending order, duplicates are allowed
- * <li>elements must not exceed the text length
- * </ul>
- * </p>
- *
- * @since 3.8
- */
-
-public class SegmentEvent extends TypedEvent {
-
- /**
- * The start offset of the <code>lineText</code> relative to text (always zero for single line widget)
- */
- public int lineOffset;
-
- /**
- * Text used to calculate the segments
- */
- public String lineText;
-
- /**
- * Text ranges that should be treated as separate segments (e.g. for bidi reordering)
- */
- public int[] segments;
-
- /**
- * Characters to be used in the segment boundaries (optional)
- */
- public char[] segmentsChars;
-
- static final long serialVersionUID = -2414889726745247762L;
-
- public SegmentEvent(Event e) {
- super(e);
- lineText = e.text;
- lineOffset = e.detail;
- }
-}
+/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.events; + +import org.eclipse.swt.widgets.Event; + +/** + * This event is sent to SegmentListeners when a text content is to be modified. + * The segments field can be used in conjunction with the segmentsChars field or + * by itself. Setting only the segmentsChars field has no effect. When used by + * itself, the segments field specify text ranges that should be treated as + * separate segments. + * <p> + * The elements in the segments field specify the start offset of a segment + * relative to the start of the text. They must follow the following rules: + * <ul> + * <li>elements must be in ascending order and must not have duplicates + * <li>elements must not exceed the text length + * </ul> + * In addition, the first element may be set to zero and the last element may + * be set to the end of the line but this is not required. + * + * The segments field may be left null if the entire text content doesn't + * require segmentation. + * </p> + * A SegmentListener may be used when adjacent segments of right-to-left text + * should not be reordered relative to each other. For example, within a Java + * editor, you may wish multiple right-to-left string literals to be reordered + * differently than the bidi algorithm specifies. + * + * Example: + * <pre> + * stored text = "R1R2R3" + "R4R5R6" + * R1 to R6 are right-to-left characters. The quotation marks + * are part of the text. The text is 13 characters long. + * + * segments = null: + * entire text content will be reordered and thus the two R2L segments + * swapped (as per the bidi algorithm). + * visual display (rendered on screen) = "R6R5R4" + "R3R2R1" + * + * segments = [0, 5, 8] + * "R1R2R3" will be reordered, followed by [blank]+[blank] and + * "R4R5R6". + * visual display = "R3R2R1" + "R6R5R4" + * </pre> + * + * <p> + * The segments and segementsChars fields can be used together to obtain different + * types of bidi reordering and text display. The application can use these two fields + * to insert Unicode Control Characters in specific offsets in the text, the character + * at segmentsChars[i] is inserted at the offset specified by segments[i]. When both fields + * are set, the rules for the segments field are less restrictive: + * <ul> + * <li>elements must be in ascending order, duplicates are allowed + * <li>elements must not exceed the text length + * </ul> + * </p> + * + * @since 3.8 + */ + +public class SegmentEvent extends TypedEvent { + + /** + * The start offset of the <code>lineText</code> relative to text (always zero for single line widget) + */ + public int lineOffset; + + /** + * Text used to calculate the segments + */ + public String lineText; + + /** + * Text ranges that should be treated as separate segments (e.g. for bidi reordering) + */ + public int[] segments; + + /** + * Characters to be used in the segment boundaries (optional) + */ + public char[] segmentsChars; + + static final long serialVersionUID = -2414889726745247762L; + + public SegmentEvent(Event e) { + super(e); + lineText = e.text; + lineOffset = e.detail; + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentListener.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentListener.java index 9b7ec29018..ff5e814126 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentListener.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/SegmentListener.java @@ -1,38 +1,38 @@ -/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.events;
-
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * This listener interface may be implemented in order to receive
- * SegmentEvents.
- * @see SegmentEvent
- */
-public interface SegmentListener extends SWTEventListener {
-
-/**
- * This method is called when text content is being modified.
- * <p>
- * The following event fields are used:<ul>
- * <li>event.text text content (input)</li>
- * <li>event.segmentsChars characters that should be inserted (output)</li>
- * <li>event.segments text offsets for segment characters (output)</li>
- * </ul>
- *
- * @param event the given event
- * @see SegmentEvent
- *
- * @since 3.8
- */
-public void getSegments(SegmentEvent event);
-
-}
+/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.events; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * This listener interface may be implemented in order to receive + * SegmentEvents. + * @see SegmentEvent + */ +public interface SegmentListener extends SWTEventListener { + +/** + * This method is called when text content is being modified. + * <p> + * The following event fields are used:<ul> + * <li>event.text text content (input)</li> + * <li>event.segmentsChars characters that should be inserted (output)</li> + * <li>event.segments text offsets for segment characters (output)</li> + * </ul> + * + * @param event the given event + * @see SegmentEvent + * + * @since 3.8 + */ +public void getSegments(SegmentEvent event); + +} diff --git a/bundles/org.eclipse.swt/tasks/classpath.xls b/bundles/org.eclipse.swt/tasks/classpath.xls index de5b22342d..b3273de86b 100644 --- a/bundles/org.eclipse.swt/tasks/classpath.xls +++ b/bundles/org.eclipse.swt/tasks/classpath.xls @@ -1,25 +1,25 @@ -<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:param name="srcDir"/>
-<xsl:param name="outputDir"/>
-<xsl:template match="/">
-<project name="test" default="copy_files" basedir=".">
-<target name="copy_files">
- <copy>
- <xsl:attribute name="todir">
- <xsl:value-of select="$outputDir" />
- </xsl:attribute>
- <xsl:for-each select="classpath/classpathentry">
- <xsl:if test="@kind = 'src'">
- <fileset>
- <xsl:attribute name="dir"><xsl:value-of select="$srcDir"/>/<xsl:value-of select="@path"/></xsl:attribute>
- <include name="**/*.java"/>
- </fileset>
- </xsl:if>
- </xsl:for-each>
- </copy>
-</target>
-</project>
-</xsl:template>
-</xsl:stylesheet>
+<?xml version="1.0" encoding="ISO-8859-1"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:param name="srcDir"/> +<xsl:param name="outputDir"/> +<xsl:template match="/"> +<project name="test" default="copy_files" basedir="."> +<target name="copy_files"> + <copy> + <xsl:attribute name="todir"> + <xsl:value-of select="$outputDir" /> + </xsl:attribute> + <xsl:for-each select="classpath/classpathentry"> + <xsl:if test="@kind = 'src'"> + <fileset> + <xsl:attribute name="dir"><xsl:value-of select="$srcDir"/>/<xsl:value-of select="@path"/></xsl:attribute> + <include name="**/*.java"/> + </fileset> + </xsl:if> + </xsl:for-each> + </copy> +</target> +</project> +</xsl:template> +</xsl:stylesheet> diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/style.css b/examples/org.eclipse.swt.examples.browser.demos/css1/style.css index 7b36fa934a..ed5d648c6a 100644 --- a/examples/org.eclipse.swt.examples.browser.demos/css1/style.css +++ b/examples/org.eclipse.swt.examples.browser.demos/css1/style.css @@ -1,30 +1,30 @@ -body {background: url(./back2.jpg) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: center;}
-table { border-collapse: collapse; margin: 0;}
-tr {}
-td {height: 32px; width:32px; table-layout: fixed;}
-
-.whitelink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-.blacklink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-.empty {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-
-.whitelink a:hover {display: block; background: url(./white.gif) no-repeat; width:32px; height:32px;}
-.blacklink a:hover {display: block; background: url(./black.gif) no-repeat; width:32px; height:32px;}
-.white {background: url(./white.gif) no-repeat;}
-.black {background: url(./black.gif) no-repeat;}
-.wall {background: url(./wall.gif) no-repeat;}
-
-.playerwhite {float: left; margin: 1em 1em; border: 1px solid gray; background: url(./white.gif) no-repeat; text-align: right; width:100px; height:32px;}
-.playerblack {float: right; margin: 1em 1em; border: 1px solid gray; background: url(./black.gif) no-repeat; text-align: right; width:100px; height:32px;}
-
-.winner {border: 4px solid blue; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
+body {background: url(./back2.jpg) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;} +h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} + +ul {list-style: none; padding: 0; margin:0; font: 12pt Times;} +li.white {background: url(./white.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.black {background: url(./black.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.wall {background: url(./wall.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} + +.board {text-align: center;} +table { border-collapse: collapse; margin: 0;} +tr {} +td {height: 32px; width:32px; table-layout: fixed;} + +.whitelink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;} +.blacklink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;} +.empty {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;} + +.whitelink a:hover {display: block; background: url(./white.gif) no-repeat; width:32px; height:32px;} +.blacklink a:hover {display: block; background: url(./black.gif) no-repeat; width:32px; height:32px;} +.white {background: url(./white.gif) no-repeat;} +.black {background: url(./black.gif) no-repeat;} +.wall {background: url(./wall.gif) no-repeat;} + +.playerwhite {float: left; margin: 1em 1em; border: 1px solid gray; background: url(./white.gif) no-repeat; text-align: right; width:100px; height:32px;} +.playerblack {float: right; margin: 1em 1em; border: 1px solid gray; background: url(./black.gif) no-repeat; text-align: right; width:100px; height:32px;} + +.winner {border: 4px solid blue; font: bold 16pt Times, serif;} +.loser {border: 1px solid black; font: 12pt Times, serif;} diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/style.css b/examples/org.eclipse.swt.examples.browser.demos/css2/style.css index 590749c6b1..ad139626a5 100644 --- a/examples/org.eclipse.swt.examples.browser.demos/css2/style.css +++ b/examples/org.eclipse.swt.examples.browser.demos/css2/style.css @@ -1,30 +1,30 @@ -body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./white_chip.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./black_chip.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./white_chip.gif) no-repeat;}
-.black {background: url(./black_chip.gif) no-repeat;}
-.wall {background: url(./wall_chip.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
+body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;} +h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} + +ul {list-style: none; padding: 0; margin:0; font: 12pt Times;} +li.white {background: url(./white_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.black {background: url(./black_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.wall {background: url(./wall_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} + +.board {text-align: left;} +table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)} +tr {} +td {height:48px; width:48px; table-layout: fixed;} + +.whitelink a {display: block; width:48px; height:48px;} +.blacklink a {display: block; width:48px; height:48px;} +.empty {display: block; width:48px; height:48px;} + +.whitelink a:hover {display: block; background: url(./white_chip.gif) no-repeat; width:48px; height:48px;} +.blacklink a:hover {display: block; background: url(./black_chip.gif) no-repeat; width:48px; height:48px;} +.white {background: url(./white_chip.gif) no-repeat;} +.black {background: url(./black_chip.gif) no-repeat;} +.wall {background: url(./wall_chip.gif) no-repeat;} + +.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} +.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} + +.winner {border: 4px solid white; font: bold 16pt Times, serif;} +.loser {border: 1px solid black; font: 12pt Times, serif;} diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/style.css b/examples/org.eclipse.swt.examples.browser.demos/css3/style.css index bddf04e514..11cc691c97 100644 --- a/examples/org.eclipse.swt.examples.browser.demos/css3/style.css +++ b/examples/org.eclipse.swt.examples.browser.demos/css3/style.css @@ -1,30 +1,30 @@ -body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./white_pawn.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./black_pawn.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./white_pawn.gif) no-repeat;}
-.black {background: url(./black_pawn.gif) no-repeat;}
-.wall {background: url(./wall_pawn.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
+body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;} +h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} + +ul {list-style: none; padding: 0; margin:0; font: 12pt Times;} +li.white {background: url(./white_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.black {background: url(./black_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.wall {background: url(./wall_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} + +.board {text-align: left;} +table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)} +tr {} +td {height:48px; width:48px; table-layout: fixed;} + +.whitelink a {display: block; width:48px; height:48px;} +.blacklink a {display: block; width:48px; height:48px;} +.empty {display: block; width:48px; height:48px;} + +.whitelink a:hover {display: block; background: url(./white_pawn.gif) no-repeat; width:48px; height:48px;} +.blacklink a:hover {display: block; background: url(./black_pawn.gif) no-repeat; width:48px; height:48px;} +.white {background: url(./white_pawn.gif) no-repeat;} +.black {background: url(./black_pawn.gif) no-repeat;} +.wall {background: url(./wall_pawn.gif) no-repeat;} + +.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} +.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} + +.winner {border: 4px solid white; font: bold 16pt Times, serif;} +.loser {border: 1px solid black; font: 12pt Times, serif;} diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/style.css b/examples/org.eclipse.swt.examples.browser.demos/css4/style.css index e15b096be0..a3a5fd7c10 100644 --- a/examples/org.eclipse.swt.examples.browser.demos/css4/style.css +++ b/examples/org.eclipse.swt.examples.browser.demos/css4/style.css @@ -1,30 +1,30 @@ -body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./blue_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./gold_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./blue_people.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./gold_people.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./blue_people.gif) no-repeat;}
-.black {background: url(./gold_people.gif) no-repeat;}
-.wall {background: url(./wall_people.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./blue_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./gold_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
+body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;} +h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} +h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;} + +ul {list-style: none; padding: 0; margin:0; font: 12pt Times;} +li.white {background: url(./blue_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.black {background: url(./gold_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} +li.wall {background: url(./wall_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;} + +.board {text-align: left;} +table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)} +tr {} +td {height:48px; width:48px; table-layout: fixed;} + +.whitelink a {display: block; width:48px; height:48px;} +.blacklink a {display: block; width:48px; height:48px;} +.empty {display: block; width:48px; height:48px;} + +.whitelink a:hover {display: block; background: url(./blue_people.gif) no-repeat; width:48px; height:48px;} +.blacklink a:hover {display: block; background: url(./gold_people.gif) no-repeat; width:48px; height:48px;} +.white {background: url(./blue_people.gif) no-repeat;} +.black {background: url(./gold_people.gif) no-repeat;} +.wall {background: url(./wall_people.gif) no-repeat;} + +.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./blue_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} +.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./gold_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;} + +.winner {border: 4px solid white; font: bold 16pt Times, serif;} +.loser {border: 1px solid black; font: 12pt Times, serif;} diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java index e157154d56..e6c463f03b 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java @@ -1,155 +1,155 @@ -/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.snippets;
-
-/*
- * TreeCursor example snippet: navigate a Tree's cells with the arrow keys.
- * Edit when user hits Return key. Exit edit mode by hitting Escape (cancels edit)
- * or Return (applies edit to tree). Expand/Collapse with MOD1+Arrow keys.
- *
- * For a list of all SWT example snippets see
- * http://www.eclipse.org/swt/snippets/
- *
- * @since 3.8
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-public class Snippet360 {
-
-public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new GridLayout());
-
- // create a a tree with 3 columns and fill with data
- final Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
- tree.setHeaderVisible(true);
- TreeColumn column1 = new TreeColumn(tree, SWT.NONE);
- TreeColumn column2 = new TreeColumn(tree, SWT.NONE);
- TreeColumn column3 = new TreeColumn(tree, SWT.NONE);
- for (int i = 0; i < 9; i++) {
- TreeItem item = new TreeItem(tree, SWT.NONE);
- item.setText(new String[] { "root " + i + " 0", "root " + i + " 1", "root " + i + " 2" });
- for (int j = 0; j < 9; j++) {
- TreeItem item2 = new TreeItem(item, SWT.NONE);
- item2.setText(new String[] { "child " + j + " 0", "child " + j + " 1", "child " + j + " 2" });
- TreeItem current = item2;
- for (int k = 0; k < 5; k++) {
- TreeItem item3 = new TreeItem(current, SWT.NONE);
- item3.setText(new String[] { "descendent " + k + " 0", "descendent " + k + " 1", "descendent " + k + " 2" });
- current = item3;
- }
- }
- }
- column1.setWidth(200);
- column2.setWidth(100);
- column3.setWidth(100);
-
- // create a TreeCursor to navigate around the tree
- final TreeCursor cursor = new TreeCursor(tree, SWT.NONE);
- // create an editor to edit the cell when the user hits "ENTER"
- // while over a cell in the tree
- final ControlEditor editor = new ControlEditor(cursor);
- editor.grabHorizontal = true;
- editor.grabVertical = true;
-
- cursor.addSelectionListener(new SelectionAdapter() {
- // when the TreeEditor is over a cell, select the corresponding row
- // in the tree
- public void widgetSelected(SelectionEvent e) {
- tree.setSelection(new TreeItem[] { cursor.getRow() });
- }
-
- // when the user hits "ENTER" in the TreeCursor, pop up a text
- // editor so that they can change the text of the cell
- public void widgetDefaultSelected(SelectionEvent e) {
- final Text text = new Text(cursor, SWT.NONE);
- TreeItem row = cursor.getRow();
- int column = cursor.getColumn();
- text.setText(row.getText(column));
- text.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- // close the text editor and copy the data over
- // when the user hits "ENTER"
- if (e.character == SWT.CR) {
- TreeItem row = cursor.getRow();
- int column = cursor.getColumn();
- row.setText(column, text.getText());
- text.dispose();
- }
- // close the text editor when the user hits "ESC"
- if (e.character == SWT.ESC) {
- text.dispose();
- }
- }
- });
- editor.setEditor(text);
- text.setFocus();
- }
- });
- // Hide the TreeCursor when the user hits the "MOD1" or "MOD2" key.
- // This allows the user to select multiple items in the tree.
- cursor.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.MOD1 || e.keyCode == SWT.MOD2
- || (e.stateMask & SWT.MOD1) != 0
- || (e.stateMask & SWT.MOD2) != 0) {
- cursor.setVisible(false);
- }
- }
- });
- // Show the TreeCursor when the user releases the "MOD2" or "MOD1" key.
- // This signals the end of the multiple selection task.
- tree.addKeyListener(new KeyListener() {
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.MOD1 && (e.stateMask & SWT.MOD2) != 0) return;
- if (e.keyCode == SWT.MOD2 && (e.stateMask & SWT.MOD1) != 0) return;
- if (e.keyCode != SWT.MOD1 && (e.stateMask & SWT.MOD1) != 0) return;
- if (e.keyCode != SWT.MOD2 && (e.stateMask & SWT.MOD2) != 0) return;
-
- TreeItem[] selection = tree.getSelection();
- TreeItem row = (selection.length == 0) ? tree.getItem(tree.indexOf(tree.getTopItem())) : selection[0];
- tree.showItem(row);
- cursor.setSelection(row, cursor.getColumn());
- cursor.setVisible(true);
- cursor.setFocus();
- }
- public void keyPressed(KeyEvent e) {
- switch (e.keyCode) {
- case SWT.ARROW_LEFT:
- case SWT.ARROW_RIGHT: {
- if ((e.stateMask & SWT.MOD1) != 0) {
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0) {
- selection[0].setExpanded(e.keyCode == SWT.ARROW_RIGHT);
- }
- break;
- }
- }
- }
- }
- });
-
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.dispose();
-}
-
-}
+/******************************************************************************* + * Copyright (c) 2011 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.snippets; + +/* + * TreeCursor example snippet: navigate a Tree's cells with the arrow keys. + * Edit when user hits Return key. Exit edit mode by hitting Escape (cancels edit) + * or Return (applies edit to tree). Expand/Collapse with MOD1+Arrow keys. + * + * For a list of all SWT example snippets see + * http://www.eclipse.org/swt/snippets/ + * + * @since 3.8 + */ +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.layout.*; +import org.eclipse.swt.widgets.*; + +public class Snippet360 { + +public static void main(String[] args) { + Display display = new Display(); + Shell shell = new Shell(display); + shell.setLayout(new GridLayout()); + + // create a a tree with 3 columns and fill with data + final Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); + tree.setLayoutData(new GridData(GridData.FILL_BOTH)); + tree.setHeaderVisible(true); + TreeColumn column1 = new TreeColumn(tree, SWT.NONE); + TreeColumn column2 = new TreeColumn(tree, SWT.NONE); + TreeColumn column3 = new TreeColumn(tree, SWT.NONE); + for (int i = 0; i < 9; i++) { + TreeItem item = new TreeItem(tree, SWT.NONE); + item.setText(new String[] { "root " + i + " 0", "root " + i + " 1", "root " + i + " 2" }); + for (int j = 0; j < 9; j++) { + TreeItem item2 = new TreeItem(item, SWT.NONE); + item2.setText(new String[] { "child " + j + " 0", "child " + j + " 1", "child " + j + " 2" }); + TreeItem current = item2; + for (int k = 0; k < 5; k++) { + TreeItem item3 = new TreeItem(current, SWT.NONE); + item3.setText(new String[] { "descendent " + k + " 0", "descendent " + k + " 1", "descendent " + k + " 2" }); + current = item3; + } + } + } + column1.setWidth(200); + column2.setWidth(100); + column3.setWidth(100); + + // create a TreeCursor to navigate around the tree + final TreeCursor cursor = new TreeCursor(tree, SWT.NONE); + // create an editor to edit the cell when the user hits "ENTER" + // while over a cell in the tree + final ControlEditor editor = new ControlEditor(cursor); + editor.grabHorizontal = true; + editor.grabVertical = true; + + cursor.addSelectionListener(new SelectionAdapter() { + // when the TreeEditor is over a cell, select the corresponding row + // in the tree + public void widgetSelected(SelectionEvent e) { + tree.setSelection(new TreeItem[] { cursor.getRow() }); + } + + // when the user hits "ENTER" in the TreeCursor, pop up a text + // editor so that they can change the text of the cell + public void widgetDefaultSelected(SelectionEvent e) { + final Text text = new Text(cursor, SWT.NONE); + TreeItem row = cursor.getRow(); + int column = cursor.getColumn(); + text.setText(row.getText(column)); + text.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + // close the text editor and copy the data over + // when the user hits "ENTER" + if (e.character == SWT.CR) { + TreeItem row = cursor.getRow(); + int column = cursor.getColumn(); + row.setText(column, text.getText()); + text.dispose(); + } + // close the text editor when the user hits "ESC" + if (e.character == SWT.ESC) { + text.dispose(); + } + } + }); + editor.setEditor(text); + text.setFocus(); + } + }); + // Hide the TreeCursor when the user hits the "MOD1" or "MOD2" key. + // This allows the user to select multiple items in the tree. + cursor.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.MOD1 || e.keyCode == SWT.MOD2 + || (e.stateMask & SWT.MOD1) != 0 + || (e.stateMask & SWT.MOD2) != 0) { + cursor.setVisible(false); + } + } + }); + // Show the TreeCursor when the user releases the "MOD2" or "MOD1" key. + // This signals the end of the multiple selection task. + tree.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent e) { + if (e.keyCode == SWT.MOD1 && (e.stateMask & SWT.MOD2) != 0) return; + if (e.keyCode == SWT.MOD2 && (e.stateMask & SWT.MOD1) != 0) return; + if (e.keyCode != SWT.MOD1 && (e.stateMask & SWT.MOD1) != 0) return; + if (e.keyCode != SWT.MOD2 && (e.stateMask & SWT.MOD2) != 0) return; + + TreeItem[] selection = tree.getSelection(); + TreeItem row = (selection.length == 0) ? tree.getItem(tree.indexOf(tree.getTopItem())) : selection[0]; + tree.showItem(row); + cursor.setSelection(row, cursor.getColumn()); + cursor.setVisible(true); + cursor.setFocus(); + } + public void keyPressed(KeyEvent e) { + switch (e.keyCode) { + case SWT.ARROW_LEFT: + case SWT.ARROW_RIGHT: { + if ((e.stateMask & SWT.MOD1) != 0) { + TreeItem[] selection = tree.getSelection(); + if (selection.length > 0) { + selection[0].setExpanded(e.keyCode == SWT.ARROW_RIGHT); + } + break; + } + } + } + } + }); + + shell.pack(); + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); +} + +} |