Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-02-10 09:21:17 +0000
committerAndre Weinand2004-02-10 09:21:17 +0000
commit7f1321b76026463d61ff6378af53acaafb6861cb (patch)
treef58b6b2851ae40bb3df30c159bf2ad71bd2761bb /bundles/org.eclipse.compare/compare
parent369fb032f54ed720f32626d11d0bedcb14e6d227 (diff)
downloadeclipse.platform.team-7f1321b76026463d61ff6378af53acaafb6861cb.tar.gz
eclipse.platform.team-7f1321b76026463d61ff6378af53acaafb6861cb.tar.xz
eclipse.platform.team-7f1321b76026463d61ff6378af53acaafb6861cb.zip
support for outline view
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java167
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java2
3 files changed, 26 insertions, 146 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 c4dc60ea3..180fbb89e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -365,138 +365,13 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
* @return the SWT control hierarchy for the compare editor
*/
public Control createContents(Composite parent) {
-
- fComposite= new Splitter(parent, SWT.VERTICAL);
- fComposite.setData(this);
-
- final Splitter h= new Splitter(fComposite, SWT.HORIZONTAL);
-
- fStructureInputPane= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof DiffNode) {
- DiffNode dn= (DiffNode) input;
- if (dn.hasChildren())
- return createDiffViewer(this);
- }
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- fFocusPane= fStructureInputPane;
-
- fStructurePane1= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane1, false);
-
- fStructurePane2= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findStructureViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- h.setVisible(fStructurePane2, false);
-
- fContentInputPane= new CompareViewerSwitchingPane(fComposite, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- if (input instanceof ICompareInput)
- return findContentViewer(oldViewer, (ICompareInput)input, this);
- return null;
- }
- };
- fComposite.setVisible(h, false);
- fComposite.setVisible(fContentInputPane, true);
-
- fComposite.setWeights(new int[] { 30, 70 });
-
- fComposite.layout();
-
- // setup the wiring for top left pane
- fStructureInputPane.addOpenListener(
- new IOpenListener() {
- public void open(OpenEvent oe) {
- feed1(oe.getSelection());
- }
- }
- );
- fStructureInputPane.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- ISelection s= e.getSelection();
- if (s == null || s.isEmpty())
- feed1(s);
- }
- }
- );
- fStructureInputPane.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- feedDefault1(event.getSelection());
- }
- }
- );
-
- fStructurePane1.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed2(e.getSelection());
- }
- }
- );
-
- fStructurePane2.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- feed3(e.getSelection());
- }
- }
- );
-
- if (fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
- }
- );
-
- return fComposite;
- }
-
- /**
- * Create the SWT controls that are used to display the result of the compare operation.
- * Creates the SWT Controls and sets up the wiring between the individual panes.
- * This implementation creates all four panes but makes only the necessary ones visible.
- * Finally it feeds the compare result into the top left structure viewer
- * and the content viewer.
- * <p>
- * Subclasses may override if they need to change the layout or wiring between panes.
- *
- * @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the compare editor
- */
- public Control createContents2(Composite parent) {
fComposite= new Splitter(parent, SWT.VERTICAL);
fComposite.setData(this);
- Splitter hSplitter= null;
+ Control outline= null;
if (!fUseOutlineView)
- hSplitter= createHierarchy(fComposite, SWT.HORIZONTAL);
+ outline= createOutlineContents(fComposite, SWT.HORIZONTAL);
fContentInputPane= new CompareViewerSwitchingPane(fComposite, SWT.BORDER | SWT.FLAT) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
@@ -507,8 +382,8 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
};
if (fFocusPane == null)
fFocusPane= fContentInputPane;
- if (hSplitter != null)
- fComposite.setVisible(hSplitter, false);
+ if (outline != null)
+ fComposite.setVisible(outline, false);
fComposite.setVisible(fContentInputPane, true);
if (fStructureInputPane != null)
@@ -537,10 +412,10 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
/**
* @param parent the parent control under which the control must be created
- * @return the SWT control hierarchy for the compare editor
+ * @return the SWT control hierarchy for the outline part of the compare editor
* @since 3.0
*/
- public Splitter createHierarchy(Composite parent, int direction) {
+ public Control createOutlineContents(Composite parent, int direction) {
final Splitter h= new Splitter(parent, direction);
fStructureInputPane= new CompareViewerSwitchingPane(h, SWT.BORDER | SWT.FLAT, true) {
@@ -616,21 +491,23 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
}
);
- if (fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
-
- fComposite.setData("Nav", //$NON-NLS-1$
- new CompareViewerSwitchingPane[] {
- fStructureInputPane,
- fStructurePane1,
- fStructurePane2,
- fContentInputPane
+ if (fUseOutlineView) {
+ if (fInput instanceof ICompareInput) {
+ fStructureInputPane.setInput(fInput);
+ ISelection sel= fStructureInputPane.getSelection();
+ if (sel == null || sel.isEmpty())
+ feed1(sel); // we only feed downstream viewers if the top left pane is empty
}
- );
+
+ fComposite.setData("Nav", //$NON-NLS-1$
+ new CompareViewerSwitchingPane[] {
+ fStructureInputPane,
+ fStructurePane1,
+ fStructurePane2,
+ fContentInputPane
+ }
+ );
+ }
return h;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
index 9f15d423a..d0f4d805a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
@@ -44,6 +44,9 @@ public class CompareAction extends BaseCompareAction implements IObjectActionDel
// buffered merge mode: don't ask for confirmation
// when switching between modified resources
cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false));
+
+ // uncomment following line to have separate outline view
+ //cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, new Boolean(true));
fInput= new ResourceCompareInput(cc);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
index f623225c2..92f572895 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
@@ -40,7 +40,7 @@ public class CompareOutlinePage implements IContentOutlinePage {
*/
public void createControl(Composite parent) {
if (fCompareEditorInput != null) {
- fControl= fCompareEditorInput.createHierarchy(parent, SWT.VERTICAL);
+ fControl= fCompareEditorInput.createOutlineContents(parent, SWT.VERTICAL);
}
}

Back to the top