Skip to content

Instantly share code, notes, and snippets.

View vorburger's full-sized avatar
💭
I may be slow to respond.

Michael Vorburger vorburger

💭
I may be slow to respond.
View GitHub Profile
/**
* Copyright (c) 2014 Michael Vorburger and others.
*
* 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: Michael Vorburger - Initial API and implementation
*/
package ch.vorburger.xtext.utils;
import java.io.File;
import java.util.Collection;
import org.apache.commons.io.FileUtils;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@vorburger
vorburger / first_eclipse.org_xtext_gerrit
Created February 8, 2014 16:34
My first contribution to Xtext on Eclipse.org via Gerrit
vorburger@yoko:~/git/org.eclipse.xtext$ git push origin
Counting objects: 21, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 1.01 KiB | 0 bytes/s, done.
Total 11 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6)
remote: Processing changes: new: 1, refs: 1, done
remote: ----------
remote: Reviewing commit: commit 04b2c6347d0ae4b20ff3a3749120568a9f772322 1391876867 ----sp
@vorburger
vorburger / ProjectUtil.java
Created January 23, 2015 16:10
Eclipse Optional<IJavaProject> getJavaProject(IProject project)
// TODO This probably already exists somewhere?
public Optional<IJavaProject> getJavaProject(IProject project) {
try {
if (project.hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = JavaCore.create(project);
return Optional.of(javaProject);
} else {
return Optional.absent();
}
} catch (CoreException e) {
@vorburger
vorburger / OptionalInstanceofCast.java
Created January 23, 2015 16:11
instanceof cast Optional (Guava or Java 8)
// TODO Such an Optional for instanceof cast should be available more generically, somewhere?
@SuppressWarnings("unchecked")
protected <S, T extends S> Optional<T> getOptionalSubclass(S project, Class<T> desiredSubclass) {
if (desiredSubclass.isInstance(project))
return Optional.of((T) project);
else
return Optional.absent();
}
@vorburger
vorburger / gist:130c9951fbcae1a729c5
Last active August 29, 2015 14:19
Example of email causing Google Inbox A/HREF linkify bug
Delivered-To: mi...@gmail.com
Received: by 10.112.182.1 with SMTP id ea1csp1097818lbc;
Sun, 19 Apr 2015 15:17:27 -0700 (PDT)
X-Received: by 10.42.88.206 with SMTP id d14mr15378148icm.40.1429481846161;
Sun, 19 Apr 2015 15:17:26 -0700 (PDT)
Return-Path: <bugzilla-daemon@eclipse.org>
Received: from pmta1.delivery9.ore.mailhop.org (pmta1.delivery9.ore.mailhop.org. [54.186.172.23])
by mx.google.com with ESMTPS id j197si14363280ioj.18.2015.04.19.15.17.25
for <mi...@gmail.com>
/*
* Copyright (c) 2016 Red Hat, Inc. and others. 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
*/
package org.opendaylight.netvirt.aclservice.tests.utils.inject;
import static java.lang.annotation.ElementType.TYPE;
/*
* Copyright (c) 2016 Red Hat, Inc. and others. 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
*/
package org.opendaylight.netvirt.aclservice.tests.utils.inject;
/**
/*
* Copyright (c) 2016 Red Hat, Inc. and others. 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
*/
package org.opendaylight.netvirt.aclservice.tests.utils.inject;
import java.lang.reflect.Method;
/*
* Copyright (c) 2016 Red Hat, Inc. and others. 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
*/
package org.opendaylight.netvirt.aclservice.tests.utils.inject;
import org.junit.runners.BlockJUnit4ClassRunner;