-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from gamerson/issue-99
Issue-99 Added ITernNatureCapability interface
- Loading branch information
Showing
4 changed files
with
99 additions
and
22 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
25 changes: 25 additions & 0 deletions
25
eclipse/tern.eclipse.ide.core/src/tern/eclipse/ide/core/ITernNatureCapability.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,25 @@ | ||
/** | ||
* Copyright (c) 2014 Liferay, Inc. | ||
* 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: | ||
* Gregory Amerson <gregory.amerson@liferay.com> - initial API and implementation | ||
*/ | ||
package tern.eclipse.ide.core; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.CoreException; | ||
|
||
|
||
/** | ||
* Tern nature adapter, can be used by adopters to provide more | ||
* advanced logic for which projects should be treated as tern projects | ||
*/ | ||
public interface ITernNatureCapability { | ||
|
||
boolean hasTernNature( IProject project ) throws CoreException; | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...se/tern.eclipse.ide.core/src/tern/eclipse/ide/internal/core/DefaultTernNatureAdapter.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,35 @@ | ||
/** | ||
* Copyright (c) 2014 Liferay, Inc. | ||
* 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: | ||
* Gregory Amerson <gregory.amerson@liferay.com> - initial API and implementation | ||
*/ | ||
package tern.eclipse.ide.internal.core; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.CoreException; | ||
|
||
import tern.eclipse.ide.core.ITernNatureCapability; | ||
|
||
|
||
/** | ||
* Provides a default tern adapter since most adapters only need to match ids | ||
*/ | ||
public class DefaultTernNatureAdapter implements ITernNatureCapability { | ||
|
||
final String natureId; | ||
|
||
public DefaultTernNatureAdapter( String id ) { | ||
this.natureId = id; | ||
} | ||
|
||
@Override | ||
public boolean hasTernNature( IProject project) throws CoreException { | ||
return project != null && project.hasNature( this.natureId ); | ||
} | ||
|
||
} |
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