eclipse plugin: Change the default wrapping...

...indentation policy to 'Indent by one'
This commit is contained in:
Timotei Dolean 2011-08-08 21:27:50 +00:00
parent 3e9555d9b5
commit 5fa7d2ccbc
131 changed files with 1731 additions and 1701 deletions

View file

@ -1,4 +1,4 @@
#Sat Aug 06 22:15:01 EEST 2011
#Mon Aug 08 23:52:12 EEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@ -80,28 +80,28 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=4
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=20
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -334,7 +334,7 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constan
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=false
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=false
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false

View file

@ -67,9 +67,9 @@ public abstract class WMLTests extends AbstractXtextTests
// get the wesnoth data path from the user
dataPath_ = System.getProperty( "wesnothDataDir" );
if( StringUtils.isNullOrEmpty( dataPath_ )
|| ! new File( dataPath_ ).exists( ) ) {
|| ! new File( dataPath_ ).exists( ) ) {
System.out
.println( "Please set the wesnoth data dir before testing!." );
.println( "Please set the wesnoth data dir before testing!." );
assertTrue( false );
}
}
@ -94,7 +94,7 @@ public abstract class WMLTests extends AbstractXtextTests
CharStream stream = new ANTLRStringStream( input );
getLexer( ).setCharStream( stream );
XtextTokenStream tokenStream = new XtextTokenStream( getLexer( ),
getTokenDefProvider( ) );
getTokenDefProvider( ) );
List< Token > tokens = tokenStream.getTokens( );
return tokens;
}
@ -111,7 +111,7 @@ public abstract class WMLTests extends AbstractXtextTests
* check whether an input is chopped into a list of expected token types
*/
protected void checkTokenisation( String input,
String... expectedTokenTypes )
String... expectedTokenTypes )
{
List< Token > tokens = getTokens( input );
assertEquals( input, expectedTokenTypes.length, tokens.size( ) );
@ -204,7 +204,7 @@ public abstract class WMLTests extends AbstractXtextTests
// the rule name for a keyword is usually
// the keyword enclosed in single quotes
String rule = new StringBuilder( "'" ).append( input ).append( "'" ) //$NON-NLS-1$ //$NON-NLS-2$
.toString( );
.toString( );
checkTokenisation( input, rule );
}

View file

@ -17,7 +17,7 @@ import org.wesnoth.tests.plugin.WMLParsingCampaignsConfigs;
@RunWith( Suite.class )
@Suite.SuiteClasses( { WMLGrammarTokensTests.class, WMLFilesTests.class,
WMLParsingCampaignsConfigs.class, } )
WMLParsingCampaignsConfigs.class, } )
public class WMLTestsSuite
{
}

View file

@ -74,7 +74,7 @@ public class WMLParsingCampaignsConfigs extends WMLTests
try {
SimpleWMLParser wmlParser = new SimpleWMLParser( new File( path ),
getParser( ) );
getParser( ) );
wmlParser.parse( );
WMLConfig config = wmlParser.getParsedConfig( );
@ -114,15 +114,15 @@ public class WMLParsingCampaignsConfigs extends WMLTests
public static Collection< Object[] > data( )
{
return Arrays.asList( new Object[][] {
{ new String[] { "An_Orcish_Incursion", "An_Orcish_Incursion",
"01_Defend_the_Forest", "02_Assassins", "03_Wasteland",
"04_Valley_of_Trolls", "05_Linaera_the_Quick",
"06_A_Detour_through_the_Swamp", "07_Showdown" } },
{ new String[] { "Dead_Water", "Dead_Water", "01_Invasion",
"02_Flight", "03_Wolf_Coast", "04_Slavers",
"05_Tirigaz", "06_Uncharted_Islands", "07_Bilheld",
"08_Talking_to_Tyegea", "09_The_Mage",
"10_The_Flaming_Sword", "11_Getting_Help",
"12_Revenge", "13_Epilogue" } } } );
{ new String[] { "An_Orcish_Incursion", "An_Orcish_Incursion",
"01_Defend_the_Forest", "02_Assassins", "03_Wasteland",
"04_Valley_of_Trolls", "05_Linaera_the_Quick",
"06_A_Detour_through_the_Swamp", "07_Showdown" } },
{ new String[] { "Dead_Water", "Dead_Water", "01_Invasion",
"02_Flight", "03_Wolf_Coast", "04_Slavers",
"05_Tirigaz", "06_Uncharted_Islands", "07_Bilheld",
"08_Talking_to_Tyegea", "09_The_Mage",
"10_The_Flaming_Sword", "11_Getting_Help",
"12_Revenge", "13_Epilogue" } } } );
}
}

View file

@ -1,4 +1,4 @@
#Sat Aug 06 22:15:01 EEST 2011
#Mon Aug 08 23:52:12 EEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@ -80,28 +80,28 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=4
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=20
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -334,7 +334,7 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constan
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=false
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=false
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -63,7 +63,7 @@ public class WMLUiModule extends org.wesnoth.ui.AbstractWMLUiModule
super.configure( binder );
binder.bind( IEObjectHoverProvider.class ).to(
WMLEObjectHoverProvider.class );
WMLEObjectHoverProvider.class );
}
@Override
@ -91,7 +91,7 @@ public class WMLUiModule extends org.wesnoth.ui.AbstractWMLUiModule
public ICharacterPairMatcher bindICharacterPairMatcher( )
{
return new WMLCharacterPairMatcher( new char[] { '(', ')', '{', '}',
'[', ']' } );
'[', ']' } );
}
public Class< ? extends XtextEditor > bindEditor( )

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -30,7 +30,7 @@ public class ClosingEndTagAutoEditStrategy implements IAutoEditStrategy
{
@Override
public void customizeDocumentCommand( final IDocument document,
final DocumentCommand command )
final DocumentCommand command )
{
try {
if( command.text.equals( "/" ) && document.get( command.offset - 1, 1 ).equals( "[" ) ) //$NON-NLS-1$ //$NON-NLS-2$
@ -41,40 +41,40 @@ public class ClosingEndTagAutoEditStrategy implements IAutoEditStrategy
}
editor.getDocument( ).readOnly(
new IUnitOfWork.Void< XtextResource >( ) {
@Override
public void process( XtextResource state )
throws Exception
{
ILeafNode currentNode = NodeModelUtils
.findLeafNodeAtOffset( state
.getParseResult( )
.getRootNode( ), command.offset );
new IUnitOfWork.Void< XtextResource >( ) {
@Override
public void process( XtextResource state )
throws Exception
{
ILeafNode currentNode = NodeModelUtils
.findLeafNodeAtOffset( state
.getParseResult( )
.getRootNode( ), command.offset );
if( currentNode == null ) {
return;
}
EObject semanticElement = currentNode
.getSemanticElement( );
if( semanticElement == null ) {
return;
}
String tagName = ""; //$NON-NLS-1$
EObject container = semanticElement
.eContainer( );
if( container instanceof WMLTag ) {
tagName = ( ( WMLTag ) container )
.getName( );
}
if( ! StringUtils.isNullOrEmpty( tagName ) ) {
command.shiftsCaret = true;
command.text = ( "/" + tagName ); //$NON-NLS-1$
}
if( currentNode == null ) {
return;
}
} );
EObject semanticElement = currentNode
.getSemanticElement( );
if( semanticElement == null ) {
return;
}
String tagName = ""; //$NON-NLS-1$
EObject container = semanticElement
.eContainer( );
if( container instanceof WMLTag ) {
tagName = ( ( WMLTag ) container )
.getName( );
}
if( ! StringUtils.isNullOrEmpty( tagName ) ) {
command.shiftsCaret = true;
command.text = ( "/" + tagName ); //$NON-NLS-1$
}
}
} );
}
} catch( BadLocationException e ) {
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -24,6 +24,6 @@ public class WMLAutoEditStrategy extends DefaultAutoEditStrategyProvider
super.configure( acceptor );
configureStringLiteral( acceptor );
acceptor.accept( new ClosingEndTagAutoEditStrategy( ),
IDocument.DEFAULT_CONTENT_TYPE );
IDocument.DEFAULT_CONTENT_TYPE );
}
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -18,7 +18,7 @@ public class WMLProposalComparator implements ICompletionProposalComparator
public int compare( ICompletionProposal arg0, ICompletionProposal arg1 )
{
if( arg0 instanceof ConfigurableCompletionProposal
&& arg1 instanceof ConfigurableCompletionProposal ) {
&& arg1 instanceof ConfigurableCompletionProposal ) {
ConfigurableCompletionProposal tmp0 = ( ConfigurableCompletionProposal ) arg0;
ConfigurableCompletionProposal tmp1 = ( ConfigurableCompletionProposal ) arg1;
return tmp0.compareTo( tmp1 );

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -93,14 +93,14 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
// load the schema so we know what to suggest for autocomplete
schemaParser_ = SchemaParser.getInstance( WesnothInstallsUtils
.getInstallNameForResource( file ) );
.getInstallNameForResource( file ) );
dependencyIndex_ = ResourceUtils.getDependencyIndex( file );
}
@Override
public void completeWMLKey_Name( EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
super.completeWMLKey_Name( model, assignment, context, acceptor );
refresh( );
@ -110,7 +110,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
@Override
public void complete_WMLKeyValue( EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
super.complete_WMLKeyValue( model, ruleCall, context, acceptor );
refresh( );
@ -120,7 +120,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
@Override
public void complete_WMLTag( EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
super.complete_WMLTag( model, ruleCall, context, acceptor );
refresh( );
@ -130,7 +130,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
@Override
public void completeWMLTag_Name( EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
super.completeWMLTag_Name( model, assignment, context, acceptor );
refresh( );
@ -140,8 +140,8 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
@Override
public void completeWMLMacroCall_Name( EObject model,
Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor )
Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor )
{
super.completeWMLMacroCall_Name( model, assignment, context, acceptor );
refresh( );
@ -151,7 +151,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
@Override
public void complete_WMLMacroCall( EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
super.complete_WMLMacroCall( model, ruleCall, context, acceptor );
refresh( );
@ -160,10 +160,10 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
}
private void addMacroCallProposals( EObject model, boolean ruleProposal,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
for( Entry< String, Define > define: projectCache_.getDefines( )
.entrySet( ) ) {
.entrySet( ) ) {
StringBuilder proposal = new StringBuilder( 10 );
if( ruleProposal == true ) {
proposal.append( "{" ); //$NON-NLS-1$
@ -176,13 +176,13 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
proposal.append( "}" ); //$NON-NLS-1$
acceptor.accept( createCompletionProposal( proposal.toString( ),
define.getKey( ), MACRO_CALL_IMAGE, context,
MACRO_CALL_PRIORITY ) );
define.getKey( ), MACRO_CALL_IMAGE, context,
MACRO_CALL_PRIORITY ) );
}
}
private void addKeyValueProposals( EObject model,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
if( model == null || ! ( model instanceof WMLKey ) ) {
return;
@ -192,19 +192,19 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
// handle the next_scenario and first_scenario
if( keyName.equals( "next_scenario" ) || //$NON-NLS-1$
keyName.equals( "first_scenario" ) ) //$NON-NLS-1$
keyName.equals( "first_scenario" ) ) //$NON-NLS-1$
{
for( WMLConfig config: projectCache_.getWMLConfigs( ).values( ) ) {
if( StringUtils.isNullOrEmpty( config.ScenarioId ) ) {
continue;
}
acceptor.accept( createCompletionProposal( config.ScenarioId,
config.ScenarioId, SCENARIO_VALUE_IMAGE, context,
KEY_VALUE_PRIORITY ) );
config.ScenarioId, SCENARIO_VALUE_IMAGE, context,
KEY_VALUE_PRIORITY ) );
}
}
else if( model.eContainer( ) != null
&& model.eContainer( ) instanceof WMLTag ) {
&& model.eContainer( ) instanceof WMLTag ) {
WMLTag parent = ( WMLTag ) model.eContainer( );
String tagName = parent.getName( );
WMLTag tag = schemaParser_.getTags( ).get( tagName );
@ -213,64 +213,65 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
if( tagKey != null && tagKey.is_Enum( ) ) {
for( WMLKeyValue val: tagKey.getValues( ) ) {
acceptor.accept( createCompletionProposal(
val.toString( ), context, KEY_VALUE_PRIORITY ) );
val.toString( ), context, KEY_VALUE_PRIORITY ) );
}
}
}
if( ( tagName.equals( "event" ) || tagName.equals( "fire_event" ) )
&& keyName.equals( "name" ) ) {
&& keyName.equals( "name" ) ) {
// add events
List< String > events = new ArrayList< String >( );
events.addAll( TemplateProvider.getInstance( )
.getCAC( "events" ) );
.getCAC( "events" ) );
events.addAll( projectCache_.getEvents( ) );
for( String event: events ) {
acceptor.accept( createCompletionProposal( event, context ) );
acceptor
.accept( createCompletionProposal( event, context ) );
}
}
else {
final int nodeOffset = NodeModelUtils.getNode( model )
.getTotalOffset( );
.getTotalOffset( );
List< String > variables = new ArrayList< String >( );
// add CAC variables
variables.addAll( TemplateProvider.getInstance( ).getCAC(
"variables" ) );
"variables" ) );
// filter variables by index
Collection< String > projectVariables = Collections2.transform(
projectCache_.getVariables( ).values( ),
new Function< WMLVariable, String >( ) {
projectCache_.getVariables( ).values( ),
new Function< WMLVariable, String >( ) {
@Override
public String apply( WMLVariable from )
{
for( Scope scope: from.getScopes( ) ) {
if( scope.contains( dependencyIndex_,
nodeOffset ) ) {
return from.getName( );
}
@Override
public String apply( WMLVariable from )
{
for( Scope scope: from.getScopes( ) ) {
if( scope.contains( dependencyIndex_,
nodeOffset ) ) {
return from.getName( );
}
return null;
}
} );
return null;
}
} );
variables.addAll( Collections2.filter( projectVariables,
Predicates.notNull( ) ) );
Predicates.notNull( ) ) );
for( String variable: variables ) {
acceptor.accept( createCompletionProposal( "$" + variable,
context ) );
context ) );
}
}
}
}
private void addKeyNameProposals( EObject model,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
WMLTag tag = null;
if( model instanceof WMLTag ) {
@ -303,9 +304,9 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
if( toAdd ) {
acceptor.accept( createCompletionProposal(
key.getName( ) + "=", //$NON-NLS-1$
key.getName( ), WML_KEY_IMAGE, context,
KEY_NAME_PRIORITY ) );
key.getName( ) + "=", //$NON-NLS-1$
key.getName( ), WML_KEY_IMAGE, context,
KEY_NAME_PRIORITY ) );
}
}
}
@ -313,7 +314,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
}
private void addTagProposals( EObject model, boolean ruleProposal,
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
{
WMLTag parentTag = null;
if( model instanceof WMLTag ) {
@ -329,16 +330,16 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
String parentIndent = ""; //$NON-NLS-1$
if( context.getCurrentNode( ).getOffset( ) > 0 ) {
parentIndent = NodeModelUtils.findLeafNodeAtOffset( node,
context.getCurrentNode( ).getOffset( ) -
context.getCurrentNode( ).getOffset( ) -
// if we have a non-rule proposal, subtract 1
( ruleProposal ? 0: 1 ) ).getText( );
( ruleProposal ? 0: 1 ) ).getText( );
}
// remove ugly new lines that break indentation
parentIndent = parentIndent.replace( "\r", "" ).replace( "\n", "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
WMLTag tagChildren = schemaParser_.getTags( ).get(
parentTag.getName( ) );
parentTag.getName( ) );
if( tagChildren != null ) {
boolean toAdd = true;
for( WMLTag tag: tagChildren.getWMLTags( ) ) {
@ -352,12 +353,12 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
// check only non-repeatable tags
if( ! tag.is_Repeatable( ) ) {
toAdd = ( WMLUtils.getTagByName( parentTag,
tag.getName( ) ) == null );
tag.getName( ) ) == null );
}
if( toAdd ) {
acceptor.accept( createTagProposal( tag.asWMLTag( ),
parentIndent, ruleProposal, context ) );
parentIndent, ruleProposal, context ) );
}
}
}
@ -367,19 +368,20 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
WMLTag rootTag = schemaParser_.getTags( ).get( "root" ); //$NON-NLS-1$
for( WMLTag tag: rootTag.getWMLTags( ) ) {
acceptor.accept( createTagProposal( tag,
"", ruleProposal, context ) ); //$NON-NLS-1$
"", ruleProposal, context ) ); //$NON-NLS-1$
}
}
// parsed custom tags
for( WMLTag tag: projectCache_.getWMLTags( ).values( ) ) {
acceptor.accept( createTagProposal( tag, "", ruleProposal, context ) ); //$NON-NLS-1$
acceptor
.accept( createTagProposal( tag, "", ruleProposal, context ) ); //$NON-NLS-1$
}
}
/**
* Returns the proposal for the specified tag, usign the specified indent
*
*
* @param tag
* The tag from which to construct the proposal
* @param indent
@ -390,7 +392,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
* @return
*/
private ICompletionProposal createTagProposal( WMLTag tag, String indent,
boolean ruleProposal, ContentAssistContext context )
boolean ruleProposal, ContentAssistContext context )
{
StringBuilder proposal = new StringBuilder( );
if( ruleProposal ) {
@ -401,27 +403,27 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
for( WMLKey key: tag.getWMLKeys( ) ) {
if( key.is_Required( ) ) {
proposal.append( String.format( "\t%s%s=\n", //$NON-NLS-1$
indent, key.getName( ) ) );
indent, key.getName( ) ) );
}
}
proposal.append( String.format( "%s[/%s", indent, tag.getName( ) ) ); //$NON-NLS-1$
return createCompletionProposal( proposal.toString( ), tag.getName( ),
WML_TAG_IMAGE, context, TAG_PRIORITY );
WML_TAG_IMAGE, context, TAG_PRIORITY );
}
private ICompletionProposal createCompletionProposal( String proposal,
ContentAssistContext context, int priority )
ContentAssistContext context, int priority )
{
return createCompletionProposal( proposal, null, null, priority,
context.getPrefix( ), context );
context.getPrefix( ), context );
}
public ICompletionProposal createCompletionProposal( String proposal,
String displayString, Image image,
ContentAssistContext contentAssistContext, int priority )
String displayString, Image image,
ContentAssistContext contentAssistContext, int priority )
{
return createCompletionProposal( proposal, new StyledString(
displayString ), image, priority,
contentAssistContext.getPrefix( ), contentAssistContext );
displayString ), image, priority,
contentAssistContext.getPrefix( ), contentAssistContext );
}
}

View file

@ -11,7 +11,7 @@ package org.wesnoth.ui.editor;
import org.eclipse.jface.action.IMenuManager;
public class DefaultExtXtextEditorCustomizer implements
IExtXtextEditorCustomizer
IExtXtextEditorCustomizer
{
@Override
public void customizeEditorContextMenu( IMenuManager menuManager )

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -46,7 +46,7 @@ public class LinkedFileEditorInput extends FileEditorInput
return false;
}
return getFile( ).getLocationURI( ).toString( )
.toLowerCase( Locale.ENGLISH )
.equals( targetUri.toLowerCase( Locale.ENGLISH ) );
.toLowerCase( Locale.ENGLISH )
.equals( targetUri.toLowerCase( Locale.ENGLISH ) );
}
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -16,7 +16,7 @@ import org.eclipse.xtext.ui.editor.XtextEditor;
* a xtext nature on non-xtext project. We don't want that (yet)
*/
public class WMLAbstractDirtyEditorCallback extends
AbstractDirtyStateAwareEditorCallback
AbstractDirtyStateAwareEditorCallback
{
@Override
public void afterCreatePartControl( XtextEditor editor )

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -75,7 +75,7 @@ public class WMLEditor extends XtextEditor
super( );
if( DEBUG ) {
org.apache.log4j.Logger.getLogger( XtextEditor.class ).setLevel(
Level.DEBUG );
Level.DEBUG );
}
// activate the wesnoth plugin
WesnothPlugin.getDefault( );
@ -99,12 +99,12 @@ public class WMLEditor extends XtextEditor
return false;
}
if( getEditorInput( ) == null
|| ( ( XtextEditor ) obj ).getEditorInput( ) == null ) {
|| ( ( XtextEditor ) obj ).getEditorInput( ) == null ) {
return false;
}
java.net.URI u1 = ( ( IURIEditorInput ) getEditorInput( ) ).getURI( );
java.net.URI u2 = ( ( IURIEditorInput ) ( ( XtextEditor ) obj )
.getEditorInput( ) ).getURI( );
.getEditorInput( ) ).getURI( );
if( u1 == null || u2 == null ) {
return false;
}
@ -114,7 +114,7 @@ public class WMLEditor extends XtextEditor
/**
* Gets current edited file.
*
*
* @return An IFile instance
*/
public static IFile getActiveEditorFile( )
@ -124,7 +124,7 @@ public class WMLEditor extends XtextEditor
/**
* Gets the edited file from the specified editor
*
*
* @param editor
* The editor to get the file from
* @return An IFile instance
@ -140,7 +140,7 @@ public class WMLEditor extends XtextEditor
/**
* Here it comes the part that handles external files
* (from outside the workspace)
*
*
*/
/**
* Copyright (c) 2010, Cloudsmith Inc.
@ -151,7 +151,7 @@ public class WMLEditor extends XtextEditor
*/
private void createLink( IProject project, IFile linkFile, java.net.URI uri )
throws CoreException
throws CoreException
{
IPath path = linkFile.getFullPath( );
@ -160,7 +160,7 @@ public class WMLEditor extends XtextEditor
int segmentCount = folders.segmentCount( );
for( int i = 0; i < segmentCount; i++ ) {
checkPath = checkPath.addTrailingSeparator( ).append(
folders.segment( i ) );
folders.segment( i ) );
IFolder folder = project.getFolder( checkPath );
if( ! folder.exists( ) ) {
folder.create( true, true, null );
@ -183,7 +183,7 @@ public class WMLEditor extends XtextEditor
// down, it is NOT a good
// idea to delete the link
if( PlatformUI.isWorkbenchRunning( )
&& ! PlatformUI.getWorkbench( ).isClosing( ) ) {
&& ! PlatformUI.getWorkbench( ).isClosing( ) ) {
file.delete( true, null );
}
} catch( CoreException e ) {
@ -199,7 +199,7 @@ public class WMLEditor extends XtextEditor
/**
* Overridden to allow customization of editor context menu via injected
* handler
*
*
* @see org.eclipse.ui.editors.text.TextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
*/
@Override
@ -212,9 +212,9 @@ public class WMLEditor extends XtextEditor
private IFile getWorkspaceFile( IFileStore fileStore )
{
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace( )
.getRoot( );
.getRoot( );
IFile[] files = workspaceRoot.findFilesForLocationURI( fileStore
.toURI( ) );
.toURI( ) );
if( files != null && files.length == 1 ) {
return files[0];
}
@ -233,7 +233,7 @@ public class WMLEditor extends XtextEditor
*/
@Override
public void init( IEditorSite site, IEditorInput input )
throws PartInitException
throws PartInitException
{
// THE ISSUE HERE:
// In the IDE, the File Open Dialog (and elsewhere) uses a
@ -247,14 +247,14 @@ public class WMLEditor extends XtextEditor
//
// Remedy:
if( input instanceof IURIEditorInput
&& ! ( input instanceof IFileEditorInput ) ) {
&& ! ( input instanceof IFileEditorInput ) ) {
java.net.URI uri = ( ( IURIEditorInput ) input ).getURI( );
String name = ( ( IURIEditorInput ) input ).getName( );
// Check if this is linkable input
if( uri.getScheme( ).equals( "file" ) ) { //$NON-NLS-1$
IFile linkedFile = obtainLink( uri );
IFileEditorInput linkedInput = new LinkedFileEditorInput(
linkedFile );
linkedFile );
super.init( site, linkedInput );
}
@ -266,7 +266,7 @@ public class WMLEditor extends XtextEditor
// or stored in tmp, and processed as the other linked
// resources..
URIEditorInput uriInput = new URIEditorInput(
URI.createURI( uri.toString( ) ), name );
URI.createURI( uri.toString( ) ), name );
super.init( site, uriInput );
return;
}
@ -277,7 +277,7 @@ public class WMLEditor extends XtextEditor
/**
* Throws WrappedException - the URI must refer to an existing file!
*
*
* @param uri
* @return
*/
@ -299,7 +299,7 @@ public class WMLEditor extends XtextEditor
if( newProject ) {
project.setDefaultCharset( ENCODING_UTF8,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
}
// path in project that is the same as the external file's path
@ -337,15 +337,15 @@ public class WMLEditor extends XtextEditor
// external link project
//
if( input instanceof IFileEditorInput
&& ( ( IFileEditorInput ) input ).getFile( ).isLinked( )
&& ( ( IFileEditorInput ) input ).getFile( ).getProject( )
.getName( ).equals( AUTOLINK_PROJECT_NAME ) ) {
&& ( ( IFileEditorInput ) input ).getFile( ).isLinked( )
&& ( ( IFileEditorInput ) input ).getFile( ).getProject( )
.getName( ).equals( AUTOLINK_PROJECT_NAME ) ) {
final IEditorInput newInput;
IDocumentProvider provider = getDocumentProvider( );
FileDialog dialog = new FileDialog( shell, SWT.SAVE );
IPath oldPath = URIUtil.toPath( ( ( IURIEditorInput ) input )
.getURI( ) );
.getURI( ) );
if( oldPath != null ) {
dialog.setFileName( oldPath.lastSegment( ) );
dialog.setFilterPath( oldPath.toOSString( ) );
@ -364,11 +364,11 @@ public class WMLEditor extends XtextEditor
final File localFile = new File( path );
if( localFile.exists( ) ) {
MessageDialog overwriteDialog = new MessageDialog( shell,
Messages.WMLEditor_0, null,
path + Messages.WMLEditor_1, MessageDialog.WARNING,
new String[] { IDialogConstants.YES_LABEL,
IDialogConstants.NO_LABEL }, 1 ); // 'No' is the
// default
Messages.WMLEditor_0, null,
path + Messages.WMLEditor_1, MessageDialog.WARNING,
new String[] { IDialogConstants.YES_LABEL,
IDialogConstants.NO_LABEL }, 1 ); // 'No' is the
// default
if( overwriteDialog.open( ) != Window.OK ) {
if( progressMonitor != null ) {
progressMonitor.setCanceled( true );
@ -411,7 +411,7 @@ public class WMLEditor extends XtextEditor
provider.aboutToChange( newInput );
provider.saveDocument( progressMonitor, newInput,
provider.getDocument( input ), true );
provider.getDocument( input ), true );
success = true;
} catch( CoreException x ) {

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* 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

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -44,16 +44,16 @@ public class WMLFoldingRegionProvider extends DefaultFoldingRegionProvider
@Override
protected void computeObjectFolding( EObject eObject,
IFoldingRegionAcceptor< ITextRegion > foldingRegionAcceptor )
IFoldingRegionAcceptor< ITextRegion > foldingRegionAcceptor )
{
// copied from "DefaultFoldingRegionProvider
ITextRegion region = locationInFileProvider.getFullTextRegion( eObject );
if( region != null ) {
ITextRegion significant = locationInFileProvider
.getSignificantTextRegion( eObject );
.getSignificantTextRegion( eObject );
if( significant == null ) {
throw new NullPointerException(
"significant region may not be null" );
"significant region may not be null" );
}
int offset = region.getOffset( );
int length = region.getLength( );

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* 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
@ -17,7 +17,7 @@ public class WMLEObjectHoverProvider extends DefaultEObjectHoverProvider
{
@Override
public IInformationControlCreatorProvider getHoverInfo( EObject object,
ITextViewer viewer, IRegion region )
ITextViewer viewer, IRegion region )
{
return null;
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -12,21 +12,21 @@ import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
*
* see
* http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class WMLDescriptionLabelProvider extends
DefaultDescriptionLabelProvider
DefaultDescriptionLabelProvider
{
/*
* //Labels and icons can be computed like this:
*
*
* String text(IEObjectDescription ele) {
* return "my "+ele.getName();
* }
*
*
* String image(IEObjectDescription ele) {
* return ele.getEClass().getName() + ".gif";
* }

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -20,7 +20,7 @@ import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
/**
* Provides labels for a EObjects.
*
*
* see
* http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
@ -40,8 +40,8 @@ public class WMLLabelProvider extends DefaultEObjectLabelProvider
{
if( element instanceof EClass ) {
return ( ( EClass ) element ).getName( ).toLowerCase(
Locale.ENGLISH )
+ ".png"; //$NON-NLS-1$
Locale.ENGLISH )
+ ".png"; //$NON-NLS-1$
}
else if( element instanceof String ) {
return element;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -17,14 +17,14 @@ public interface IWMLDocProvider
{
/**
* Gets the title of the wmldoc dialog
*
*
* @return
*/
public String getTitle( );
/**
* Gets the text to be written in the info statusbar
*
*
* @return
*/
public String getInfoText( );
@ -32,14 +32,14 @@ public interface IWMLDocProvider
/**
* Gets the contents to be written into the
* styledtext control of the wmldoc dialog
*
*
* @return
*/
public String getContents( );
/**
* Gets an array of StyleRange used to style the contents
*
*
* @return
*/
public StyleRange[] getStyleRanges( );

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -41,58 +41,58 @@ public class WMLDocHandler extends AbstractHandler
final XtextEditor editor = EditorUtils.getActiveXtextEditor( event );
final IFile editedFile = WMLEditor.getEditorFile( editor );
final String installName = WesnothInstallsUtils
.getInstallNameForResource( editedFile );
.getInstallNameForResource( editedFile );
editor.getDocument( ).readOnly(
new IUnitOfWork.Void< XtextResource >( ) {
@Override
public void process( XtextResource resource )
throws Exception
{
ITextSelection selection = ( ITextSelection ) editor
.getSelectionProvider( ).getSelection( );
Point positionRelative = editor
.getInternalSourceViewer( )
.getTextWidget( )
.getLocationAtOffset( selection.getOffset( ) );
Point positionAbsolute = editor
.getInternalSourceViewer( ).getTextWidget( )
.toDisplay( positionRelative );
positionAbsolute.y += 20;
new IUnitOfWork.Void< XtextResource >( ) {
@Override
public void process( XtextResource resource )
throws Exception
{
ITextSelection selection = ( ITextSelection ) editor
.getSelectionProvider( ).getSelection( );
Point positionRelative = editor
.getInternalSourceViewer( )
.getTextWidget( )
.getLocationAtOffset( selection.getOffset( ) );
Point positionAbsolute = editor
.getInternalSourceViewer( ).getTextWidget( )
.toDisplay( positionRelative );
positionAbsolute.y += 20;
EObject grammarElement = WMLUtils.resolveElementAt(
resource, selection.getOffset( ) );
if( grammarElement == null ) {
return;
}
EObject grammarElement = WMLUtils.resolveElementAt(
resource, selection.getOffset( ) );
if( grammarElement == null ) {
return;
}
if( grammarElement instanceof WMLMacroCall ) {
WMLMacroCall macro = ( WMLMacroCall ) grammarElement;
Define define = ProjectUtils
.getCacheForProject(
editedFile.getProject( ) )
.getDefines( ).get( macro.getName( ) );
if( define != null ) {
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
editor.getSite( ).getShell( ),
new WMLDocMacro( define ),
positionAbsolute );
presenter.create( );
presenter.open( );
}
}
else if( grammarElement instanceof WMLTag ) {
if( grammarElement instanceof WMLMacroCall ) {
WMLMacroCall macro = ( WMLMacroCall ) grammarElement;
Define define = ProjectUtils
.getCacheForProject(
editedFile.getProject( ) )
.getDefines( ).get( macro.getName( ) );
if( define != null ) {
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
editor.getSite( ).getShell( ),
new WMLDocTag( editedFile, installName,
( ( WMLTag ) grammarElement )
.getName( ) ),
positionAbsolute );
editor.getSite( ).getShell( ),
new WMLDocMacro( define ),
positionAbsolute );
presenter.create( );
presenter.open( );
}
}
} );
else if( grammarElement instanceof WMLTag ) {
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
editor.getSite( ).getShell( ),
new WMLDocTag( editedFile, installName,
( ( WMLTag ) grammarElement )
.getName( ) ),
positionAbsolute );
presenter.create( );
presenter.open( );
}
}
} );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -28,11 +28,11 @@ public class WMLDocInformationPresenter extends PopupDialog
* Creates a new WMLDocumentation information presenter
*/
public WMLDocInformationPresenter( Shell parent,
IWMLDocProvider docProvider, Point bounds )
IWMLDocProvider docProvider, Point bounds )
{
super( parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true,
true, false, false, docProvider.getTitle( ), docProvider
.getInfoText( ) );
true, false, false, docProvider.getTitle( ), docProvider
.getInfoText( ) );
bounds_ = bounds;
currentDocProvider_ = docProvider;
@ -43,9 +43,9 @@ public class WMLDocInformationPresenter extends PopupDialog
{
panel_ = new Composite( parent, SWT.None );
panel_.setBackground( parent.getDisplay( ).getSystemColor(
SWT.COLOR_INFO_BACKGROUND ) );
SWT.COLOR_INFO_BACKGROUND ) );
panel_.setForeground( parent.getDisplay( ).getSystemColor(
SWT.COLOR_INFO_FOREGROUND ) );
SWT.COLOR_INFO_FOREGROUND ) );
GridLayout grid = new GridLayout( );
grid.numColumns = 5;

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -74,7 +74,7 @@ public class WMLDocMacro implements IWMLDocProvider
/**
* Adds a style range to current list
*
*
* @param offset
* @param length
* @param style
@ -82,9 +82,9 @@ public class WMLDocMacro implements IWMLDocProvider
private void addStyleRange( int offset, int length, int style )
{
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
style ) );
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
style ) );
}
@Override
@ -110,7 +110,7 @@ public class WMLDocMacro implements IWMLDocProvider
/**
* Gets the associated macro
*
*
* @return
*/
public Define getMacro( )
@ -125,6 +125,6 @@ public class WMLDocMacro implements IWMLDocProvider
return null;
}
return "Defined in: " + macro_.getLocation( ) + " : "
+ macro_.getLineNum( );
+ macro_.getLineNum( );
}
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -41,7 +41,7 @@ public class WMLDocTag implements IWMLDocProvider
// try to get it from the Project Cache ( lua parsed ones )
if( tag_ == null ) {
tag_ = ProjectUtils.getCacheForProject( currentFile.getProject( ) )
.getWMLTags( ).get( name );
.getWMLTags( ).get( name );
}
// Create a default one
@ -80,7 +80,7 @@ public class WMLDocTag implements IWMLDocProvider
/**
* Adds a style range to current list
*
*
* @param offset
* @param length
* @param style
@ -88,9 +88,9 @@ public class WMLDocTag implements IWMLDocProvider
private void addStyleRange( int offset, int length, int style )
{
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
style ) );
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
style ) );
}
@Override

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -34,7 +34,7 @@ public class FileLocationOpenerHyperlink extends XtextHyperlink
ITextEditor editor = EditorUtils.getTextEditor( part );
IDocument doc = editor.getDocumentProvider( ).getDocument(
editor.getEditorInput( ) );
editor.getEditorInput( ) );
int offset = 0;
try {
// compute offset based on linenum_

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -40,9 +40,9 @@ public class MapOpenerHyperlink extends XtextHyperlink
{
if( ! new File( location_ ).exists( ) ) {
if( GUIUtils
.showMessageBox(
"The map doesn't exist. Do you want to create a default one and open that?",
SWT.YES | SWT.NO ) == SWT.NO ) {
.showMessageBox(
"The map doesn't exist. Do you want to create a default one and open that?",
SWT.YES | SWT.NO ) == SWT.NO ) {
return;
}
@ -51,7 +51,7 @@ public class MapOpenerHyperlink extends XtextHyperlink
try {
writer = new FileWriter( location_ );
writer.write( TemplateProvider.getInstance( ).getTemplate(
"map" ) );
"map" ) );
writer.close( );
} catch( IOException e ) {
Logger.getInstance( ).logException( e );

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -32,7 +32,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
{
@Override
public void createHyperlinksByOffset( XtextResource resource, int offset,
IHyperlinkAcceptor acceptor )
IHyperlinkAcceptor acceptor )
{
super.createHyperlinksByOffset( resource, offset, acceptor );
@ -45,12 +45,12 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
IFile file = WMLEditor.getActiveEditorFile( );
if( file == null ) {
Logger.getInstance( ).logError(
"FATAL! file is null (and it shouldn't) " );
"FATAL! file is null (and it shouldn't) " );
return;
}
Paths paths = Preferences.getPaths( WesnothInstallsUtils
.getInstallNameForResource( file ) );
.getInstallNameForResource( file ) );
ICompositeNode node = NodeModelUtils.getNode( object );
@ -60,7 +60,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
/**
* Creates a hyperlink for opening the macro definition
*
*
* @param paths
* The paths variable for the current install
* @param file
@ -73,7 +73,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
* The node model representation of the macro
*/
private void createMacroHyperlink( Paths paths, IFile file, EObject object,
IHyperlinkAcceptor acceptor, ICompositeNode node )
IHyperlinkAcceptor acceptor, ICompositeNode node )
{
if( object instanceof WMLMacroCall == false ) {
return;
@ -83,7 +83,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
// get the define for the macro
Define define = ProjectUtils.getCacheForProject( file.getProject( ) )
.getDefines( ).get( macro.getName( ) );
.getDefines( ).get( macro.getName( ) );
if( define == null || define.getLocation( ).length( ) <= 2 ) {
return;
}
@ -101,7 +101,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
FileLocationOpenerHyperlink macroTarget = new FileLocationOpenerHyperlink( );
macroTarget.setHyperlinkRegion( new Region( node.getOffset( ), node
.getLength( ) ) );
.getLength( ) ) );
macroTarget.setFilePath( filePath );
macroTarget.setLinenumber( define.getLineNum( ) );
acceptor.accept( macroTarget );
@ -109,7 +109,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
/**
* Creates a hyperlink for opening the map ( if applying )
*
*
* @param paths
* The paths variable for the current install
* @param object
@ -120,12 +120,12 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
* The node model representation of the macro
*/
private void createMapHyperlink( Paths paths, EObject object,
IHyperlinkAcceptor acceptor, ICompositeNode node )
IHyperlinkAcceptor acceptor, ICompositeNode node )
{
EObject container = object.eContainer( );
if( ! ( container instanceof WMLKey )
|| ! ( ( WMLKey ) container ).getName( ).equals( "map_data" ) ) {
|| ! ( ( WMLKey ) container ).getName( ).equals( "map_data" ) ) {
return;
}
@ -161,17 +161,17 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
if( mapLocation.charAt( 0 ) == '~' ) {
// expand the '~' character to user data dir
mapLocation = mapLocation
.replaceFirst( "~", paths.getUserDataDir( ) );
.replaceFirst( "~", paths.getUserDataDir( ) );
}
else if( mapLocation.startsWith( "campaigns/" ) ) {
// expand the campaigns path
mapLocation = mapLocation.replaceFirst( "campaigns/",
paths.getCampaignDir( ) );
paths.getCampaignDir( ) );
}
MapOpenerHyperlink hyperlink = new MapOpenerHyperlink( );
hyperlink.setHyperlinkRegion( new Region( node.getOffset( ), node
.getLength( ) ) );
.getLength( ) ) );
hyperlink.setLocation( mapLocation );
acceptor.accept( hyperlink );
}

View file

@ -9,7 +9,7 @@ import org.wesnoth.wml.WMLRoot;
/**
* customization of the default outline structure
*
*
*/
public class WMLOutlineTreeProvider extends DefaultOutlineTreeProvider
{

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -11,18 +11,18 @@ package org.wesnoth.ui.syntax;
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;
public class WMLAntlrTokenToAttributeIdMapper extends
DefaultAntlrTokenToAttributeIdMapper
DefaultAntlrTokenToAttributeIdMapper
{
@Override
protected String calculateId( String tokenName, int tokenType )
{
if( tokenName.equals( "'+'" ) || tokenName.equals( "'['" )
|| tokenName.equals( "'[/'" ) || tokenName.equals( "']'" ) ) //$NON-NLS-1$ //$NON-NLS-2$
|| tokenName.equals( "'[/'" ) || tokenName.equals( "']'" ) ) //$NON-NLS-1$ //$NON-NLS-2$
{
return WMLHighlightingConfiguration.RULE_WML_TAG;
}
if( tokenName.equals( "'~'" ) || tokenName.equals( "'{'" )
|| tokenName.equals( "'}'" ) ) //$NON-NLS-1$
|| tokenName.equals( "'}'" ) ) //$NON-NLS-1$
{
return WMLHighlightingConfiguration.RULE_WML_MACRO_CALL;
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -43,32 +43,32 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
IRegion region = super.match( doc, offset );
if( region == null && doc instanceof XtextDocument
&& doc.getLength( ) > 0 ) {
&& doc.getLength( ) > 0 ) {
if( matchCnt == 2 ) {
matchCnt = 0;
}
else {
( ( XtextDocument ) doc )
.readOnly( new IUnitOfWork< Boolean, XtextResource >( ) {
.readOnly( new IUnitOfWork< Boolean, XtextResource >( ) {
@Override
public Boolean exec( XtextResource state )
throws Exception
{
computeMatchingRegion( state, offset );
return true;
}
} );
@Override
public Boolean exec( XtextResource state )
throws Exception
{
computeMatchingRegion( state, offset );
return true;
}
} );
// refresh the highlighting
WMLEditor currentEditor = ( WMLEditor ) EditorUtils
.getActiveXtextEditor( );
.getActiveXtextEditor( );
if( currentEditor != null
&& currentEditor.getHighlightingHelper( ) != null
&& currentEditor.getHighlightingHelper( )
.getReconciler( ) != null ) {
&& currentEditor.getHighlightingHelper( ) != null
&& currentEditor.getHighlightingHelper( )
.getReconciler( ) != null ) {
currentEditor.getHighlightingHelper( ).getReconciler( )
.refresh( );
.refresh( );
}
}
}
@ -77,7 +77,7 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
}
public synchronized void computeMatchingRegion( XtextResource state,
int offset )
int offset )
{
EObject object = WMLUtils.resolveElementAt( state, offset );
@ -99,8 +99,8 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
}
state.eAdapters( )
.add( new WMLSyntaxColoringAdapter(
WMLHighlightingConfiguration.RULE_MATCH_TAG, object ) );
.add( new WMLSyntaxColoringAdapter(
WMLHighlightingConfiguration.RULE_MATCH_TAG, object ) );
}
else {
// nothing new selected, just remove current adapter

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -17,7 +17,7 @@ import org.eclipse.xtext.ui.editor.utils.TextStyle;
import org.wesnoth.ui.Messages;
public class WMLHighlightingConfiguration extends
DefaultHighlightingConfiguration
DefaultHighlightingConfiguration
{
public static final String RULE_WML_TAG = "wmlTag"; //$NON-NLS-1$
public static final String RULE_WML_KEY = "wmlKey"; //$NON-NLS-1$
@ -34,22 +34,22 @@ public class WMLHighlightingConfiguration extends
{
super.configure( acceptor );
acceptor.acceptDefaultHighlighting( RULE_WML_TAG,
Messages.WMLHighlightingConfiguration_7, tagTextStyle( ) );
Messages.WMLHighlightingConfiguration_7, tagTextStyle( ) );
acceptor.acceptDefaultHighlighting( RULE_WML_KEY,
Messages.WMLHighlightingConfiguration_8, keyTextStyle( ) );
Messages.WMLHighlightingConfiguration_8, keyTextStyle( ) );
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_CALL,
Messages.WMLHighlightingConfiguration_9, macroTextStyle( ) );
Messages.WMLHighlightingConfiguration_9, macroTextStyle( ) );
acceptor.acceptDefaultHighlighting( RULE_MATCH_TAG,
Messages.WMLHighlightingConfiguration_10, startEndTextStyle( ) );
Messages.WMLHighlightingConfiguration_10, startEndTextStyle( ) );
// preproc
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_DEFINE,
Messages.WMLHighlightingConfiguration_11, preprocTextStyle( ) );
Messages.WMLHighlightingConfiguration_11, preprocTextStyle( ) );
acceptor.acceptDefaultHighlighting( RULE_WML_IF,
Messages.WMLHighlightingConfiguration_12, preprocTextStyle( ) );
Messages.WMLHighlightingConfiguration_12, preprocTextStyle( ) );
acceptor.acceptDefaultHighlighting( RULE_WML_TEXTDOMAIN,
Messages.WMLHighlightingConfiguration_13, preprocTextStyle( ) );
Messages.WMLHighlightingConfiguration_13, preprocTextStyle( ) );
}
public TextStyle preprocTextStyle( )

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010 - 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
@ -33,11 +33,11 @@ import org.wesnoth.wml.WMLTextdomain;
import org.wesnoth.wml.WmlPackage;
public class WMLSemanticHighlightingCalculator implements
ISemanticHighlightingCalculator
ISemanticHighlightingCalculator
{
@Override
public void provideHighlightingFor( XtextResource resource,
IHighlightedPositionAcceptor acceptor )
IHighlightedPositionAcceptor acceptor )
{
if( resource == null ) {
return;
@ -51,56 +51,56 @@ public class WMLSemanticHighlightingCalculator implements
if( current instanceof WMLTag ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_TAG ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_TAG ) );
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_TAG__END_NAME ),
WMLHighlightingConfiguration.RULE_WML_TAG ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_TAG__END_NAME ),
WMLHighlightingConfiguration.RULE_WML_TAG ) );
}
else if( current instanceof WMLKey ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_KEY ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_KEY ) );
}
else if( current instanceof WMLMacroCall ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_CALL ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_CALL ) );
}
else if( current instanceof WMLTextdomain ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_TEXTDOMAIN ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_TEXTDOMAIN ) );
}
else if( current instanceof WMLPreprocIF ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_IF ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_IF ) );
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_IF ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_IF ) );
}
else if( current instanceof WMLMacroDefine ) {
toColor.add( Pair.create(
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
getFirstFeatureNode( current,
WmlPackage.Literals.WML_EXPRESSION__NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
toColor.add( Pair
.create(
getFirstFeatureNode(
current,
WmlPackage.Literals.WML_MACRO_DEFINE__END_NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
.create(
getFirstFeatureNode(
current,
WmlPackage.Literals.WML_MACRO_DEFINE__END_NAME ),
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
}
// check if we have any information specific information for
@ -130,7 +130,7 @@ public class WMLSemanticHighlightingCalculator implements
/**
* Copied from org.eclipse.xtext.xtext.ui.editor.syntaxcoloring.
* SemanticHighlightingCalculator
*
*
* @param node
* The node to highlight
* @param id
@ -139,7 +139,7 @@ public class WMLSemanticHighlightingCalculator implements
* The acceptor to add the node to
*/
private void highlightNode( INode node, String id,
IHighlightedPositionAcceptor acceptor )
IHighlightedPositionAcceptor acceptor )
{
if( node == null ) {
return;
@ -151,7 +151,7 @@ public class WMLSemanticHighlightingCalculator implements
for( ILeafNode leaf: node.getLeafNodes( ) ) {
if( ! leaf.isHidden( ) ) {
acceptor.addPosition( leaf.getOffset( ), leaf.getLength( ),
id );
id );
}
}
}
@ -160,7 +160,7 @@ public class WMLSemanticHighlightingCalculator implements
/**
* Copied from org.eclipse.xtext.xtext.ui.editor.syntaxcoloring.
* SemanticHighlightingCalculator
*
*
* @param semantic
* The object to search in
* @param feature
@ -168,13 +168,13 @@ public class WMLSemanticHighlightingCalculator implements
* @return Null if there is no feature, or an {@link INode} node
*/
public INode getFirstFeatureNode( EObject semantic,
EStructuralFeature feature )
EStructuralFeature feature )
{
if( feature == null ) {
return NodeModelUtils.findActualNodeFor( semantic );
}
List< INode > nodes = NodeModelUtils.findNodesForFeature( semantic,
feature );
feature );
if( ! nodes.isEmpty( ) ) {
return nodes.get( 0 );
}

View file

@ -1,6 +1,6 @@
/*******************************************************************************
* 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

View file

@ -1,4 +1,4 @@
#Sat Aug 06 22:15:01 EEST 2011
#Mon Aug 08 23:52:12 EEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@ -80,28 +80,28 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=4
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=20
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=20
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -334,7 +334,7 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constan
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=false
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=false
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false

View file

@ -19,25 +19,26 @@ public class Constants
{
/** Plugin related */
public static final String PLUGIN_FULL_PATH = Constants.class
.getProtectionDomain( )
.getCodeSource( )
.getLocation( )
.getPath( )
+ "/"; //$NON-NLS-1$
.getProtectionDomain( )
.getCodeSource( )
.getLocation( )
.getPath( )
+ "/"; //$NON-NLS-1$
public static final String PLUGIN_ID = "org.wesnoth"; //$NON-NLS-1$
public static final String MACHINE_OS = System.getProperty(
public static final String MACHINE_OS = System
.getProperty(
"os.name" ).toLowerCase( Locale.ENGLISH ); //$NON-NLS-1$
/**
* The boolean value whether this machine is running windows or not
*/
public static final boolean IS_WINDOWS_MACHINE = MACHINE_OS
.contains( "windows" ); //$NON-NLS-1$
.contains( "windows" ); //$NON-NLS-1$
/**
* The boolean value whether this machine is running Machintosh or not
*/
public static final boolean IS_MAC_MACHINE = MACHINE_OS
.contains( "mac" ); //$NON-NLS-1$
.contains( "mac" ); //$NON-NLS-1$
/** Preferences Constants **/
public static final String P_WESNOTH_EXEC_PATH = "wesnoth_exec_path"; //$NON-NLS-1$

View file

@ -60,14 +60,12 @@ public class Logger
throw new IOException( "Could not create the temporary folder." ); //$NON-NLS-1$
}
String logFilePath = String.format(
"%s/logs/log%s.txt", //$NON-NLS-1$
WorkspaceUtils.getTemporaryFolder( ),
WorkspaceUtils.getCurrentDateTime( ) );
String toolsLogFilePath = String.format(
"%s/logs/tools_log%s.txt", //$NON-NLS-1$
WorkspaceUtils.getTemporaryFolder( ),
WorkspaceUtils.getCurrentDateTime( ) );
String logFilePath = String.format( "%s/logs/log%s.txt", //$NON-NLS-1$
WorkspaceUtils.getTemporaryFolder( ),
WorkspaceUtils.getCurrentDateTime( ) );
String toolsLogFilePath = String.format( "%s/logs/tools_log%s.txt", //$NON-NLS-1$
WorkspaceUtils.getTemporaryFolder( ),
WorkspaceUtils.getCurrentDateTime( ) );
new File( WorkspaceUtils.getTemporaryFolder( ) + "/logs/" ).mkdirs( ); //$NON-NLS-1$
@ -76,15 +74,15 @@ public class Logger
log( "Error codes: 1 - INFO, 2 - WARNING, 4 - ERROR" ); //$NON-NLS-1$
toolLaunchLogWriter_ = new BufferedWriter( new FileWriter(
toolsLogFilePath ) );
toolsLogFilePath ) );
logTool( "Logging started." ); //$NON-NLS-1$
logTool( "Error codes: 1 - INFO, 2 - WARNING, 4 - ERROR" ); //$NON-NLS-1$
} catch( IOException e ) {
JOptionPane
.showMessageDialog(
null,
"There was an error trying to open the log." + e.getMessage( ) ); //$NON-NLS-1$
.showMessageDialog(
null,
"There was an error trying to open the log." + e.getMessage( ) ); //$NON-NLS-1$
e.printStackTrace( );
}
}
@ -216,15 +214,16 @@ public class Logger
}
private void logToWriter( BufferedWriter writer, String message,
int severity )
int severity )
{
if( writer != null ) {
try {
writer.write( String
writer
.write( String
.format(
"%s | %d | %s\n", //$NON-NLS-1$
new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( new Date( ) ), //$NON-NLS-1$
severity, message ) );
"%s | %d | %s\n", //$NON-NLS-1$
new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( new Date( ) ), //$NON-NLS-1$
severity, message ) );
writer.flush( );
} catch( IOException e ) {
e.printStackTrace( );
@ -233,7 +232,7 @@ public class Logger
// don't print to console the tools if there was no error/warning
if( writer != toolLaunchLogWriter_
|| ( writer == toolLaunchLogWriter_ && severity != IStatus.INFO ) ) {
|| ( writer == toolLaunchLogWriter_ && severity != IStatus.INFO ) ) {
System.out.println( message );
}
}

View file

@ -67,7 +67,7 @@ public class WesnothPlugin extends AbstractUIPlugin
{
// save the caches of the projects on disk
for( Entry< IProject, ProjectCache > cache: ProjectUtils
.getProjectCaches( ).entrySet( ) ) {
.getProjectCaches( ).entrySet( ) ) {
cache.getValue( ).saveCache( );
}
PreprocessorUtils.getInstance( ).saveTimestamps( );

View file

@ -33,17 +33,19 @@ public class RegenerateBuildFiles extends ObjectActionDelegate
Object element = it.next( );
if( element instanceof IProject ) {
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
param.add( new ReplaceableParameter(
param
.add( new ReplaceableParameter(
"$$project_name", ( ( ( IProject ) element ).getName( ) ) ) ); //$NON-NLS-1$
param.add( new ReplaceableParameter(
param
.add( new ReplaceableParameter(
"$$project_dir_name", ( ( IProject ) element ).getName( ) ) ); //$NON-NLS-1$
ResourceUtils.createFile( ( IProject ) element,
"build.xml", //$NON-NLS-1$
TemplateProvider.getInstance( ).getProcessedTemplate(
"build_xml", param ), true ); //$NON-NLS-1$
"build.xml", //$NON-NLS-1$
TemplateProvider.getInstance( ).getProcessedTemplate(
"build_xml", param ), true ); //$NON-NLS-1$
try {
( ( IProject ) element ).refreshLocal( IResource.DEPTH_ONE,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -20,7 +20,7 @@ public class ShowPlainPreprocessedConfig extends ObjectActionDelegate
public void run( IAction action )
{
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
WorkspaceUtils.getSelectedFile( WorkspaceUtils
.getWorkbenchWindow( ) ), true );
WorkspaceUtils.getSelectedFile( WorkspaceUtils
.getWorkbenchWindow( ) ), true );
}
}

View file

@ -20,6 +20,6 @@ public class ShowPreprocessedConfig extends ObjectActionDelegate
public void run( IAction action )
{
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
WorkspaceUtils.getSelectedFile( ), false );
WorkspaceUtils.getSelectedFile( ), false );
}
}

View file

@ -30,23 +30,23 @@ public class UploadAddon extends ObjectActionDelegate
public void run( IAction action )
{
final String fullPath = WorkspaceUtils.getSelectedResource( )
.getLocation( ).toOSString( );
.getLocation( ).toOSString( );
ProgressMonitorDialog dialog = new ProgressMonitorDialog(
WesnothPlugin.getShell( ) );
WesnothPlugin.getShell( ) );
try {
dialog.run( false, false, new IRunnableWithProgress( ) {
@Override
public void run( IProgressMonitor monitor )
throws InvocationTargetException, InterruptedException
throws InvocationTargetException, InterruptedException
{
monitor.beginTask( Messages.UploadAddon_0, 50 );
monitor.worked( 10 );
OutputStream consoleStream = GUIUtils.createConsole(
Messages.UploadAddon_1, null, true )
.newOutputStream( );
Messages.UploadAddon_1, null, true )
.newOutputStream( );
WMLTools.uploadWesnothAddon( fullPath,
new OutputStream[] { consoleStream },
new OutputStream[] { consoleStream } );
new OutputStream[] { consoleStream },
new OutputStream[] { consoleStream } );
monitor.worked( 40 );
monitor.done( );
}

View file

@ -44,24 +44,24 @@ public class WesnothProjectReport extends ObjectActionDelegate
int[] statistics = new int[3];
File scenariosFolder = new File( container.getLocation( ).toOSString( )
+ "/scenarios" ); //$NON-NLS-1$
+ "/scenarios" ); //$NON-NLS-1$
if( scenariosFolder.exists( ) ) {
statistics[0] = scenariosFolder.listFiles( ).length;
}
File mapsFolder = new File( container.getLocation( ).toOSString( )
+ "/maps" ); //$NON-NLS-1$
+ "/maps" ); //$NON-NLS-1$
if( mapsFolder.exists( ) ) {
statistics[1] = mapsFolder.listFiles( ).length;
}
File unitsFolder = new File( container.getLocation( ).toOSString( )
+ "/units" ); //$NON-NLS-1$
+ "/units" ); //$NON-NLS-1$
if( unitsFolder.exists( ) ) {
statistics[2] = unitsFolder.listFiles( ).length;
}
return String.format( Messages.WesnothProjectReport_4, statistics[0],
statistics[1], statistics[2] );
statistics[1], statistics[2] );
}
}

View file

@ -79,8 +79,8 @@ public class DependencyListBuilder implements Serializable
{
if( isCreated_ && ! force ) {
Logger.getInstance( )
.log( "Skipping depedency list for project "
+ project_.getName( ) );
.log( "Skipping depedency list for project "
+ project_.getName( ) );
return;
}
@ -107,7 +107,7 @@ public class DependencyListBuilder implements Serializable
// in case we need to add multiple subsequent files...
DependencyListNode backupPrevious = previous_, newNode = null;
String fileParentProjectPath = file.getParent( )
.getProjectRelativePath( ).toString( );
.getProjectRelativePath( ).toString( );
// we add a file in an existing processed directory.
if( directories_.contains( fileParentProjectPath ) ) {
@ -143,7 +143,7 @@ public class DependencyListBuilder implements Serializable
// we found the place?
if( ResourceUtils.wmlFileNameCompare( tmpNode.getFile( )
.getName( ), fileName ) > 0 ) {
.getName( ), fileName ) > 0 ) {
previous_ = tmpNode.getPrevious( );
@ -222,7 +222,7 @@ public class DependencyListBuilder implements Serializable
// skip core library
if( container.getName( ).equals(
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
return;
}
@ -250,14 +250,14 @@ public class DependencyListBuilder implements Serializable
if( ! directories_.contains( containerPath ) ) {
directories_.add( containerPath );
directoriesEntries_.add( new ListDirectoryEntry( containerPath,
null, null ) );
null, null ) );
toAddDirectoryEntry = true;
}
else {
// update the includes
directoriesEntries_.get( directoriesEntries_
.indexOf( containerPath ) ).Includes++;
.indexOf( containerPath ) ).Includes++;
}
if( members.isEmpty( ) ) {
@ -270,7 +270,7 @@ public class DependencyListBuilder implements Serializable
for( IResource resource: members ) {
if( resource instanceof IContainer ) {
internal_addContainer( resource.getProjectRelativePath( )
.toString( ) );
.toString( ) );
}
else {
// just config files.
@ -289,8 +289,8 @@ public class DependencyListBuilder implements Serializable
if( toAddDirectoryEntry ) {
// update the first directory node
directoriesEntries_.set( directories_.size( ) - 1,
new ListDirectoryEntry( containerPath,
firstNewNode, lastNode ) );
new ListDirectoryEntry( containerPath,
firstNewNode, lastNode ) );
}
else {
// if the current entry has null nodes
@ -298,17 +298,17 @@ public class DependencyListBuilder implements Serializable
// we need to update the references nodes
ListDirectoryEntry entry = directoriesEntries_
.get( directories_.indexOf( containerPath ) );
.get( directories_.indexOf( containerPath ) );
if( entry.FirstNode == null
|| ( entry.FirstNode != null && firstNewNode
.getIndex( ) < entry.FirstNode.getIndex( ) ) ) {
|| ( entry.FirstNode != null && firstNewNode
.getIndex( ) < entry.FirstNode.getIndex( ) ) ) {
entry.FirstNode = firstNewNode;
}
if( entry.LastNode == null
|| ( entry.LastNode != null && lastNode.getIndex( ) > entry.LastNode
.getIndex( ) ) ) {
|| ( entry.LastNode != null && lastNode.getIndex( ) > entry.LastNode
.getIndex( ) ) ) {
entry.LastNode = lastNode;
}
}
@ -332,12 +332,12 @@ public class DependencyListBuilder implements Serializable
// inserting is done between 2 nodes
if( previous_.getNext( ) != null ) {
int newIndex = ( previous_.getIndex( ) + previous_.getNext( )
.getIndex( ) ) / 2;
.getIndex( ) ) / 2;
if( newIndex > previous_.getIndex( )
+ DependencyListNode.INDEX_STEP ) {
+ DependencyListNode.INDEX_STEP ) {
newIndex = previous_.getIndex( )
+ DependencyListNode.INDEX_STEP;
+ DependencyListNode.INDEX_STEP;
}
newNode.setIndex( newIndex );
@ -364,7 +364,7 @@ public class DependencyListBuilder implements Serializable
newNode.setNext( root );
newNode.setIndex( root.getIndex( )
- DependencyListNode.INDEX_STEP );
- DependencyListNode.INDEX_STEP );
}
else {
newNode.setIndex( currentIndex_ );
@ -411,7 +411,7 @@ public class DependencyListBuilder implements Serializable
}
String fileParentProjectPath = node.getFile( ).getParent( )
.getProjectRelativePath( ).toString( );
.getProjectRelativePath( ).toString( );
list_.remove( node.getFile( ).getProjectRelativePath( ).toString( ) );
@ -420,7 +420,7 @@ public class DependencyListBuilder implements Serializable
if( node.getNext( ) == null ) {
if( node.getPrevious( ) != null ) {
currentIndex_ = node.getPrevious( ).getIndex( )
+ DependencyListNode.INDEX_STEP;
+ DependencyListNode.INDEX_STEP;
}
}
@ -494,7 +494,7 @@ public class DependencyListBuilder implements Serializable
List< String > processedIncludes = new ArrayList< String >( );
for( int prevIndex = 0, newIndex = 0; prevIndex < prevLength
&& newIndex < newLength; ) {
&& newIndex < newLength; ) {
String prevIncl = previousIncludes.get( prevIndex );
String newIncl = newIncludes.get( prevIndex );
@ -519,8 +519,8 @@ public class DependencyListBuilder implements Serializable
// get the directory entry for the previous include
if( newIndex > 0 ) {
ListDirectoryEntry entry = directoriesEntries_
.get( directories_.indexOf( newIncludes
.get( newIndex - 1 ) ) );
.get( directories_.indexOf( newIncludes
.get( newIndex - 1 ) ) );
if( entry != null ) {
previous_ = entry.FirstNode;
@ -546,13 +546,13 @@ public class DependencyListBuilder implements Serializable
if( ! processedIncludes.contains( prevIncl ) ) {
ListDirectoryEntry prevEntry = directoriesEntries_
.get( directories_.indexOf( prevIncl ) );
.get( directories_.indexOf( prevIncl ) );
ListDirectoryEntry newEntry = directoriesEntries_
.get( directories_.indexOf( newIncl ) );
.get( directories_.indexOf( newIncl ) );
if( prevEntry != null && newEntry != null
&& prevEntry.FirstNode != null
&& newEntry.FirstNode != null ) {
&& prevEntry.FirstNode != null
&& newEntry.FirstNode != null ) {
// create a list for easier swap
List< DependencyListNode > nodes = new ArrayList< DependencyListNode >( );
@ -602,8 +602,8 @@ public class DependencyListBuilder implements Serializable
}
else {
Logger.getInstance( ).log(
"Null directory entry for" + "includes: "
+ prevIncl + " and " + newIncl );
"Null directory entry for" + "includes: "
+ prevIncl + " and " + newIncl );
}
}
}
@ -714,7 +714,7 @@ public class DependencyListBuilder implements Serializable
public int Includes;
public ListDirectoryEntry( String name, DependencyListNode firstNode,
DependencyListNode lastNode )
DependencyListNode lastNode )
{
Name = name;
FirstNode = firstNode;

View file

@ -41,8 +41,8 @@ public class DependencyListNode implements Serializable
public static final int INDEX_STEP = 100000;
public static final QualifiedName PDL_INDEX = new QualifiedName(
Constants.PLUGIN_ID,
"pdl_index" ); //$NON-NLS-1$
Constants.PLUGIN_ID,
"pdl_index" ); //$NON-NLS-1$
private DependencyListNode previous_;
private DependencyListNode next_;
@ -86,7 +86,7 @@ public class DependencyListNode implements Serializable
{
if( includes_ == null || refresh ) {
includes_ = new ArrayList< String >(
ResourceUtils.getContainers( file_ ) );
ResourceUtils.getContainers( file_ ) );
}
return includes_;

View file

@ -39,7 +39,7 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
}
else if( element instanceof IAdaptable ) {
project = ( IProject ) ( ( IAdaptable ) element )
.getAdapter( IProject.class );
.getAdapter( IProject.class );
}
if( project != null ) {
toggleNature( project );
@ -65,12 +65,12 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
String[] newNatures = new String[natures.length - 1];
System.arraycopy( natures, 0, newNatures, 0, i );
System.arraycopy( natures, i + 1, newNatures, i,
natures.length - i - 1 );
natures.length - i - 1 );
description.setNatureIds( newNatures );
project.setDescription( description,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
project.refreshLocal( IResource.DEPTH_INFINITE,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
return;
}
}
@ -82,7 +82,7 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
description.setNatureIds( newNatures );
project.setDescription( description, new NullProgressMonitor( ) );
project.refreshLocal( IResource.DEPTH_INFINITE,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -39,7 +39,7 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
}
else if( element instanceof IAdaptable ) {
project = ( IProject ) ( ( IAdaptable ) element )
.getAdapter( IProject.class );
.getAdapter( IProject.class );
}
if( project != null ) {
toggleNature( project );
@ -65,12 +65,12 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
String[] newNatures = new String[natures.length - 1];
System.arraycopy( natures, 0, newNatures, 0, i );
System.arraycopy( natures, i + 1, newNatures, i,
natures.length - i - 1 );
natures.length - i - 1 );
description.setNatureIds( newNatures );
project.setDescription( description,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
project.refreshLocal( IResource.DEPTH_INFINITE,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
return;
}
}
@ -82,7 +82,7 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
description.setNatureIds( newNatures );
project.setDescription( description, new NullProgressMonitor( ) );
project.refreshLocal( IResource.DEPTH_INFINITE,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -64,7 +64,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
@SuppressWarnings( "rawtypes" )
@Override
protected IProject[] build( int kind, Map args, IProgressMonitor monitor )
throws CoreException
throws CoreException
{
project_ = getProject( );
if( WesnothInstallsUtils.setupInstallForResource( project_ ) == false ) {
@ -76,13 +76,13 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
}
Logger.getInstance( ).log(
"Building project " + getProject( ).getName( ) + " ..." ); //$NON-NLS-1$
"Building project " + getProject( ).getName( ) + " ..." ); //$NON-NLS-1$
monitor.beginTask(
String.format( Messages.WesnothProjectBuilder_1,
project_.getName( ) ), 100 );
String.format( Messages.WesnothProjectBuilder_1,
project_.getName( ) ), 100 );
String installName = WesnothInstallsUtils
.getInstallNameForResource( project_ );
.getInstallNameForResource( project_ );
Paths paths = Preferences.getPaths( installName );
monitor.subTask( Messages.WesnothProjectBuilder_3 );
@ -133,7 +133,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
monitor.done( );
Logger.getInstance( ).log(
"Done building project " + getProject( ).getName( ) );
"Done building project " + getProject( ).getName( ) );
return null;
}
@ -146,12 +146,12 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
* @throws CoreException
*/
protected boolean fullBuild( final IProgressMonitor monitor )
throws CoreException
throws CoreException
{
// clean all project cache
projectCache_.clear( );
PreprocessorUtils.getInstance( ).clearTimestampsForPath(
project_.getLocation( ).toOSString( ) );
project_.getLocation( ).toOSString( ) );
projectCache_.getDependencyList( ).createDependencyList( true );
boolean foundCfg = false;
@ -159,7 +159,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
DependencyListNode node = null;
node = projectCache_.getDependencyList( ).getNode(
DependencyListBuilder.ROOT_NODE_KEY );
DependencyListBuilder.ROOT_NODE_KEY );
if( node != null ) {
@ -186,7 +186,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
* @throws CoreException
*/
protected boolean incrementalBuild( IResourceDelta delta,
IProgressMonitor monitor ) throws CoreException
IProgressMonitor monitor ) throws CoreException
{
boolean foundCfg = false;
@ -212,15 +212,15 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
if( deltaKind == IResourceDelta.REMOVED ) {
projectCache_.getDependencyList( ).removeNode( file );
projectCache_.getWMLConfigs( ).remove(
file.getProjectRelativePath( ).toString( ) );
file.getProjectRelativePath( ).toString( ) );
}
else if( deltaKind == IResourceDelta.ADDED ) {
DependencyListNode newNode = list.addNode( file );
if( newNode == null ) {
Logger.getInstance( ).logError(
"Couldn't create a new" + "PDL node for file: "
+ file.getFullPath( ).toString( ) );
"Couldn't create a new" + "PDL node for file: "
+ file.getFullPath( ).toString( ) );
}
else {
nodesToProcess.add( newNode );
@ -230,9 +230,9 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
DependencyListNode node = list.getNode( file );
if( node == null ) {
Logger.getInstance( ).logError(
"Couldn't find file "
+ file.getFullPath( ).toString( )
+ " in PDL!." );
"Couldn't find file "
+ file.getFullPath( ).toString( )
+ " in PDL!." );
}
else {
nodesToProcess.add( node );
@ -241,39 +241,39 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
}
else {
Logger.getInstance( ).log(
"unknown delta kind: " + deltaKind );
"unknown delta kind: " + deltaKind );
}
}
// skip core library files
if( resource instanceof IContainer
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
.equals( resource.getName( ) ) ) {
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
.equals( resource.getName( ) ) ) {
continue;
}
deltasQueue
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
}
// sort the list by index (ascending)
Collections.sort( nodesToProcess,
new Comparator< DependencyListNode >( ) {
new Comparator< DependencyListNode >( ) {
@Override
public int compare( DependencyListNode o1,
DependencyListNode o2 )
{
if( o1.getIndex( ) < o2.getIndex( ) ) {
return - 1;
}
else if( o1.getIndex( ) == o2.getIndex( ) ) {
return 0;
}
return 1;
@Override
public int compare( DependencyListNode o1,
DependencyListNode o2 )
{
if( o1.getIndex( ) < o2.getIndex( ) ) {
return - 1;
}
} );
else if( o1.getIndex( ) == o2.getIndex( ) ) {
return 0;
}
return 1;
}
} );
foundCfg = ( ! nodesToProcess.isEmpty( ) );
// process nodes
@ -297,7 +297,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
private boolean runAntJob( Paths paths, IProgressMonitor monitor )
{
String buildXMLPath = project_.getLocation( ).toOSString( )
+ "/build.xml";
+ "/build.xml";
// check for 'build.xml' existance
if( new File( buildXMLPath ).exists( ) == true ) {
// run the ant job to copy the whole project
@ -313,7 +313,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
if( result == null ) {
Logger.getInstance( ).log( "error running the ant job", //$NON-NLS-1$
Messages.WesnothProjectBuilder_13 );
Messages.WesnothProjectBuilder_13 );
return false;
}
}
@ -323,7 +323,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
}
protected boolean checkResource( IResource resource,
IProgressMonitor monitor )
IProgressMonitor monitor )
{
monitor.worked( 5 );
if( resource.exists( ) == false || monitor.isCanceled( ) ) {
@ -335,13 +335,13 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
IFile file = ( IFile ) resource;
String filePath = file.getProjectRelativePath( ).toString( );
String macrosFilePath = PreprocessorUtils.getInstance( )
.getMacrosLocation( file );
.getMacrosLocation( file );
Logger.getInstance( ).log( "Resource: " + filePath ); //$NON-NLS-1$
try {
monitor.subTask( String.format(
Messages.WesnothProjectBuilder_19, filePath ) );
Messages.WesnothProjectBuilder_19, filePath ) );
List< String > defines = new ArrayList< String >( );
// parse the core only if we don't have any macros file
@ -351,17 +351,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
// we use a single _MACROS_.cfg file for each project
PreprocessorUtils.getInstance( ).preprocessFile( file,
macrosFilePath, defines );
macrosFilePath, defines );
monitor.worked( 5 );
// process the AST ( Abstract Syntax Tree ) to get info for the
// file
monitor.subTask( String.format(
Messages.WesnothProjectBuilder_22, filePath ) );
Messages.WesnothProjectBuilder_22, filePath ) );
WMLConfig config = projectCache_.getWMLConfig( filePath );
SimpleWMLParser parser = new SimpleWMLParser( file, config,
projectCache_ );
projectCache_ );
parser.parse( );
monitor.worked( 10 );
@ -375,17 +375,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
@SuppressWarnings( "unused" )
private void runWMLLint( String installName, IProgressMonitor monitor,
IFile file )
IFile file )
{
monitor.subTask( String.format( "Running WMLlint on file %s ...",
file.getName( ) ) );
file.getName( ) ) );
ExternalToolInvoker tool = WMLTools.runWMLLint( installName, file
.getLocation( ).toOSString( ), false, false );
.getLocation( ).toOSString( ), false, false );
tool.waitForTool( );
try {
file.deleteMarkers( Constants.MARKER_WMLLINT, false,
IResource.DEPTH_INFINITE );
IResource.DEPTH_INFINITE );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}
@ -407,17 +407,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
*/
@SuppressWarnings( "unused" )
private void runWMLScope( String installName, IProgressMonitor monitor,
IFile file )
IFile file )
{
monitor.subTask( String.format( "Running WMLScope on file %s ...",
file.getName( ) ) );
file.getName( ) ) );
ExternalToolInvoker tool = WMLTools.runWMLScope( installName, file
.getLocation( ).toOSString( ), false );
.getLocation( ).toOSString( ), false );
tool.waitForTool( );
try {
file.deleteMarkers( Constants.MARKER_WMLSCOPE, false,
IResource.DEPTH_INFINITE );
IResource.DEPTH_INFINITE );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -32,7 +32,7 @@ public class WesnothProjectNature implements IProjectNature
int configured = 0;
for( int i = 0; i < commands.length; ++i ) {
if( commands[i].getBuilderName( ).equals(
Constants.BUIILDER_WESNOTH ) ) {
Constants.BUIILDER_WESNOTH ) ) {
wesnothConfigured = true;
configured++;
}
@ -46,7 +46,7 @@ public class WesnothProjectNature implements IProjectNature
}
ICommand[] newCommands = new ICommand[commands.length
+ ( 2 - configured )];
+ ( 2 - configured )];
System.arraycopy( commands, 0, newCommands, 0, commands.length );
if( wesnothConfigured == false ) {
ICommand command = desc.newCommand( );
@ -69,13 +69,13 @@ public class WesnothProjectNature implements IProjectNature
ICommand[] commands = description.getBuildSpec( );
for( int i = 0; i < commands.length; ++i ) {
if( commands[i].getBuilderName( ).equals(
Constants.BUIILDER_WESNOTH )
|| commands[i].getBuilderName( ).equals(
Constants.BUILDER_XTEXT ) ) {
Constants.BUIILDER_WESNOTH )
|| commands[i].getBuilderName( ).equals(
Constants.BUILDER_XTEXT ) ) {
ICommand[] newCommands = new ICommand[commands.length - 1];
System.arraycopy( commands, 0, newCommands, 0, i );
System.arraycopy( commands, i + 1, newCommands, i,
commands.length - i - 1 );
commands.length - i - 1 );
description.setBuildSpec( newCommands );
project.setDescription( description, null );
}

View file

@ -38,26 +38,26 @@ public class WMLFormatter extends AbstractDeclarativeFormatter
// no space after '[' and '[/'
c.setNoSpace( ).after(
f.getWMLTagAccess( ).getLeftSquareBracketKeyword_0( ) );
f.getWMLTagAccess( ).getLeftSquareBracketKeyword_0( ) );
c.setNoSpace( ).after(
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
// no space before and after ']'
c.setNoSpace( ).around(
f.getWMLTagAccess( ).getRightSquareBracketKeyword_3( ) );
f.getWMLTagAccess( ).getRightSquareBracketKeyword_3( ) );
c.setNoSpace( ).around(
f.getWMLTagAccess( ).getRightSquareBracketKeyword_7( ) );
f.getWMLTagAccess( ).getRightSquareBracketKeyword_7( ) );
// no space before and after the '=' in 'key=value'
c.setNoSpace( ).around( f.getWMLKeyAccess( ).getEqualsSignKeyword_1( ) );
// one indentation after tag ...
c.setIndentationIncrement( ).before(
f.getWMLTagAccess( ).getExpressionsAssignment_4( ) );
f.getWMLTagAccess( ).getExpressionsAssignment_4( ) );
// but get back the [/<tagname>]
c.setIndentationDecrement( ).before(
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
c.setLinewrap( 0, 1, 2 ).before( f.getSL_COMMENTRule( ) );
}

View file

@ -28,14 +28,14 @@ public class ImportMapHandler extends AbstractHandler
IFolder selectedFolder = WorkspaceUtils.getSelectedFolder( );
if( selectedFolder == null ) {
Logger.getInstance( ).log(
"no directory selected (importMapHandler)", //$NON-NLS-1$
Messages.ImportMapHandler_1 );
"no directory selected (importMapHandler)", //$NON-NLS-1$
Messages.ImportMapHandler_1 );
return null;
}
if( ! selectedFolder.getName( ).equals( "maps" ) && //$NON-NLS-1$
GUIUtils.showMessageBox( Messages.ImportMapHandler_3,
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
GUIUtils.showMessageBox( Messages.ImportMapHandler_3,
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
return null;
}

View file

@ -26,15 +26,15 @@ public class OpenMapInEditorHandler extends AbstractHandler
IFile selectedFile = WorkspaceUtils.getSelectedFile( );
if( selectedFile == null ) {
Logger.getInstance( ).log( "file null (open map handler)", //$NON-NLS-1$
Messages.OpenMapInEditorHandler_1 );
Messages.OpenMapInEditorHandler_1 );
return null;
}
if( ! selectedFile.getName( ).endsWith( ".map" ) ) //$NON-NLS-1$
{
Logger.getInstance( ).log(
"non-map file selected: " + selectedFile.getName( ), //$NON-NLS-1$
Messages.OpenMapInEditorHandler_4 );
"non-map file selected: " + selectedFile.getName( ), //$NON-NLS-1$
Messages.OpenMapInEditorHandler_4 );
return null;
}

View file

@ -55,35 +55,35 @@ public class ImportProjectPage extends WizardPageTemplate
};
projectPathField_ = new DirectoryFieldEditor( "project_path",
"Directory to import:", container );
"Directory to import:", container );
projectPathField_.getTextControl( container ).addModifyListener(
listener );
listener );
Label lblNewLabel = new Label( container, SWT.NONE );
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
false, 1, 1 ) );
false, 1, 1 ) );
lblNewLabel.setText( "Project Name:" );
txtProjectName_ = new Text( container, SWT.BORDER );
txtProjectName_.setLayoutData( new GridData( SWT.FILL, SWT.TOP, true,
false, 2, 1 ) );
false, 2, 1 ) );
txtProjectName_.addModifyListener( listener );
Label lblWesnothInstall = new Label( container, SWT.NONE );
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
false, false, 1, 1 ) );
false, false, 1, 1 ) );
lblWesnothInstall.setText( "Wesnoth install:" );
cmbInstalls_ = new Combo( container, SWT.READ_ONLY );
cmbInstalls_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
false, 2, 1 ) );
false, 2, 1 ) );
WesnothInstallsUtils.fillComboWithInstalls( cmbInstalls_ );
}
protected void updatePageIsComplete( )
{
setPageComplete( ! txtProjectName_.getText( ).isEmpty( )
&& new File( projectPathField_.getStringValue( ) ).exists( ) );
&& new File( projectPathField_.getStringValue( ) ).exists( ) );
}
/**

View file

@ -11,7 +11,7 @@ import org.wesnoth.projects.ProjectUtils;
import org.wesnoth.wizards.WizardTemplate;
public class ImportProjectWizard extends WizardTemplate implements
IImportWizard
IImportWizard
{
private ImportProjectPage page0_;
@ -37,8 +37,8 @@ public class ImportProjectWizard extends WizardTemplate implements
public void run( IProgressMonitor monitor )
{
ProjectUtils.createWesnothProject( page0_.getProjectName( ),
page0_.getProjectPath( ),
page0_.getSelectedInstallName( ), monitor );
page0_.getProjectPath( ),
page0_.getSelectedInstallName( ), monitor );
monitor.done( );
}
};

View file

@ -44,12 +44,12 @@ public class SelectWesnothInstallDialog extends Dialog
Label lblWesnothInstall = new Label( composite, SWT.NONE );
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
false, false, 1, 1 ) );
false, false, 1, 1 ) );
lblWesnothInstall.setText( "Wesnoth Install:" );
cmbInstall_ = new Combo( composite, SWT.READ_ONLY );
GridData gd_cmbInstall_ = new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 );
false, 1, 1 );
gd_cmbInstall_.widthHint = 163;
cmbInstall_.setLayoutData( gd_cmbInstall_ );

View file

@ -39,7 +39,7 @@ public class WesnothInstallsUtils
List< WesnothInstall > installsList = new ArrayList< WesnothInstall >( );
// unpack installs
String[] installs = Preferences.getString(
Constants.P_INST_INSTALL_LIST ).split( ";" ); //$NON-NLS-1$
Constants.P_INST_INSTALL_LIST ).split( ";" ); //$NON-NLS-1$
for( String str: installs ) {
if( str.isEmpty( ) ) {
continue;
@ -49,7 +49,7 @@ public class WesnothInstallsUtils
if( tokens.length != 2 ) {
Logger.getInstance( ).logError(
"invalid install [" + str + "] in installs list." ); //$NON-NLS-1$ //$NON-NLS-2$
"invalid install [" + str + "] in installs list." ); //$NON-NLS-1$ //$NON-NLS-2$
continue;
}
@ -79,7 +79,7 @@ public class WesnothInstallsUtils
installs.append( install.getVersion( ) );
}
Preferences.getPreferences( ).setValue( Constants.P_INST_INSTALL_LIST,
installs.toString( ) );
installs.toString( ) );
}
/**
@ -96,7 +96,7 @@ public class WesnothInstallsUtils
}
return getInstallNameForResource( ResourcesPlugin.getWorkspace( )
.getRoot( ).findMember( resourcePath ) );
.getRoot( ).findMember( resourcePath ) );
}
/**
@ -113,7 +113,7 @@ public class WesnothInstallsUtils
}
return ProjectUtils.getCacheForProject( resource.getProject( ) )
.getInstallName( );
.getInstallName( );
}
/**
@ -125,14 +125,14 @@ public class WesnothInstallsUtils
* The new install name
*/
public static void setInstallNameForResource( IResource resource,
String newInstallName )
String newInstallName )
{
if( resource == null ) {
return;
}
ProjectUtils.getCacheForProject( resource.getProject( ) )
.setInstallName( newInstallName );
.setInstallName( newInstallName );
}
/**
@ -160,7 +160,7 @@ public class WesnothInstallsUtils
// select the first if there is no other selected
if( comboBox.getSelectionIndex( ) == - 1
&& comboBox.getItemCount( ) > 0 ) {
&& comboBox.getItemCount( ) > 0 ) {
comboBox.select( 0 );
}
}
@ -187,10 +187,10 @@ public class WesnothInstallsUtils
}
if( GUIUtils
.showMessageBox( String.format(
Messages.WesnothInstallsUtils_1, resource
.getProject( ).getName( ) ),
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
.showMessageBox( String.format(
Messages.WesnothInstallsUtils_1, resource
.getProject( ).getName( ) ),
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
return false; // no hope :(
}

View file

@ -34,7 +34,7 @@ public class DoubleInputDialog extends Dialog
private String val1String = "", val2String = ""; //$NON-NLS-1$ //$NON-NLS-2$
public DoubleInputDialog( Shell parentShell, String value1String,
String value2String )
String value2String )
{
super( parentShell );
setShellStyle( SWT.DIALOG_TRIM );
@ -53,21 +53,21 @@ public class DoubleInputDialog extends Dialog
lblValue1.setText( val1String );
Label label = new Label( container, SWT.NONE );
label.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false, false,
1, 1 ) );
1, 1 ) );
txtValue1_ = new Text( container, SWT.BORDER );
txtValue1_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 ) );
false, 1, 1 ) );
lblValue2 = new Label( container, SWT.NONE );
lblValue2.setText( val2String );
Label label_3 = new Label( container, SWT.NONE );
label_3.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
false, 1, 1 ) );
false, 1, 1 ) );
txtValue2_ = new Text( container, SWT.BORDER );
txtValue2_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 ) );
false, 1, 1 ) );
return container;
}
@ -76,9 +76,9 @@ public class DoubleInputDialog extends Dialog
protected void createButtonsForButtonBar( Composite parent )
{
createButton( parent, IDialogConstants.OK_ID,
IDialogConstants.OK_LABEL, true );
IDialogConstants.OK_LABEL, true );
createButton( parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false );
IDialogConstants.CANCEL_LABEL, false );
}
@Override

View file

@ -26,7 +26,7 @@ public class RegexStringFieldEditor extends StringFieldEditor
* doesn't match the regex
*/
public RegexStringFieldEditor( String name, String labelText, String regex,
String errorMessage, Composite parent )
String errorMessage, Composite parent )
{
super( name, labelText, parent );
regex_ = regex;

View file

@ -14,7 +14,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
public abstract class AbstractPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage
implements IWorkbenchPreferencePage
{
public AbstractPreferencePage( int style )
{
@ -35,7 +35,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage
protected void addField( FieldEditor editor, String tooltip )
{
editor.getLabelControl( getFieldEditorParent( ) ).setToolTipText(
tooltip );
tooltip );
super.addField( editor );
}

View file

@ -53,21 +53,21 @@ public class AddonUploadPreferencePage extends AbstractPreferencePage
protected void createFieldEditors( )
{
addField(
new StringFieldEditor( Constants.P_WAU_PASSWORD,
Messages.AddonUploadPreferencePage_11,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_12 );
new StringFieldEditor( Constants.P_WAU_PASSWORD,
Messages.AddonUploadPreferencePage_11,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_12 );
addField( new BooleanFieldEditor( Constants.P_WAU_VERBOSE,
Messages.AddonUploadPreferencePage_13, 1,
getFieldEditorParent( ) ) );
Messages.AddonUploadPreferencePage_13, 1,
getFieldEditorParent( ) ) );
addField(
new RegexStringFieldEditor( Constants.P_WAU_ADDRESS,
Messages.AddonUploadPreferencePage_14,
Messages.AddonUploadPreferencePage_15,
Messages.AddonUploadPreferencePage_16,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_17 );
new RegexStringFieldEditor( Constants.P_WAU_ADDRESS,
Messages.AddonUploadPreferencePage_14,
Messages.AddonUploadPreferencePage_15,
Messages.AddonUploadPreferencePage_16,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_17 );
StringBuilder ports = new StringBuilder( );
StringBuilder portsRegex = new StringBuilder( );
@ -75,20 +75,20 @@ public class AddonUploadPreferencePage extends AbstractPreferencePage
for( Entry< String, String > item: ADDON_SERVER_PORTS.entrySet( ) ) {
portsRegex.append( item.getKey( ) + "|" ); //$NON-NLS-1$
ports.append( String.format(
"\t%s - %s\n", item.getKey( ), item.getValue( ) ) ); //$NON-NLS-1$
"\t%s - %s\n", item.getKey( ), item.getValue( ) ) ); //$NON-NLS-1$
}
portsRegex.deleteCharAt( portsRegex.length( ) - 1 );
portsRegex.append( ")*" ); //$NON-NLS-1$
// System.out.println(portsRegex.toString());
addField(
new RegexStringFieldEditor( Constants.P_WAU_PORT,
Messages.AddonUploadPreferencePage_22,
portsRegex.toString( ),
Messages.AddonUploadPreferencePage_23,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_24 );
new RegexStringFieldEditor( Constants.P_WAU_PORT,
Messages.AddonUploadPreferencePage_22,
portsRegex.toString( ),
Messages.AddonUploadPreferencePage_23,
getFieldEditorParent( ) ),
Messages.AddonUploadPreferencePage_24 );
addField( new LabelFieldEditor( Messages.AddonUploadPreferencePage_25
+ ports.toString( ), getFieldEditorParent( ) ) );
+ ports.toString( ), getFieldEditorParent( ) ) );
}
}

View file

@ -28,14 +28,14 @@ public class AdvancedPreferencePage extends AbstractPreferencePage
protected void createFieldEditors( )
{
addField( new BooleanFieldEditor( Constants.P_NO_TERRAIN_GFX,
Messages.AdvancedPreferencePage_1,
BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent( ) ),
Messages.AdvancedPreferencePage_2 );
Messages.AdvancedPreferencePage_1,
BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent( ) ),
Messages.AdvancedPreferencePage_2 );
addField( new BooleanFieldEditor( Constants.P_WML_VALIDATION,
"WML Validation, parent", BooleanFieldEditor.SEPARATE_LABEL,
getFieldEditorParent( ) ),
"If checked, the WML Editor will validate some of the "
+ "written WML to check for semantic errors." );
"WML Validation, parent", BooleanFieldEditor.SEPARATE_LABEL,
getFieldEditorParent( ) ),
"If checked, the WML Editor will validate some of the "
+ "written WML to check for semantic errors." );
}
}

View file

@ -32,7 +32,7 @@ public class Preferences extends AbstractPreferenceInitializer
public static void initializeToDefault( )
{
IPreferenceStore store = WesnothPlugin.getDefault( )
.getPreferenceStore( );
.getPreferenceStore( );
// general settings
store.setDefault( Constants.P_WESNOTH_EXEC_PATH, "" ); //$NON-NLS-1$
store.setDefault( Constants.P_WESNOTH_WORKING_DIR, "" ); //$NON-NLS-1$
@ -142,7 +142,7 @@ public class Preferences extends AbstractPreferenceInitializer
public static void setDefaultInstallName( String newInstallName )
{
getPreferences( ).setValue( Constants.P_INST_DEFAULT_INSTALL,
newInstallName );
newInstallName );
}
/**
@ -251,7 +251,7 @@ public class Preferences extends AbstractPreferenceInitializer
public String getUserDir( )
{
return getString( installPrefix_ + Constants.P_WESNOTH_USER_DIR )
.replace( '\\', '/' ) + IPath.SEPARATOR;
.replace( '\\', '/' ) + IPath.SEPARATOR;
}
/**
@ -263,7 +263,7 @@ public class Preferences extends AbstractPreferenceInitializer
public String getWorkingDir( )
{
return getString( installPrefix_ + Constants.P_WESNOTH_WORKING_DIR )
.replace( '\\', '/' ) + IPath.SEPARATOR;
.replace( '\\', '/' ) + IPath.SEPARATOR;
}
/**
@ -275,7 +275,8 @@ public class Preferences extends AbstractPreferenceInitializer
public String getWMLToolsDir( )
{
return getString( installPrefix_ + Constants.P_WESNOTH_WMLTOOLS_DIR )
.replace( '\\', '/' ) + IPath.SEPARATOR;
.replace( '\\', '/' )
+ IPath.SEPARATOR;
}
/**
@ -286,7 +287,7 @@ public class Preferences extends AbstractPreferenceInitializer
public String getWesnothExecutablePath( )
{
return getString( installPrefix_ + Constants.P_WESNOTH_EXEC_PATH )
.replace( '\\', '/' );
.replace( '\\', '/' );
}
}
}

View file

@ -30,31 +30,31 @@ public class WMLToolsPreferencePage extends AbstractPreferencePage
protected void createFieldEditors( )
{
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_1,
getFieldEditorParent( ) ) );
getFieldEditorParent( ) ) );
addField( new BooleanFieldEditor( Constants.P_WMLINDENT_DRYRUN,
Messages.WMLToolsPreferencePage_2, 1, getFieldEditorParent( ) ) );
Messages.WMLToolsPreferencePage_2, 1, getFieldEditorParent( ) ) );
addField( new BooleanFieldEditor( Constants.P_WMLINDENT_VERBOSE,
Messages.WMLToolsPreferencePage_3, 1, getFieldEditorParent( ) ) );
Messages.WMLToolsPreferencePage_3, 1, getFieldEditorParent( ) ) );
addField( new LabelFieldEditor( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_5,
getFieldEditorParent( ) ) );
getFieldEditorParent( ) ) );
addField( new ScaleFieldEditor( Constants.P_WMLSCOPE_VERBOSE_LEVEL,
Messages.WMLToolsPreferencePage_6, getFieldEditorParent( ), 0,
2, 1, 1 ) );
Messages.WMLToolsPreferencePage_6, getFieldEditorParent( ), 0,
2, 1, 1 ) );
addField( new BooleanFieldEditor( Constants.P_WMLSCOPE_COLLISIONS,
Messages.WMLToolsPreferencePage_7, 1, getFieldEditorParent( ) ) );
Messages.WMLToolsPreferencePage_7, 1, getFieldEditorParent( ) ) );
addField( new LabelFieldEditor( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_9,
getFieldEditorParent( ) ) );
getFieldEditorParent( ) ) );
addField( new BooleanFieldEditor( Constants.P_WMLLINT_DRYRUN,
Messages.WMLToolsPreferencePage_10, 1, getFieldEditorParent( ) ) );
Messages.WMLToolsPreferencePage_10, 1, getFieldEditorParent( ) ) );
addField( new BooleanFieldEditor( Constants.P_WMLLINT_SPELL_CHECK,
Messages.WMLToolsPreferencePage_11, 1, getFieldEditorParent( ) ) );
Messages.WMLToolsPreferencePage_11, 1, getFieldEditorParent( ) ) );
addField( new ScaleFieldEditor( Constants.P_WMLLINT_VERBOSE_LEVEL,
Messages.WMLToolsPreferencePage_12, getFieldEditorParent( ), 0,
3, 1, 1 ) );
Messages.WMLToolsPreferencePage_12, getFieldEditorParent( ), 0,
3, 1, 1 ) );
addField( new LabelFieldEditor( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
}
}

View file

@ -113,50 +113,50 @@ public class WesnothInstallsPage extends AbstractPreferencePage
};
wesnothExecutableField_ = new FileFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_5, getFieldEditorParent( ) );
Messages.WesnothPreferencesPage_5, getFieldEditorParent( ) );
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
.addFocusListener( new FocusListener( ) {
@Override
public void focusLost( FocusEvent e )
{
checkState( );
}
.addFocusListener( new FocusListener( ) {
@Override
public void focusLost( FocusEvent e )
{
checkState( );
}
@Override
public void focusGained( FocusEvent e )
{
}
} );
@Override
public void focusGained( FocusEvent e )
{
}
} );
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
.addModifyListener( new ModifyListener( ) {
.addModifyListener( new ModifyListener( ) {
@Override
public void modifyText( ModifyEvent e )
{
checkState( );
}
} );
@Override
public void modifyText( ModifyEvent e )
{
checkState( );
}
} );
addField( wesnothExecutableField_, Messages.WesnothPreferencesPage_6 );
wesnothWorkingDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_7, getFieldEditorParent( ) );
Messages.WesnothPreferencesPage_7, getFieldEditorParent( ) );
wesnothWorkingDirField_.getTextControl( getFieldEditorParent( ) )
.addModifyListener( listener );
.addModifyListener( listener );
addField( wesnothWorkingDirField_, Messages.WesnothPreferencesPage_8 );
wesnothUserDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_9, getFieldEditorParent( ) );
Messages.WesnothPreferencesPage_9, getFieldEditorParent( ) );
addField( wesnothUserDirField_, Messages.WesnothPreferencesPage_10 );
wmlToolsField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
Messages.WesnothPreferencesPage_11, getFieldEditorParent( ) );
Messages.WesnothPreferencesPage_11, getFieldEditorParent( ) );
addField( wmlToolsField_, Messages.WesnothPreferencesPage_12 );
addField( new FileFieldEditor( Constants.P_PYTHON_PATH,
Messages.WesnothPreferencesPage_13, getFieldEditorParent( ) ) );
Messages.WesnothPreferencesPage_13, getFieldEditorParent( ) ) );
addField( new LabelFieldEditor( Messages.WesnothPreferencesPage_14,
getFieldEditorParent( ) ) );
getFieldEditorParent( ) ) );
// update the default
updateInterface( installs_.get( Preferences.getDefaultInstallName( ) ) );
@ -169,11 +169,11 @@ public class WesnothInstallsPage extends AbstractPreferencePage
Composite installComposite = new Composite( parent, 0 );
installComposite.setLayout( new GridLayout( 2, false ) );
installComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
true, 1, 1 ) );
true, 1, 1 ) );
// create install manager
installsTableViewer_ = new TableViewer( installComposite, SWT.BORDER
| SWT.FULL_SELECTION );
| SWT.FULL_SELECTION );
installsTable_ = installsTableViewer_.getTable( );
installsTable_.addMouseListener( new MouseAdapter( ) {
@Override
@ -184,19 +184,19 @@ public class WesnothInstallsPage extends AbstractPreferencePage
} );
installsTable_.setHeaderVisible( true );
installsTable_.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
true, 1, 1 ) );
true, 1, 1 ) );
TableColumn tblclmnName = new TableColumn( installsTable_, SWT.NONE );
tblclmnName.setWidth( 150 );
tblclmnName.setText( Messages.WesnothInstallsPage_5 );
TableColumn tblclmnWesnothVersion = new TableColumn( installsTable_,
SWT.NONE );
SWT.NONE );
tblclmnWesnothVersion.setWidth( 70 );
tblclmnWesnothVersion.setText( Messages.WesnothInstallsPage_6 );
TableColumn tblclmnIsDefault = new TableColumn( installsTable_,
SWT.NONE );
SWT.NONE );
tblclmnIsDefault.setWidth( 70 );
tblclmnIsDefault.setText( Messages.WesnothInstallsPage_7 );
@ -210,7 +210,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
fl_composite.marginHeight = 10;
composite.setLayout( fl_composite );
GridData gd_composite = new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 );
false, 1, 1 );
gd_composite.widthHint = 80;
composite.setLayoutData( gd_composite );
@ -251,14 +251,14 @@ public class WesnothInstallsPage extends AbstractPreferencePage
txtInstallName_.setText( Messages.WesnothInstallsPage_12 );
txtInstallName_.setEditable( false );
txtInstallName_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
false, false, 1, 1 ) );
false, false, 1, 1 ) );
txtInstallName_.addVerifyListener( new VerifyListener( ) {
private boolean isCharOk( char character )
{
return ( character >= 'a' && character <= 'z' )
|| ( character >= 'A' && character <= 'Z' )
|| ( character >= '0' && character <= '9' );
|| ( character >= 'A' && character <= 'Z' )
|| ( character >= '0' && character <= '9' );
}
@Override
@ -276,9 +276,9 @@ public class WesnothInstallsPage extends AbstractPreferencePage
}
else {
e.doit = isCharOk( e.character ) || e.keyCode == SWT.BS
|| e.keyCode == SWT.ARROW_LEFT
|| e.keyCode == SWT.ARROW_RIGHT
|| e.keyCode == SWT.DEL;
|| e.keyCode == SWT.ARROW_LEFT
|| e.keyCode == SWT.ARROW_RIGHT
|| e.keyCode == SWT.DEL;
}
}
} );
@ -288,7 +288,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
cmbVersion_ = new Combo( parent, SWT.READ_ONLY );
cmbVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 ) );
false, 1, 1 ) );
cmbVersion_.add( "1.9.x" ); //$NON-NLS-1$
cmbVersion_.add( "trunk" ); //$NON-NLS-1$
@ -322,23 +322,24 @@ public class WesnothInstallsPage extends AbstractPreferencePage
// unset all settings.
IPreferenceStore prefs = Preferences.getPreferences( );
String installPrefix = Preferences.getInstallPrefix( install
.getName( ) );
.getName( ) );
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_EXEC_PATH );
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_USER_DIR );
prefs.setToDefault( installPrefix
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_WORKING_DIR );
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
prefs
.setToDefault( installPrefix + Constants.P_WESNOTH_WORKING_DIR );
// unset the default install if this was that
// and select another one (the first) - if any - as default
if( install.getName( )
.equals( Preferences.getDefaultInstallName( ) ) ) {
.equals( Preferences.getDefaultInstallName( ) ) ) {
Preferences.setDefaultInstallName( "" ); //$NON-NLS-1$
if( ! installs_.isEmpty( ) ) {
// get the first item from the iterator
Iterator< WesnothInstall > itor = installs_.values( )
.iterator( );
.iterator( );
setInstallAsDefault( itor.next( ) );
}
}
@ -370,8 +371,8 @@ public class WesnothInstallsPage extends AbstractPreferencePage
cmbVersion_.setText( install == null ? "": install.getVersion( ) ); //$NON-NLS-1$
setFieldsPreferenceName(
install == null ? "": Preferences.getInstallPrefix( install.getName( ) ), //$NON-NLS-1$
true );
install == null ? "": Preferences.getInstallPrefix( install.getName( ) ), //$NON-NLS-1$
true );
}
/**
@ -383,19 +384,19 @@ public class WesnothInstallsPage extends AbstractPreferencePage
* True to load the current stored preference
*/
private void setFieldsPreferenceName( String installPrefix,
boolean loadPreferences )
boolean loadPreferences )
{
wesnothExecutableField_.setPreferenceName( installPrefix
+ Constants.P_WESNOTH_EXEC_PATH );
+ Constants.P_WESNOTH_EXEC_PATH );
wesnothUserDirField_.setPreferenceName( installPrefix
+ Constants.P_WESNOTH_USER_DIR );
+ Constants.P_WESNOTH_USER_DIR );
wesnothWorkingDirField_.setPreferenceName( installPrefix
+ Constants.P_WESNOTH_WORKING_DIR );
+ Constants.P_WESNOTH_WORKING_DIR );
wmlToolsField_.setPreferenceName( installPrefix
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
if( loadPreferences ) {
wesnothUserDirField_.setStringValue( "" ); //$NON-NLS-1$
@ -421,12 +422,12 @@ public class WesnothInstallsPage extends AbstractPreferencePage
String wesnothExecName = new File( wesnothExec ).getName( );
if( wesnothWorkingDirField_.getStringValue( ).isEmpty( )
&& ! wesnothExec.isEmpty( )
&& new File( wesnothExec.substring( 0,
wesnothExec.lastIndexOf( wesnothExecName ) ) )
.exists( ) ) {
&& ! wesnothExec.isEmpty( )
&& new File( wesnothExec.substring( 0,
wesnothExec.lastIndexOf( wesnothExecName ) ) )
.exists( ) ) {
wesnothWorkingDirField_.setStringValue( wesnothExec.substring(
0, wesnothExec.lastIndexOf( wesnothExecName ) ) );
0, wesnothExec.lastIndexOf( wesnothExecName ) ) );
}
}
@ -449,39 +450,39 @@ public class WesnothInstallsPage extends AbstractPreferencePage
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
params.add( new ReplaceableParameter(
"$$home_path", System.getProperty( "user.home" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
"$$home_path", System.getProperty( "user.home" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
.getProcessedTemplate( os + "_exec", params ) ), //$NON-NLS-1$
wesnothExecutableField_ );
.getProcessedTemplate( os + "_exec", params ) ), //$NON-NLS-1$
wesnothExecutableField_ );
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
.getProcessedTemplate( os + "_data", params ) ), //$NON-NLS-1$
wesnothWorkingDirField_ );
.getProcessedTemplate( os + "_data", params ) ), //$NON-NLS-1$
wesnothWorkingDirField_ );
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
.getProcessedTemplate( os + "_user", params ) ), //$NON-NLS-1$
wesnothUserDirField_ );
.getProcessedTemplate( os + "_user", params ) ), //$NON-NLS-1$
wesnothUserDirField_ );
// guess the working dir based on executable's path
Text textControl = wesnothWorkingDirField_
.getTextControl( getFieldEditorParent( ) );
.getTextControl( getFieldEditorParent( ) );
String workingDirValue = wesnothWorkingDirField_.getStringValue( );
String wesnothExecValue = wesnothExecutableField_.getStringValue( );
if( workingDirValue.isEmpty( )
&& ! wesnothExecValue.isEmpty( )
&& new File(
wesnothExecValue.substring( 0, wesnothExecValue
.lastIndexOf( new File( wesnothExecValue )
.getName( ) ) ) ).exists( ) ) {
&& ! wesnothExecValue.isEmpty( )
&& new File(
wesnothExecValue.substring( 0, wesnothExecValue
.lastIndexOf( new File( wesnothExecValue )
.getName( ) ) ) ).exists( ) ) {
textControl.setText( wesnothExecValue.substring( 0,
wesnothExecValue.lastIndexOf( new File( wesnothExecValue )
.getName( ) ) ) );
wesnothExecValue.lastIndexOf( new File( wesnothExecValue )
.getName( ) ) ) );
}
// guess the wmltools path
if( wmlToolsField_.getStringValue( ).isEmpty( )
&& ! workingDirValue.isEmpty( ) ) {
&& ! workingDirValue.isEmpty( ) ) {
String path = workingDirValue + "/data/tools"; //$NON-NLS-1$
if( testWMLToolsPath( path ) ) {
wmlToolsField_.setStringValue( path );
@ -509,7 +510,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
for( String tool: wmlToolsList_ ) {
if( ! ( new File( path + IPath.SEPARATOR + tool ).exists( ) ) ) {
setErrorMessage( String.format(
Messages.WesnothPreferencesPage_24, tool ) );
Messages.WesnothPreferencesPage_24, tool ) );
return false;
}
}
@ -550,10 +551,10 @@ public class WesnothInstallsPage extends AbstractPreferencePage
private boolean isFieldsEmpty( )
{
return wmlToolsField_.getStringValue( ).isEmpty( )
&& wesnothExecutableField_.getStringValue( ).isEmpty( )
&& wesnothUserDirField_.getStringValue( ).isEmpty( )
&& wesnothWorkingDirField_.getStringValue( ).isEmpty( )
&& txtInstallName_.getText( ).isEmpty( );
&& wesnothExecutableField_.getStringValue( ).isEmpty( )
&& wesnothUserDirField_.getStringValue( ).isEmpty( )
&& wesnothWorkingDirField_.getStringValue( ).isEmpty( )
&& txtInstallName_.getText( ).isEmpty( );
}
/**
@ -573,7 +574,8 @@ public class WesnothInstallsPage extends AbstractPreferencePage
// if we haven't completed anything,
// we can skip the saving without alerting the user.
if( ! isFieldsEmpty ) {
GUIUtils.showErrorMessageBox( Messages.WesnothInstallsPage_19 );
GUIUtils
.showErrorMessageBox( Messages.WesnothInstallsPage_19 );
}
// we consider successfully save if the fields are all
@ -588,10 +590,10 @@ public class WesnothInstallsPage extends AbstractPreferencePage
// update the fields preferences names
setFieldsPreferenceName(
Preferences.getInstallPrefix( installName ), false );
Preferences.getInstallPrefix( installName ), false );
WesnothInstall newInstall = new WesnothInstall( installName,
cmbVersion_.getText( ) );
cmbVersion_.getText( ) );
installs_.put( installName, newInstall );
@ -658,7 +660,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
}
private static class TableLabelProvider extends LabelProvider implements
ITableLabelProvider
ITableLabelProvider
{
@Override
public Image getColumnImage( Object element, int columnIndex )
@ -681,7 +683,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
else if( columnIndex == 2 ) { // is Default ?
if( install.getName( ).equals(
Preferences.getDefaultInstallName( ) ) ) {
Preferences.getDefaultInstallName( ) ) ) {
return Messages.WesnothInstallsPage_21;
}

View file

@ -62,24 +62,24 @@ public class WesnothPreferencesPage extends AbstractPreferencePage
public void widgetSelected( SelectionEvent e )
{
if( GUIUtils
.showMessageBox(
"Are you sure you want to clear the plugin preferences?",
SWT.YES | SWT.NO ) == SWT.NO ) {
.showMessageBox(
"Are you sure you want to clear the plugin preferences?",
SWT.YES | SWT.NO ) == SWT.NO ) {
return;
}
// clear the preferences
IEclipsePreferences root = Platform.getPreferencesService( )
.getRootNode( );
.getRootNode( );
try {
for( String rootName: root.childrenNames( ) ) {
org.osgi.service.prefs.Preferences childNode = root
.node( rootName );
.node( rootName );
for( String childName: childNode.childrenNames( ) ) {
org.osgi.service.prefs.Preferences node = childNode
.node( childName );
.node( childName );
if( childName.startsWith( "org.wesnoth" ) ) {
try {
@ -101,15 +101,15 @@ public class WesnothPreferencesPage extends AbstractPreferencePage
// clear the plugin's dirs
File pluginDir = WesnothPlugin.getDefault( ).getStateLocation( )
.toFile( ).getParentFile( );
.toFile( ).getParentFile( );
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
+ "/org.wesnoth" );
+ "/org.wesnoth" );
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
+ "/org.wesnoth.ui" );
+ "/org.wesnoth.ui" );
// clear the temporary files
File[] files = new File( WorkspaceUtils.getTemporaryFolder( ) )
.listFiles( );
.listFiles( );
for( File file: files ) {
// don't remove the logs

View file

@ -36,7 +36,7 @@ public class Define
private List< String > args_;
public Define( String name, String value, String textdomain, int linenum,
String location, List< String > args )
String location, List< String > args )
{
name_ = name;
value_ = value;
@ -112,18 +112,18 @@ public class Define
* @return Returns a map of defines
*/
public static Map< String, Define > readDefines( String installName,
String file )
String file )
{
DefinesSAXHandler handler = ( DefinesSAXHandler ) ResourceUtils
.getWMLSAXHandlerFromResource( installName, file,
new DefinesSAXHandler( ) );
.getWMLSAXHandlerFromResource( installName, file,
new DefinesSAXHandler( ) );
if( handler != null ) {
return handler.getDefines( );
}
Logger.getInstance( ).log(
"There was an error on creating the Defines SAX handler" ); //$NON-NLS-1$
"There was an error on creating the Defines SAX handler" ); //$NON-NLS-1$
return new HashMap< String, Define >( 0 );
}
}

View file

@ -43,7 +43,7 @@ public class DefinesSAXHandler extends DefaultHandler
@Override
public void startElement( String uri, String localName, String qName,
Attributes attributes ) throws SAXException
Attributes attributes ) throws SAXException
{
super.startElement( uri, localName, qName, attributes );
stack_.push( qName );
@ -51,7 +51,7 @@ public class DefinesSAXHandler extends DefaultHandler
@Override
public void endElement( String uri, String localName, String qName )
throws SAXException
throws SAXException
{
super.endElement( uri, localName, qName );
stack_.pop( );
@ -60,7 +60,7 @@ public class DefinesSAXHandler extends DefaultHandler
{
// create the define
defines_.put( name_, new Define( name_, value_, textdomain_,
linenum_, location_, arguments_ ) );
linenum_, location_, arguments_ ) );
// reset values
resetValues( );
}
@ -68,7 +68,7 @@ public class DefinesSAXHandler extends DefaultHandler
@Override
public void characters( char[] ch, int start, int length )
throws SAXException
throws SAXException
{
super.characters( ch, start, length );
if( stack_.isEmpty( ) ) {

View file

@ -45,8 +45,8 @@ public class PreprocessorUtils
private Map< String, Long > filesTimeStamps_ = new HashMap< String, Long >( );
private static final String PREPROCESSED_FILE_PATH = WorkspaceUtils
.getTemporaryFolder( )
+ "preprocessed.txt";
.getTemporaryFolder( )
+ "preprocessed.txt";
private PreprocessorUtils( )
{
@ -75,7 +75,7 @@ public class PreprocessorUtils
public int preprocessFile( IFile file, List< String > defines )
{
return preprocessFile( file, getPreprocessedFileLocation( file ),
getMacrosLocation( file ), defines, true );
getMacrosLocation( file ), defines, true );
}
/**
@ -94,10 +94,10 @@ public class PreprocessorUtils
* @return
*/
public int preprocessFile( IFile file, String macrosFile,
List< String > defines )
List< String > defines )
{
return preprocessFile( file, getPreprocessedFileLocation( file ),
macrosFile, defines, true );
macrosFile, defines, true );
}
/**
@ -121,14 +121,14 @@ public class PreprocessorUtils
* 1 - there was an error
*/
public int preprocessFile( IFile file, String targetDirectory,
String macrosFile, List< String > defines, boolean waitForIt )
String macrosFile, List< String > defines, boolean waitForIt )
{
String filePath = file.getLocation( ).toOSString( );
if( filesTimeStamps_.containsKey( filePath )
&& filesTimeStamps_.get( filePath ) >= new File( filePath )
.lastModified( ) ) {
&& filesTimeStamps_.get( filePath ) >= new File( filePath )
.lastModified( ) ) {
Logger.getInstance( ).logTool(
"skipped preprocessing a non-modified file: " + filePath ); //$NON-NLS-1$
"skipped preprocessing a non-modified file: " + filePath ); //$NON-NLS-1$
return - 1;
}
@ -137,8 +137,8 @@ public class PreprocessorUtils
try {
Paths paths = Preferences
.getPaths( ProjectUtils.getCacheForProject(
file.getProject( ) ).getInstallName( ) );
.getPaths( ProjectUtils.getCacheForProject(
file.getProject( ) ).getInstallName( ) );
List< String > arguments = new ArrayList< String >( );
@ -178,7 +178,7 @@ public class PreprocessorUtils
StringBuilder definesArg = new StringBuilder( );
for( Iterator< String > itor = defines.iterator( ); itor
.hasNext( ); ) {
.hasNext( ); ) {
if( definesArg.length( ) > 0 ) {
definesArg.append( "," ); //$NON-NLS-1$
}
@ -191,7 +191,7 @@ public class PreprocessorUtils
Logger.getInstance( ).logTool( "preprocessing file: " + filePath ); //$NON-NLS-1$
ExternalToolInvoker wesnoth = new ExternalToolInvoker(
paths.getWesnothExecutablePath( ), arguments );
paths.getWesnothExecutablePath( ), arguments );
wesnoth.runTool( );
if( waitForIt ) {
return wesnoth.waitForTool( );
@ -216,11 +216,11 @@ public class PreprocessorUtils
{
if( file == null || ! file.exists( ) ) {
Logger.getInstance( ).log( "file null or non existent.", //$NON-NLS-1$
Messages.PreprocessorUtils_12 );
Messages.PreprocessorUtils_12 );
return;
}
EditorUtils
.openEditor( getPreprocessedFilePath( file, openPlain, true ) );
.openEditor( getPreprocessedFilePath( file, openPlain, true ) );
}
/**
@ -236,12 +236,12 @@ public class PreprocessorUtils
* @return
*/
public IFileStore getPreprocessedFilePath( IFile file, boolean plain,
boolean create )
boolean create )
{
IFileStore preprocFile = EFS.getLocalFileSystem( ).getStore(
new Path( getPreprocessedFileLocation( file ) ) );
new Path( getPreprocessedFileLocation( file ) ) );
preprocFile = preprocFile.getChild( file.getName( )
+ ( plain == true ? ".plain": "" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ ( plain == true ? ".plain": "" ) ); //$NON-NLS-1$ //$NON-NLS-2$
if( create && ! preprocFile.fetchInfo( ).exists( ) ) {
preprocessFile( file, null );
}
@ -259,8 +259,8 @@ public class PreprocessorUtils
String targetDirectory = WorkspaceUtils.getTemporaryFolder( );
targetDirectory += file.getProject( ).getName( ) + "/"; //$NON-NLS-1$
targetDirectory += file.getParent( ).getProjectRelativePath( )
.toOSString( )
+ "/"; //$NON-NLS-1$
.toOSString( )
+ "/"; //$NON-NLS-1$
return targetDirectory;
}
@ -277,8 +277,8 @@ public class PreprocessorUtils
public String getMacrosLocation( IResource resource )
{
return WorkspaceUtils
.getProjectTemporaryFolder( resource.getProject( ) )
+ "/_MACROS_.cfg"; //$NON-NLS-1$
.getProjectTemporaryFolder( resource.getProject( ) )
+ "/_MACROS_.cfg"; //$NON-NLS-1$
}
/**
@ -290,12 +290,13 @@ public class PreprocessorUtils
DialogSettings settings = new DialogSettings( "preprocessed" ); //$NON-NLS-1$
try {
settings.put(
"files", filesTimeStamps_.keySet( ).toArray( new String[0] ) ); //$NON-NLS-1$
"files", filesTimeStamps_.keySet( ).toArray( new String[0] ) ); //$NON-NLS-1$
List< String > timestamps = new ArrayList< String >( );
for( Long timestamp: filesTimeStamps_.values( ) ) {
timestamps.add( timestamp.toString( ) );
}
settings.put(
settings
.put(
"timestamps", timestamps.toArray( new String[timestamps.size( )] ) ); //$NON-NLS-1$
settings.save( PREPROCESSED_FILE_PATH );
} catch( Exception e ) {
@ -322,10 +323,10 @@ public class PreprocessorUtils
String[] timestamps = settings.getArray( "timestamps" ); //$NON-NLS-1$
String[] files = settings.getArray( "files" ); //$NON-NLS-1$
if( timestamps != null && files != null
&& timestamps.length == files.length ) {
&& timestamps.length == files.length ) {
for( int index = 0; index < files.length; ++index ) {
filesTimeStamps_.put( files[index],
Long.valueOf( timestamps[index] ) );
Long.valueOf( timestamps[index] ) );
}
}
} catch( IOException e ) {
@ -342,7 +343,7 @@ public class PreprocessorUtils
public void clearTimestampsForPath( String path )
{
Iterator< Entry< String, Long >> itor = filesTimeStamps_.entrySet( )
.iterator( );
.iterator( );
while( itor.hasNext( ) ) {
Entry< String, Long > entry = itor.next( );

View file

@ -23,25 +23,25 @@ import org.wesnoth.Messages;
public class ActionWiper implements IStartup, IPerspectiveListener
{
private static final String[] ACTIONS_2_WIPE = new String[] {
"org.eclipse.search.searchActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.breakpointActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.debugActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.launchActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.profileActionSet", //$NON-NLS-1$
"org.eclipse.ui.externaltools.ExternalToolsSet" //$NON-NLS-1$
"org.eclipse.search.searchActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.breakpointActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.debugActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.launchActionSet", //$NON-NLS-1$
"org.eclipse.debug.ui.profileActionSet", //$NON-NLS-1$
"org.eclipse.ui.externaltools.ExternalToolsSet" //$NON-NLS-1$
// "org.eclipse.ui.edit.text.actionSet.presentation",
// "org.eclipse.ui.edit.text.actionSet.openExternalFile",
// "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
// "org.eclipse.ui.edit.text.actionSet.navigation",
// "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
// "org.eclipse.update.ui.softwareUpdates"
// "org.eclipse.ui.edit.text.actionSet.openExternalFile",
// "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
// "org.eclipse.ui.edit.text.actionSet.navigation",
// "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
// "org.eclipse.update.ui.softwareUpdates"
};
@Override
public void earlyStartup( )
{
IWorkbenchWindow[] windows = PlatformUI.getWorkbench( )
.getWorkbenchWindows( );
.getWorkbenchWindows( );
for( int i = 0; i < windows.length; i++ ) {
IWorkbenchPage page = windows[i].getActivePage( );
if( page != null ) {
@ -74,14 +74,14 @@ public class ActionWiper implements IStartup, IPerspectiveListener
@Override
public void perspectiveActivated( IWorkbenchPage page,
IPerspectiveDescriptor perspective )
IPerspectiveDescriptor perspective )
{
wipeActions( page );
}
@Override
public void perspectiveChanged( IWorkbenchPage page,
IPerspectiveDescriptor perspective, String changeId )
IPerspectiveDescriptor perspective, String changeId )
{
}
}

View file

@ -35,11 +35,11 @@ public class WMLPerspective implements IPerspectiveFactory
// Place navigator and outline to left of editor area.
IFolderLayout left = layout.createFolder(
"left", IPageLayout.LEFT, ( float ) 0.26, editorArea ); //$NON-NLS-1$
"left", IPageLayout.LEFT, ( float ) 0.26, editorArea ); //$NON-NLS-1$
left.addView( WesnothProjectsExplorer.ID_PROJECTS_EXPLORER );
IFolderLayout bottom = layout.createFolder(
"bottom", IPageLayout.BOTTOM, 0.76f, editorArea ); //$NON-NLS-1$
"bottom", IPageLayout.BOTTOM, 0.76f, editorArea ); //$NON-NLS-1$
bottom.addView( IPageLayout.ID_PROBLEM_VIEW );
bottom.addView( IPageLayout.ID_PROGRESS_VIEW );
bottom.addView( IConsoleConstants.ID_CONSOLE_VIEW );
@ -47,7 +47,7 @@ public class WMLPerspective implements IPerspectiveFactory
bottom.addView( "org.eclipse.pde.runtime.LogView" ); //$NON-NLS-1$
IFolderLayout right = layout.createFolder(
"right", IPageLayout.RIGHT, 0.68f, editorArea ); //$NON-NLS-1$
"right", IPageLayout.RIGHT, 0.68f, editorArea ); //$NON-NLS-1$
right.addView( IPageLayout.ID_OUTLINE );
layout.addPerspectiveShortcut( WMLPERSPECTIVE_ID );

View file

@ -25,7 +25,7 @@ public class WesnothApplication implements IApplication
Logger.getInstance( ).startLogger( );
try {
int returnCode = PlatformUI.createAndRunWorkbench( display,
new WesnothWorkbenchAdvisor( ) );
new WesnothWorkbenchAdvisor( ) );
if( returnCode == PlatformUI.RETURN_RESTART ) {
return IApplication.EXIT_RESTART;
}

View file

@ -23,7 +23,7 @@ public class WesnothWorkbenchAdvisor extends WorkbenchAdvisorHack
@Override
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
IWorkbenchWindowConfigurer configurer )
IWorkbenchWindowConfigurer configurer )
{
return new WesnothWorkbenchWindowAdvisor( configurer );
}

View file

@ -28,7 +28,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
@Override
public ActionBarAdvisor createActionBarAdvisor(
IActionBarConfigurer configurer )
IActionBarConfigurer configurer )
{
return new WesnothActionBarAdvisor( configurer );
}
@ -50,7 +50,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
public void postWindowCreate( )
{
getWindowConfigurer( ).getWindow( ).getActivePage( )
.hideActionSet( "org.eclipse.ui.run" ); //$NON-NLS-1$
.hideActionSet( "org.eclipse.ui.run" ); //$NON-NLS-1$
}
@Override
@ -58,7 +58,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
{
try {
ResourcesPlugin.getWorkspace( ).save( true,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
} catch( CoreException e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -284,10 +284,10 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
// set default build handler -- can't be done until the shell is
// available
IAction buildHandler = new BuildAction(
page.getWorkbenchWindow( ),
IncrementalProjectBuilder.INCREMENTAL_BUILD );
page.getWorkbenchWindow( ),
IncrementalProjectBuilder.INCREMENTAL_BUILD );
( ( RetargetActionWithDefault ) buildProjectAction )
.setDefaultHandler( buildHandler );
.setDefaultHandler( buildHandler );
}
};
getWindow( ).addPageListener( pageListener );
@ -296,13 +296,13 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
public void propertyChange( Preferences.PropertyChangeEvent event )
{
if( event.getProperty( ).equals(
ResourcesPlugin.PREF_AUTO_BUILDING ) ) {
ResourcesPlugin.PREF_AUTO_BUILDING ) ) {
updateBuildActions( false );
}
}
};
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
.addPropertyChangeListener( prefListener );
.addPropertyChangeListener( prefListener );
// listener for the "close editors automatically"
// preference change
@ -310,18 +310,18 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
public void propertyChange( PropertyChangeEvent event )
{
if( event.getProperty( ).equals(
IPreferenceConstants.REUSE_EDITORS_BOOLEAN ) ) {
IPreferenceConstants.REUSE_EDITORS_BOOLEAN ) ) {
if( window.getShell( ) != null
&& ! window.getShell( ).isDisposed( ) ) {
&& ! window.getShell( ).isDisposed( ) ) {
// this property change notification could be from a
// non-ui thread
window.getShell( ).getDisplay( )
.syncExec( new Runnable( ) {
public void run( )
{
updatePinActionToolbar( );
}
} );
.syncExec( new Runnable( ) {
public void run( )
{
updatePinActionToolbar( );
}
} );
}
}
}
@ -336,7 +336,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
* WorkbenchActionBuilder.
*/
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
.addPropertyChangeListener( propPrefListener );
.addPropertyChangeListener( propPrefListener );
// listen for project description changes, which can affect enablement
// of build actions
resourceListener = new IResourceChangeListener( ) {
@ -360,7 +360,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
}
};
ResourcesPlugin.getWorkspace( ).addResourceChangeListener(
resourceListener, IResourceChangeEvent.POST_CHANGE );
resourceListener, IResourceChangeEvent.POST_CHANGE );
}
@Override
@ -384,44 +384,44 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
{ // Set up the context Menu
coolbarPopupMenuManager = new MenuManager( );
coolbarPopupMenuManager.add( new ActionContributionItem(
lockToolBarAction ) );
lockToolBarAction ) );
coolbarPopupMenuManager.add( new ActionContributionItem(
editActionSetAction ) );
editActionSetAction ) );
coolBar.setContextMenuManager( coolbarPopupMenuManager );
IMenuService menuService = ( IMenuService ) window
.getService( IMenuService.class );
.getService( IMenuService.class );
menuService.populateContributionManager( coolbarPopupMenuManager,
"popup:windowCoolbarContextMenu" ); //$NON-NLS-1$
"popup:windowCoolbarContextMenu" ); //$NON-NLS-1$
}
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_FILE ) );
{ // File Group
IToolBarManager fileToolBar = actionBarConfigurer
.createToolBarManager( );
.createToolBarManager( );
fileToolBar
.add( new Separator( IWorkbenchActionConstants.NEW_GROUP ) );
.add( new Separator( IWorkbenchActionConstants.NEW_GROUP ) );
fileToolBar.add( newWizardDropDownAction );
fileToolBar
.add( new GroupMarker( IWorkbenchActionConstants.NEW_EXT ) );
.add( new GroupMarker( IWorkbenchActionConstants.NEW_EXT ) );
fileToolBar.add( new GroupMarker(
IWorkbenchActionConstants.SAVE_GROUP ) );
IWorkbenchActionConstants.SAVE_GROUP ) );
fileToolBar.add( saveAction );
fileToolBar.add( saveAllAction );
fileToolBar.add( new GroupMarker(
IWorkbenchActionConstants.SAVE_EXT ) );
IWorkbenchActionConstants.SAVE_EXT ) );
fileToolBar.add( getPrintItem( ) );
fileToolBar.add( new GroupMarker(
IWorkbenchActionConstants.PRINT_EXT ) );
IWorkbenchActionConstants.PRINT_EXT ) );
fileToolBar.add( new Separator(
IWorkbenchActionConstants.BUILD_GROUP ) );
IWorkbenchActionConstants.BUILD_GROUP ) );
fileToolBar.add( new GroupMarker(
IWorkbenchActionConstants.BUILD_EXT ) );
IWorkbenchActionConstants.BUILD_EXT ) );
fileToolBar.add( new Separator(
IWorkbenchActionConstants.MB_ADDITIONS ) );
IWorkbenchActionConstants.MB_ADDITIONS ) );
// Add to the cool bar manager
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE ) );
fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE ) );
}
coolBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
@ -429,20 +429,20 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_NAV ) );
{ // Navigate group
IToolBarManager navToolBar = actionBarConfigurer
.createToolBarManager( );
.createToolBarManager( );
navToolBar.add( new Separator(
IWorkbenchActionConstants.HISTORY_GROUP ) );
IWorkbenchActionConstants.HISTORY_GROUP ) );
navToolBar.add( new GroupMarker(
IWorkbenchActionConstants.GROUP_APP ) );
IWorkbenchActionConstants.GROUP_APP ) );
navToolBar.add( backwardHistoryAction );
navToolBar.add( forwardHistoryAction );
navToolBar
.add( new Separator( IWorkbenchActionConstants.PIN_GROUP ) );
.add( new Separator( IWorkbenchActionConstants.PIN_GROUP ) );
navToolBar.add( getPinEditorItem( ) );
// Add to the cool bar manager
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE ) );
navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE ) );
}
coolBar.add( new GroupMarker( IWorkbenchActionConstants.GROUP_EDITOR ) );
@ -451,16 +451,16 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
{ // Help group
IToolBarManager helpToolBar = actionBarConfigurer
.createToolBarManager( );
.createToolBarManager( );
helpToolBar.add( new Separator(
IWorkbenchActionConstants.GROUP_HELP ) );
IWorkbenchActionConstants.GROUP_HELP ) );
// helpToolBar.add(searchComboItem);
// Add the group for applications to contribute
helpToolBar.add( new GroupMarker(
IWorkbenchActionConstants.GROUP_APP ) );
IWorkbenchActionConstants.GROUP_APP ) );
// Add to the cool bar manager
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP ) );
helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP ) );
}
}
@ -486,8 +486,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createFileMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_file,
IWorkbenchActionConstants.M_FILE );
IDEWorkbenchMessages.Workbench_file,
IWorkbenchActionConstants.M_FILE );
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_START ) );
{
// create the New submenu, using the same id for it as the New
@ -499,7 +499,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
newMenu.add( new Separator( newId ) );
this.newWizardMenu = new NewWizardMenu( getWindow( ) );
newMenu.add( this.newWizardMenu );
newMenu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
newMenu
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
menu.add( newMenu );
}
@ -546,7 +547,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
// looking for it when Cmd-Q is invoked (or Quit is chosen from the
// application menu.
ActionContributionItem quitItem = new ActionContributionItem(
quitAction );
quitAction );
quitItem.setVisible( ! Util.isMac( ) );
menu.add( quitItem );
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) );
@ -559,8 +560,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createEditMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_edit,
IWorkbenchActionConstants.M_EDIT );
IDEWorkbenchMessages.Workbench_edit,
IWorkbenchActionConstants.M_EDIT );
menu.add( new GroupMarker( IWorkbenchActionConstants.EDIT_START ) );
menu.add( undoAction );
@ -597,20 +598,20 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createNavigateMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_navigate,
IWorkbenchActionConstants.M_NAVIGATE );
IDEWorkbenchMessages.Workbench_navigate,
IWorkbenchActionConstants.M_NAVIGATE );
menu.add( new GroupMarker( IWorkbenchActionConstants.NAV_START ) );
menu.add( goIntoAction );
MenuManager goToSubMenu = new MenuManager(
IDEWorkbenchMessages.Workbench_goTo,
IWorkbenchActionConstants.GO_TO );
IDEWorkbenchMessages.Workbench_goTo,
IWorkbenchActionConstants.GO_TO );
menu.add( goToSubMenu );
goToSubMenu.add( backAction );
goToSubMenu.add( forwardAction );
goToSubMenu.add( upAction );
goToSubMenu
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
menu.add( new Separator( IWorkbenchActionConstants.OPEN_EXT ) );
for( int i = 2; i < 5; ++i ) {
@ -619,11 +620,11 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
menu.add( new Separator( IWorkbenchActionConstants.SHOW_EXT ) );
{
MenuManager showInSubMenu = new MenuManager(
IDEWorkbenchMessages.Workbench_showIn, "showIn" ); //$NON-NLS-1$
IDEWorkbenchMessages.Workbench_showIn, "showIn" ); //$NON-NLS-1$
showInSubMenu.setActionDefinitionId( showInQuickMenu
.getActionDefinitionId( ) );
.getActionDefinitionId( ) );
showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN
.create( getWindow( ) ) );
.create( getWindow( ) ) );
menu.add( showInSubMenu );
}
for( int i = 2; i < 5; ++i ) {
@ -648,8 +649,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createProjectMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_project,
IWorkbenchActionConstants.M_PROJECT );
IDEWorkbenchMessages.Workbench_project,
IWorkbenchActionConstants.M_PROJECT );
menu.add( new Separator( IWorkbenchActionConstants.PROJ_START ) );
menu.add( getOpenProjectItem( ) );
@ -677,8 +678,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createWindowMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW );
IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW );
menu.add( newWindowAction );
menu.add( newEditorAction );
@ -693,7 +694,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
// See the comment for quit in createFileMenu
ActionContributionItem openPreferencesItem = new ActionContributionItem(
openPreferencesAction );
openPreferencesAction );
openPreferencesItem.setVisible( ! Util.isMac( ) );
menu.add( openPreferencesItem );
@ -709,17 +710,17 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
{
String openText = IDEWorkbenchMessages.Workbench_openPerspective;
MenuManager changePerspMenuMgr = new MenuManager( openText,
"openPerspective" ); //$NON-NLS-1$
"openPerspective" ); //$NON-NLS-1$
IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST
.create( getWindow( ) );
.create( getWindow( ) );
changePerspMenuMgr.add( changePerspMenuItem );
menu.add( changePerspMenuMgr );
}
{
MenuManager showViewMenuMgr = new MenuManager(
IDEWorkbenchMessages.Workbench_showView, "showView" ); //$NON-NLS-1$
IDEWorkbenchMessages.Workbench_showView, "showView" ); //$NON-NLS-1$
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST
.create( getWindow( ) );
.create( getWindow( ) );
showViewMenuMgr.add( showViewMenu );
menu.add( showViewMenuMgr );
}
@ -737,9 +738,9 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private void addWorkingSetBuildActions( MenuManager menu )
{
buildWorkingSetMenu = new MenuManager(
IDEWorkbenchMessages.Workbench_buildSet );
IDEWorkbenchMessages.Workbench_buildSet );
IContributionItem workingSetBuilds = new BuildSetMenu( window,
getActionBarConfigurer( ) );
getActionBarConfigurer( ) );
buildWorkingSetMenu.add( workingSetBuilds );
menu.add( buildWorkingSetMenu );
}
@ -750,7 +751,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private void addKeyboardShortcuts( MenuManager menu )
{
MenuManager subMenu = new MenuManager(
IDEWorkbenchMessages.Workbench_shortcuts, "shortcuts" ); //$NON-NLS-1$
IDEWorkbenchMessages.Workbench_shortcuts, "shortcuts" ); //$NON-NLS-1$
menu.add( subMenu );
subMenu.add( showPartPaneMenuAction );
subMenu.add( showViewMenuAction );
@ -777,8 +778,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private MenuManager createHelpMenu( )
{
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_help,
IWorkbenchActionConstants.M_HELP );
IDEWorkbenchMessages.Workbench_help,
IWorkbenchActionConstants.M_HELP );
addSeparatorOrGroupMarker( menu, "group.intro" ); //$NON-NLS-1$
// See if a welcome or intro page is specified
if( introAction != null ) {
@ -810,7 +811,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$
ActionContributionItem aboutItem = new ActionContributionItem(
aboutAction );
aboutAction );
aboutItem.setVisible( ! Util.isMac( ) );
menu.add( aboutItem );
menu.add( new GroupMarker( "group.about.ext" ) ); //$NON-NLS-1$
@ -832,7 +833,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
{
String prefId = "useSeparator." + menu.getId( ) + "." + groupId; //$NON-NLS-1$ //$NON-NLS-2$
boolean addExtraSeparators = IDEWorkbenchPlugin.getDefault( )
.getPreferenceStore( ).getBoolean( prefId );
.getPreferenceStore( ).getBoolean( prefId );
if( addExtraSeparators ) {
menu.add( new Separator( groupId ) );
}
@ -854,29 +855,29 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
}
isDisposed = true;
IMenuService menuService = ( IMenuService ) window
.getService( IMenuService.class );
.getService( IMenuService.class );
menuService.releaseContributions( coolbarPopupMenuManager );
coolbarPopupMenuManager.dispose( );
getActionBarConfigurer( ).getStatusLineManager( ).remove(
statusLineItem );
statusLineItem );
if( pageListener != null ) {
window.removePageListener( pageListener );
pageListener = null;
}
if( prefListener != null ) {
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
.removePropertyChangeListener( prefListener );
.removePropertyChangeListener( prefListener );
prefListener = null;
}
if( propPrefListener != null ) {
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
.removePropertyChangeListener( propPrefListener );
.removePropertyChangeListener( propPrefListener );
propPrefListener = null;
}
if( resourceListener != null ) {
ResourcesPlugin.getWorkspace( ).removeResourceChangeListener(
resourceListener );
resourceListener );
resourceListener = null;
}
@ -1014,7 +1015,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
register( newWizardAction );
newWizardDropDownAction = IDEActionFactory.NEW_WIZARD_DROP_DOWN
.create( window );
.create( window );
register( newWizardDropDownAction );
importResourcesAction = ActionFactory.IMPORT.create( window );
@ -1030,7 +1031,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
register( cleanAction );
toggleAutoBuildAction = IDEActionFactory.BUILD_AUTOMATICALLY
.create( window );
.create( window );
register( toggleAutoBuildAction );
saveAction = ActionFactory.SAVE.create( window );
@ -1083,8 +1084,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
aboutAction = ActionFactory.ABOUT.create( window );
aboutAction
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD ) );
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD ) );
register( aboutAction );
openPreferencesAction = ActionFactory.PREFERENCES.create( window );
@ -1101,7 +1102,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
register( showViewMenuAction );
showPartPaneMenuAction = ActionFactory.SHOW_PART_PANE_MENU
.create( window );
.create( window );
register( showPartPaneMenuAction );
nextEditorAction = ActionFactory.NEXT_EDITOR.create( window );
@ -1119,10 +1120,10 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
nextPerspectiveAction = ActionFactory.NEXT_PERSPECTIVE.create( window );
register( nextPerspectiveAction );
prevPerspectiveAction = ActionFactory.PREVIOUS_PERSPECTIVE
.create( window );
.create( window );
register( prevPerspectiveAction );
ActionFactory.linkCycleActionPair( nextPerspectiveAction,
prevPerspectiveAction );
prevPerspectiveAction );
activateEditorAction = ActionFactory.ACTIVATE_EDITOR.create( window );
register( activateEditorAction );
@ -1137,7 +1138,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
register( switchToEditorAction );
workbookEditorsAction = ActionFactory.SHOW_WORKBOOK_EDITORS
.create( window );
.create( window );
register( workbookEditorsAction );
quickAccessAction = ActionFactory.SHOW_QUICK_ACCESS.create( window );
@ -1151,12 +1152,12 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create( window );
register( lockToolBarAction );
resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE
.create( window );
.create( window );
register( resetPerspectiveAction );
closePerspAction = ActionFactory.CLOSE_PERSPECTIVE.create( window );
register( closePerspAction );
closeAllPerspsAction = ActionFactory.CLOSE_ALL_PERSPECTIVES
.create( window );
.create( window );
register( closeAllPerspsAction );
forwardHistoryAction = ActionFactory.FORWARD_HISTORY.create( window );
@ -1187,14 +1188,14 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
nextAction = ActionFactory.NEXT.create( window );
nextAction
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV ) );
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV ) );
register( nextAction );
previousAction = ActionFactory.PREVIOUS.create( window );
previousAction
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV ) );
.setImageDescriptor( IDEInternalWorkbenchImages
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV ) );
register( previousAction );
buildProjectAction = IDEActionFactory.BUILD_PROJECT.create( window );
@ -1204,7 +1205,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
register( openWorkspaceAction );
projectPropertyDialogAction = IDEActionFactory.OPEN_PROJECT_PROPERTIES
.create( window );
.create( window );
register( projectPropertyDialogAction );
if( window.getWorkbench( ).getIntroManager( ).hasIntro( ) ) {
@ -1242,7 +1243,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
AboutInfo[] infos = null;
IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault( )
.getPreferenceStore( );
.getPreferenceStore( );
// Optimization: avoid obtaining the about infos if the platform state
// is
@ -1285,7 +1286,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
String showTipsAndTricks = prefs.getString( tipsAndTricksKey );
if( sameState && "true".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
.create( window );
.create( window );
register( tipsAndTricksAction );
}
else if( sameState && "false".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
@ -1300,7 +1301,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
prefs.setValue( tipsAndTricksKey, String.valueOf( found ) );
if( found ) {
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
.create( window );
.create( window );
register( tipsAndTricksAction );
}
}
@ -1363,28 +1364,28 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
IWorkspace workspace = ResourcesPlugin.getWorkspace( );
IProject[] projects = workspace.getRoot( ).getProjects( );
boolean enabled = BuildUtilities.isEnabled( projects,
IncrementalProjectBuilder.INCREMENTAL_BUILD );
IncrementalProjectBuilder.INCREMENTAL_BUILD );
// update menu bar actions in project menu
updateCommandEnablement( buildAllAction.getActionDefinitionId( ) );
buildProjectAction.setEnabled( enabled );
toggleAutoBuildAction.setChecked( workspace.isAutoBuilding( ) );
cleanAction.setEnabled( BuildUtilities.isEnabled( projects,
IncrementalProjectBuilder.CLEAN_BUILD ) );
IncrementalProjectBuilder.CLEAN_BUILD ) );
// update the cool bar build button
ICoolBarManager coolBarManager = getActionBarConfigurer( )
.getCoolBarManager( );
.getCoolBarManager( );
IContributionItem cbItem = coolBarManager
.find( IWorkbenchActionConstants.TOOLBAR_FILE );
.find( IWorkbenchActionConstants.TOOLBAR_FILE );
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
// This should not happen
IDEWorkbenchPlugin
.log( "File toolbar contribution item is missing" ); //$NON-NLS-1$
.log( "File toolbar contribution item is missing" ); //$NON-NLS-1$
return;
}
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
IToolBarManager toolBarManager = toolBarItem
.getToolBarManager( );
.getToolBarManager( );
if( toolBarManager == null ) {
// error if this happens, file toolbar assumed to always
// exist
@ -1396,8 +1397,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
boolean found = toolBarManager.find( buildAllAction.getId( ) ) != null;
if( enabled && ! found ) {
toolBarManager.appendToGroup(
IWorkbenchActionConstants.BUILD_GROUP,
buildAllAction );
IWorkbenchActionConstants.BUILD_GROUP,
buildAllAction );
toolBarManager.update( false );
toolBarItem.update( ICoolBarManager.SIZE );
}
@ -1411,9 +1412,9 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private void updateCommandEnablement( String commandId )
{
IHandlerService handlerService = ( IHandlerService ) window
.getService( IHandlerService.class );
.getService( IHandlerService.class );
ICommandService commandService = ( ICommandService ) window
.getService( ICommandService.class );
.getService( ICommandService.class );
if( handlerService != null && commandService != null ) {
Command buildAllCmd = commandService.getCommand( commandId );
buildAllCmd.setEnabled( handlerService.getCurrentState( ) );
@ -1441,13 +1442,13 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
{
ICoolBarManager coolBarManager = getActionBarConfigurer( )
.getCoolBarManager( );
.getCoolBarManager( );
IContributionItem cbItem = coolBarManager
.find( IWorkbenchActionConstants.TOOLBAR_NAVIGATE );
.find( IWorkbenchActionConstants.TOOLBAR_NAVIGATE );
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
// This should not happen
IDEWorkbenchPlugin
.log( "Navigation toolbar contribution item is missing" ); //$NON-NLS-1$
.log( "Navigation toolbar contribution item is missing" ); //$NON-NLS-1$
return;
}
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
@ -1470,157 +1471,157 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
private IContributionItem getCutItem( )
{
return getItem( ActionFactory.CUT.getId( ),
ActionFactory.CUT.getCommandId( ), ISharedImages.IMG_TOOL_CUT,
ISharedImages.IMG_TOOL_CUT_DISABLED,
WorkbenchMessages.Workbench_cut,
WorkbenchMessages.Workbench_cutToolTip, null );
ActionFactory.CUT.getCommandId( ), ISharedImages.IMG_TOOL_CUT,
ISharedImages.IMG_TOOL_CUT_DISABLED,
WorkbenchMessages.Workbench_cut,
WorkbenchMessages.Workbench_cutToolTip, null );
}
private IContributionItem getCopyItem( )
{
return getItem( ActionFactory.COPY.getId( ),
ActionFactory.COPY.getCommandId( ),
ISharedImages.IMG_TOOL_COPY,
ISharedImages.IMG_TOOL_COPY_DISABLED,
WorkbenchMessages.Workbench_copy,
WorkbenchMessages.Workbench_copyToolTip, null );
ActionFactory.COPY.getCommandId( ),
ISharedImages.IMG_TOOL_COPY,
ISharedImages.IMG_TOOL_COPY_DISABLED,
WorkbenchMessages.Workbench_copy,
WorkbenchMessages.Workbench_copyToolTip, null );
}
private IContributionItem getPasteItem( )
{
return getItem( ActionFactory.PASTE.getId( ),
ActionFactory.PASTE.getCommandId( ),
ISharedImages.IMG_TOOL_PASTE,
ISharedImages.IMG_TOOL_PASTE_DISABLED,
WorkbenchMessages.Workbench_paste,
WorkbenchMessages.Workbench_pasteToolTip, null );
ActionFactory.PASTE.getCommandId( ),
ISharedImages.IMG_TOOL_PASTE,
ISharedImages.IMG_TOOL_PASTE_DISABLED,
WorkbenchMessages.Workbench_paste,
WorkbenchMessages.Workbench_pasteToolTip, null );
}
private IContributionItem getPrintItem( )
{
return getItem( ActionFactory.PRINT.getId( ),
ActionFactory.PRINT.getCommandId( ),
ISharedImages.IMG_ETOOL_PRINT_EDIT,
ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED,
WorkbenchMessages.Workbench_print,
WorkbenchMessages.Workbench_printToolTip, null );
ActionFactory.PRINT.getCommandId( ),
ISharedImages.IMG_ETOOL_PRINT_EDIT,
ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED,
WorkbenchMessages.Workbench_print,
WorkbenchMessages.Workbench_printToolTip, null );
}
private IContributionItem getSelectAllItem( )
{
return getItem( ActionFactory.SELECT_ALL.getId( ),
ActionFactory.SELECT_ALL.getCommandId( ), null, null,
WorkbenchMessages.Workbench_selectAll,
WorkbenchMessages.Workbench_selectAllToolTip, null );
ActionFactory.SELECT_ALL.getCommandId( ), null, null,
WorkbenchMessages.Workbench_selectAll,
WorkbenchMessages.Workbench_selectAllToolTip, null );
}
private IContributionItem getFindItem( )
{
return getItem( ActionFactory.FIND.getId( ),
ActionFactory.FIND.getCommandId( ), null, null,
WorkbenchMessages.Workbench_findReplace,
WorkbenchMessages.Workbench_findReplaceToolTip, null );
ActionFactory.FIND.getCommandId( ), null, null,
WorkbenchMessages.Workbench_findReplace,
WorkbenchMessages.Workbench_findReplaceToolTip, null );
}
private IContributionItem getBookmarkItem( )
{
return getItem( IDEActionFactory.BOOKMARK.getId( ),
IDEActionFactory.BOOKMARK.getCommandId( ), null, null,
IDEWorkbenchMessages.Workbench_addBookmark,
IDEWorkbenchMessages.Workbench_addBookmarkToolTip, null );
IDEActionFactory.BOOKMARK.getCommandId( ), null, null,
IDEWorkbenchMessages.Workbench_addBookmark,
IDEWorkbenchMessages.Workbench_addBookmarkToolTip, null );
}
private IContributionItem getTaskItem( )
{
return getItem( IDEActionFactory.ADD_TASK.getId( ),
IDEActionFactory.ADD_TASK.getCommandId( ), null, null,
IDEWorkbenchMessages.Workbench_addTask,
IDEWorkbenchMessages.Workbench_addTaskToolTip, null );
IDEActionFactory.ADD_TASK.getCommandId( ), null, null,
IDEWorkbenchMessages.Workbench_addTask,
IDEWorkbenchMessages.Workbench_addTaskToolTip, null );
}
private IContributionItem getDeleteItem( )
{
return getItem( ActionFactory.DELETE.getId( ),
ActionFactory.DELETE.getCommandId( ),
ISharedImages.IMG_TOOL_DELETE,
ISharedImages.IMG_TOOL_DELETE_DISABLED,
WorkbenchMessages.Workbench_delete,
WorkbenchMessages.Workbench_deleteToolTip,
IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION );
ActionFactory.DELETE.getCommandId( ),
ISharedImages.IMG_TOOL_DELETE,
ISharedImages.IMG_TOOL_DELETE_DISABLED,
WorkbenchMessages.Workbench_delete,
WorkbenchMessages.Workbench_deleteToolTip,
IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION );
}
private IContributionItem getRevertItem( )
{
return getItem( ActionFactory.REVERT.getId( ),
ActionFactory.REVERT.getCommandId( ), null, null,
WorkbenchMessages.Workbench_revert,
WorkbenchMessages.Workbench_revertToolTip, null );
ActionFactory.REVERT.getCommandId( ), null, null,
WorkbenchMessages.Workbench_revert,
WorkbenchMessages.Workbench_revertToolTip, null );
}
private IContributionItem getRefreshItem( )
{
return getItem( ActionFactory.REFRESH.getId( ),
ActionFactory.REFRESH.getCommandId( ), null, null,
WorkbenchMessages.Workbench_refresh,
WorkbenchMessages.Workbench_refreshToolTip, null );
ActionFactory.REFRESH.getCommandId( ), null, null,
WorkbenchMessages.Workbench_refresh,
WorkbenchMessages.Workbench_refreshToolTip, null );
}
private IContributionItem getPropertiesItem( )
{
return getItem( ActionFactory.PROPERTIES.getId( ),
ActionFactory.PROPERTIES.getCommandId( ), null, null,
WorkbenchMessages.Workbench_properties,
WorkbenchMessages.Workbench_propertiesToolTip, null );
ActionFactory.PROPERTIES.getCommandId( ), null, null,
WorkbenchMessages.Workbench_properties,
WorkbenchMessages.Workbench_propertiesToolTip, null );
}
private IContributionItem getMoveItem( )
{
return getItem( ActionFactory.MOVE.getId( ),
ActionFactory.MOVE.getCommandId( ), null, null,
WorkbenchMessages.Workbench_move,
WorkbenchMessages.Workbench_moveToolTip, null );
ActionFactory.MOVE.getCommandId( ), null, null,
WorkbenchMessages.Workbench_move,
WorkbenchMessages.Workbench_moveToolTip, null );
}
private IContributionItem getRenameItem( )
{
return getItem( ActionFactory.RENAME.getId( ),
ActionFactory.RENAME.getCommandId( ), null, null,
WorkbenchMessages.Workbench_rename,
WorkbenchMessages.Workbench_renameToolTip, null );
ActionFactory.RENAME.getCommandId( ), null, null,
WorkbenchMessages.Workbench_rename,
WorkbenchMessages.Workbench_renameToolTip, null );
}
private IContributionItem getOpenProjectItem( )
{
return getItem( IDEActionFactory.OPEN_PROJECT.getId( ),
IDEActionFactory.OPEN_PROJECT.getCommandId( ), null, null,
IDEWorkbenchMessages.OpenResourceAction_text,
IDEWorkbenchMessages.OpenResourceAction_toolTip, null );
IDEActionFactory.OPEN_PROJECT.getCommandId( ), null, null,
IDEWorkbenchMessages.OpenResourceAction_text,
IDEWorkbenchMessages.OpenResourceAction_toolTip, null );
}
private IContributionItem getCloseProjectItem( )
{
return getItem( IDEActionFactory.CLOSE_PROJECT.getId( ),
IDEActionFactory.CLOSE_PROJECT.getCommandId( ), null, null,
IDEWorkbenchMessages.CloseResourceAction_text,
IDEWorkbenchMessages.CloseResourceAction_text, null );
IDEActionFactory.CLOSE_PROJECT.getCommandId( ), null, null,
IDEWorkbenchMessages.CloseResourceAction_text,
IDEWorkbenchMessages.CloseResourceAction_text, null );
}
private IContributionItem getItem( String actionId, String commandId,
String image, String disabledImage, String label, String tooltip,
String helpContextId )
String image, String disabledImage, String label, String tooltip,
String helpContextId )
{
ISharedImages sharedImages = getWindow( ).getWorkbench( )
.getSharedImages( );
.getSharedImages( );
IActionCommandMappingService acms = ( IActionCommandMappingService ) getWindow( )
.getService( IActionCommandMappingService.class );
.getService( IActionCommandMappingService.class );
acms.map( actionId, commandId );
CommandContributionItemParameter commandParm = new CommandContributionItemParameter(
getWindow( ), actionId, commandId, null,
sharedImages.getImageDescriptor( image ),
sharedImages.getImageDescriptor( disabledImage ), null, label,
null, tooltip, CommandContributionItem.STYLE_PUSH, null, false );
getWindow( ), actionId, commandId, null,
sharedImages.getImageDescriptor( image ),
sharedImages.getImageDescriptor( disabledImage ), null, label,
null, tooltip, CommandContributionItem.STYLE_PUSH, null, false );
return new CommandContributionItem( commandParm );
}
}

View file

@ -57,96 +57,96 @@ public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor
Bundle ideBundle = Platform
.getBundle( IDEWorkbenchPlugin.IDE_WORKBENCH );
.getBundle( IDEWorkbenchPlugin.IDE_WORKBENCH );
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
+ "build_exec.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
+ "build_exec.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
PATH_ETOOL + "build_exec.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
PATH_ETOOL + "build_exec.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
PATH_DTOOL + "build_exec.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
PATH_DTOOL + "build_exec.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
+ "search_src.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
+ "search_src.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
PATH_ETOOL + "search_src.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
PATH_ETOOL + "search_src.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
PATH_DTOOL + "search_src.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
PATH_DTOOL + "search_src.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
+ "next_nav.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
+ "next_nav.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV, PATH_ETOOL
+ "prev_nav.gif", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV, PATH_ETOOL
+ "prev_nav.gif", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWPRJ_WIZ, PATH_WIZBAN
+ "newprj_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWPRJ_WIZ, PATH_WIZBAN
+ "newprj_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFOLDER_WIZ,
PATH_WIZBAN + "newfolder_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFOLDER_WIZ,
PATH_WIZBAN + "newfolder_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFILE_WIZ, PATH_WIZBAN
+ "newfile_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFILE_WIZ, PATH_WIZBAN
+ "newfile_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTDIR_WIZ,
PATH_WIZBAN + "importdir_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTDIR_WIZ,
PATH_WIZBAN + "importdir_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTZIP_WIZ,
PATH_WIZBAN + "importzip_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTZIP_WIZ,
PATH_WIZBAN + "importzip_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTDIR_WIZ,
PATH_WIZBAN + "exportdir_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTDIR_WIZ,
PATH_WIZBAN + "exportdir_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTZIP_WIZ,
PATH_WIZBAN + "exportzip_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTZIP_WIZ,
PATH_WIZBAN + "exportzip_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ,
PATH_WIZBAN + "workset_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ,
PATH_WIZBAN + "workset_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, PATH_WIZBAN
+ "saveas_wiz.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, PATH_WIZBAN
+ "saveas_wiz.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG, PATH_WIZBAN
+ "quick_fix.png", false ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG, PATH_WIZBAN
+ "quick_fix.png", false ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT,
PATH_OBJECT + "prj_obj.gif", true ); //$NON-NLS-1$
PATH_OBJECT + "prj_obj.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
+ "cprj_obj.gif", true ); //$NON-NLS-1$
IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
+ "cprj_obj.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OPEN_MARKER,
PATH_ELOCALTOOL + "gotoobj_tsk.gif", true ); //$NON-NLS-1$
PATH_ELOCALTOOL + "gotoobj_tsk.gif", true ); //$NON-NLS-1$
// Quick fix icons
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
PATH_ELOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
PATH_ELOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
PATH_DLOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
PATH_DLOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
PATH_OBJECT + "quickfix_warning_obj.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
PATH_OBJECT + "quickfix_warning_obj.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_ERROR, PATH_OBJECT
+ "quickfix_error_obj.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_ERROR, PATH_OBJECT
+ "quickfix_error_obj.gif", true ); //$NON-NLS-1$
// task objects
@ -158,51 +158,51 @@ public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor
// PATH_OBJECT+"lprio_tsk.gif");
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK,
PATH_OBJECT + "taskmrk_tsk.gif", true ); //$NON-NLS-1$
PATH_OBJECT + "taskmrk_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OBJS_BKMRK_TSK,
PATH_OBJECT + "bkmrk_tsk.gif", true ); //$NON-NLS-1$
PATH_OBJECT + "bkmrk_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_COMPLETE_TSK, PATH_OBJECT
+ "complete_tsk.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_COMPLETE_TSK, PATH_OBJECT
+ "complete_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_INCOMPLETE_TSK, PATH_OBJECT
+ "incomplete_tsk.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_INCOMPLETE_TSK, PATH_OBJECT
+ "incomplete_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_ITEM, PATH_OBJECT
+ "welcome_item.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_ITEM, PATH_OBJECT
+ "welcome_item.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER, PATH_OBJECT
+ "welcome_banner.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER, PATH_OBJECT
+ "welcome_banner.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_ERROR_PATH, PATH_OBJECT
+ "error_tsk.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_ERROR_PATH, PATH_OBJECT
+ "error_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_WARNING_PATH, PATH_OBJECT
+ "warn_tsk.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_WARNING_PATH, PATH_OBJECT
+ "warn_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_OBJS_INFO_PATH, PATH_OBJECT
+ "info_tsk.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_OBJS_INFO_PATH, PATH_OBJECT
+ "info_tsk.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_LCL_FLAT_LAYOUT, PATH_ELOCALTOOL
+ "flatLayout.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_LCL_FLAT_LAYOUT, PATH_ELOCALTOOL
+ "flatLayout.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_LCL_HIERARCHICAL_LAYOUT,
PATH_ELOCALTOOL + "hierarchicalLayout.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_LCL_HIERARCHICAL_LAYOUT,
PATH_ELOCALTOOL + "hierarchicalLayout.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEM_CATEGORY,
PATH_ETOOL + "problem_category.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEM_CATEGORY,
PATH_ETOOL + "problem_category.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW, PATH_EVIEW
+ "problems_view.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW, PATH_EVIEW
+ "problems_view.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_ERROR,
PATH_EVIEW + "problems_view_error.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_ERROR,
PATH_EVIEW + "problems_view_error.gif", true ); //$NON-NLS-1$
declareWorkbenchImage( ideBundle,
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_WARNING,
PATH_EVIEW + "problems_view_warning.gif", true ); //$NON-NLS-1$
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_WARNING,
PATH_EVIEW + "problems_view_warning.gif", true ); //$NON-NLS-1$
}
@ -220,7 +220,7 @@ public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor
* @see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor#declareImage
*/
private void declareWorkbenchImage( Bundle ideBundle, String symbolicName,
String path, boolean shared )
String path, boolean shared )
{
URL url = FileLocator.find( ideBundle, new Path( path ), null );
ImageDescriptor desc = ImageDescriptor.createFromURL( url );

View file

@ -71,9 +71,9 @@ public class ProjectCache implements Serializable
definesTimestamp_ = - 1;
wesnothFile_ = new File( project.getLocation( ).toOSString( )
+ "/.wesnoth" ); //$NON-NLS-1$
+ "/.wesnoth" ); //$NON-NLS-1$
definesFile_ = new File( PreprocessorUtils.getInstance( )
.getMacrosLocation( project ) );
.getMacrosLocation( project ) );
}
/**
@ -134,13 +134,13 @@ public class ProjectCache implements Serializable
public void loadCache( )
{
ResourceUtils
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
try {
try {
FileInputStream inputStream = new FileInputStream( wesnothFile_ );
ObjectInputStream deserializer = new ObjectInputStream(
inputStream );
inputStream );
ProjectCache cache = ( ProjectCache ) deserializer.readObject( );
properties_ = cache.properties_;
@ -176,12 +176,12 @@ public class ProjectCache implements Serializable
public boolean saveCache( )
{
ResourceUtils
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
try {
FileOutputStream outputStream = new FileOutputStream( wesnothFile_ );
ObjectOutputStream serializer = new ObjectOutputStream(
outputStream );
outputStream );
serializer.writeObject( this );
return true;
@ -209,7 +209,7 @@ public class ProjectCache implements Serializable
}
defines_ = Define.readDefines( getInstallName( ),
definesFile_.getAbsolutePath( ) );
definesFile_.getAbsolutePath( ) );
definesTimestamp_ = definesFile_.lastModified( );
}
@ -229,7 +229,7 @@ public class ProjectCache implements Serializable
public String getInstallName( )
{
return Preferences.getString( Constants.P_INST_NAME_PREFIX
+ project_.getName( ) );
+ project_.getName( ) );
}
/**
@ -241,8 +241,8 @@ public class ProjectCache implements Serializable
public void setInstallName( String newInstallName )
{
Preferences.getPreferences( ).setValue(
Constants.P_INST_NAME_PREFIX + project_.getName( ),
newInstallName );
Constants.P_INST_NAME_PREFIX + project_.getName( ),
newInstallName );
}
/**

View file

@ -49,7 +49,7 @@ public class ProjectUtils
* @return A map with properties of the project
*/
public static Map< String, String > getPropertiesForProject(
IProject project )
IProject project )
{
return getCacheForProject( project ).getProperties( );
}
@ -86,7 +86,7 @@ public class ProjectUtils
* @throws CoreException
*/
public static IProject createWesnothProject( String name, String location,
String installName, IProgressMonitor monitor )
String installName, IProgressMonitor monitor )
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( );
IProject newProject = root.getProject( name );
@ -96,7 +96,7 @@ public class ProjectUtils
// root
if( ! location.equals( root.getLocation( ).toOSString( ) ) ) {
description = ResourcesPlugin.getWorkspace( )
.newProjectDescription( name );
.newProjectDescription( name );
description.setLocation( new Path( location ) );
}
@ -121,8 +121,8 @@ public class ProjectUtils
* @throws CoreException
*/
public static int createWesnothProject( IProject handle,
IProjectDescription description, String installName,
IProgressMonitor monitor )
IProjectDescription description, String installName,
IProgressMonitor monitor )
{
if( handle == null || handle.exists( ) ) {
return - 1;
@ -133,7 +133,7 @@ public class ProjectUtils
if( handle.getLocation( ) == null && description != null ) {
projectPath = description.getLocationURI( ).getPath( )
.toString( ).substring( 1 );
.toString( ).substring( 1 );
}
else if( handle.getLocation( ) != null ) {
projectPath = handle.getLocation( ).toOSString( );
@ -141,8 +141,8 @@ public class ProjectUtils
else {
// project is in workspace
projectPath = ResourcesPlugin.getWorkspace( ).getRoot( )
.getLocation( ).toOSString( )
+ "/" + handle.getProject( ).getName( );
.getLocation( ).toOSString( )
+ "/" + handle.getProject( ).getName( );
}
monitor.subTask( Messages.ProjectUtils_0 );
@ -154,7 +154,7 @@ public class ProjectUtils
monitor.worked( 5 );
monitor.subTask( String.format( Messages.ProjectUtils_4,
handle.getName( ) ) );
handle.getName( ) ) );
// create the project
if( description == null ) {
@ -171,12 +171,12 @@ public class ProjectUtils
// add wesnoth nature
IProjectDescription tmpDescription = handle.getDescription( );
tmpDescription
.setNatureIds( new String[] { Constants.NATURE_WESNOTH /*
* ,
* Constants
* .
* NATURE_XTEXT
*/} );
.setNatureIds( new String[] { Constants.NATURE_WESNOTH /*
* ,
* Constants
* .
* NATURE_XTEXT
*/} );
handle.setDescription( tmpDescription, monitor );
monitor.worked( 5 );
@ -185,18 +185,18 @@ public class ProjectUtils
Paths paths = Preferences.getPaths( installName );
String normalizedPath = StringUtils.normalizePath( projectPath );
if( ! normalizedPath.contains( StringUtils.normalizePath( paths
.getCampaignDir( ) ) )
&& ! normalizedPath.contains( StringUtils
.normalizePath( paths.getAddonsDir( ) ) ) ) {
.getCampaignDir( ) ) )
&& ! normalizedPath.contains( StringUtils
.normalizePath( paths.getAddonsDir( ) ) ) ) {
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
param.add( new ReplaceableParameter(
"$$project_name", handle.getName( ) ) ); //$NON-NLS-1$
"$$project_name", handle.getName( ) ) ); //$NON-NLS-1$
param.add( new ReplaceableParameter(
"$$project_dir_name", handle.getName( ) ) ); //$NON-NLS-1$
"$$project_dir_name", handle.getName( ) ) ); //$NON-NLS-1$
ResourceUtils.createFile( handle,
"build.xml", //$NON-NLS-1$
TemplateProvider.getInstance( ).getProcessedTemplate(
"build_xml", param ), true ); //$NON-NLS-1$
"build.xml", //$NON-NLS-1$
TemplateProvider.getInstance( ).getProcessedTemplate(
"build_xml", param ), true ); //$NON-NLS-1$
}
monitor.worked( 10 );

View file

@ -53,12 +53,12 @@ public class WesnothProjectPage extends PropertyPage
Label lblNewLabel = new Label( grpGeneral, SWT.NONE );
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
false, 1, 1 ) );
false, 1, 1 ) );
lblNewLabel.setText( Messages.WesnothProjectPage_1 );
cmbInstall_ = new Combo( grpGeneral, SWT.READ_ONLY );
cmbInstall_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
false, 1, 1 ) );
false, 1, 1 ) );
// fill the installs
List< WesnothInstall > installs = WesnothInstallsUtils.getInstalls( );

View file

@ -98,7 +98,7 @@ public class SchemaParser
public void parseSchema( boolean force )
{
parseSchemaFile( force, Preferences.getPaths( installName_ )
.getSchemaPath( ) );
.getSchemaPath( ) );
}
/**
@ -113,7 +113,7 @@ public class SchemaParser
{
if( parsingDone_ && ! force ) {
Logger.getInstance( ).log(
"schema not parsed since there is already in cache." ); //$NON-NLS-1$
"schema not parsed since there is already in cache." ); //$NON-NLS-1$
return;
}
@ -124,7 +124,7 @@ public class SchemaParser
}
Logger.getInstance( ).log(
"parsing schema " + ( force == true ? "forced": "" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"parsing schema " + ( force == true ? "forced": "" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
File schemaFile = new File( schemaPath );
String res = ResourceUtils.getFileContents( schemaFile );
String[] lines = StringUtils.getLines( res );
@ -135,7 +135,7 @@ public class SchemaParser
String line = lines[index];
// skip comments and empty lines
if( StringUtils.startsWith( line, "#" )
|| line.matches( "^[\t ]*$" ) ) {
|| line.matches( "^[\t ]*$" ) ) {
continue;
}
@ -147,24 +147,24 @@ public class SchemaParser
// propagate the 'needsexpanding' property to upper levels
boolean expand = false;
if( ! tagStack.isEmpty( )
&& tags_.containsKey( tagStack.peek( ) ) ) {
&& tags_.containsKey( tagStack.peek( ) ) ) {
expand = tags_.get( tagStack.peek( ) )
.is_NeedingExpansion( );
.is_NeedingExpansion( );
}
tagStack.pop( );
if( ! tagStack.isEmpty( )
&& tags_.containsKey( tagStack.peek( ) )
&& expand == true ) {
&& tags_.containsKey( tagStack.peek( ) )
&& expand == true ) {
tags_.get( tagStack.peek( ) ).set_NeedingExpansion(
expand );
expand );
}
}
// opening tag
else {
String tagName = line.substring(
line.indexOf( "[" ) + 1, line.indexOf( "]" ) ); //$NON-NLS-1$ //$NON-NLS-2$
line.indexOf( "[" ) + 1, line.indexOf( "]" ) ); //$NON-NLS-1$ //$NON-NLS-2$
String simpleTagName = tagName;
String extendedTagName = ""; //$NON-NLS-1$
if( tagName.split( ":" ).length > 1 ) //$NON-NLS-1$
@ -182,13 +182,13 @@ public class SchemaParser
currentTag = tags_.get( simpleTagName );
currentTag.set_InhertedTagName( extendedTagName );
currentTag.set_NeedingExpansion( ! extendedTagName
.isEmpty( ) );
.isEmpty( ) );
}
else {
WMLTag tag = WmlFactory2.eINSTANCE.createWMLTag(
simpleTagName, extendedTagName );
simpleTagName, extendedTagName );
tag.set_NeedingExpansion( ! extendedTagName
.isEmpty( ) );
.isEmpty( ) );
currentTag = tag;
tags_.put( simpleTagName, tag );
}
@ -202,12 +202,12 @@ public class SchemaParser
String[] tokens = line.split( "=" ); //$NON-NLS-1$
if( tokens.length != 2 ) {
Logger.getInstance( ).logError(
"Error. invalid primitive on line :" + index ); //$NON-NLS-1$
"Error. invalid primitive on line :" + index ); //$NON-NLS-1$
continue;
}
primitives_.put( tokens[0].trim( ),
StringUtils.trimQuotes( tokens[1].trim( ) ) );
StringUtils.trimQuotes( tokens[1].trim( ) ) );
}
else if( tagStack.peek( ).equals( "description" ) ) //$NON-NLS-1$
{
@ -220,8 +220,8 @@ public class SchemaParser
value.append( tokens[1] + "\n" ); //$NON-NLS-1$
++index;
while( StringUtils.countOf( lines[index], '"' ) % 2 == 0
&& ! StringUtils.startsWith( lines[index], "#" ) && //$NON-NLS-1$
index < lines.length ) {
&& ! StringUtils.startsWith( lines[index], "#" ) && //$NON-NLS-1$
index < lines.length ) {
value.append( lines[index] + "\n" ); //$NON-NLS-1$
++index;
}
@ -234,7 +234,7 @@ public class SchemaParser
// get rid of the quotes
if( value.length( ) >= 2 ) {
value = new StringBuilder( value.substring( 1,
value.length( ) - 1 ) );
value.length( ) - 1 ) );
}
if( currentTag != null ) {
@ -248,22 +248,23 @@ public class SchemaParser
String tmpLine = line.trim( );
if( line.contains( "#" ) ) {
tmpLine = line
.substring( 0, line.lastIndexOf( "#" ) ).trim( ); //$NON-NLS-1$
.substring( 0, line.lastIndexOf( "#" ) ).trim( ); //$NON-NLS-1$
}
String[] tokens = tmpLine.split( "=" ); //$NON-NLS-1$
if( tokens.length != 2 ) {
Logger.getInstance( ).logError(
"Error. invalid attribute on line :" + index ); //$NON-NLS-1$
"Error. invalid attribute on line :" + index ); //$NON-NLS-1$
continue;
}
String[] value = tokens[1].substring( 1,
tokens[1].length( ) - 1 ).split( " " ); //$NON-NLS-1$
tokens[1].length( ) - 1 ).split( " " ); //$NON-NLS-1$
if( value.length != 2 ) {
Logger.getInstance( )
.logError(
"Error. invalid attribute value on line:" + index ); //$NON-NLS-1$
Logger
.getInstance( )
.logError(
"Error. invalid attribute value on line:" + index ); //$NON-NLS-1$
continue;
}
@ -276,8 +277,8 @@ public class SchemaParser
// tag wasn't created yet
if( targetTag == null ) {
targetTag = WmlFactory2.eINSTANCE
.createWMLTag( value[1], "",
getCardinality( value[0] ) );
.createWMLTag( value[1], "",
getCardinality( value[0] ) );
tags_.put( value[1], targetTag );
}
@ -285,17 +286,18 @@ public class SchemaParser
}
else {
if( primitives_.get( value[1] ) == null ) {
Logger.getInstance( )
.logError(
"Undefined primitive type in schema.cfg for: " + value[1] ); //$NON-NLS-1$
Logger
.getInstance( )
.logError(
"Undefined primitive type in schema.cfg for: " + value[1] ); //$NON-NLS-1$
}
currentTag.getExpressions( ).add(
WmlFactory2.eINSTANCE.createWMLKey(
tokens[0],
primitives_.get( value[1] ),
getCardinality( value[0] ),
value[1].equals( "tstring" ) ) );
WmlFactory2.eINSTANCE.createWMLKey(
tokens[0],
primitives_.get( value[1] ),
getCardinality( value[0] ),
value[1].equals( "tstring" ) ) );
}
}
else {
@ -346,7 +348,7 @@ public class SchemaParser
private void sortChildren( WMLTag tag )
{
WMLExpression[] expressions = ( WMLExpression[] ) tag.getExpressions( )
.toArray( );
.toArray( );
Arrays.sort( expressions, new CardinalityComparator( ) );
tag.getExpressions( ).clear( );
@ -399,7 +401,7 @@ public class SchemaParser
* That is, after the sort the required wmlexpressions will be first
*/
public static class CardinalityComparator implements
Comparator< WMLExpression >, Serializable
Comparator< WMLExpression >, Serializable
{
private static final long serialVersionUID = 6103884038547449868L;

View file

@ -62,16 +62,16 @@ public class TemplateProvider
try {
File varsFile = new File( Constants.PLUGIN_FULL_PATH
+ "/templates/cac/variables.txt" );
+ "/templates/cac/variables.txt" );
cacs_.put( "variables", Arrays.asList( StringUtils
.getLines( ResourceUtils.getFileContents( varsFile, true,
true ) ) ) );
.getLines( ResourceUtils.getFileContents( varsFile, true,
true ) ) ) );
File eventsFile = new File( Constants.PLUGIN_FULL_PATH
+ "/templates/cac/events.txt" );
+ "/templates/cac/events.txt" );
cacs_.put( "events", Arrays.asList( StringUtils
.getLines( ResourceUtils.getFileContents( eventsFile, true,
true ) ) ) );
.getLines( ResourceUtils.getFileContents( eventsFile, true,
true ) ) ) );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
}
@ -85,10 +85,10 @@ public class TemplateProvider
templates_.clear( );
try {
Logger.getInstance( ).log( "reading templates from: " + //$NON-NLS-1$
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME );
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME );
BufferedReader reader = new BufferedReader( new FileReader(
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME ) );
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME ) );
BufferedReader tmpReader;
String line, tmpLine;
StringBuilder content = new StringBuilder( );
@ -105,17 +105,17 @@ public class TemplateProvider
if( tokensStrings.length != 2 ) {
Logger.getInstance( ).logWarn(
"TemplateIndex line " + line
+ "is not properly formatted" );
"TemplateIndex line " + line
+ "is not properly formatted" );
continue;
}
content.setLength( 0 );
if( new File( Constants.PLUGIN_FULL_PATH + tokensStrings[1] )
.exists( ) ) {
.exists( ) ) {
tmpReader = new BufferedReader( new FileReader(
Constants.PLUGIN_FULL_PATH + tokensStrings[1] ) );
Constants.PLUGIN_FULL_PATH + tokensStrings[1] ) );
while( ( tmpLine = tmpReader.readLine( ) ) != null ) {
content.append( tmpLine + '\n' );
}
@ -139,10 +139,10 @@ public class TemplateProvider
* @return
*/
public String getProcessedTemplate( String templateName,
List< ReplaceableParameter > parameters )
List< ReplaceableParameter > parameters )
{
String tmpTemplate = TemplateProvider.getInstance( ).getTemplate(
templateName );
templateName );
if( tmpTemplate == null || parameters == null ) {
return null;
}
@ -156,11 +156,11 @@ public class TemplateProvider
for( ReplaceableParameter param: parameters ) {
if( template[i].contains( param.paramName ) ) {
template[i] = StringUtils.replaceWithIndent( template[i],
param.paramName, param.paramValue );
param.paramName, param.paramValue );
if( ! templateName.equals( "build_xml" ) && //$NON-NLS-1$
( param.paramValue == null || param.paramValue
.isEmpty( ) ) ) {
( param.paramValue == null || param.paramValue
.isEmpty( ) ) ) {
// we don't have any value supplied -
// let's comment that line (if it's not already
// commented)
@ -229,7 +229,7 @@ public class TemplateProvider
* @return
*/
public Pair< List< Pair< String, String >>, List< String >> getFilesDirectories(
String structureTemplate )
String structureTemplate )
{
List< Pair< String, String >> files = new ArrayList< Pair< String, String >>( );
List< String > dirs = new ArrayList< String >( );
@ -245,16 +245,18 @@ public class TemplateProvider
// oops. error
if( tmpLine.length != 2 ) {
Logger.getInstance( )
.logError(
String.format(
"error parsing 'structure template' (%s) on line %s", //$NON-NLS-1$
structureTemplate, line ) );
Logger
.getInstance( )
.logError(
String
.format(
"error parsing 'structure template' (%s) on line %s", //$NON-NLS-1$
structureTemplate, line ) );
continue;
}
files.add( new Pair< String, String >( tmpLine[0].trim( ),
tmpLine[1].trim( ) ) );
tmpLine[1].trim( ) ) );
}
else {
dirs.add( line.trim( ) );
@ -262,6 +264,6 @@ public class TemplateProvider
}
return new Pair< List< Pair< String, String >>, List< String >>( files,
dirs );
dirs );
}
}

View file

@ -40,7 +40,7 @@ public class AntUtils
* @return null if the build didn't success
*/
public static String runAnt( String antFile,
Map< String, String > properties, boolean recordOutput )
Map< String, String > properties, boolean recordOutput )
{
Project project = new Project( );
ByteArrayOutputStream out = null;
@ -56,7 +56,7 @@ public class AntUtils
ProjectHelper.configureProject( project, buildFile );
Iterator< Entry< String, String >> iterator = properties.entrySet( )
.iterator( );
.iterator( );
while( iterator.hasNext( ) ) {
Entry< String, String > key = iterator.next( );
project.setUserProperty( key.getKey( ), key.getValue( ) );

View file

@ -51,7 +51,7 @@ public class EditorUtils
public static void writeInEditor( IEditorPart targetEditor, String content )
{
int offset = ( ( ITextSelection ) getTextEditor( targetEditor )
.getSelectionProvider( ).getSelection( ) ).getOffset( );
.getSelectionProvider( ).getSelection( ) ).getOffset( );
try {
getEditorDocument( targetEditor ).replace( offset, 0, content );
} catch( BadLocationException e ) {
@ -76,14 +76,14 @@ public class EditorUtils
* the string to replace the current content
*/
public static void replaceEditorText( IEditorPart targetEditor,
String content )
String content )
{
if( targetEditor == null ) {
return;
}
try {
getEditorDocument( targetEditor ).replace( 0,
getEditorDocument( targetEditor ).getLength( ), content );
getEditorDocument( targetEditor ).getLength( ), content );
} catch( BadLocationException e ) {
}
}
@ -110,7 +110,7 @@ public class EditorUtils
}
IDocumentProvider dp = getTextEditor( targetEditor )
.getDocumentProvider( );
.getDocumentProvider( );
return dp.getDocument( targetEditor.getEditorInput( ) );
}
@ -150,7 +150,7 @@ public class EditorUtils
public static IEditorPart getEditedFile( )
{
return WorkspaceUtils.getWorkbenchWindow( ).getPages( )[0]
.getActiveEditor( );
.getActiveEditor( );
}
/**
@ -164,7 +164,7 @@ public class EditorUtils
public static IEditorPart openEditor( IFile file, boolean activatePage )
{
IWorkbenchPage page = WorkspaceUtils.getWorkbenchWindow( )
.getActivePage( );
.getActivePage( );
try {
return IDE.openEditor( page, file, activatePage );
} catch( PartInitException e ) {
@ -182,7 +182,7 @@ public class EditorUtils
public static IEditorPart openEditor( String file )
{
return openEditor( EFS.getLocalFileSystem( )
.getStore( new Path( file ) ) );
.getStore( new Path( file ) ) );
}
/**
@ -195,7 +195,7 @@ public class EditorUtils
{
try {
return IDE.openEditorOnFileStore( WorkspaceUtils
.getWorkbenchWindow( ).getActivePage( ), file );
.getWorkbenchWindow( ).getActivePage( ), file );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
return null;

View file

@ -64,8 +64,8 @@ public class ExternalToolInvoker
processBuilder_ = new ProcessBuilder( commandline );
Logger.getInstance( ).logTool(
String.format( "Invoking tool %s with args: %s", //$NON-NLS-1$
fileName, arguments ) );
String.format( "Invoking tool %s with args: %s", //$NON-NLS-1$
fileName, arguments ) );
outputContent_ = new StringBuilder( );
errorContent_ = new StringBuilder( );
@ -85,10 +85,10 @@ public class ExternalToolInvoker
Reader stderrReader = null;
if( arguments_.get( 0 ).toLowerCase( Locale.ENGLISH )
.contains( "wesnoth.exe" ) && //$NON-NLS-1$
Constants.IS_WINDOWS_MACHINE ) {
.contains( "wesnoth.exe" ) && //$NON-NLS-1$
Constants.IS_WINDOWS_MACHINE ) {
String wesnothParent = new File( arguments_.get( 0 ) )
.getParent( ) + "/"; //$NON-NLS-1$
.getParent( ) + "/"; //$NON-NLS-1$
if( new File( wesnothParent + "stdout.txt" ).exists( ) ) {
stdoutReader = new FileReader( wesnothParent + "stdout.txt" ); //$NON-NLS-1$
}
@ -385,11 +385,11 @@ public class ExternalToolInvoker
* @return
*/
public static ExternalToolInvoker launchTool( final String fileName,
final List< String > args, final OutputStream[] stdout,
final OutputStream[] stderr )
final List< String > args, final OutputStream[] stdout,
final OutputStream[] stderr )
{
final ExternalToolInvoker toolInvoker = new ExternalToolInvoker(
fileName, args );
fileName, args );
toolInvoker.runTool( );
Thread outputStreamThread = new Thread( new Runnable( ) {
@Override

View file

@ -32,7 +32,7 @@ public class GUIUtils
public static int showInfoMessageBox( final String message )
{
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
SWT.ICON_INFORMATION );
SWT.ICON_INFORMATION );
}
/**
@ -46,7 +46,7 @@ public class GUIUtils
public static int showWarnMessageBox( final String message )
{
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
SWT.ICON_WARNING );
SWT.ICON_WARNING );
}
/**
@ -60,7 +60,7 @@ public class GUIUtils
public static int showErrorMessageBox( final String message )
{
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
SWT.ICON_ERROR );
SWT.ICON_ERROR );
}
/**
@ -74,7 +74,7 @@ public class GUIUtils
public static int showMessageBox( final String message, final int style )
{
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
style );
style );
}
/**
@ -86,7 +86,7 @@ public class GUIUtils
* the message to print
*/
public static int showMessageBox( final IWorkbenchWindow window,
final String message )
final String message )
{
return showMessageBox( window, message, SWT.ICON_INFORMATION );
}
@ -100,7 +100,7 @@ public class GUIUtils
* the message to print
*/
public static int showMessageBox( final IWorkbenchWindow window,
final String message, final int style )
final String message, final int style )
{
if( window == null || window.getShell( ) == null || message == null ) {
return - 1;
@ -136,11 +136,11 @@ public class GUIUtils
* @return
*/
public static MessageConsole createConsole( String consoleTitle,
ImageDescriptor imageDescriptor, boolean activate )
ImageDescriptor imageDescriptor, boolean activate )
{
MessageConsole console = null;
IConsoleManager conMan = ConsolePlugin.getDefault( )
.getConsoleManager( );
.getConsoleManager( );
IConsole[] existing = conMan.getConsoles( );
for( int i = 0; i < existing.length; i++ ) {
if( consoleTitle.equals( existing[i].getName( ) ) ) {

View file

@ -69,12 +69,12 @@ public class GameUtils
String scenarioId = null;
campaignId = ProjectUtils.getCacheForProject(
selectedResource.getProject( ) ).getWMLConfig( "_main.cfg" ).CampaignId; //$NON-NLS-1$
selectedResource.getProject( ) ).getWMLConfig( "_main.cfg" ).CampaignId; //$NON-NLS-1$
if( scenario == true && selectedResource instanceof IFile ) {
scenarioId = ProjectUtils.getCacheForProject(
selectedResource.getProject( ) ).getWMLConfig(
selectedResource.getProjectRelativePath( ).toString( ) ).ScenarioId;
selectedResource.getProject( ) ).getWMLConfig(
selectedResource.getProjectRelativePath( ).toString( ) ).ScenarioId;
}
if( campaignId == null ) {
@ -99,9 +99,9 @@ public class GameUtils
}
startGame(
WesnothInstallsUtils
.getInstallNameForResource( selectedResource ),
args );
WesnothInstallsUtils
.getInstallNameForResource( selectedResource ),
args );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
}
@ -119,9 +119,9 @@ public class GameUtils
else {
WesnothInstallsUtils.setupInstallForResource( selectedRes );
startGame(
WesnothInstallsUtils
.getInstallNameForResource( selectedRes ),
null );
WesnothInstallsUtils
.getInstallNameForResource( selectedRes ),
null );
}
}
@ -156,10 +156,10 @@ public class GameUtils
args.add( workingDir );
MessageConsole console = GUIUtils.createConsole( Messages.GameUtils_9,
null, true );
null, true );
ExternalToolInvoker.launchTool( wesnothExec, args,
new OutputStream[] { console.newMessageStream( ) },
new OutputStream[] { console.newMessageStream( ) } );
new OutputStream[] { console.newMessageStream( ) },
new OutputStream[] { console.newMessageStream( ) } );
}
/**
@ -180,7 +180,7 @@ public class GameUtils
{
if( file == null || ! file.exists( ) ) {
Logger.getInstance( ).log( "non-existing map file", //$NON-NLS-1$
Messages.GameUtils_12 );
Messages.GameUtils_12 );
return;
}
@ -195,7 +195,7 @@ public class GameUtils
public static void startEditor( String mapName )
{
startGame( WesnothInstallsUtils.getInstallNameForResource( mapName ),
getEditorLaunchArguments( mapName ) );
getEditorLaunchArguments( mapName ) );
}
/**

View file

@ -23,7 +23,7 @@ public class ListUtils
* @return A string with the string representation of that objects
*/
public static String concatenateList( List< ? extends Object > list,
String separator )
String separator )
{
if( list == null || list.isEmpty( ) ) {
return ""; //$NON-NLS-1$

View file

@ -28,12 +28,12 @@ public class MapUtils
{
if( WorkspaceUtils.getSelectedFolder( ) == null ) {
Logger.getInstance( ).log( "no directory selected (importMap)", //$NON-NLS-1$
Messages.MapUtils_1 );
Messages.MapUtils_1 );
return;
}
FileDialog mapDialog = new FileDialog( WesnothPlugin.getShell( ),
SWT.OPEN );
SWT.OPEN );
mapDialog.setText( Messages.MapUtils_2 );
mapDialog.setFilterExtensions( new String[] { "*.map" } ); //$NON-NLS-1$
String file = mapDialog.open( );
@ -45,19 +45,19 @@ public class MapUtils
try {
File source = new File( file );
File target = new File( WorkspaceUtils.getSelectedFolder( )
.getLocation( ).toOSString( )
+ IPath.SEPARATOR + source.getName( ) );
.getLocation( ).toOSString( )
+ IPath.SEPARATOR + source.getName( ) );
if( target.exists( ) ) {
if( GUIUtils.showMessageBox( Messages.MapUtils_4,
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
return;
}
}
ResourceUtils.copyTo( source, target );
WorkspaceUtils.getSelectedFolder( ).refreshLocal(
IResource.DEPTH_INFINITE, null );
IResource.DEPTH_INFINITE, null );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
}

View file

@ -96,7 +96,7 @@ public class ResourceUtils
}
public static String getFileContents( File file, boolean skipEmptyLines,
boolean skipCommentLines )
boolean skipCommentLines )
{
if( ! file.exists( ) || ! file.isFile( ) ) {
return ""; //$NON-NLS-1$
@ -107,7 +107,7 @@ public class ResourceUtils
try {
String line = ""; //$NON-NLS-1$
reader = new BufferedReader( new InputStreamReader(
new FileInputStream( file ) ) );
new FileInputStream( file ) ) );
while( ( line = reader.readLine( ) ) != null ) {
if( skipEmptyLines && line.isEmpty( ) ) {
continue;
@ -158,7 +158,7 @@ public class ResourceUtils
* the contents of the resource or null if no contents needed
*/
public static void createResource( IResource resource, IProject project,
String resourceName, InputStream input )
String resourceName, InputStream input )
{
try {
if( ! project.isOpen( ) ) {
@ -171,18 +171,18 @@ public class ResourceUtils
if( resource instanceof IFile ) {
( ( IFile ) resource ).create( input, true,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
}
else if( resource instanceof IFolder ) {
( ( IFolder ) resource ).create( true, true,
new NullProgressMonitor( ) );
new NullProgressMonitor( ) );
}
} catch( CoreException e ) {
Logger.getInstance( ).logError(
"Error creating the resource" + resourceName ); //$NON-NLS-1$
"Error creating the resource" + resourceName ); //$NON-NLS-1$
GUIUtils.showMessageBox( Messages.ResourceUtils_5 + resourceName,
SWT.ICON_ERROR );
SWT.ICON_ERROR );
Logger.getInstance( ).logException( e );
}
}
@ -250,7 +250,7 @@ public class ResourceUtils
* true to overwrite the file if it already exists
*/
public static void createFile( IProject project, String fileName,
String fileContentsString, boolean overwrite )
String fileContentsString, boolean overwrite )
{
IFile file = project.getFile( fileName );
if( fileContentsString == null ) {
@ -267,7 +267,7 @@ public class ResourceUtils
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(
fileContentsString.getBytes( ) );
fileContentsString.getBytes( ) );
createResource( file, project, fileName, inputStream );
}
@ -285,7 +285,7 @@ public class ResourceUtils
File wesnothFile = new File( path );
try {
if( force == true
|| ( force == false && wesnothFile.exists( ) == false ) ) {
|| ( force == false && wesnothFile.exists( ) == false ) ) {
createNewFile( wesnothFile.getAbsolutePath( ) );
}
} catch( Exception e ) {
@ -302,14 +302,14 @@ public class ResourceUtils
* The parameters list to replace in the template of 'build.xml'
*/
public static void createBuildXMLFile( String path,
List< ReplaceableParameter > params )
List< ReplaceableParameter > params )
{
try {
File antFile = new File( path );
createNewFile( antFile.getAbsolutePath( ) );
FileWriter writer = new FileWriter( antFile );
writer.write( TemplateProvider.getInstance( ).getProcessedTemplate(
"build_xml", params ) ); //$NON-NLS-1$
"build_xml", params ) ); //$NON-NLS-1$
writer.close( );
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
@ -369,10 +369,10 @@ public class ResourceUtils
public static boolean isValidFilePath( String filePath )
{
boolean valid = filePath != null && ! filePath.isEmpty( )
&& new File( filePath ).exists( );
&& new File( filePath ).exists( );
if( valid == false && ! StringUtils.isNullOrEmpty( filePath ) ) {
Logger.getInstance( ).logWarn(
"The file does not exist or is null: " + filePath ); //$NON-NLS-1$
"The file does not exist or is null: " + filePath ); //$NON-NLS-1$
}
return valid;
}
@ -393,7 +393,7 @@ public class ResourceUtils
}
return StringUtils.normalizePath( path ).contains(
StringUtils.normalizePath( paths.getAddonsDir( ) ) );
StringUtils.normalizePath( paths.getAddonsDir( ) ) );
}
/**
@ -412,7 +412,7 @@ public class ResourceUtils
}
return StringUtils.normalizePath( path ).contains(
StringUtils.normalizePath( paths.getCampaignDir( ) ) );
StringUtils.normalizePath( paths.getCampaignDir( ) ) );
}
/**
@ -425,8 +425,8 @@ public class ResourceUtils
public static boolean isConfigFile( IResource resource )
{
return resource instanceof IFile
&& resource.getName( ).toLowerCase( Locale.ENGLISH )
.endsWith( ".cfg" ); //$NON-NLS-1$
&& resource.getName( ).toLowerCase( Locale.ENGLISH )
.endsWith( ".cfg" ); //$NON-NLS-1$
}
/**
@ -476,13 +476,13 @@ public class ResourceUtils
IContainer container = resource.getParent( );
if( container != null ) {
while( container.getParent( ) != null
&& container.getParent( ) != resource
.getProject( ) ) {
&& container.getParent( ) != resource
.getProject( ) ) {
container = container.getParent( );
}
IFile file = project.getFile( container
.getProjectRelativePath( ).toOSString( )
+ "/_main.cfg" ); //$NON-NLS-1$
.getProjectRelativePath( ).toOSString( )
+ "/_main.cfg" ); //$NON-NLS-1$
if( file.exists( ) ) {
targetResource = file;
}
@ -509,7 +509,7 @@ public class ResourceUtils
public static String getCampaignID( IResource resource )
{
SimpleWMLParser parser = new SimpleWMLParser(
getMainConfigLocation( resource ) );
getMainConfigLocation( resource ) );
parser.parse( );
return parser.getParsedConfig( ).CampaignId;
}
@ -537,10 +537,10 @@ public class ResourceUtils
* @return
*/
public static DefaultHandler getWMLSAXHandlerFromResource(
String installName, String resourcePath, DefaultHandler saxHandler )
String installName, String resourcePath, DefaultHandler saxHandler )
{
ExternalToolInvoker parser = WMLTools.runWMLParser2( installName,
resourcePath );
resourcePath );
if( parser == null ) {
return null;
}
@ -549,12 +549,12 @@ public class ResourceUtils
saxparser = SAXParserFactory.newInstance( ).newSAXParser( );
saxparser
.parse( new InputSource( parser.getStdout( ) ), saxHandler );
.parse( new InputSource( parser.getStdout( ) ), saxHandler );
return saxHandler;
} catch( SAXException e ) {
Logger.getInstance( ).logException( e );
Logger.getInstance( ).logError(
"Using output: " + parser.getOutputContent( ) ); //$NON-NLS-1$
"Using output: " + parser.getOutputContent( ) ); //$NON-NLS-1$
return null;
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
@ -598,14 +598,14 @@ public class ResourceUtils
String sourceFile = line.substring( 1, pivotIndex - 1 );
int lineNumber = Integer.parseInt( line.substring( pivotIndex
+ pivot.length( ),
line.indexOf( ":", pivotIndex + pivot.length( ) + 1 ) ) ); //$NON-NLS-1$
+ pivot.length( ),
line.indexOf( ":", pivotIndex + pivot.length( ) + 1 ) ) ); //$NON-NLS-1$
String message = line.substring( line.indexOf(
" ", pivotIndex + pivot.length( ) + 1 ) ); //$NON-NLS-1$
" ", pivotIndex + pivot.length( ) + 1 ) ); //$NON-NLS-1$
// Get the file
IFile file = ResourcesPlugin.getWorkspace( ).getRoot( )
.getFileForLocation( new Path( sourceFile ) );
.getFileForLocation( new Path( sourceFile ) );
if( file.exists( ) == false ) {
return null;
}
@ -640,10 +640,10 @@ public class ResourceUtils
public static IResource getWorkspaceResource( Resource emfResource )
{
return ResourcesPlugin
.getWorkspace( )
.getRoot( )
.getFile(
new Path( emfResource.getURI( ).toPlatformString( true ) ) );
.getWorkspace( )
.getRoot( )
.getFile(
new Path( emfResource.getURI( ).toPlatformString( true ) ) );
}
/**
@ -689,7 +689,7 @@ public class ResourceUtils
*/
// TODO: check for including a specific config file?
if( ! ( text.startsWith( "{campaigns" ) ) && //$NON-NLS-1$
! ( text.equals( "{~add-ons" ) ) ) {
! ( text.equals( "{~add-ons" ) ) ) {
continue;
}
@ -699,12 +699,12 @@ public class ResourceUtils
if( projectPath.contains( WMLUtils.toString( macro.getParameters( )
.get( 1 ) ) ) ) {
.get( 1 ) ) ) ) {
String subString = text.replace( "}", "" )
.replaceFirst( "\\{campaigns/", "" )
.replaceFirst( "\\{~add-ons/", "" );
.replaceFirst( "\\{campaigns/", "" )
.replaceFirst( "\\{~add-ons/", "" );
containersToAdd.add( subString.substring( subString
.indexOf( '/' ) ) );
.indexOf( '/' ) ) );
}
}
@ -723,7 +723,7 @@ public class ResourceUtils
int index = Integer.MAX_VALUE;
try {
index = Integer.parseInt( file
.getPersistentProperty( DependencyListNode.PDL_INDEX ) );
.getPersistentProperty( DependencyListNode.PDL_INDEX ) );
} catch( CoreException e ) {
// not interested
} catch( NumberFormatException e ) {
@ -739,7 +739,7 @@ public class ResourceUtils
* @see http://wiki.wesnoth.org/PreprocessorRef
*/
public static class WMLFilesComparator implements Comparator< IResource >,
Serializable
Serializable
{
private static final long serialVersionUID = 1045365969430128101L;
@ -748,7 +748,7 @@ public class ResourceUtils
public int compare( IResource o1, IResource o2 )
{
return ResourceUtils.wmlFileNameCompare( o1.getName( ),
o2.getName( ) );
o2.getName( ) );
}
}
@ -766,23 +766,23 @@ public class ResourceUtils
{
// _initial.cfg is always the "lowest"
if( fileName1.equals( "_initial.cfg" )
&& ! ( fileName2.equals( "_initial.cfg" ) ) ) {
&& ! ( fileName2.equals( "_initial.cfg" ) ) ) {
return - 1;
}
if( fileName2.equals( "_initial.cfg" )
&& ! ( fileName1.equals( "_initial.cfg" ) ) ) {
&& ! ( fileName1.equals( "_initial.cfg" ) ) ) {
return 1;
}
// _final.cfg is always the "highest"
if( fileName1.equals( "_final.cfg" )
&& ! ( fileName2.equals( "_final.cfg" ) ) ) {
&& ! ( fileName2.equals( "_final.cfg" ) ) ) {
return 1;
}
if( fileName2.equals( "_final.cfg" )
&& ! ( fileName1.equals( "_final.cfg" ) ) ) {
&& ! ( fileName1.equals( "_final.cfg" ) ) ) {
return - 1;
}

View file

@ -33,7 +33,7 @@ public class StringUtils
}
Pattern pattern = Pattern
.compile( "[\t ]*" + Pattern.quote( sequence ) ); //$NON-NLS-1$
.compile( "[\t ]*" + Pattern.quote( sequence ) ); //$NON-NLS-1$
Matcher matcher = pattern.matcher( target );
return( matcher.find( ) && matcher.start( ) == 0 );
}
@ -60,7 +60,7 @@ public class StringUtils
while( tmpString.contains( new String( new char[] { character } ) ) ) {
++cnt;
tmpString = tmpString
.substring( tmpString.indexOf( character ) + 1 );
.substring( tmpString.indexOf( character ) + 1 );
}
return cnt;
}
@ -109,7 +109,7 @@ public class StringUtils
* @return
*/
public static String removeIncorrectCharacters( String target,
char character, boolean removeTrailing, boolean removePreceding )
char character, boolean removeTrailing, boolean removePreceding )
{
if( target == null ) {
return ""; //$NON-NLS-1$
@ -125,7 +125,7 @@ public class StringUtils
}
if( target.charAt( i ) == character
&& ( ( removeTrailing && i == target.length( ) ) || ( removePreceding && i == 0 ) ) ) {
&& ( ( removeTrailing && i == target.length( ) ) || ( removePreceding && i == 0 ) ) ) {
continue;
}
@ -164,7 +164,7 @@ public class StringUtils
}
while( string.charAt( string.length( ) - 1 ) == '/'
|| string.charAt( string.length( ) - 1 ) == '\\' ) {
|| string.charAt( string.length( ) - 1 ) == '\\' ) {
string = string.substring( 0, string.length( ) - 1 );
}
return string;
@ -243,7 +243,7 @@ public class StringUtils
* @return
*/
public static String replaceWithIndent( String string, String source,
String target )
String target )
{
if( string == null ) {
return ""; //$NON-NLS-1$
@ -264,7 +264,7 @@ public class StringUtils
}
return string.replace( source,
ListUtils.concatenateArray( tmpTarget, "\n" ) ); //$NON-NLS-1$
ListUtils.concatenateArray( tmpTarget, "\n" ) ); //$NON-NLS-1$
}
/**
@ -316,7 +316,7 @@ public class StringUtils
List< String > groupList = new ArrayList< String >( );
try {
Pattern regex = Pattern
.compile( regexStr, Pattern.CASE_INSENSITIVE );
.compile( regexStr, Pattern.CASE_INSENSITIVE );
Matcher regexMatcher = regex.matcher( targetString );
while( regexMatcher.find( ) ) {
groupList.add( regexMatcher.group( ) );

View file

@ -55,8 +55,8 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWMLIndent( String installName,
String resourcePath, String stdin, boolean dryrun,
OutputStream[] stdout, OutputStream[] stderr )
String resourcePath, String stdin, boolean dryrun,
OutputStream[] stdout, OutputStream[] stderr )
{
Paths paths = Preferences.getPaths( installName );
@ -75,7 +75,7 @@ public class WMLTools
}
if( dryrun
|| Preferences.getBool( Constants.P_WMLINDENT_DRYRUN ) == true ) {
|| Preferences.getBool( Constants.P_WMLINDENT_DRYRUN ) == true ) {
arguments.add( "--dryrun" ); //$NON-NLS-1$
}
@ -95,17 +95,17 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWMLParser2( String installName,
String resourcePath )
String resourcePath )
{
Paths paths = Preferences.getPaths( installName );
if( ! ResourceUtils.isValidFilePath( resourcePath )
|| ! checkWMLTool( paths, "wesnoth/wmlparser2.py" ) ) {
|| ! checkWMLTool( paths, "wesnoth/wmlparser2.py" ) ) {
return null;
}
File wmlparserFile = new File( paths.getWMLToolsDir( )
+ "/wesnoth/wmlparser2.py" ); //$NON-NLS-1$
+ "/wesnoth/wmlparser2.py" ); //$NON-NLS-1$
List< String > arguments = new ArrayList< String >( );
@ -149,10 +149,10 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWMLLint( String installName,
String resourcePath, boolean dryrun, boolean showProgress )
String resourcePath, boolean dryrun, boolean showProgress )
{
return runWMLLint( installName, resourcePath, dryrun, showProgress,
new OutputStream[0], new OutputStream[0] );
new OutputStream[0], new OutputStream[0] );
}
/**
@ -171,13 +171,13 @@ public class WMLTools
* The array of streams where to output the stderr content
*/
public static ExternalToolInvoker runWMLLint( String installName,
String resourcePath, boolean dryrun, boolean showProgress,
OutputStream[] stdout, OutputStream[] stderr )
String resourcePath, boolean dryrun, boolean showProgress,
OutputStream[] stdout, OutputStream[] stderr )
{
Paths paths = Preferences.getPaths( installName );
if( ! ResourceUtils.isValidFilePath( resourcePath )
|| ! checkWMLTool( paths, Tools.WMLLINT.toString( ) ) ) {
|| ! checkWMLTool( paths, Tools.WMLLINT.toString( ) ) ) {
return null;
}
@ -188,7 +188,7 @@ public class WMLTools
arguments.add( wmllintFile.getAbsolutePath( ) );
int verboseLevel = Preferences
.getInt( Constants.P_WMLLINT_VERBOSE_LEVEL );
.getInt( Constants.P_WMLLINT_VERBOSE_LEVEL );
for( int i = 1; i <= verboseLevel; i++ ) {
arguments.add( "-v" ); //$NON-NLS-1$
}
@ -221,10 +221,10 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWMLScope( String installName,
String resourcePath, boolean showProgress )
String resourcePath, boolean showProgress )
{
return runWMLScope( installName, resourcePath, showProgress,
new OutputStream[0], new OutputStream[0] );
new OutputStream[0], new OutputStream[0] );
}
/**
@ -240,13 +240,13 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWMLScope( String installName,
String resourcePath, boolean showProgress, OutputStream[] stdout,
OutputStream[] stderr )
String resourcePath, boolean showProgress, OutputStream[] stdout,
OutputStream[] stderr )
{
Paths paths = Preferences.getPaths( installName );
if( ! ResourceUtils.isValidFilePath( resourcePath )
|| ! checkWMLTool( paths, Tools.WMLSCOPE.toString( ) ) ) {
|| ! checkWMLTool( paths, Tools.WMLSCOPE.toString( ) ) ) {
return null;
}
@ -256,7 +256,7 @@ public class WMLTools
arguments.add( wmlscopeFile.getAbsolutePath( ) );
int verboseLevel = Preferences
.getInt( Constants.P_WMLSCOPE_VERBOSE_LEVEL );
.getInt( Constants.P_WMLSCOPE_VERBOSE_LEVEL );
if( verboseLevel > 0 ) {
arguments.add( "-w" ); //$NON-NLS-1$
@ -292,7 +292,7 @@ public class WMLTools
* argument for launching the tool
*/
public static void runWMLToolAsWorkspaceJob( final Tools tool,
final String targetPath )
final String targetPath )
{
// TODO: remove/rework this hackish method.
if( tool == Tools.WESNOTH_ADDON_MANAGER ) {
@ -300,7 +300,7 @@ public class WMLTools
}
IEditorReference[] editors = WorkspaceUtils.getWorkbenchWindow( )
.getPages( )[0].getEditorReferences( );
.getPages( )[0].getEditorReferences( );
for( IEditorReference editor: editors ) {
if( editor.isDirty( ) ) {
@ -330,11 +330,11 @@ public class WMLTools
try {
monitor.beginTask( toolName, 1050 );
MessageConsole console = GUIUtils.createConsole( toolName
+ Messages.WMLTools_29, null, true );
+ Messages.WMLTools_29, null, true );
OutputStream[] stdout = new OutputStream[] { console
.newMessageStream( ) };
.newMessageStream( ) };
OutputStream[] stderr = new OutputStream[] { console
.newMessageStream( ) };
.newMessageStream( ) };
String location;
IResource resource = null;
@ -355,33 +355,33 @@ public class WMLTools
}
installName = WesnothInstallsUtils
.getInstallNameForResource( resource );
.getInstallNameForResource( resource );
}
switch( tool ) {
case WMLINDENT:
if( selFile != null && targetPath == null ) {
String stdin = EditorUtils.getEditorDocument( )
.get( );
.get( );
// don't output to stdout as we will put that in
// the editor
toolInvoker = WMLTools.runWMLIndent(
installName, null, stdin, false, null,
stdout );
installName, null, stdin, false, null,
stdout );
}
else {
toolInvoker = WMLTools.runWMLIndent(
installName, location, null, false,
stdout, stderr );
installName, location, null, false,
stdout, stderr );
}
break;
case WMLLINT:
toolInvoker = WMLTools.runWMLLint( installName,
location, true, false, stdout, stderr );
location, true, false, stdout, stderr );
break;
case WMLSCOPE:
toolInvoker = WMLTools.runWMLScope( installName,
location, false, stdout, stderr );
location, false, stdout, stderr );
break;
}
monitor.worked( 50 );
@ -421,26 +421,26 @@ public class WMLTools
stdoutWatcher.start( );
toolInvoker.waitForTool( );
if( tool == Tools.WMLINDENT && selFile != null
&& targetPath == null ) {
&& targetPath == null ) {
EditorUtils.replaceEditorText( toolInvoker
.getOutputContent( ) );
.getOutputContent( ) );
}
if( tool == Tools.WMLSCOPE ) {
if( resource != null ) {
resource.deleteMarkers( Constants.MARKER_WMLSCOPE,
false, IResource.DEPTH_INFINITE );
false, IResource.DEPTH_INFINITE );
}
parseAndAddMarkers( toolInvoker.getOutputContent( ),
Constants.MARKER_WMLSCOPE );
Constants.MARKER_WMLSCOPE );
}
else if( tool == Tools.WMLLINT ) {
if( resource != null ) {
resource.deleteMarkers( Constants.MARKER_WMLLINT,
false, IResource.DEPTH_INFINITE );
false, IResource.DEPTH_INFINITE );
}
parseAndAddMarkers( toolInvoker.getOutputContent( ),
Constants.MARKER_WMLLINT );
Constants.MARKER_WMLLINT );
}
monitor.worked( 50 );
@ -466,18 +466,18 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker uploadWesnothAddon( String containerPath,
OutputStream[] stdout, OutputStream[] stderr )
OutputStream[] stdout, OutputStream[] stderr )
{
if( ! ResourceUtils.isValidFilePath( containerPath ) ) {
return null;
}
return runWesnothAddonManager(
WesnothInstallsUtils.getInstallNameForResource( containerPath ),
Preferences.getString( Constants.P_WAU_PASSWORD ),
Preferences.getString( Constants.P_WAU_PORT ),
Arrays.asList( "-u", containerPath ) // upload container
, stdout, stderr );
WesnothInstallsUtils.getInstallNameForResource( containerPath ),
Preferences.getString( Constants.P_WAU_PASSWORD ),
Preferences.getString( Constants.P_WAU_PORT ),
Arrays.asList( "-u", containerPath ) // upload container
, stdout, stderr );
}
/**
@ -498,9 +498,9 @@ public class WMLTools
* @return null if there were errors or an ExternalToolInvoker instance
*/
public static ExternalToolInvoker runWesnothAddonManager(
String installName, String password, String port,
List< String > extraArguments, OutputStream[] stdout,
OutputStream[] stderr )
String installName, String password, String port,
List< String > extraArguments, OutputStream[] stdout,
OutputStream[] stderr )
{
Paths paths = Preferences.getPaths( installName );
if( ! checkWMLTool( paths, Tools.WESNOTH_ADDON_MANAGER.toString( ) ) ) {
@ -508,7 +508,7 @@ public class WMLTools
}
File wmllintFile = new File( paths.getWMLToolsDir( )
+ "/wesnoth_addon_manager" ); //$NON-NLS-1$
+ "/wesnoth_addon_manager" ); //$NON-NLS-1$
List< String > arguments = new ArrayList< String >( );
arguments.add( wmllintFile.getAbsolutePath( ) );
@ -542,8 +542,8 @@ public class WMLTools
for( String line: lines ) {
if( line.startsWith( "#" ) || //$NON-NLS-1$
line.matches( "^[\\t ]*$" ) || //$NON-NLS-1$
line.startsWith( "wmllint:" ) ) {
line.matches( "^[\\t ]*$" ) || //$NON-NLS-1$
line.startsWith( "wmllint:" ) ) {
continue;
}
if( line.startsWith( "%%" ) ) //$NON-NLS-1$
@ -574,9 +574,9 @@ public class WMLTools
{
String pythonPath = Preferences.getString( Constants.P_PYTHON_PATH );
if( pythonPath.isEmpty( )
|| ( pythonPath.matches( "^.*(/|\\\\).*$" ) && ! ResourceUtils
.isValidFilePath( Preferences
.getString( Constants.P_PYTHON_PATH ) ) ) ) {
|| ( pythonPath.matches( "^.*(/|\\\\).*$" ) && ! ResourceUtils
.isValidFilePath( Preferences
.getString( Constants.P_PYTHON_PATH ) ) ) ) {
GUIUtils.showWarnMessageBox( Messages.WMLTools_42 );
return false;
}
@ -592,7 +592,7 @@ public class WMLTools
if( ! wmlToolFile.exists( ) ) {
GUIUtils.showErrorMessageBox( String.format(
Messages.WMLTools_47, wmlToolFile ) );
Messages.WMLTools_47, wmlToolFile ) );
return false;
}
@ -624,12 +624,12 @@ public class WMLTools
* @return
*/
public static ExternalToolInvoker runPythonScript(
List< String > arguments, String stdin, boolean stderrMonitoring,
boolean stdoutMonitoring, final OutputStream[] stdout,
final OutputStream[] stderr )
List< String > arguments, String stdin, boolean stderrMonitoring,
boolean stdoutMonitoring, final OutputStream[] stdout,
final OutputStream[] stderr )
{
final ExternalToolInvoker pyscript = new ExternalToolInvoker(
Preferences.getString( Constants.P_PYTHON_PATH ), arguments );
Preferences.getString( Constants.P_PYTHON_PATH ), arguments );
pyscript.runTool( );
if( stderrMonitoring == true || ( stderr != null && stderr.length > 0 ) ) {
@ -641,7 +641,7 @@ public class WMLTools
if( stdin != null ) {
try {
BufferedWriter stdinStream = new BufferedWriter(
new OutputStreamWriter( pyscript.getStdin( ) ) );
new OutputStreamWriter( pyscript.getStdin( ) ) );
stdinStream.write( stdin );
stdinStream.close( );
} catch( IOException e ) {

View file

@ -60,7 +60,7 @@ public class WMLUtils
public static WMLRoot getWMLRoot( IFile file )
{
URI uri = URI.createPlatformResourceURI(
file.getFullPath( ).toString( ), true );
file.getFullPath( ).toString( ), true );
ResourceSet resourceSet = new ResourceSetImpl( );
Resource resource = resourceSet.getResource( uri, true );
if( resource == null || resource.getContents( ).isEmpty( ) ) {
@ -159,11 +159,11 @@ public class WMLUtils
for( WMLExpression expression: tag.getExpressions( ) ) {
if( expression.isWMLKey( ) ) {
res.append( indent + "\t"
+ toWMLString( expression.asWMLKey( ) ) );
+ toWMLString( expression.asWMLKey( ) ) );
}
else if( expression.isWMLTag( ) ) {
res.append( indent + "\t"
+ toWMLString( expression.asWMLTag( ) ) );
+ toWMLString( expression.asWMLTag( ) ) );
}
}
@ -199,6 +199,6 @@ public class WMLUtils
private static String toCleanedUpText( EObject obj )
{
return NodeModelUtils.getNode( obj ).getText( )
.replaceFirst( "(\\n|\\r| )+", "" );
.replaceFirst( "(\\n|\\r| )+", "" );
}
}

View file

@ -31,7 +31,7 @@ public class WizardUtils
* @return
*/
public static int launchWizard( WizardTemplate wizard, Shell shell,
IStructuredSelection selection )
IStructuredSelection selection )
{
if( wizard == null ) {
return Window.CANCEL;
@ -44,18 +44,17 @@ public class WizardUtils
wizardDialog.create( );
int x = shell.getBounds( ).x, y = shell.getBounds( ).y;
x += ( ( shell.getBounds( ).width - wizardDialog.getShell( )
.getBounds( ).width ) / 2 );
.getBounds( ).width ) / 2 );
y += ( ( shell.getBounds( ).height - wizardDialog.getShell( )
.getBounds( ).height ) / 2 );
.getBounds( ).height ) / 2 );
wizardDialog.getShell( ).setLocation( x, y );
wizardDialog.setHelpAvailable( true );
WesnothPlugin
.getDefault( )
.getWorkbench( )
.getHelpSystem( )
.setHelp( wizardDialog.getShell( ),
"org.wesnoth.help.wizardHelp" ); //$NON-NLS-1$
.getDefault( )
.getWorkbench( )
.getHelpSystem( )
.setHelp( wizardDialog.getShell( ), "org.wesnoth.help.wizardHelp" ); //$NON-NLS-1$
return wizardDialog.open( );
}

View file

@ -70,7 +70,7 @@ public class WorkspaceUtils
{
IStructuredSelection selection = getSelectedStructuredSelection( window );
if( selection == null
|| ! ( selection.getFirstElement( ) instanceof IProject ) ) {
|| ! ( selection.getFirstElement( ) instanceof IProject ) ) {
return null;
}
@ -86,7 +86,7 @@ public class WorkspaceUtils
public static IProject getProject( String name )
{
IProject proj = ResourcesPlugin.getWorkspace( ).getRoot( )
.getProject( name );
.getProject( name );
if( proj.exists( ) ) {
return proj;
}
@ -114,7 +114,7 @@ public class WorkspaceUtils
{
IStructuredSelection selection = getSelectedStructuredSelection( window );
if( selection == null
|| ! ( selection.getFirstElement( ) instanceof IFolder ) ) {
|| ! ( selection.getFirstElement( ) instanceof IFolder ) ) {
return null;
}
@ -142,7 +142,7 @@ public class WorkspaceUtils
{
IStructuredSelection selection = getSelectedStructuredSelection( window );
if( selection == null
|| ! ( selection.getFirstElement( ) instanceof IFile ) ) {
|| ! ( selection.getFirstElement( ) instanceof IFile ) ) {
return null;
}
return ( IFile ) selection.getFirstElement( );
@ -156,7 +156,7 @@ public class WorkspaceUtils
public static IStructuredSelection getSelectedStructuredSelection( )
{
return getSelectedStructuredSelection( WorkspaceUtils
.getWorkbenchWindow( ) );
.getWorkbenchWindow( ) );
}
/**
@ -167,7 +167,7 @@ public class WorkspaceUtils
* @return
*/
public static IStructuredSelection getSelectedStructuredSelection(
final IWorkbenchWindow window )
final IWorkbenchWindow window )
{
if( window == null ) {
return null;
@ -185,7 +185,7 @@ public class WorkspaceUtils
}
setResult( ( IStructuredSelection ) window
.getSelectionService( ).getSelection( ) );
.getSelectionService( ).getSelection( ) );
} catch( Exception e ) {
e.printStackTrace( );
}
@ -204,8 +204,8 @@ public class WorkspaceUtils
{
IStructuredSelection selection = getSelectedStructuredSelection( );
if( selection == null
|| ! ( selection.getFirstElement( ) instanceof IFolder || selection
.getFirstElement( ) instanceof IProject ) ) {
|| ! ( selection.getFirstElement( ) instanceof IFolder || selection
.getFirstElement( ) instanceof IProject ) ) {
return null;
}
@ -306,7 +306,7 @@ public class WorkspaceUtils
{
if( temporaryFolder_ == null || temporaryFolder_.isEmpty( ) ) {
temporaryFolder_ = System.getProperty( "java.io.tmpdir" ) + //$NON-NLS-1$
IPath.SEPARATOR + "wesnoth_plugin" + IPath.SEPARATOR; //$NON-NLS-1$
IPath.SEPARATOR + "wesnoth_plugin" + IPath.SEPARATOR; //$NON-NLS-1$
File tmpFile = new File( temporaryFolder_ );
@ -338,7 +338,7 @@ public class WorkspaceUtils
public static String getCurrentDateTime( )
{
return new SimpleDateFormat( "yyyy_MM_dd_HH_mm_ss" )
.format( new Date( ) );
.format( new Date( ) );
}
/**
@ -355,8 +355,8 @@ public class WorkspaceUtils
}
String result = Preferences.getPaths(
WesnothInstallsUtils.getInstallNameForResource( resource ) )
.getAddonsDir( );
WesnothInstallsUtils.getInstallNameForResource( resource ) )
.getAddonsDir( );
result += resource.getProject( ).getName( ) + IPath.SEPARATOR;
result += resource.getProjectRelativePath( ).toOSString( );
return result;
@ -375,8 +375,8 @@ public class WorkspaceUtils
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), false ) ) {
PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
WesnothPlugin.getShell( ),
"org.wesnoth.preferences.InstallsPage", null, null ); //$NON-NLS-1$
WesnothPlugin.getShell( ),
"org.wesnoth.preferences.InstallsPage", null, null ); //$NON-NLS-1$
pref.open( );
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), true ) ) {
GUIUtils.showErrorMessageBox( Messages.WorkspaceUtils_7 );
@ -396,47 +396,48 @@ public class WorkspaceUtils
// automatically import 'special' folders as projects
List< File > userAddonsFiles = new ArrayList< File >( );
Paths paths = Preferences.getPaths( Preferences
.getDefaultInstallName( ) );
.getDefaultInstallName( ) );
if( GUIUtils.showMessageBox( Messages.WorkspaceUtils_18,
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.YES ) {
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.YES ) {
// useraddons/add-ons/data
File[] tmp = new File( paths.getAddonsDir( ) )
.listFiles( );
.listFiles( );
if( tmp != null ) {
userAddonsFiles.addAll( Arrays.asList( tmp ) );
}
}
monitor.beginTask( Messages.WorkspaceUtils_22,
userAddonsFiles.size( ) * 10 );
userAddonsFiles.size( ) * 10 );
for( File file: userAddonsFiles ) {
if( file.isDirectory( ) == false
|| file.getName( ).startsWith( "." ) ) {
|| file.getName( ).startsWith( "." ) ) {
continue;
}
String projectName = file.getName( );
if( ResourceUtils.isCampaignDirPath( paths,
file.getAbsolutePath( ) ) ) {
file.getAbsolutePath( ) ) ) {
projectName = "_Mainline_" + file.getName( ); //$NON-NLS-1$
}
ProjectUtils.createWesnothProject( projectName,
file.getAbsolutePath( ),
paths.getInstallName( ), monitor );
file.getAbsolutePath( ),
paths.getInstallName( ), monitor );
monitor.worked( 10 );
}
if( guided ) {
GUIUtils.showInfoMessageBox( Messages.WorkspaceUtils_25 );
GUIUtils
.showInfoMessageBox( Messages.WorkspaceUtils_25 );
}
else {
Logger.getInstance( ).log(
"setupWorkspace was successful", //$NON-NLS-1$
Messages.WorkspaceUtils_29 );
"setupWorkspace was successful", //$NON-NLS-1$
Messages.WorkspaceUtils_29 );
}
} catch( Exception e ) {
Logger.getInstance( ).logException( e );
@ -459,16 +460,16 @@ public class WorkspaceUtils
* the user if conditions are not met
*/
public static boolean checkPathsAreSet( String installName,
boolean displayWarning )
boolean displayWarning )
{
if( ! ResourceUtils.isValidFilePath( Preferences.getPaths( installName )
.getWesnothExecutablePath( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getUserDir( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getWMLToolsDir( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getWorkingDir( ) ) ) {
.getWesnothExecutablePath( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getUserDir( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getWMLToolsDir( ) )
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
installName ).getWorkingDir( ) ) ) {
if( displayWarning ) {
GUIUtils.showWarnMessageBox( Messages.WorkspaceUtils_33 );
}

View file

@ -60,8 +60,8 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
private SchemaParser getSchema( EObject object )
{
return SchemaParser.getInstance( WesnothInstallsUtils
.getInstallNameForResource( ResourceUtils
.getWorkspaceResource( object.eResource( ) ) ) );
.getInstallNameForResource( ResourceUtils
.getWorkspaceResource( object.eResource( ) ) ) );
}
private boolean isValidationEnabled( )
@ -78,7 +78,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
if( ! tag.getName( ).equals( tag.getEndName( ) ) ) {
warning( Messages.WMLJavaValidator_0,
WmlPackage.Literals.WML_TAG__END_NAME );
WmlPackage.Literals.WML_TAG__END_NAME );
}
}
@ -92,7 +92,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
ICompositeNode node = NodeModelUtils.getNode( tag );
if( node != null ) {
ILeafNode parentNode = NodeModelUtils.findLeafNodeAtOffset(
node.getParent( ), node.getParent( ).getOffset( ) + 2 );
node.getParent( ), node.getParent( ).getOffset( ) + 2 );
boolean found = false;
String searchName = parentNode.getText( );
@ -112,14 +112,14 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
}
if( found == false ) {
warning( Messages.WMLJavaValidator_1,
WmlPackage.Literals.WML_EXPRESSION__NAME );
WmlPackage.Literals.WML_EXPRESSION__NAME );
}
}
}
}
private void checkTagsCardinalities( SchemaParser schema,
Iterable< WMLTag > tags )
Iterable< WMLTag > tags )
{
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
@ -141,14 +141,14 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
if( schemaTag.getAllowedCount( ) < entry.getValue( ) ) {
warning( "Tag " + entry.getKey( ) + " cannot appear more"
+ "than " + schemaTag.getAllowedCount( ) + " times. ",
WmlPackage.Literals.WML_EXPRESSION__NAME );
+ "than " + schemaTag.getAllowedCount( ) + " times. ",
WmlPackage.Literals.WML_EXPRESSION__NAME );
}
}
}
private void checkKeysCardinalities( WMLTag parentTag,
Iterable< WMLKey > keys )
Iterable< WMLKey > keys )
{
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
@ -163,7 +163,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
for( Entry< String, Integer > entry: ocurrences.entrySet( ) ) {
WMLKey schemaKey = WMLUtils
.getKeyByName( parentTag, entry.getKey( ) );
.getKeyByName( parentTag, entry.getKey( ) );
if( schemaKey == null ) {
continue;
@ -171,11 +171,11 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
if( schemaKey.getAllowedCount( ) < entry.getValue( ) ) {
warning(
"Key " + entry.getKey( ) + ", in tag "
+ parentTag.getName( )
+ "cannot appear more than "
+ schemaKey.getAllowedCount( ) + " times. ",
WmlPackage.Literals.WML_EXPRESSION__NAME );
"Key " + entry.getKey( ) + ", in tag "
+ parentTag.getName( )
+ "cannot appear more than "
+ schemaKey.getAllowedCount( ) + " times. ",
WmlPackage.Literals.WML_EXPRESSION__NAME );
}
}
}
@ -188,7 +188,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
}
checkTagsCardinalities( getSchema( root ),
Iterables.filter( root.getExpressions( ), WMLTag.class ) );
Iterables.filter( root.getExpressions( ), WMLTag.class ) );
}
@Check( CheckType.NORMAL )
@ -200,10 +200,10 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
SchemaParser schema = getSchema( tag );
checkTagsCardinalities( schema,
Iterables.filter( tag.getExpressions( ), WMLTag.class ) );
Iterables.filter( tag.getExpressions( ), WMLTag.class ) );
checkKeysCardinalities( tag,
Iterables.filter( tag.getExpressions( ), WMLKey.class ) );
Iterables.filter( tag.getExpressions( ), WMLKey.class ) );
}
@Check( CheckType.NORMAL )
@ -214,12 +214,12 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
}
IResource resource = ResourceUtils.getWorkspaceResource( call
.eResource( ) );
.eResource( ) );
ProjectCache cache = ProjectUtils.getCacheForProject( resource
.getProject( ) );
.getProject( ) );
if( ! cache.getDefines( ).containsKey( call.getName( ) ) ) {
warning( "Undefined macro: " + call.getName( ),
WmlPackage.Literals.WML_EXPRESSION__NAME );
WmlPackage.Literals.WML_EXPRESSION__NAME );
}
}
}

View file

@ -82,7 +82,7 @@ public class AddonsView extends ViewPart
grpAddonsList.setLayout( new FillLayout( SWT.HORIZONTAL ) );
tableAddons_ = new Table( grpAddonsList, SWT.BORDER
| SWT.FULL_SELECTION );
| SWT.FULL_SELECTION );
tableAddons_.setHeaderVisible( true );
tableAddons_.setLinesVisible( true );
@ -119,7 +119,7 @@ public class AddonsView extends ViewPart
cmbAddonServer_ = new Combo( grpOptions, SWT.NONE );
GridData gd_cmbAddonServer = new GridData( SWT.FILL, SWT.FILL, false,
false, 1, 1 );
false, 1, 1 );
gd_cmbAddonServer.widthHint = 148;
cmbAddonServer_.setLayoutData( gd_cmbAddonServer );
@ -139,9 +139,9 @@ public class AddonsView extends ViewPart
public void widgetSelected( SelectionEvent e )
{
PreferencesUtil.createPreferenceDialogOn(
getViewSite( ).getShell( ),
AddonUploadPreferencePage.ID_ADDON_PREFERENCE_PAGE,
null, null ).open( );
getViewSite( ).getShell( ),
AddonUploadPreferencePage.ID_ADDON_PREFERENCE_PAGE,
null, null ).open( );
}
} );
btnOpenAddonManager.setText( "Open Addon Manager preferences" );
@ -157,10 +157,10 @@ public class AddonsView extends ViewPart
ports_.clear( );
// fill the addons
for( Entry< String, String > server: AddonUploadPreferencePage.ADDON_SERVER_PORTS
.entrySet( ) ) {
.entrySet( ) ) {
cmbAddonServer_.add( String.format( "%s ( port: %s )",
server.getValue( ), server.getKey( ) ) );
server.getValue( ), server.getKey( ) ) );
ports_.add( server.getKey( ) );
}
@ -203,7 +203,7 @@ public class AddonsView extends ViewPart
@Override
public IStatus runInWorkspace( final IProgressMonitor monitor )
throws CoreException
throws CoreException
{
monitor.beginTask( "Downloading addon " + addonName, 100 );
@ -215,7 +215,7 @@ public class AddonsView extends ViewPart
{
// ask the user to select the install for the project
SelectWesnothInstallDialog dialog = new SelectWesnothInstallDialog(
null );
null );
if( dialog.open( ) == SWT.OK ) {
setResult( dialog.getSelectedInstallName( ) );
}
@ -230,17 +230,17 @@ public class AddonsView extends ViewPart
final Paths paths = Preferences.getPaths( installName );
OutputStream console = GUIUtils.createConsole(
"Wesnoth Addon Manager", null, false )
.newOutputStream( );
"Wesnoth Addon Manager", null, false )
.newOutputStream( );
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
installName,
null,
currentPort_,
Arrays.asList( "-d", addonName, "-c",
paths.getAddonsDir( ) ),
new OutputStream[] { console },
new OutputStream[] { console } );
installName,
null,
currentPort_,
Arrays.asList( "-d", addonName, "-c",
paths.getAddonsDir( ) ),
new OutputStream[] { console },
new OutputStream[] { console } );
tool.waitForTool( );
@ -248,13 +248,13 @@ public class AddonsView extends ViewPart
// ask user if he wants to create a project
if( GUIUtils
.showMessageBox(
"Do you want to create a new project for the downloaded addon?",
SWT.YES | SWT.NO ) == SWT.YES ) {
.showMessageBox(
"Do you want to create a new project for the downloaded addon?",
SWT.YES | SWT.NO ) == SWT.YES ) {
ProjectUtils.createWesnothProject( addonName,
paths.getAddonsDir( ) + addonName, installName,
monitor );
paths.getAddonsDir( ) + addonName, installName,
monitor );
}
monitor.done( );
@ -270,7 +270,8 @@ public class AddonsView extends ViewPart
protected void refreshAddons( )
{
if( loading_ ) {
GUIUtils.showInfoMessageBox( "Please wait for the previous query to finish." );
GUIUtils
.showInfoMessageBox( "Please wait for the previous query to finish." );
return;
}
@ -292,7 +293,7 @@ public class AddonsView extends ViewPart
@Override
public IStatus runInWorkspace( IProgressMonitor monitor )
throws CoreException
throws CoreException
{
monitor.beginTask( "Retrieving list...", 100 );
monitor.worked( 10 );
@ -300,14 +301,14 @@ public class AddonsView extends ViewPart
String installName = Preferences.getDefaultInstallName( );
OutputStream stderr = GUIUtils.createConsole(
"Wesnoth Addon Manager", null, false )
.newOutputStream( );
"Wesnoth Addon Manager", null, false )
.newOutputStream( );
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
installName, null, currentPort_,
Arrays.asList( "-w", "-l" ), // list addons in raw
// mode
null, new OutputStream[] { stderr } );
installName, null, currentPort_,
Arrays.asList( "-w", "-l" ), // list addons in raw
// mode
null, new OutputStream[] { stderr } );
tool.waitForTool( );
/**
@ -316,7 +317,7 @@ public class AddonsView extends ViewPart
* "5 - downloads", "size", "timestamp", "translate"]]
*/
final String[] lines = StringUtils.getLines( tool
.getOutputContent( ) );
.getOutputContent( ) );
final List< String[] > addons = new ArrayList< String[] >( );
String[] tmpColumns = null;
@ -353,8 +354,8 @@ public class AddonsView extends ViewPart
// got something interesting? parse it
if( tmpColumns != null && index != - 1 ) {
tmpColumns[index] = line.substring(
line.indexOf( '\'' ) + 1,
line.lastIndexOf( '\'' ) ).trim( );
line.indexOf( '\'' ) + 1,
line.lastIndexOf( '\'' ) ).trim( );
}
}
@ -367,10 +368,10 @@ public class AddonsView extends ViewPart
for( String[] addon: addons ) {
TableItem tableItem = new TableItem(
tableAddons_, SWT.NONE );
tableAddons_, SWT.NONE );
tableItem.setText( new String[] { addon[0],
addon[1], addon[2], addon[3], addon[4],
addon[5] } );
addon[1], addon[2], addon[3], addon[4],
addon[5] } );
}

View file

@ -17,7 +17,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.navigator.CommonNavigator;
public class WesnothProjectsExplorer extends CommonNavigator implements
IPersistableElement, IElementFactory
IPersistableElement, IElementFactory
{
public static final String ID_PROJECTS_EXPLORER = "org.wesnoth.views.WesnothProjectsExplorer"; //$NON-NLS-1$
@ -36,7 +36,7 @@ public class WesnothProjectsExplorer extends CommonNavigator implements
}
if( adapter.equals( IWorkbenchAdapter.class ) ) {
return ResourcesPlugin.getWorkspace( ).getRoot( )
.getAdapter( adapter );
.getAdapter( adapter );
}
return null;
}

View file

@ -25,7 +25,7 @@ public class WizardPageTemplate extends WizardPage
public void createControl( Composite parent )
{
WesnothPlugin.getDefault( ).getWorkbench( ).getHelpSystem( )
.setHelp( getShell( ), "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
.setHelp( getShell( ), "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
}
@Override
@ -41,20 +41,20 @@ public class WizardPageTemplate extends WizardPage
public IPath handleBrowseContainer( )
{
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
getShell( ), ResourcesPlugin.getWorkspace( ).getRoot( ), false,
Messages.NewWizardPageTemplate_1 );
getShell( ), ResourcesPlugin.getWorkspace( ).getRoot( ), false,
Messages.NewWizardPageTemplate_1 );
if( dialog.open( ) == Window.OK ) {
Object[] result = dialog.getResult( );
if( result.length == 1 ) {
try {
getWizard( ).selectionContainer_ = ResourcesPlugin
.getWorkspace( ).getRoot( )
.getFolder( ( Path ) result[0] );
.getWorkspace( ).getRoot( )
.getFolder( ( Path ) result[0] );
} catch( IllegalArgumentException e ) {
// the path is a project
getWizard( ).selectionContainer_ = ResourcesPlugin
.getWorkspace( ).getRoot( )
.getProject( result[0].toString( ) );
.getWorkspace( ).getRoot( )
.getProject( result[0].toString( ) );
}
return ( Path ) result[0];
}

Some files were not shown because too many files have changed in this diff Show more