From 3e9555d9b53e3f0ecfbd102cda7f372e86c7b636 Mon Sep 17 00:00:00 2001 From: Timotei Dolean Date: Mon, 8 Aug 2011 21:27:26 +0000 Subject: [PATCH] eclipse plugin: Start working on adding a core library... ...link to each project for an easier reference --- utils/umc_dev/org.wesnoth/plugin.xml | 43 ++++++++++++++++ .../builder/DependencyListBuilder.java | 7 +++ .../builder/WesnothProjectBuilder.java | 9 ++++ .../views/WesnothProjectsExplorer.java | 2 + .../WesnothProjectsExplorerViewerSorter.java | 50 +++++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 utils/umc_dev/org.wesnoth/src/org/wesnoth/views/WesnothProjectsExplorerViewerSorter.java diff --git a/utils/umc_dev/org.wesnoth/plugin.xml b/utils/umc_dev/org.wesnoth/plugin.xml index 95c7dc00fa0..772f29354dc 100644 --- a/utils/umc_dev/org.wesnoth/plugin.xml +++ b/utils/umc_dev/org.wesnoth/plugin.xml @@ -301,6 +301,34 @@ wizardId="org.wesnoth.wizards.wizardLauncher"> + + + + + + + + + + + + + + + @@ -316,9 +344,24 @@ + + + + + + + + + + + * + * 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; + } +}