summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <seven>2001-09-06 13:06:46 +0000
committerCarolyn MacLeod <seven>2001-09-06 13:06:46 +0000
commit956dd6f010b039518d460b217768b56aa6fff5b6 (patch)
tree428bac86335ec86d2423addb7c203f323c7ba86e
parent524fc5a8c62e59f0bf5d40bc68980bcfc087a5e4 (diff)
downloadeclipse.platform.swt-956dd6f010b039518d460b217768b56aa6fff5b6.tar.gz
eclipse.platform.swt-956dd6f010b039518d460b217768b56aa6fff5b6.tar.xz
eclipse.platform.swt-956dd6f010b039518d460b217768b56aa6fff5b6.zip
*** empty log message ***temp_synch_HEAD_and_R1_0NL
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java3
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java60
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java3
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java2
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java46
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java60
32 files changed, 208 insertions, 140 deletions
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
index a28105e9fb..0fcd6ae284 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Ellipse object
*/
public class EllipseFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs an Ellipse
@@ -26,13 +26,16 @@ public class EllipseFigure extends Figure {
* @param x2 the virtual X coordinate of the second corner
* @param y2 the virtual Y coordinate of the second corner
*/
- public EllipseFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
index cfd26997d6..ced0b873b8 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
@@ -50,7 +50,7 @@ public class EllipseTool extends DragPaintSession implements PaintTool {
if (settings.commonFillType != ToolSettings.ftNone)
container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
return container;
}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
index 221f4eefc7..de71910f76 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Line object
*/
public class LineFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs a Line
@@ -25,14 +25,17 @@ public class LineFigure extends Figure {
* @param x2 the virtual X coordinate of the second end-point
* @param y2 the virtual Y coordinate of the second end-point
*/
- public LineFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public LineFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Point p1 = fdc.toClientPoint(x1, y1);
Point p2 = fdc.toClientPoint(x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawLine(p1.x, p1.y, p2.x, p2.y);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
index ab9e9e598c..f969d24911 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
@@ -46,7 +46,7 @@ public class LineTool extends DragPaintSession implements PaintTool {
* Template methods for drawing
*/
protected Figure createFigure(Point a, Point b) {
- return new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ return new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y);
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
index 4d650f9ef9..973e152695 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
@@ -54,13 +54,13 @@ public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
for (int i = 0; i < numPoints - 1; ++i) {
final Point a = points[i];
final Point b = points[i + 1];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
}
if (closed) {
final Point a = points[points.length - 1];
final Point b = points[0];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
index d6073f3f31..b6bf01462b 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Rectangle object
*/
public class RectangleFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs a Rectangle
@@ -25,13 +25,16 @@ public class RectangleFigure extends Figure {
* @param x2 the virtual X coordinate of the second corner
* @param y2 the virtual Y coordinate of the second corner
*/
- public RectangleFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
index aa8726a769..555280150c 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
@@ -49,14 +49,14 @@ public class RectangleTool extends DragPaintSession implements PaintTool {
switch (settings.commonFillType) {
default:
case ToolSettings.ftNone:
- return new RectangleFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y);
case ToolSettings.ftSolid:
return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y);
case ToolSettings.ftOutline: {
ContainerFigure container = new ContainerFigure();
container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
return container;
}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
index b8e0cd2d28..ec561dd454 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Rectangle object
*/
public class RoundedRectangleFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2, diameter;
/**
* Constructs a Rectangle
@@ -26,14 +26,17 @@ public class RoundedRectangleFigure extends Figure {
* @param y2 the virtual Y coordinate of the second corner
* @param diameter the diameter of curvature of all four corners
*/
- public RoundedRectangleFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
- this.color = color; this.lineStyle = lineStyle;
+ public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
this.diameter = diameter;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
index 5c0311e43c..e649b40005 100755
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
@@ -51,7 +51,7 @@ public class RoundedRectangleTool extends DragPaintSession implements PaintTool
container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor,
a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(settings.commonForegroundColor,
+ container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor,
settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
return container;
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
index a28105e9fb..0fcd6ae284 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Ellipse object
*/
public class EllipseFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs an Ellipse
@@ -26,13 +26,16 @@ public class EllipseFigure extends Figure {
* @param x2 the virtual X coordinate of the second corner
* @param y2 the virtual Y coordinate of the second corner
*/
- public EllipseFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
index cfd26997d6..ced0b873b8 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
@@ -50,7 +50,7 @@ public class EllipseTool extends DragPaintSession implements PaintTool {
if (settings.commonFillType != ToolSettings.ftNone)
container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
return container;
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
index 221f4eefc7..de71910f76 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Line object
*/
public class LineFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs a Line
@@ -25,14 +25,17 @@ public class LineFigure extends Figure {
* @param x2 the virtual X coordinate of the second end-point
* @param y2 the virtual Y coordinate of the second end-point
*/
- public LineFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public LineFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Point p1 = fdc.toClientPoint(x1, y1);
Point p2 = fdc.toClientPoint(x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawLine(p1.x, p1.y, p2.x, p2.y);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
index ab9e9e598c..f969d24911 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
@@ -46,7 +46,7 @@ public class LineTool extends DragPaintSession implements PaintTool {
* Template methods for drawing
*/
protected Figure createFigure(Point a, Point b) {
- return new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ return new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y);
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
index 4d650f9ef9..973e152695 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
@@ -54,13 +54,13 @@ public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
for (int i = 0; i < numPoints - 1; ++i) {
final Point a = points[i];
final Point b = points[i + 1];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
}
if (closed) {
final Point a = points[points.length - 1];
final Point b = points[0];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
index d6073f3f31..b6bf01462b 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Rectangle object
*/
public class RectangleFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2;
/**
* Constructs a Rectangle
@@ -25,13 +25,16 @@ public class RectangleFigure extends Figure {
* @param x2 the virtual X coordinate of the second corner
* @param y2 the virtual Y coordinate of the second corner
*/
- public RectangleFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2) {
- this.color = color; this.lineStyle = lineStyle;
+ public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
index aa8726a769..555280150c 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
@@ -49,14 +49,14 @@ public class RectangleTool extends DragPaintSession implements PaintTool {
switch (settings.commonFillType) {
default:
case ToolSettings.ftNone:
- return new RectangleFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y);
case ToolSettings.ftSolid:
return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y);
case ToolSettings.ftOutline: {
ContainerFigure container = new ContainerFigure();
container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonLineStyle,
+ container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y));
return container;
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
index b8e0cd2d28..ec561dd454 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
@@ -12,7 +12,7 @@ import org.eclipse.swt.graphics.*;
* 2D Rectangle object
*/
public class RoundedRectangleFigure extends Figure {
- private Color color;
+ private Color foregroundColor, backgroundColor;
private int lineStyle, x1, y1, x2, y2, diameter;
/**
* Constructs a Rectangle
@@ -26,14 +26,17 @@ public class RoundedRectangleFigure extends Figure {
* @param y2 the virtual Y coordinate of the second corner
* @param diameter the diameter of curvature of all four corners
*/
- public RoundedRectangleFigure(Color color, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
- this.color = color; this.lineStyle = lineStyle;
+ public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ this.lineStyle = lineStyle;
this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
this.diameter = diameter;
}
public void draw(FigureDrawContext fdc) {
Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(color);
+ fdc.gc.setForeground(foregroundColor);
+ fdc.gc.setBackground(backgroundColor);
fdc.gc.setLineStyle(lineStyle);
fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter);
fdc.gc.setLineStyle(SWT.LINE_SOLID);
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
index 5c0311e43c..e649b40005 100755
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
@@ -51,7 +51,7 @@ public class RoundedRectangleTool extends DragPaintSession implements PaintTool
container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor,
a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(settings.commonForegroundColor,
+ container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor,
settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
return container;
}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
index 8b72c7fda8..5ca6ad0fce 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
@@ -61,7 +61,7 @@ private boolean closeAddressBook() {
if (!save()) return false;
}
}
-
+
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i ++) {
items[i].dispose();
@@ -276,6 +276,7 @@ private String[][] mergeSort(String[][] items, int column) {
}
private void newAddressBook() {
shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
+ file = null;
isModified = false;
}
private void newEntry() {
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
index e110e5ceb3..6a7d620401 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
@@ -92,6 +92,7 @@ public SearchDialog(Shell parent) {
Button up = new Button(direction, SWT.RADIO);
up.setText(resAddressBook.getString("Dialog_dir_up"));
+ up.setSelection(false);
down = new Button(direction, SWT.RADIO);
down.setText(resAddressBook.getString("Dialog_dir_down"));
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
index 7dfaaa500d..64363bd151 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
@@ -153,7 +153,7 @@ class LabelTab extends AlignableTab {
centerButton.setSelection (!isSeparator && (label1.getStyle () & SWT.CENTER) != 0);
rightButton.setSelection (!isSeparator && (label1.getStyle () & SWT.RIGHT) != 0);
shadowInButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_IN) != 0);
- shadowOutButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_OUT) != 0);
+ shadowOutButton.setSelection (!shadowInButton.getSelection ());
leftButton.setEnabled (!isSeparator);
centerButton.setEnabled (!isSeparator);
rightButton.setEnabled (!isSeparator);
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
index 1797a4d15a..33de3df0c8 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
@@ -129,7 +129,7 @@ class SliderTab extends RangeTab {
/* Add the listeners */
pageIncrementScale.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent event) {
- setWidgetIncrement ();
+ setWidgetPageIncrement ();
}
});
}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
index 5440b80e41..a07f1bd69c 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
@@ -83,7 +83,7 @@ class TableTab extends ScrollableTab {
/* Create a group for the table */
tableGroup = new Group (exampleGroup, SWT.NULL);
tableGroup.setLayout (new GridLayout ());
- tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+ tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
tableGroup.setText (ControlExample.getResourceString("Table"));
}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
index 1bcb47fb16..bc472694ee 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
@@ -33,6 +33,7 @@ public class FileViewer {
private Label diskSpaceLabel;
private File currentDirectory = null;
+ private boolean initial = true;
/* Drag and drop optimizations */
private boolean isDragging = false; // if this app is dragging
@@ -488,13 +489,10 @@ public class FileViewer {
}
private File getTargetFile(DropTargetEvent event) {
// Determine the target File for the drop
- final TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
- final File targetFile;
- if (item == null) {
- // We dropped on an unoccupied area of the tree, we have no recourse. Quit.
- targetFile = null;
- } else {
- // We dropped on a particular item in the tree, use the item's file
+ TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
+ File targetFile = null;
+ if (item != null) {
+ // We are over a particular item in the tree, use the item's file
targetFile = (File) item.getData(TREEITEMDATA_FILE);
}
return targetFile;
@@ -790,13 +788,16 @@ public class FileViewer {
}
private File getTargetFile(DropTargetEvent event) {
// Determine the target File for the drop
- final TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
- final File targetFile;
+ TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
+ File targetFile = null;
if (item == null) {
- // We dropped on an unoccupied area of the table, use the table's root file
- targetFile = (File) table.getData(TABLEDATA_DIR);
+ // We are over an unoccupied area of the table.
+ // If it is a COPY, we can use the table's root file.
+ if (event.detail == DND.DROP_COPY) {
+ targetFile = (File) table.getData(TABLEDATA_DIR);
+ }
} else {
- // We dropped on a particular item in the table, use the item's file
+ // We are over a particular item in the table, use the item's file
targetFile = (File) item.getData(TABLEITEMDATA_FILE);
}
return targetFile;
@@ -935,6 +936,11 @@ public class FileViewer {
*/
void handleDeferredRefresh() {
if (isDragging || isDropping || ! deferredRefreshRequested) return;
+ if (progressDialog != null) {
+ progressDialog.close();
+ progressDialog = null;
+ }
+
deferredRefreshRequested = false;
File[] files = deferredRefreshFiles;
deferredRefreshFiles = null;
@@ -1093,7 +1099,7 @@ public class FileViewer {
if (source.equals(dest)) continue; // ignore if in same location
progressDialog.setDetailFile(source, ProgressDialog.COPY);
- for (;! progressDialog.isCancelled();) {
+ while (! progressDialog.isCancelled()) {
if (copyFileStructure(source, dest)) {
processedFiles.add(source);
break;
@@ -1170,7 +1176,7 @@ public class FileViewer {
for (int i = 0; (i < sourceFiles.length) && (! progressDialog.isCancelled()); i++){
final File source = sourceFiles[i];
progressDialog.setDetailFile(source, ProgressDialog.DELETE);
- for (;! progressDialog.isCancelled();) {
+ while (! progressDialog.isCancelled()) {
if (deleteFileStructure(source)) {
break;
} else if (! progressDialog.isCancelled()) {
@@ -1196,7 +1202,7 @@ public class FileViewer {
* @return an array of Files corresponding to the root directories on the platform,
* may be empty but not null
*/
- static File[] getRoots() {
+ File[] getRoots() {
/*
* On JDK 1.22 only...
*/
@@ -1214,13 +1220,21 @@ public class FileViewer {
File drive = new File(i + ":" + File.separator);
if (drive.isDirectory() && drive.exists()) {
list.add(drive);
+ if (initial && i == 'c') {
+ currentDirectory = drive;
+ initial = false;
+ }
}
}
File[] roots = (File[]) list.toArray(new File[list.size()]);
sortFiles(roots);
return roots;
} else {
- return new File[] { new File(File.separator) };
+ File root = new File(File.separator);
+ if (initial) {
+ currentDirectory = root;
+ }
+ return new File[] { root };
}
}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
index 549ff8e283..cffeff99f9 100755
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
@@ -890,35 +890,41 @@ public class ImageAnalyzer {
void menuPrint() {
if (image == null) return;
- // Ask the user to specify the printer.
- PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
- PrinterData printerData = dialog.open();
- if (printerData == null) return;
-
- Printer printer = new Printer(printerData);
-
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob(fileName)) {
- GC gc = new GC(printer);
- if (printer.startPage()) {
- gc.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * imageData.width,
- scaleFactor * imageData.height);
- printer.endPage();
+ try {
+ // Ask the user to specify the printer.
+ PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
+ PrinterData printerData = dialog.open();
+ if (printerData == null) return;
+
+ Printer printer = new Printer(printerData);
+
+ Point screenDPI = display.getDPI();
+ Point printerDPI = printer.getDPI();
+ int scaleFactor = printerDPI.x / screenDPI.x;
+ Rectangle trim = printer.computeTrim(0, 0, 0, 0);
+ if (printer.startJob(fileName)) {
+ GC gc = new GC(printer);
+ if (printer.startPage()) {
+ gc.drawImage(
+ image,
+ 0,
+ 0,
+ imageData.width,
+ imageData.height,
+ -trim.x,
+ -trim.y,
+ scaleFactor * imageData.width,
+ scaleFactor * imageData.height);
+ printer.endPage();
+ }
+ printer.endJob();
}
- printer.endJob();
+ printer.dispose();
+ } catch (SWTError e) {
+ MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
+ box.setMessage(bundle.getString("Printing_error") + e.getMessage());
+ box.open();
}
- printer.dispose();
}
void menuReopen() {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
index 8b72c7fda8..5ca6ad0fce 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
@@ -61,7 +61,7 @@ private boolean closeAddressBook() {
if (!save()) return false;
}
}
-
+
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i ++) {
items[i].dispose();
@@ -276,6 +276,7 @@ private String[][] mergeSort(String[][] items, int column) {
}
private void newAddressBook() {
shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
+ file = null;
isModified = false;
}
private void newEntry() {
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
index e110e5ceb3..6a7d620401 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
@@ -92,6 +92,7 @@ public SearchDialog(Shell parent) {
Button up = new Button(direction, SWT.RADIO);
up.setText(resAddressBook.getString("Dialog_dir_up"));
+ up.setSelection(false);
down = new Button(direction, SWT.RADIO);
down.setText(resAddressBook.getString("Dialog_dir_down"));
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
index 7dfaaa500d..64363bd151 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
@@ -153,7 +153,7 @@ class LabelTab extends AlignableTab {
centerButton.setSelection (!isSeparator && (label1.getStyle () & SWT.CENTER) != 0);
rightButton.setSelection (!isSeparator && (label1.getStyle () & SWT.RIGHT) != 0);
shadowInButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_IN) != 0);
- shadowOutButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_OUT) != 0);
+ shadowOutButton.setSelection (!shadowInButton.getSelection ());
leftButton.setEnabled (!isSeparator);
centerButton.setEnabled (!isSeparator);
rightButton.setEnabled (!isSeparator);
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
index 1797a4d15a..33de3df0c8 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
@@ -129,7 +129,7 @@ class SliderTab extends RangeTab {
/* Add the listeners */
pageIncrementScale.addSelectionListener (new SelectionAdapter () {
public void widgetSelected (SelectionEvent event) {
- setWidgetIncrement ();
+ setWidgetPageIncrement ();
}
});
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
index 5440b80e41..a07f1bd69c 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
@@ -83,7 +83,7 @@ class TableTab extends ScrollableTab {
/* Create a group for the table */
tableGroup = new Group (exampleGroup, SWT.NULL);
tableGroup.setLayout (new GridLayout ());
- tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+ tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
tableGroup.setText (ControlExample.getResourceString("Table"));
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
index 1bcb47fb16..bc472694ee 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
@@ -33,6 +33,7 @@ public class FileViewer {
private Label diskSpaceLabel;
private File currentDirectory = null;
+ private boolean initial = true;
/* Drag and drop optimizations */
private boolean isDragging = false; // if this app is dragging
@@ -488,13 +489,10 @@ public class FileViewer {
}
private File getTargetFile(DropTargetEvent event) {
// Determine the target File for the drop
- final TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
- final File targetFile;
- if (item == null) {
- // We dropped on an unoccupied area of the tree, we have no recourse. Quit.
- targetFile = null;
- } else {
- // We dropped on a particular item in the tree, use the item's file
+ TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
+ File targetFile = null;
+ if (item != null) {
+ // We are over a particular item in the tree, use the item's file
targetFile = (File) item.getData(TREEITEMDATA_FILE);
}
return targetFile;
@@ -790,13 +788,16 @@ public class FileViewer {
}
private File getTargetFile(DropTargetEvent event) {
// Determine the target File for the drop
- final TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
- final File targetFile;
+ TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
+ File targetFile = null;
if (item == null) {
- // We dropped on an unoccupied area of the table, use the table's root file
- targetFile = (File) table.getData(TABLEDATA_DIR);
+ // We are over an unoccupied area of the table.
+ // If it is a COPY, we can use the table's root file.
+ if (event.detail == DND.DROP_COPY) {
+ targetFile = (File) table.getData(TABLEDATA_DIR);
+ }
} else {
- // We dropped on a particular item in the table, use the item's file
+ // We are over a particular item in the table, use the item's file
targetFile = (File) item.getData(TABLEITEMDATA_FILE);
}
return targetFile;
@@ -935,6 +936,11 @@ public class FileViewer {
*/
void handleDeferredRefresh() {
if (isDragging || isDropping || ! deferredRefreshRequested) return;
+ if (progressDialog != null) {
+ progressDialog.close();
+ progressDialog = null;
+ }
+
deferredRefreshRequested = false;
File[] files = deferredRefreshFiles;
deferredRefreshFiles = null;
@@ -1093,7 +1099,7 @@ public class FileViewer {
if (source.equals(dest)) continue; // ignore if in same location
progressDialog.setDetailFile(source, ProgressDialog.COPY);
- for (;! progressDialog.isCancelled();) {
+ while (! progressDialog.isCancelled()) {
if (copyFileStructure(source, dest)) {
processedFiles.add(source);
break;
@@ -1170,7 +1176,7 @@ public class FileViewer {
for (int i = 0; (i < sourceFiles.length) && (! progressDialog.isCancelled()); i++){
final File source = sourceFiles[i];
progressDialog.setDetailFile(source, ProgressDialog.DELETE);
- for (;! progressDialog.isCancelled();) {
+ while (! progressDialog.isCancelled()) {
if (deleteFileStructure(source)) {
break;
} else if (! progressDialog.isCancelled()) {
@@ -1196,7 +1202,7 @@ public class FileViewer {
* @return an array of Files corresponding to the root directories on the platform,
* may be empty but not null
*/
- static File[] getRoots() {
+ File[] getRoots() {
/*
* On JDK 1.22 only...
*/
@@ -1214,13 +1220,21 @@ public class FileViewer {
File drive = new File(i + ":" + File.separator);
if (drive.isDirectory() && drive.exists()) {
list.add(drive);
+ if (initial && i == 'c') {
+ currentDirectory = drive;
+ initial = false;
+ }
}
}
File[] roots = (File[]) list.toArray(new File[list.size()]);
sortFiles(roots);
return roots;
} else {
- return new File[] { new File(File.separator) };
+ File root = new File(File.separator);
+ if (initial) {
+ currentDirectory = root;
+ }
+ return new File[] { root };
}
}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
index 549ff8e283..cffeff99f9 100755
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
@@ -890,35 +890,41 @@ public class ImageAnalyzer {
void menuPrint() {
if (image == null) return;
- // Ask the user to specify the printer.
- PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
- PrinterData printerData = dialog.open();
- if (printerData == null) return;
-
- Printer printer = new Printer(printerData);
-
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob(fileName)) {
- GC gc = new GC(printer);
- if (printer.startPage()) {
- gc.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * imageData.width,
- scaleFactor * imageData.height);
- printer.endPage();
+ try {
+ // Ask the user to specify the printer.
+ PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
+ PrinterData printerData = dialog.open();
+ if (printerData == null) return;
+
+ Printer printer = new Printer(printerData);
+
+ Point screenDPI = display.getDPI();
+ Point printerDPI = printer.getDPI();
+ int scaleFactor = printerDPI.x / screenDPI.x;
+ Rectangle trim = printer.computeTrim(0, 0, 0, 0);
+ if (printer.startJob(fileName)) {
+ GC gc = new GC(printer);
+ if (printer.startPage()) {
+ gc.drawImage(
+ image,
+ 0,
+ 0,
+ imageData.width,
+ imageData.height,
+ -trim.x,
+ -trim.y,
+ scaleFactor * imageData.width,
+ scaleFactor * imageData.height);
+ printer.endPage();
+ }
+ printer.endJob();
}
- printer.endJob();
+ printer.dispose();
+ } catch (SWTError e) {
+ MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
+ box.setMessage(bundle.getString("Printing_error") + e.getMessage());
+ box.open();
}
- printer.dispose();
}
void menuReopen() {