eclipse plugin: Start working on adding a core library...

...link to each project for an easier reference
This commit is contained in:
Timotei Dolean 2011-08-08 21:27:26 +00:00
parent d86437472a
commit 3e9555d9b5
5 changed files with 111 additions and 0 deletions

View file

@ -301,6 +301,34 @@
wizardId="org.wesnoth.wizards.wizardLauncher">
<enablement></enablement>
</commonWizard>
<navigatorContent
activeByDefault="true"
appearsBefore="org.eclipse.ui.navigator.resourceContent"
contentProvider="org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider"
icon="icons/wesnoth-icon_16.png"
id="org.wesnoth.wesnothNavigatorContent"
labelProvider="org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionLabelProvider"
name="Wesnoth Resources"
priority="highest"
sortOnly="true">
<enablement>
<or>
<instanceof
value="org.eclipse.core.resources.IResource" />
</or>
</enablement>
<commonSorter
class="org.wesnoth.views.WesnothProjectsExplorerViewerSorter"
id="org.wesnoth.navigator.wesnothContentSorter">
<parentExpression>
<or>
<instanceof
value="org.wesnoth.views.WesnothProjectsExplorer">
</instanceof>
</or>
</parentExpression>
</commonSorter>
</navigatorContent>
</extension>
<extension
point="org.eclipse.ui.navigator.viewer">
@ -316,9 +344,24 @@
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.*">
</contentExtension>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.linkHelper">
</contentExtension>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.workingSets">
</contentExtension>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.*">
</contentExtension>
<contentExtension
pattern="org.wesnoth.navigator.filters.*">
</contentExtension>
<contentExtension
pattern="org.wesnoth.wesnothNavigatorContent">
</contentExtension>
<contentExtension
pattern="org.wesnoth.navigator.wesnothContentSorter">
</contentExtension>
</includes>
</viewerContentBinding>
<viewerActionBinding

View file

@ -27,6 +27,7 @@ import org.wesnoth.Logger;
import org.wesnoth.utils.ResourceUtils;
import org.wesnoth.utils.ResourceUtils.WMLFilesComparator;
import org.wesnoth.utils.StringUtils;
import org.wesnoth.views.WesnothProjectsExplorer;
public class DependencyListBuilder implements Serializable
{
@ -219,6 +220,12 @@ public class DependencyListBuilder implements Serializable
container = project_.getFolder( containerPath );
}
// skip core library
if( container.getName( ).equals(
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
return;
}
IResource main_cfg = container.findMember( "_main.cfg" ); //$NON-NLS-1$
if( main_cfg != null ) {
// add main.cfg to list

View file

@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingDeque;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -42,6 +43,7 @@ import org.wesnoth.utils.ResourceUtils;
import org.wesnoth.utils.StringUtils;
import org.wesnoth.utils.WMLTools;
import org.wesnoth.utils.WorkspaceUtils;
import org.wesnoth.views.WesnothProjectsExplorer;
import org.wesnoth.wml.SimpleWMLParser;
import org.wesnoth.wml.WMLConfig;
@ -243,6 +245,13 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
}
}
// skip core library files
if( resource instanceof IContainer
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
.equals( resource.getName( ) ) ) {
continue;
}
deltasQueue
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
}

View file

@ -21,6 +21,8 @@ public class WesnothProjectsExplorer extends CommonNavigator implements
{
public static final String ID_PROJECTS_EXPLORER = "org.wesnoth.views.WesnothProjectsExplorer"; //$NON-NLS-1$
public static final String CORE_LIBRARY_NAME = "Wesnoth Core Library";
public WesnothProjectsExplorer( )
{
}

View file

@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2011 by Timotei Dolean <timotei21@gmail.com>
*
* 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.wesnoth.views;
import java.text.Collator;
import org.eclipse.core.resources.IContainer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
public class WesnothProjectsExplorerViewerSorter extends ViewerSorter
{
public WesnothProjectsExplorerViewerSorter( )
{
}
public WesnothProjectsExplorerViewerSorter( Collator collator )
{
super( collator );
}
@Override
public int compare( Viewer viewer, Object e1, Object e2 )
{
// The core library container should be first everytime
int result = super.compare( viewer, e1, e2 );
if( result != 0
&& e1 instanceof IContainer
&& ( ( IContainer ) e1 ).getName( ).equals(
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
return - 1;
}
if( result != 0
&& e2 instanceof IContainer
&& ( ( IContainer ) e2 ).getName( ).equals(
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
return 1;
}
return result;
}
}