Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-03-08 14:19:41 +0000
committerAndre Weinand2004-03-08 14:19:41 +0000
commit2fb86f39c858145ac4f3fbefbc40101668e81d54 (patch)
tree748fac04e53c2f77e73790165daedff5d88ccec1
parent8ebead423aa4d5c0e064cc75e60a4c59d0b0e569 (diff)
downloadeclipse.platform.team-2fb86f39c858145ac4f3fbefbc40101668e81d54.tar.gz
eclipse.platform.team-2fb86f39c858145ac4f3fbefbc40101668e81d54.tar.xz
eclipse.platform.team-2fb86f39c858145ac4f3fbefbc40101668e81d54.zip
added visual cue (cursor) to center canvas
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java66
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java66
2 files changed, 126 insertions, 6 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 846a9ac77..48b1591d0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -162,6 +162,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fDirection= dir;
fControl= c;
fLiveResize= !(fControl instanceof Sash);
+ updateCursor(c, dir);
fControl.addMouseListener(this);
fControl.addMouseMoveListener(this);
fControl.addDisposeListener(
@@ -172,7 +173,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
);
}
-
+
public void mouseDoubleClick(MouseEvent e) {
if ((fDirection & HORIZONTAL) != 0)
fHSplit= HSPLIT;
@@ -271,6 +272,11 @@ public abstract class ContentMergeViewer extends ContentViewer
private Image fRightArrow;
private Image fLeftArrow;
private Image fBothArrow;
+ Cursor fNormalCursor;
+ private Cursor fHSashCursor;
+ private Cursor fVSashCursor;
+ private Cursor fHVSashCursor;
+
//---- end
/**
@@ -461,10 +467,47 @@ public abstract class ContentMergeViewer extends ContentViewer
if (key.equals(ANCESTOR_ENABLED)) {
fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
fComposite.layout(true);
+
+ updateCursor(fLeftLabel, VERTICAL);
+ updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL);
+ updateCursor(fRightLabel, VERTICAL);
+
return;
}
}
+ void updateCursor(Control c, int dir) {
+ if (!(c instanceof Sash)) {
+ Cursor cursor= null;
+ switch (dir) {
+ case VERTICAL:
+ if (fAncestorEnabled) {
+ if (fVSashCursor == null) fVSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZENS);
+ cursor= fVSashCursor;
+ } else {
+ if (fNormalCursor == null) fNormalCursor= new Cursor(c.getDisplay(), SWT.CURSOR_ARROW);
+ cursor= fNormalCursor;
+ }
+ break;
+ case HORIZONTAL:
+ if (fHSashCursor == null) fHSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
+ cursor= fHSashCursor;
+ break;
+ case VERTICAL + HORIZONTAL:
+ if (fAncestorEnabled) {
+ if (fHVSashCursor == null) fHVSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEALL);
+ cursor= fHVSashCursor;
+ } else {
+ if (fHSashCursor == null) fHSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
+ cursor= fHSashCursor;
+ }
+ break;
+ }
+ if (cursor != null)
+ c.setCursor(cursor);
+ }
+ }
+
void setAncestorVisibility(boolean visible, boolean enabled) {
if (fAncestorItem != null) {
Action action= (Action) fAncestorItem.getAction();
@@ -634,7 +677,7 @@ public abstract class ContentMergeViewer extends ContentViewer
* @return the new control
*/
protected final Control buildControl(Composite parent) {
-
+
fComposite= new Composite(parent, fStyles) {
public boolean setFocus() {
return internalSetFocus();
@@ -788,7 +831,24 @@ public abstract class ContentMergeViewer extends ContentViewer
fBothArrow.dispose();
fBothArrow= null;
}
-
+
+ if (fNormalCursor != null) {
+ fNormalCursor.dispose();
+ fNormalCursor= null;
+ }
+ if (fHSashCursor != null) {
+ fHSashCursor.dispose();
+ fHSashCursor= null;
+ }
+ if (fVSashCursor != null) {
+ fVSashCursor.dispose();
+ fVSashCursor= null;
+ }
+ if (fHVSashCursor != null) {
+ fHVSashCursor.dispose();
+ fHVSashCursor= null;
+ }
+
super.handleDispose(event);
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 846a9ac77..48b1591d0 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -162,6 +162,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fDirection= dir;
fControl= c;
fLiveResize= !(fControl instanceof Sash);
+ updateCursor(c, dir);
fControl.addMouseListener(this);
fControl.addMouseMoveListener(this);
fControl.addDisposeListener(
@@ -172,7 +173,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
);
}
-
+
public void mouseDoubleClick(MouseEvent e) {
if ((fDirection & HORIZONTAL) != 0)
fHSplit= HSPLIT;
@@ -271,6 +272,11 @@ public abstract class ContentMergeViewer extends ContentViewer
private Image fRightArrow;
private Image fLeftArrow;
private Image fBothArrow;
+ Cursor fNormalCursor;
+ private Cursor fHSashCursor;
+ private Cursor fVSashCursor;
+ private Cursor fHVSashCursor;
+
//---- end
/**
@@ -461,10 +467,47 @@ public abstract class ContentMergeViewer extends ContentViewer
if (key.equals(ANCESTOR_ENABLED)) {
fAncestorEnabled= Utilities.getBoolean(getCompareConfiguration(), ANCESTOR_ENABLED, fAncestorEnabled);
fComposite.layout(true);
+
+ updateCursor(fLeftLabel, VERTICAL);
+ updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL);
+ updateCursor(fRightLabel, VERTICAL);
+
return;
}
}
+ void updateCursor(Control c, int dir) {
+ if (!(c instanceof Sash)) {
+ Cursor cursor= null;
+ switch (dir) {
+ case VERTICAL:
+ if (fAncestorEnabled) {
+ if (fVSashCursor == null) fVSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZENS);
+ cursor= fVSashCursor;
+ } else {
+ if (fNormalCursor == null) fNormalCursor= new Cursor(c.getDisplay(), SWT.CURSOR_ARROW);
+ cursor= fNormalCursor;
+ }
+ break;
+ case HORIZONTAL:
+ if (fHSashCursor == null) fHSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
+ cursor= fHSashCursor;
+ break;
+ case VERTICAL + HORIZONTAL:
+ if (fAncestorEnabled) {
+ if (fHVSashCursor == null) fHVSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEALL);
+ cursor= fHVSashCursor;
+ } else {
+ if (fHSashCursor == null) fHSashCursor= new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
+ cursor= fHSashCursor;
+ }
+ break;
+ }
+ if (cursor != null)
+ c.setCursor(cursor);
+ }
+ }
+
void setAncestorVisibility(boolean visible, boolean enabled) {
if (fAncestorItem != null) {
Action action= (Action) fAncestorItem.getAction();
@@ -634,7 +677,7 @@ public abstract class ContentMergeViewer extends ContentViewer
* @return the new control
*/
protected final Control buildControl(Composite parent) {
-
+
fComposite= new Composite(parent, fStyles) {
public boolean setFocus() {
return internalSetFocus();
@@ -788,7 +831,24 @@ public abstract class ContentMergeViewer extends ContentViewer
fBothArrow.dispose();
fBothArrow= null;
}
-
+
+ if (fNormalCursor != null) {
+ fNormalCursor.dispose();
+ fNormalCursor= null;
+ }
+ if (fHSashCursor != null) {
+ fHSashCursor.dispose();
+ fHSashCursor= null;
+ }
+ if (fVSashCursor != null) {
+ fVSashCursor.dispose();
+ fVSashCursor= null;
+ }
+ if (fHVSashCursor != null) {
+ fHVSashCursor.dispose();
+ fHVSashCursor= null;
+ }
+
super.handleDispose(event);
}

Back to the top