Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-01-09 15:08:33 +0000
committerMichael Valenta2007-01-09 15:08:33 +0000
commitdacfccb13bfa79dc80cb31286aa38dcd90a7d4b6 (patch)
treeab16fd7f1169433ef9bc050d2b528b21e31d4b3c
parent6dd519754e6b8d8b5d5f3b9568aa59236ab14a84 (diff)
downloadeclipse.platform.team-dacfccb13bfa79dc80cb31286aa38dcd90a7d4b6.tar.gz
eclipse.platform.team-dacfccb13bfa79dc80cb31286aa38dcd90a7d4b6.tar.xz
eclipse.platform.team-dacfccb13bfa79dc80cb31286aa38dcd90a7d4b6.zip
Bug 169953 [Edit] Compare editor does not take focus
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java17
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java7
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java17
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java7
4 files changed, 38 insertions, 10 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 537f65609..6e0a8e1b7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -499,7 +499,8 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
final Splitter h= new Splitter(parent, direction);
fStructureInputPane= createStructureInputPane(h);
- fFocusPane= fStructureInputPane;
+ if (hasChildren(getCompareResult()))
+ fFocusPane= fStructureInputPane;
fStructurePane1= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
@@ -581,10 +582,8 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
final Composite parent) {
return new CompareViewerSwitchingPane(parent, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof IDiffContainer) {
- IDiffContainer dn= (IDiffContainer) input;
- if (dn.hasChildren())
- return createDiffViewer(this);
+ if (CompareEditorInput.this.hasChildren(input)) {
+ return createDiffViewer(this);
}
if (input instanceof ICompareInput)
return findStructureViewer(oldViewer, (ICompareInput)input, this);
@@ -592,6 +591,14 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
}
};
}
+
+ /* private */ boolean hasChildren(Object input) {
+ if (input instanceof IDiffContainer) {
+ IDiffContainer dn= (IDiffContainer) input;
+ return (dn.hasChildren());
+ }
+ return false;
+ }
private void feedInput() {
if (fStructureInputPane != null
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 1d5cf8695..4f87dbd22 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -366,10 +366,17 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
fControl= (ci).createContents(fPageBook);
fPageBook.showPage(fControl);
PlatformUI.getWorkbench().getHelpSystem().setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
+ if (isActive()) {
+ setFocus();
+ }
}
}
}
+ private boolean isActive() {
+ return getSite().getPage().getActivePart() == this;
+ }
+
private void setPageLater() {
Display.getCurrent().timerExec(1000, new Runnable() {
public void run() {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 537f65609..6e0a8e1b7 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -499,7 +499,8 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
final Splitter h= new Splitter(parent, direction);
fStructureInputPane= createStructureInputPane(h);
- fFocusPane= fStructureInputPane;
+ if (hasChildren(getCompareResult()))
+ fFocusPane= fStructureInputPane;
fStructurePane1= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
@@ -581,10 +582,8 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
final Composite parent) {
return new CompareViewerSwitchingPane(parent, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof IDiffContainer) {
- IDiffContainer dn= (IDiffContainer) input;
- if (dn.hasChildren())
- return createDiffViewer(this);
+ if (CompareEditorInput.this.hasChildren(input)) {
+ return createDiffViewer(this);
}
if (input instanceof ICompareInput)
return findStructureViewer(oldViewer, (ICompareInput)input, this);
@@ -592,6 +591,14 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
}
};
}
+
+ /* private */ boolean hasChildren(Object input) {
+ if (input instanceof IDiffContainer) {
+ IDiffContainer dn= (IDiffContainer) input;
+ return (dn.hasChildren());
+ }
+ return false;
+ }
private void feedInput() {
if (fStructureInputPane != null
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 1d5cf8695..4f87dbd22 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -366,10 +366,17 @@ public class CompareEditor extends EditorPart implements IReusableEditor, ISavea
fControl= (ci).createContents(fPageBook);
fPageBook.showPage(fControl);
PlatformUI.getWorkbench().getHelpSystem().setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
+ if (isActive()) {
+ setFocus();
+ }
}
}
}
+ private boolean isActive() {
+ return getSite().getPage().getActivePart() == this;
+ }
+
private void setPageLater() {
Display.getCurrent().timerExec(1000, new Runnable() {
public void run() {

Back to the top