Skip to content

Instantly share code, notes, and snippets.

@rherrmann
rherrmann / FixedVersusExpandingContent.java
Last active April 28, 2022 08:33
SWT ScrolledComposite Examples to accompany this article: http://www.codeaffine.com/2016/03/01/swt-scrolledcomposite/
package com.codeaffine.scrolledcomposite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
/*******************************************************************************
* Copyright (c) 2014 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
******************************************************************************/
@rherrmann
rherrmann / EqualsTester.java
Last active August 29, 2022 07:10
Utility class to help unit testing equals() and hashCode(), see also http://www.codeaffine.com/2012/06/25/how-do-you-test-equals-and-hashcode/
/*******************************************************************************
* Copyright (c) 2012 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
* Frank Appel - code review, idea for assertEquals( T, Object, Object )
@rherrmann
rherrmann / JGitCommandsLearningTest.java
Last active February 21, 2023 03:40
Accompanying source code for Getting Started with JGit: http://www.codeaffine.com/2015/12/15/getting-started-with-jgit/
/***************************************************************************************************
* Copyright (c) 2015 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
**************************************************************************************************/
package com.codeaffine.jgit.example;
@rherrmann
rherrmann / DiffLearningTest.java
Last active March 18, 2023 06:29
'Learning Tests' that use the JGit API to diff revisions and create patches: http://www.codeaffine.com/2016/06/16/jgit-diff/
/***************************************************************************************************
* Copyright (c) 2016 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
**************************************************************************************************/
package com.codeaffine.jgit.example;
@rherrmann
rherrmann / CloneLearningTest.java
Last active July 21, 2023 19:15
'Learning Tests' that uses the JGit API to clone existing repositories: http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
package com.codeaffine.jgit.example;
import static java.util.Collections.singleton;
import static org.eclipse.jgit.api.ListBranchCommand.ListMode.ALL;
import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.List;