forked from eclipse-platform/eclipse.platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show number of differences in the Compare editor eclipse-platform#504
Review points incorporated Fixes eclipse-platform#504
- Loading branch information
1 parent
07198c4
commit af84431
Showing
7 changed files
with
244 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
team/bundles/org.eclipse.compare/compare/org/eclipse/compare/LabelContributionItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 ETAS GmbH and others, all rights reserved. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* ETAS GmbH - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.compare; | ||
|
||
import org.eclipse.core.runtime.Platform.OS; | ||
import org.eclipse.jface.action.ControlContribution; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.layout.GridData; | ||
import org.eclipse.swt.layout.GridLayout; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Control; | ||
import org.eclipse.swt.widgets.Label; | ||
|
||
|
||
/** | ||
* @since 3.10 | ||
* | ||
* A contribution item which delegates to a label on the tool bar. | ||
* | ||
*/ | ||
public class LabelContributionItem extends ControlContribution { | ||
|
||
private Label toolbarLabel; | ||
private String labelName; | ||
|
||
/** | ||
* @param id | ||
* @param name | ||
*/ | ||
public LabelContributionItem(String id, String name) { | ||
super(id); | ||
this.labelName = name; | ||
} | ||
|
||
@Override | ||
protected Control createControl(Composite parent) { | ||
Composite composite = new Composite(parent, SWT.NONE); | ||
this.toolbarLabel = new Label(composite, SWT.NONE); | ||
|
||
GridLayout compositeLayout = new GridLayout(1, false); | ||
if (OS.isWindows()) { | ||
compositeLayout.marginTop = -3; | ||
compositeLayout.marginBottom = -6; | ||
} | ||
composite.setLayout(compositeLayout); | ||
GridData labelLayout = new GridData(SWT.LEFT, SWT.CENTER, true, true); | ||
|
||
this.toolbarLabel.setLayoutData(labelLayout); | ||
this.toolbarLabel.setText(this.labelName); | ||
return composite; | ||
} | ||
|
||
public Label getToolbarLabel() { | ||
return toolbarLabel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
team/tests/org.eclipse.compare.tests/labelContributionData/file1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package testPackage; | ||
import java.math.*; | ||
public class Javaclass1 { | ||
|
||
public static void main(String[] args) { | ||
// TODO Auto-generated method stub | ||
|
||
int a=0; | ||
|
||
System.out.println(""); | ||
|
||
call_me(); | ||
|
||
|
||
} | ||
|
||
private static void call_me() { | ||
// TODO Auto-generated method stub | ||
System.out.println(); | ||
|
||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
team/tests/org.eclipse.compare.tests/labelContributionData/file2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package testPackage; | ||
|
||
import java.io.File; | ||
|
||
public class Javaclass1 { | ||
|
||
public static void main(String[] args) { | ||
|
||
|
||
int a=0; | ||
|
||
System.out.println(""); | ||
|
||
call_me(); | ||
|
||
callMe(a); | ||
|
||
} | ||
|
||
private static void callMe(int a) { | ||
// TODO Auto-generated method stub | ||
System.out.println(); | ||
|
||
} | ||
|
||
private static void call_me() { | ||
File f= new File(""); | ||
System.out.println("I am calledJavaclass1.java"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters