eclipse plugin: Change the default wrapping...
...indentation policy to 'Indent by one'
This commit is contained in:
parent
3e9555d9b5
commit
5fa7d2ccbc
131 changed files with 1731 additions and 1701 deletions
|
@ -1,4 +1,4 @@
|
||||||
#Sat Aug 06 22:15:01 EEST 2011
|
#Mon Aug 08 23:52:12 EEST 2011
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
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.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=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.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_annotation=0
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
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_multiple_fields=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_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=16
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
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=16
|
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_imports=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
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_declaration=insert
|
||||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=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_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_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_empty_array_initializer_on_one_line=false
|
||||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
|
|
@ -67,9 +67,9 @@ public abstract class WMLTests extends AbstractXtextTests
|
||||||
// get the wesnoth data path from the user
|
// get the wesnoth data path from the user
|
||||||
dataPath_ = System.getProperty( "wesnothDataDir" );
|
dataPath_ = System.getProperty( "wesnothDataDir" );
|
||||||
if( StringUtils.isNullOrEmpty( dataPath_ )
|
if( StringUtils.isNullOrEmpty( dataPath_ )
|
||||||
|| ! new File( dataPath_ ).exists( ) ) {
|
|| ! new File( dataPath_ ).exists( ) ) {
|
||||||
System.out
|
System.out
|
||||||
.println( "Please set the wesnoth data dir before testing!." );
|
.println( "Please set the wesnoth data dir before testing!." );
|
||||||
assertTrue( false );
|
assertTrue( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public abstract class WMLTests extends AbstractXtextTests
|
||||||
CharStream stream = new ANTLRStringStream( input );
|
CharStream stream = new ANTLRStringStream( input );
|
||||||
getLexer( ).setCharStream( stream );
|
getLexer( ).setCharStream( stream );
|
||||||
XtextTokenStream tokenStream = new XtextTokenStream( getLexer( ),
|
XtextTokenStream tokenStream = new XtextTokenStream( getLexer( ),
|
||||||
getTokenDefProvider( ) );
|
getTokenDefProvider( ) );
|
||||||
List< Token > tokens = tokenStream.getTokens( );
|
List< Token > tokens = tokenStream.getTokens( );
|
||||||
return tokens;
|
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
|
* check whether an input is chopped into a list of expected token types
|
||||||
*/
|
*/
|
||||||
protected void checkTokenisation( String input,
|
protected void checkTokenisation( String input,
|
||||||
String... expectedTokenTypes )
|
String... expectedTokenTypes )
|
||||||
{
|
{
|
||||||
List< Token > tokens = getTokens( input );
|
List< Token > tokens = getTokens( input );
|
||||||
assertEquals( input, expectedTokenTypes.length, tokens.size( ) );
|
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 rule name for a keyword is usually
|
||||||
// the keyword enclosed in single quotes
|
// the keyword enclosed in single quotes
|
||||||
String rule = new StringBuilder( "'" ).append( input ).append( "'" ) //$NON-NLS-1$ //$NON-NLS-2$
|
String rule = new StringBuilder( "'" ).append( input ).append( "'" ) //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
.toString( );
|
.toString( );
|
||||||
checkTokenisation( input, rule );
|
checkTokenisation( input, rule );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.wesnoth.tests.plugin.WMLParsingCampaignsConfigs;
|
||||||
|
|
||||||
@RunWith( Suite.class )
|
@RunWith( Suite.class )
|
||||||
@Suite.SuiteClasses( { WMLGrammarTokensTests.class, WMLFilesTests.class,
|
@Suite.SuiteClasses( { WMLGrammarTokensTests.class, WMLFilesTests.class,
|
||||||
WMLParsingCampaignsConfigs.class, } )
|
WMLParsingCampaignsConfigs.class, } )
|
||||||
public class WMLTestsSuite
|
public class WMLTestsSuite
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class WMLParsingCampaignsConfigs extends WMLTests
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SimpleWMLParser wmlParser = new SimpleWMLParser( new File( path ),
|
SimpleWMLParser wmlParser = new SimpleWMLParser( new File( path ),
|
||||||
getParser( ) );
|
getParser( ) );
|
||||||
wmlParser.parse( );
|
wmlParser.parse( );
|
||||||
WMLConfig config = wmlParser.getParsedConfig( );
|
WMLConfig config = wmlParser.getParsedConfig( );
|
||||||
|
|
||||||
|
@ -114,15 +114,15 @@ public class WMLParsingCampaignsConfigs extends WMLTests
|
||||||
public static Collection< Object[] > data( )
|
public static Collection< Object[] > data( )
|
||||||
{
|
{
|
||||||
return Arrays.asList( new Object[][] {
|
return Arrays.asList( new Object[][] {
|
||||||
{ new String[] { "An_Orcish_Incursion", "An_Orcish_Incursion",
|
{ new String[] { "An_Orcish_Incursion", "An_Orcish_Incursion",
|
||||||
"01_Defend_the_Forest", "02_Assassins", "03_Wasteland",
|
"01_Defend_the_Forest", "02_Assassins", "03_Wasteland",
|
||||||
"04_Valley_of_Trolls", "05_Linaera_the_Quick",
|
"04_Valley_of_Trolls", "05_Linaera_the_Quick",
|
||||||
"06_A_Detour_through_the_Swamp", "07_Showdown" } },
|
"06_A_Detour_through_the_Swamp", "07_Showdown" } },
|
||||||
{ new String[] { "Dead_Water", "Dead_Water", "01_Invasion",
|
{ new String[] { "Dead_Water", "Dead_Water", "01_Invasion",
|
||||||
"02_Flight", "03_Wolf_Coast", "04_Slavers",
|
"02_Flight", "03_Wolf_Coast", "04_Slavers",
|
||||||
"05_Tirigaz", "06_Uncharted_Islands", "07_Bilheld",
|
"05_Tirigaz", "06_Uncharted_Islands", "07_Bilheld",
|
||||||
"08_Talking_to_Tyegea", "09_The_Mage",
|
"08_Talking_to_Tyegea", "09_The_Mage",
|
||||||
"10_The_Flaming_Sword", "11_Getting_Help",
|
"10_The_Flaming_Sword", "11_Getting_Help",
|
||||||
"12_Revenge", "13_Epilogue" } } } );
|
"12_Revenge", "13_Epilogue" } } } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Sat Aug 06 22:15:01 EEST 2011
|
#Mon Aug 08 23:52:12 EEST 2011
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
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.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=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.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_annotation=0
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
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_multiple_fields=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_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=16
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
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=16
|
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_imports=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
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_declaration=insert
|
||||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=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_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_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_empty_array_initializer_on_one_line=false
|
||||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class WMLUiModule extends org.wesnoth.ui.AbstractWMLUiModule
|
||||||
super.configure( binder );
|
super.configure( binder );
|
||||||
|
|
||||||
binder.bind( IEObjectHoverProvider.class ).to(
|
binder.bind( IEObjectHoverProvider.class ).to(
|
||||||
WMLEObjectHoverProvider.class );
|
WMLEObjectHoverProvider.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,7 +91,7 @@ public class WMLUiModule extends org.wesnoth.ui.AbstractWMLUiModule
|
||||||
public ICharacterPairMatcher bindICharacterPairMatcher( )
|
public ICharacterPairMatcher bindICharacterPairMatcher( )
|
||||||
{
|
{
|
||||||
return new WMLCharacterPairMatcher( new char[] { '(', ')', '{', '}',
|
return new WMLCharacterPairMatcher( new char[] { '(', ')', '{', '}',
|
||||||
'[', ']' } );
|
'[', ']' } );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class< ? extends XtextEditor > bindEditor( )
|
public Class< ? extends XtextEditor > bindEditor( )
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class ClosingEndTagAutoEditStrategy implements IAutoEditStrategy
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void customizeDocumentCommand( final IDocument document,
|
public void customizeDocumentCommand( final IDocument document,
|
||||||
final DocumentCommand command )
|
final DocumentCommand command )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if( command.text.equals( "/" ) && document.get( command.offset - 1, 1 ).equals( "[" ) ) //$NON-NLS-1$ //$NON-NLS-2$
|
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(
|
editor.getDocument( ).readOnly(
|
||||||
new IUnitOfWork.Void< XtextResource >( ) {
|
new IUnitOfWork.Void< XtextResource >( ) {
|
||||||
@Override
|
@Override
|
||||||
public void process( XtextResource state )
|
public void process( XtextResource state )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
ILeafNode currentNode = NodeModelUtils
|
ILeafNode currentNode = NodeModelUtils
|
||||||
.findLeafNodeAtOffset( state
|
.findLeafNodeAtOffset( state
|
||||||
.getParseResult( )
|
.getParseResult( )
|
||||||
.getRootNode( ), command.offset );
|
.getRootNode( ), command.offset );
|
||||||
|
|
||||||
if( currentNode == null ) {
|
if( currentNode == null ) {
|
||||||
return;
|
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$
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} );
|
|
||||||
|
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 ) {
|
} catch( BadLocationException e ) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,6 @@ public class WMLAutoEditStrategy extends DefaultAutoEditStrategyProvider
|
||||||
super.configure( acceptor );
|
super.configure( acceptor );
|
||||||
configureStringLiteral( acceptor );
|
configureStringLiteral( acceptor );
|
||||||
acceptor.accept( new ClosingEndTagAutoEditStrategy( ),
|
acceptor.accept( new ClosingEndTagAutoEditStrategy( ),
|
||||||
IDocument.DEFAULT_CONTENT_TYPE );
|
IDocument.DEFAULT_CONTENT_TYPE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class WMLProposalComparator implements ICompletionProposalComparator
|
||||||
public int compare( ICompletionProposal arg0, ICompletionProposal arg1 )
|
public int compare( ICompletionProposal arg0, ICompletionProposal arg1 )
|
||||||
{
|
{
|
||||||
if( arg0 instanceof ConfigurableCompletionProposal
|
if( arg0 instanceof ConfigurableCompletionProposal
|
||||||
&& arg1 instanceof ConfigurableCompletionProposal ) {
|
&& arg1 instanceof ConfigurableCompletionProposal ) {
|
||||||
ConfigurableCompletionProposal tmp0 = ( ConfigurableCompletionProposal ) arg0;
|
ConfigurableCompletionProposal tmp0 = ( ConfigurableCompletionProposal ) arg0;
|
||||||
ConfigurableCompletionProposal tmp1 = ( ConfigurableCompletionProposal ) arg1;
|
ConfigurableCompletionProposal tmp1 = ( ConfigurableCompletionProposal ) arg1;
|
||||||
return tmp0.compareTo( tmp1 );
|
return tmp0.compareTo( tmp1 );
|
||||||
|
|
|
@ -93,14 +93,14 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
// load the schema so we know what to suggest for autocomplete
|
// load the schema so we know what to suggest for autocomplete
|
||||||
schemaParser_ = SchemaParser.getInstance( WesnothInstallsUtils
|
schemaParser_ = SchemaParser.getInstance( WesnothInstallsUtils
|
||||||
.getInstallNameForResource( file ) );
|
.getInstallNameForResource( file ) );
|
||||||
|
|
||||||
dependencyIndex_ = ResourceUtils.getDependencyIndex( file );
|
dependencyIndex_ = ResourceUtils.getDependencyIndex( file );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeWMLKey_Name( EObject model, Assignment assignment,
|
public void completeWMLKey_Name( EObject model, Assignment assignment,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.completeWMLKey_Name( model, assignment, context, acceptor );
|
super.completeWMLKey_Name( model, assignment, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -110,7 +110,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void complete_WMLKeyValue( EObject model, RuleCall ruleCall,
|
public void complete_WMLKeyValue( EObject model, RuleCall ruleCall,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.complete_WMLKeyValue( model, ruleCall, context, acceptor );
|
super.complete_WMLKeyValue( model, ruleCall, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -120,7 +120,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void complete_WMLTag( EObject model, RuleCall ruleCall,
|
public void complete_WMLTag( EObject model, RuleCall ruleCall,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.complete_WMLTag( model, ruleCall, context, acceptor );
|
super.complete_WMLTag( model, ruleCall, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -130,7 +130,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeWMLTag_Name( EObject model, Assignment assignment,
|
public void completeWMLTag_Name( EObject model, Assignment assignment,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.completeWMLTag_Name( model, assignment, context, acceptor );
|
super.completeWMLTag_Name( model, assignment, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -140,8 +140,8 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeWMLMacroCall_Name( EObject model,
|
public void completeWMLMacroCall_Name( EObject model,
|
||||||
Assignment assignment, ContentAssistContext context,
|
Assignment assignment, ContentAssistContext context,
|
||||||
ICompletionProposalAcceptor acceptor )
|
ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.completeWMLMacroCall_Name( model, assignment, context, acceptor );
|
super.completeWMLMacroCall_Name( model, assignment, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -151,7 +151,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void complete_WMLMacroCall( EObject model, RuleCall ruleCall,
|
public void complete_WMLMacroCall( EObject model, RuleCall ruleCall,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.complete_WMLMacroCall( model, ruleCall, context, acceptor );
|
super.complete_WMLMacroCall( model, ruleCall, context, acceptor );
|
||||||
refresh( );
|
refresh( );
|
||||||
|
@ -160,10 +160,10 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMacroCallProposals( EObject model, boolean ruleProposal,
|
private void addMacroCallProposals( EObject model, boolean ruleProposal,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
for( Entry< String, Define > define: projectCache_.getDefines( )
|
for( Entry< String, Define > define: projectCache_.getDefines( )
|
||||||
.entrySet( ) ) {
|
.entrySet( ) ) {
|
||||||
StringBuilder proposal = new StringBuilder( 10 );
|
StringBuilder proposal = new StringBuilder( 10 );
|
||||||
if( ruleProposal == true ) {
|
if( ruleProposal == true ) {
|
||||||
proposal.append( "{" ); //$NON-NLS-1$
|
proposal.append( "{" ); //$NON-NLS-1$
|
||||||
|
@ -176,13 +176,13 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
proposal.append( "}" ); //$NON-NLS-1$
|
proposal.append( "}" ); //$NON-NLS-1$
|
||||||
|
|
||||||
acceptor.accept( createCompletionProposal( proposal.toString( ),
|
acceptor.accept( createCompletionProposal( proposal.toString( ),
|
||||||
define.getKey( ), MACRO_CALL_IMAGE, context,
|
define.getKey( ), MACRO_CALL_IMAGE, context,
|
||||||
MACRO_CALL_PRIORITY ) );
|
MACRO_CALL_PRIORITY ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addKeyValueProposals( EObject model,
|
private void addKeyValueProposals( EObject model,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
if( model == null || ! ( model instanceof WMLKey ) ) {
|
if( model == null || ! ( model instanceof WMLKey ) ) {
|
||||||
return;
|
return;
|
||||||
|
@ -192,19 +192,19 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
// handle the next_scenario and first_scenario
|
// handle the next_scenario and first_scenario
|
||||||
if( keyName.equals( "next_scenario" ) || //$NON-NLS-1$
|
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( ) ) {
|
for( WMLConfig config: projectCache_.getWMLConfigs( ).values( ) ) {
|
||||||
if( StringUtils.isNullOrEmpty( config.ScenarioId ) ) {
|
if( StringUtils.isNullOrEmpty( config.ScenarioId ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
acceptor.accept( createCompletionProposal( config.ScenarioId,
|
acceptor.accept( createCompletionProposal( config.ScenarioId,
|
||||||
config.ScenarioId, SCENARIO_VALUE_IMAGE, context,
|
config.ScenarioId, SCENARIO_VALUE_IMAGE, context,
|
||||||
KEY_VALUE_PRIORITY ) );
|
KEY_VALUE_PRIORITY ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( model.eContainer( ) != null
|
else if( model.eContainer( ) != null
|
||||||
&& model.eContainer( ) instanceof WMLTag ) {
|
&& model.eContainer( ) instanceof WMLTag ) {
|
||||||
WMLTag parent = ( WMLTag ) model.eContainer( );
|
WMLTag parent = ( WMLTag ) model.eContainer( );
|
||||||
String tagName = parent.getName( );
|
String tagName = parent.getName( );
|
||||||
WMLTag tag = schemaParser_.getTags( ).get( tagName );
|
WMLTag tag = schemaParser_.getTags( ).get( tagName );
|
||||||
|
@ -213,64 +213,65 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
if( tagKey != null && tagKey.is_Enum( ) ) {
|
if( tagKey != null && tagKey.is_Enum( ) ) {
|
||||||
for( WMLKeyValue val: tagKey.getValues( ) ) {
|
for( WMLKeyValue val: tagKey.getValues( ) ) {
|
||||||
acceptor.accept( createCompletionProposal(
|
acceptor.accept( createCompletionProposal(
|
||||||
val.toString( ), context, KEY_VALUE_PRIORITY ) );
|
val.toString( ), context, KEY_VALUE_PRIORITY ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( tagName.equals( "event" ) || tagName.equals( "fire_event" ) )
|
if( ( tagName.equals( "event" ) || tagName.equals( "fire_event" ) )
|
||||||
&& keyName.equals( "name" ) ) {
|
&& keyName.equals( "name" ) ) {
|
||||||
// add events
|
// add events
|
||||||
List< String > events = new ArrayList< String >( );
|
List< String > events = new ArrayList< String >( );
|
||||||
events.addAll( TemplateProvider.getInstance( )
|
events.addAll( TemplateProvider.getInstance( )
|
||||||
.getCAC( "events" ) );
|
.getCAC( "events" ) );
|
||||||
events.addAll( projectCache_.getEvents( ) );
|
events.addAll( projectCache_.getEvents( ) );
|
||||||
|
|
||||||
for( String event: events ) {
|
for( String event: events ) {
|
||||||
acceptor.accept( createCompletionProposal( event, context ) );
|
acceptor
|
||||||
|
.accept( createCompletionProposal( event, context ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final int nodeOffset = NodeModelUtils.getNode( model )
|
final int nodeOffset = NodeModelUtils.getNode( model )
|
||||||
.getTotalOffset( );
|
.getTotalOffset( );
|
||||||
List< String > variables = new ArrayList< String >( );
|
List< String > variables = new ArrayList< String >( );
|
||||||
|
|
||||||
// add CAC variables
|
// add CAC variables
|
||||||
variables.addAll( TemplateProvider.getInstance( ).getCAC(
|
variables.addAll( TemplateProvider.getInstance( ).getCAC(
|
||||||
"variables" ) );
|
"variables" ) );
|
||||||
|
|
||||||
// filter variables by index
|
// filter variables by index
|
||||||
Collection< String > projectVariables = Collections2.transform(
|
Collection< String > projectVariables = Collections2.transform(
|
||||||
projectCache_.getVariables( ).values( ),
|
projectCache_.getVariables( ).values( ),
|
||||||
new Function< WMLVariable, String >( ) {
|
new Function< WMLVariable, String >( ) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apply( WMLVariable from )
|
public String apply( WMLVariable from )
|
||||||
{
|
{
|
||||||
for( Scope scope: from.getScopes( ) ) {
|
for( Scope scope: from.getScopes( ) ) {
|
||||||
if( scope.contains( dependencyIndex_,
|
if( scope.contains( dependencyIndex_,
|
||||||
nodeOffset ) ) {
|
nodeOffset ) ) {
|
||||||
return from.getName( );
|
return from.getName( );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
} );
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
variables.addAll( Collections2.filter( projectVariables,
|
variables.addAll( Collections2.filter( projectVariables,
|
||||||
Predicates.notNull( ) ) );
|
Predicates.notNull( ) ) );
|
||||||
|
|
||||||
for( String variable: variables ) {
|
for( String variable: variables ) {
|
||||||
acceptor.accept( createCompletionProposal( "$" + variable,
|
acceptor.accept( createCompletionProposal( "$" + variable,
|
||||||
context ) );
|
context ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addKeyNameProposals( EObject model,
|
private void addKeyNameProposals( EObject model,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
WMLTag tag = null;
|
WMLTag tag = null;
|
||||||
if( model instanceof WMLTag ) {
|
if( model instanceof WMLTag ) {
|
||||||
|
@ -303,9 +304,9 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
|
|
||||||
if( toAdd ) {
|
if( toAdd ) {
|
||||||
acceptor.accept( createCompletionProposal(
|
acceptor.accept( createCompletionProposal(
|
||||||
key.getName( ) + "=", //$NON-NLS-1$
|
key.getName( ) + "=", //$NON-NLS-1$
|
||||||
key.getName( ), WML_KEY_IMAGE, context,
|
key.getName( ), WML_KEY_IMAGE, context,
|
||||||
KEY_NAME_PRIORITY ) );
|
KEY_NAME_PRIORITY ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +314,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTagProposals( EObject model, boolean ruleProposal,
|
private void addTagProposals( EObject model, boolean ruleProposal,
|
||||||
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
ContentAssistContext context, ICompletionProposalAcceptor acceptor )
|
||||||
{
|
{
|
||||||
WMLTag parentTag = null;
|
WMLTag parentTag = null;
|
||||||
if( model instanceof WMLTag ) {
|
if( model instanceof WMLTag ) {
|
||||||
|
@ -329,16 +330,16 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
String parentIndent = ""; //$NON-NLS-1$
|
String parentIndent = ""; //$NON-NLS-1$
|
||||||
if( context.getCurrentNode( ).getOffset( ) > 0 ) {
|
if( context.getCurrentNode( ).getOffset( ) > 0 ) {
|
||||||
parentIndent = NodeModelUtils.findLeafNodeAtOffset( node,
|
parentIndent = NodeModelUtils.findLeafNodeAtOffset( node,
|
||||||
context.getCurrentNode( ).getOffset( ) -
|
context.getCurrentNode( ).getOffset( ) -
|
||||||
// if we have a non-rule proposal, subtract 1
|
// if we have a non-rule proposal, subtract 1
|
||||||
( ruleProposal ? 0: 1 ) ).getText( );
|
( ruleProposal ? 0: 1 ) ).getText( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove ugly new lines that break indentation
|
// 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$
|
parentIndent = parentIndent.replace( "\r", "" ).replace( "\n", "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
|
||||||
WMLTag tagChildren = schemaParser_.getTags( ).get(
|
WMLTag tagChildren = schemaParser_.getTags( ).get(
|
||||||
parentTag.getName( ) );
|
parentTag.getName( ) );
|
||||||
if( tagChildren != null ) {
|
if( tagChildren != null ) {
|
||||||
boolean toAdd = true;
|
boolean toAdd = true;
|
||||||
for( WMLTag tag: tagChildren.getWMLTags( ) ) {
|
for( WMLTag tag: tagChildren.getWMLTags( ) ) {
|
||||||
|
@ -352,12 +353,12 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
// check only non-repeatable tags
|
// check only non-repeatable tags
|
||||||
if( ! tag.is_Repeatable( ) ) {
|
if( ! tag.is_Repeatable( ) ) {
|
||||||
toAdd = ( WMLUtils.getTagByName( parentTag,
|
toAdd = ( WMLUtils.getTagByName( parentTag,
|
||||||
tag.getName( ) ) == null );
|
tag.getName( ) ) == null );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( toAdd ) {
|
if( toAdd ) {
|
||||||
acceptor.accept( createTagProposal( tag.asWMLTag( ),
|
acceptor.accept( createTagProposal( tag.asWMLTag( ),
|
||||||
parentIndent, ruleProposal, context ) );
|
parentIndent, ruleProposal, context ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,13 +368,14 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
WMLTag rootTag = schemaParser_.getTags( ).get( "root" ); //$NON-NLS-1$
|
WMLTag rootTag = schemaParser_.getTags( ).get( "root" ); //$NON-NLS-1$
|
||||||
for( WMLTag tag: rootTag.getWMLTags( ) ) {
|
for( WMLTag tag: rootTag.getWMLTags( ) ) {
|
||||||
acceptor.accept( createTagProposal( tag,
|
acceptor.accept( createTagProposal( tag,
|
||||||
"", ruleProposal, context ) ); //$NON-NLS-1$
|
"", ruleProposal, context ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parsed custom tags
|
// parsed custom tags
|
||||||
for( WMLTag tag: projectCache_.getWMLTags( ).values( ) ) {
|
for( WMLTag tag: projectCache_.getWMLTags( ).values( ) ) {
|
||||||
acceptor.accept( createTagProposal( tag, "", ruleProposal, context ) ); //$NON-NLS-1$
|
acceptor
|
||||||
|
.accept( createTagProposal( tag, "", ruleProposal, context ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +392,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private ICompletionProposal createTagProposal( WMLTag tag, String indent,
|
private ICompletionProposal createTagProposal( WMLTag tag, String indent,
|
||||||
boolean ruleProposal, ContentAssistContext context )
|
boolean ruleProposal, ContentAssistContext context )
|
||||||
{
|
{
|
||||||
StringBuilder proposal = new StringBuilder( );
|
StringBuilder proposal = new StringBuilder( );
|
||||||
if( ruleProposal ) {
|
if( ruleProposal ) {
|
||||||
|
@ -401,27 +403,27 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
||||||
for( WMLKey key: tag.getWMLKeys( ) ) {
|
for( WMLKey key: tag.getWMLKeys( ) ) {
|
||||||
if( key.is_Required( ) ) {
|
if( key.is_Required( ) ) {
|
||||||
proposal.append( String.format( "\t%s%s=\n", //$NON-NLS-1$
|
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$
|
proposal.append( String.format( "%s[/%s", indent, tag.getName( ) ) ); //$NON-NLS-1$
|
||||||
return createCompletionProposal( proposal.toString( ), tag.getName( ),
|
return createCompletionProposal( proposal.toString( ), tag.getName( ),
|
||||||
WML_TAG_IMAGE, context, TAG_PRIORITY );
|
WML_TAG_IMAGE, context, TAG_PRIORITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICompletionProposal createCompletionProposal( String proposal,
|
private ICompletionProposal createCompletionProposal( String proposal,
|
||||||
ContentAssistContext context, int priority )
|
ContentAssistContext context, int priority )
|
||||||
{
|
{
|
||||||
return createCompletionProposal( proposal, null, null, priority,
|
return createCompletionProposal( proposal, null, null, priority,
|
||||||
context.getPrefix( ), context );
|
context.getPrefix( ), context );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICompletionProposal createCompletionProposal( String proposal,
|
public ICompletionProposal createCompletionProposal( String proposal,
|
||||||
String displayString, Image image,
|
String displayString, Image image,
|
||||||
ContentAssistContext contentAssistContext, int priority )
|
ContentAssistContext contentAssistContext, int priority )
|
||||||
{
|
{
|
||||||
return createCompletionProposal( proposal, new StyledString(
|
return createCompletionProposal( proposal, new StyledString(
|
||||||
displayString ), image, priority,
|
displayString ), image, priority,
|
||||||
contentAssistContext.getPrefix( ), contentAssistContext );
|
contentAssistContext.getPrefix( ), contentAssistContext );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ package org.wesnoth.ui.editor;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
|
||||||
public class DefaultExtXtextEditorCustomizer implements
|
public class DefaultExtXtextEditorCustomizer implements
|
||||||
IExtXtextEditorCustomizer
|
IExtXtextEditorCustomizer
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void customizeEditorContextMenu( IMenuManager menuManager )
|
public void customizeEditorContextMenu( IMenuManager menuManager )
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class LinkedFileEditorInput extends FileEditorInput
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return getFile( ).getLocationURI( ).toString( )
|
return getFile( ).getLocationURI( ).toString( )
|
||||||
.toLowerCase( Locale.ENGLISH )
|
.toLowerCase( Locale.ENGLISH )
|
||||||
.equals( targetUri.toLowerCase( Locale.ENGLISH ) );
|
.equals( targetUri.toLowerCase( Locale.ENGLISH ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.xtext.ui.editor.XtextEditor;
|
||||||
* a xtext nature on non-xtext project. We don't want that (yet)
|
* a xtext nature on non-xtext project. We don't want that (yet)
|
||||||
*/
|
*/
|
||||||
public class WMLAbstractDirtyEditorCallback extends
|
public class WMLAbstractDirtyEditorCallback extends
|
||||||
AbstractDirtyStateAwareEditorCallback
|
AbstractDirtyStateAwareEditorCallback
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void afterCreatePartControl( XtextEditor editor )
|
public void afterCreatePartControl( XtextEditor editor )
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class WMLEditor extends XtextEditor
|
||||||
super( );
|
super( );
|
||||||
if( DEBUG ) {
|
if( DEBUG ) {
|
||||||
org.apache.log4j.Logger.getLogger( XtextEditor.class ).setLevel(
|
org.apache.log4j.Logger.getLogger( XtextEditor.class ).setLevel(
|
||||||
Level.DEBUG );
|
Level.DEBUG );
|
||||||
}
|
}
|
||||||
// activate the wesnoth plugin
|
// activate the wesnoth plugin
|
||||||
WesnothPlugin.getDefault( );
|
WesnothPlugin.getDefault( );
|
||||||
|
@ -99,12 +99,12 @@ public class WMLEditor extends XtextEditor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if( getEditorInput( ) == null
|
if( getEditorInput( ) == null
|
||||||
|| ( ( XtextEditor ) obj ).getEditorInput( ) == null ) {
|
|| ( ( XtextEditor ) obj ).getEditorInput( ) == null ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
java.net.URI u1 = ( ( IURIEditorInput ) getEditorInput( ) ).getURI( );
|
java.net.URI u1 = ( ( IURIEditorInput ) getEditorInput( ) ).getURI( );
|
||||||
java.net.URI u2 = ( ( IURIEditorInput ) ( ( XtextEditor ) obj )
|
java.net.URI u2 = ( ( IURIEditorInput ) ( ( XtextEditor ) obj )
|
||||||
.getEditorInput( ) ).getURI( );
|
.getEditorInput( ) ).getURI( );
|
||||||
if( u1 == null || u2 == null ) {
|
if( u1 == null || u2 == null ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public class WMLEditor extends XtextEditor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void createLink( IProject project, IFile linkFile, java.net.URI uri )
|
private void createLink( IProject project, IFile linkFile, java.net.URI uri )
|
||||||
throws CoreException
|
throws CoreException
|
||||||
{
|
{
|
||||||
IPath path = linkFile.getFullPath( );
|
IPath path = linkFile.getFullPath( );
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class WMLEditor extends XtextEditor
|
||||||
int segmentCount = folders.segmentCount( );
|
int segmentCount = folders.segmentCount( );
|
||||||
for( int i = 0; i < segmentCount; i++ ) {
|
for( int i = 0; i < segmentCount; i++ ) {
|
||||||
checkPath = checkPath.addTrailingSeparator( ).append(
|
checkPath = checkPath.addTrailingSeparator( ).append(
|
||||||
folders.segment( i ) );
|
folders.segment( i ) );
|
||||||
IFolder folder = project.getFolder( checkPath );
|
IFolder folder = project.getFolder( checkPath );
|
||||||
if( ! folder.exists( ) ) {
|
if( ! folder.exists( ) ) {
|
||||||
folder.create( true, true, null );
|
folder.create( true, true, null );
|
||||||
|
@ -183,7 +183,7 @@ public class WMLEditor extends XtextEditor
|
||||||
// down, it is NOT a good
|
// down, it is NOT a good
|
||||||
// idea to delete the link
|
// idea to delete the link
|
||||||
if( PlatformUI.isWorkbenchRunning( )
|
if( PlatformUI.isWorkbenchRunning( )
|
||||||
&& ! PlatformUI.getWorkbench( ).isClosing( ) ) {
|
&& ! PlatformUI.getWorkbench( ).isClosing( ) ) {
|
||||||
file.delete( true, null );
|
file.delete( true, null );
|
||||||
}
|
}
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
|
@ -212,9 +212,9 @@ public class WMLEditor extends XtextEditor
|
||||||
private IFile getWorkspaceFile( IFileStore fileStore )
|
private IFile getWorkspaceFile( IFileStore fileStore )
|
||||||
{
|
{
|
||||||
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace( )
|
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace( )
|
||||||
.getRoot( );
|
.getRoot( );
|
||||||
IFile[] files = workspaceRoot.findFilesForLocationURI( fileStore
|
IFile[] files = workspaceRoot.findFilesForLocationURI( fileStore
|
||||||
.toURI( ) );
|
.toURI( ) );
|
||||||
if( files != null && files.length == 1 ) {
|
if( files != null && files.length == 1 ) {
|
||||||
return files[0];
|
return files[0];
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ public class WMLEditor extends XtextEditor
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init( IEditorSite site, IEditorInput input )
|
public void init( IEditorSite site, IEditorInput input )
|
||||||
throws PartInitException
|
throws PartInitException
|
||||||
{
|
{
|
||||||
// THE ISSUE HERE:
|
// THE ISSUE HERE:
|
||||||
// In the IDE, the File Open Dialog (and elsewhere) uses a
|
// In the IDE, the File Open Dialog (and elsewhere) uses a
|
||||||
|
@ -247,14 +247,14 @@ public class WMLEditor extends XtextEditor
|
||||||
//
|
//
|
||||||
// Remedy:
|
// Remedy:
|
||||||
if( input instanceof IURIEditorInput
|
if( input instanceof IURIEditorInput
|
||||||
&& ! ( input instanceof IFileEditorInput ) ) {
|
&& ! ( input instanceof IFileEditorInput ) ) {
|
||||||
java.net.URI uri = ( ( IURIEditorInput ) input ).getURI( );
|
java.net.URI uri = ( ( IURIEditorInput ) input ).getURI( );
|
||||||
String name = ( ( IURIEditorInput ) input ).getName( );
|
String name = ( ( IURIEditorInput ) input ).getName( );
|
||||||
// Check if this is linkable input
|
// Check if this is linkable input
|
||||||
if( uri.getScheme( ).equals( "file" ) ) { //$NON-NLS-1$
|
if( uri.getScheme( ).equals( "file" ) ) { //$NON-NLS-1$
|
||||||
IFile linkedFile = obtainLink( uri );
|
IFile linkedFile = obtainLink( uri );
|
||||||
IFileEditorInput linkedInput = new LinkedFileEditorInput(
|
IFileEditorInput linkedInput = new LinkedFileEditorInput(
|
||||||
linkedFile );
|
linkedFile );
|
||||||
super.init( site, linkedInput );
|
super.init( site, linkedInput );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ public class WMLEditor extends XtextEditor
|
||||||
// or stored in tmp, and processed as the other linked
|
// or stored in tmp, and processed as the other linked
|
||||||
// resources..
|
// resources..
|
||||||
URIEditorInput uriInput = new URIEditorInput(
|
URIEditorInput uriInput = new URIEditorInput(
|
||||||
URI.createURI( uri.toString( ) ), name );
|
URI.createURI( uri.toString( ) ), name );
|
||||||
super.init( site, uriInput );
|
super.init( site, uriInput );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ public class WMLEditor extends XtextEditor
|
||||||
|
|
||||||
if( newProject ) {
|
if( newProject ) {
|
||||||
project.setDefaultCharset( ENCODING_UTF8,
|
project.setDefaultCharset( ENCODING_UTF8,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// path in project that is the same as the external file's path
|
// 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
|
// external link project
|
||||||
//
|
//
|
||||||
if( input instanceof IFileEditorInput
|
if( input instanceof IFileEditorInput
|
||||||
&& ( ( IFileEditorInput ) input ).getFile( ).isLinked( )
|
&& ( ( IFileEditorInput ) input ).getFile( ).isLinked( )
|
||||||
&& ( ( IFileEditorInput ) input ).getFile( ).getProject( )
|
&& ( ( IFileEditorInput ) input ).getFile( ).getProject( )
|
||||||
.getName( ).equals( AUTOLINK_PROJECT_NAME ) ) {
|
.getName( ).equals( AUTOLINK_PROJECT_NAME ) ) {
|
||||||
final IEditorInput newInput;
|
final IEditorInput newInput;
|
||||||
IDocumentProvider provider = getDocumentProvider( );
|
IDocumentProvider provider = getDocumentProvider( );
|
||||||
|
|
||||||
FileDialog dialog = new FileDialog( shell, SWT.SAVE );
|
FileDialog dialog = new FileDialog( shell, SWT.SAVE );
|
||||||
IPath oldPath = URIUtil.toPath( ( ( IURIEditorInput ) input )
|
IPath oldPath = URIUtil.toPath( ( ( IURIEditorInput ) input )
|
||||||
.getURI( ) );
|
.getURI( ) );
|
||||||
if( oldPath != null ) {
|
if( oldPath != null ) {
|
||||||
dialog.setFileName( oldPath.lastSegment( ) );
|
dialog.setFileName( oldPath.lastSegment( ) );
|
||||||
dialog.setFilterPath( oldPath.toOSString( ) );
|
dialog.setFilterPath( oldPath.toOSString( ) );
|
||||||
|
@ -364,11 +364,11 @@ public class WMLEditor extends XtextEditor
|
||||||
final File localFile = new File( path );
|
final File localFile = new File( path );
|
||||||
if( localFile.exists( ) ) {
|
if( localFile.exists( ) ) {
|
||||||
MessageDialog overwriteDialog = new MessageDialog( shell,
|
MessageDialog overwriteDialog = new MessageDialog( shell,
|
||||||
Messages.WMLEditor_0, null,
|
Messages.WMLEditor_0, null,
|
||||||
path + Messages.WMLEditor_1, MessageDialog.WARNING,
|
path + Messages.WMLEditor_1, MessageDialog.WARNING,
|
||||||
new String[] { IDialogConstants.YES_LABEL,
|
new String[] { IDialogConstants.YES_LABEL,
|
||||||
IDialogConstants.NO_LABEL }, 1 ); // 'No' is the
|
IDialogConstants.NO_LABEL }, 1 ); // 'No' is the
|
||||||
// default
|
// default
|
||||||
if( overwriteDialog.open( ) != Window.OK ) {
|
if( overwriteDialog.open( ) != Window.OK ) {
|
||||||
if( progressMonitor != null ) {
|
if( progressMonitor != null ) {
|
||||||
progressMonitor.setCanceled( true );
|
progressMonitor.setCanceled( true );
|
||||||
|
@ -411,7 +411,7 @@ public class WMLEditor extends XtextEditor
|
||||||
|
|
||||||
provider.aboutToChange( newInput );
|
provider.aboutToChange( newInput );
|
||||||
provider.saveDocument( progressMonitor, newInput,
|
provider.saveDocument( progressMonitor, newInput,
|
||||||
provider.getDocument( input ), true );
|
provider.getDocument( input ), true );
|
||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
} catch( CoreException x ) {
|
} catch( CoreException x ) {
|
||||||
|
|
|
@ -44,16 +44,16 @@ public class WMLFoldingRegionProvider extends DefaultFoldingRegionProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void computeObjectFolding( EObject eObject,
|
protected void computeObjectFolding( EObject eObject,
|
||||||
IFoldingRegionAcceptor< ITextRegion > foldingRegionAcceptor )
|
IFoldingRegionAcceptor< ITextRegion > foldingRegionAcceptor )
|
||||||
{
|
{
|
||||||
// copied from "DefaultFoldingRegionProvider
|
// copied from "DefaultFoldingRegionProvider
|
||||||
ITextRegion region = locationInFileProvider.getFullTextRegion( eObject );
|
ITextRegion region = locationInFileProvider.getFullTextRegion( eObject );
|
||||||
if( region != null ) {
|
if( region != null ) {
|
||||||
ITextRegion significant = locationInFileProvider
|
ITextRegion significant = locationInFileProvider
|
||||||
.getSignificantTextRegion( eObject );
|
.getSignificantTextRegion( eObject );
|
||||||
if( significant == null ) {
|
if( significant == null ) {
|
||||||
throw new NullPointerException(
|
throw new NullPointerException(
|
||||||
"significant region may not be null" );
|
"significant region may not be null" );
|
||||||
}
|
}
|
||||||
int offset = region.getOffset( );
|
int offset = region.getOffset( );
|
||||||
int length = region.getLength( );
|
int length = region.getLength( );
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class WMLEObjectHoverProvider extends DefaultEObjectHoverProvider
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public IInformationControlCreatorProvider getHoverInfo( EObject object,
|
public IInformationControlCreatorProvider getHoverInfo( EObject object,
|
||||||
ITextViewer viewer, IRegion region )
|
ITextViewer viewer, IRegion region )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
|
||||||
* http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
|
* http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
|
||||||
*/
|
*/
|
||||||
public class WMLDescriptionLabelProvider extends
|
public class WMLDescriptionLabelProvider extends
|
||||||
DefaultDescriptionLabelProvider
|
DefaultDescriptionLabelProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class WMLLabelProvider extends DefaultEObjectLabelProvider
|
||||||
{
|
{
|
||||||
if( element instanceof EClass ) {
|
if( element instanceof EClass ) {
|
||||||
return ( ( EClass ) element ).getName( ).toLowerCase(
|
return ( ( EClass ) element ).getName( ).toLowerCase(
|
||||||
Locale.ENGLISH )
|
Locale.ENGLISH )
|
||||||
+ ".png"; //$NON-NLS-1$
|
+ ".png"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else if( element instanceof String ) {
|
else if( element instanceof String ) {
|
||||||
return element;
|
return element;
|
||||||
|
|
|
@ -41,58 +41,58 @@ public class WMLDocHandler extends AbstractHandler
|
||||||
final XtextEditor editor = EditorUtils.getActiveXtextEditor( event );
|
final XtextEditor editor = EditorUtils.getActiveXtextEditor( event );
|
||||||
final IFile editedFile = WMLEditor.getEditorFile( editor );
|
final IFile editedFile = WMLEditor.getEditorFile( editor );
|
||||||
final String installName = WesnothInstallsUtils
|
final String installName = WesnothInstallsUtils
|
||||||
.getInstallNameForResource( editedFile );
|
.getInstallNameForResource( editedFile );
|
||||||
|
|
||||||
editor.getDocument( ).readOnly(
|
editor.getDocument( ).readOnly(
|
||||||
new IUnitOfWork.Void< XtextResource >( ) {
|
new IUnitOfWork.Void< XtextResource >( ) {
|
||||||
@Override
|
@Override
|
||||||
public void process( XtextResource resource )
|
public void process( XtextResource resource )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
ITextSelection selection = ( ITextSelection ) editor
|
ITextSelection selection = ( ITextSelection ) editor
|
||||||
.getSelectionProvider( ).getSelection( );
|
.getSelectionProvider( ).getSelection( );
|
||||||
Point positionRelative = editor
|
Point positionRelative = editor
|
||||||
.getInternalSourceViewer( )
|
.getInternalSourceViewer( )
|
||||||
.getTextWidget( )
|
.getTextWidget( )
|
||||||
.getLocationAtOffset( selection.getOffset( ) );
|
.getLocationAtOffset( selection.getOffset( ) );
|
||||||
Point positionAbsolute = editor
|
Point positionAbsolute = editor
|
||||||
.getInternalSourceViewer( ).getTextWidget( )
|
.getInternalSourceViewer( ).getTextWidget( )
|
||||||
.toDisplay( positionRelative );
|
.toDisplay( positionRelative );
|
||||||
positionAbsolute.y += 20;
|
positionAbsolute.y += 20;
|
||||||
|
|
||||||
EObject grammarElement = WMLUtils.resolveElementAt(
|
EObject grammarElement = WMLUtils.resolveElementAt(
|
||||||
resource, selection.getOffset( ) );
|
resource, selection.getOffset( ) );
|
||||||
if( grammarElement == null ) {
|
if( grammarElement == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( grammarElement instanceof WMLMacroCall ) {
|
if( grammarElement instanceof WMLMacroCall ) {
|
||||||
WMLMacroCall macro = ( WMLMacroCall ) grammarElement;
|
WMLMacroCall macro = ( WMLMacroCall ) grammarElement;
|
||||||
Define define = ProjectUtils
|
Define define = ProjectUtils
|
||||||
.getCacheForProject(
|
.getCacheForProject(
|
||||||
editedFile.getProject( ) )
|
editedFile.getProject( ) )
|
||||||
.getDefines( ).get( macro.getName( ) );
|
.getDefines( ).get( macro.getName( ) );
|
||||||
if( define != null ) {
|
if( define != null ) {
|
||||||
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
|
|
||||||
editor.getSite( ).getShell( ),
|
|
||||||
new WMLDocMacro( define ),
|
|
||||||
positionAbsolute );
|
|
||||||
presenter.create( );
|
|
||||||
presenter.open( );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( grammarElement instanceof WMLTag ) {
|
|
||||||
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
|
WMLDocInformationPresenter presenter = new WMLDocInformationPresenter(
|
||||||
editor.getSite( ).getShell( ),
|
editor.getSite( ).getShell( ),
|
||||||
new WMLDocTag( editedFile, installName,
|
new WMLDocMacro( define ),
|
||||||
( ( WMLTag ) grammarElement )
|
positionAbsolute );
|
||||||
.getName( ) ),
|
|
||||||
positionAbsolute );
|
|
||||||
presenter.create( );
|
presenter.create( );
|
||||||
presenter.open( );
|
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 ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class WMLDocInformationPresenter extends PopupDialog
|
||||||
* Creates a new WMLDocumentation information presenter
|
* Creates a new WMLDocumentation information presenter
|
||||||
*/
|
*/
|
||||||
public WMLDocInformationPresenter( Shell parent,
|
public WMLDocInformationPresenter( Shell parent,
|
||||||
IWMLDocProvider docProvider, Point bounds )
|
IWMLDocProvider docProvider, Point bounds )
|
||||||
{
|
{
|
||||||
super( parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true,
|
super( parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true,
|
||||||
true, false, false, docProvider.getTitle( ), docProvider
|
true, false, false, docProvider.getTitle( ), docProvider
|
||||||
.getInfoText( ) );
|
.getInfoText( ) );
|
||||||
|
|
||||||
bounds_ = bounds;
|
bounds_ = bounds;
|
||||||
currentDocProvider_ = docProvider;
|
currentDocProvider_ = docProvider;
|
||||||
|
@ -43,9 +43,9 @@ public class WMLDocInformationPresenter extends PopupDialog
|
||||||
{
|
{
|
||||||
panel_ = new Composite( parent, SWT.None );
|
panel_ = new Composite( parent, SWT.None );
|
||||||
panel_.setBackground( parent.getDisplay( ).getSystemColor(
|
panel_.setBackground( parent.getDisplay( ).getSystemColor(
|
||||||
SWT.COLOR_INFO_BACKGROUND ) );
|
SWT.COLOR_INFO_BACKGROUND ) );
|
||||||
panel_.setForeground( parent.getDisplay( ).getSystemColor(
|
panel_.setForeground( parent.getDisplay( ).getSystemColor(
|
||||||
SWT.COLOR_INFO_FOREGROUND ) );
|
SWT.COLOR_INFO_FOREGROUND ) );
|
||||||
|
|
||||||
GridLayout grid = new GridLayout( );
|
GridLayout grid = new GridLayout( );
|
||||||
grid.numColumns = 5;
|
grid.numColumns = 5;
|
||||||
|
|
|
@ -82,9 +82,9 @@ public class WMLDocMacro implements IWMLDocProvider
|
||||||
private void addStyleRange( int offset, int length, int style )
|
private void addStyleRange( int offset, int length, int style )
|
||||||
{
|
{
|
||||||
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
|
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
|
||||||
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
|
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
|
||||||
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
|
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
|
||||||
style ) );
|
style ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,6 +125,6 @@ public class WMLDocMacro implements IWMLDocProvider
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return "Defined in: " + macro_.getLocation( ) + " : "
|
return "Defined in: " + macro_.getLocation( ) + " : "
|
||||||
+ macro_.getLineNum( );
|
+ macro_.getLineNum( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class WMLDocTag implements IWMLDocProvider
|
||||||
// try to get it from the Project Cache ( lua parsed ones )
|
// try to get it from the Project Cache ( lua parsed ones )
|
||||||
if( tag_ == null ) {
|
if( tag_ == null ) {
|
||||||
tag_ = ProjectUtils.getCacheForProject( currentFile.getProject( ) )
|
tag_ = ProjectUtils.getCacheForProject( currentFile.getProject( ) )
|
||||||
.getWMLTags( ).get( name );
|
.getWMLTags( ).get( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a default one
|
// Create a default one
|
||||||
|
@ -88,9 +88,9 @@ public class WMLDocTag implements IWMLDocProvider
|
||||||
private void addStyleRange( int offset, int length, int style )
|
private void addStyleRange( int offset, int length, int style )
|
||||||
{
|
{
|
||||||
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
|
styleRanges_.add( new StyleRange( offset, length, Display.getDefault( )
|
||||||
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
|
.getSystemColor( SWT.COLOR_INFO_FOREGROUND ), Display
|
||||||
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
|
.getDefault( ).getSystemColor( SWT.COLOR_INFO_BACKGROUND ),
|
||||||
style ) );
|
style ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FileLocationOpenerHyperlink extends XtextHyperlink
|
||||||
|
|
||||||
ITextEditor editor = EditorUtils.getTextEditor( part );
|
ITextEditor editor = EditorUtils.getTextEditor( part );
|
||||||
IDocument doc = editor.getDocumentProvider( ).getDocument(
|
IDocument doc = editor.getDocumentProvider( ).getDocument(
|
||||||
editor.getEditorInput( ) );
|
editor.getEditorInput( ) );
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
try {
|
try {
|
||||||
// compute offset based on linenum_
|
// compute offset based on linenum_
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class MapOpenerHyperlink extends XtextHyperlink
|
||||||
{
|
{
|
||||||
if( ! new File( location_ ).exists( ) ) {
|
if( ! new File( location_ ).exists( ) ) {
|
||||||
if( GUIUtils
|
if( GUIUtils
|
||||||
.showMessageBox(
|
.showMessageBox(
|
||||||
"The map doesn't exist. Do you want to create a default one and open that?",
|
"The map doesn't exist. Do you want to create a default one and open that?",
|
||||||
SWT.YES | SWT.NO ) == SWT.NO ) {
|
SWT.YES | SWT.NO ) == SWT.NO ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class MapOpenerHyperlink extends XtextHyperlink
|
||||||
try {
|
try {
|
||||||
writer = new FileWriter( location_ );
|
writer = new FileWriter( location_ );
|
||||||
writer.write( TemplateProvider.getInstance( ).getTemplate(
|
writer.write( TemplateProvider.getInstance( ).getTemplate(
|
||||||
"map" ) );
|
"map" ) );
|
||||||
writer.close( );
|
writer.close( );
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void createHyperlinksByOffset( XtextResource resource, int offset,
|
public void createHyperlinksByOffset( XtextResource resource, int offset,
|
||||||
IHyperlinkAcceptor acceptor )
|
IHyperlinkAcceptor acceptor )
|
||||||
{
|
{
|
||||||
super.createHyperlinksByOffset( resource, offset, acceptor );
|
super.createHyperlinksByOffset( resource, offset, acceptor );
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
IFile file = WMLEditor.getActiveEditorFile( );
|
IFile file = WMLEditor.getActiveEditorFile( );
|
||||||
if( file == null ) {
|
if( file == null ) {
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"FATAL! file is null (and it shouldn't) " );
|
"FATAL! file is null (and it shouldn't) " );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Paths paths = Preferences.getPaths( WesnothInstallsUtils
|
Paths paths = Preferences.getPaths( WesnothInstallsUtils
|
||||||
.getInstallNameForResource( file ) );
|
.getInstallNameForResource( file ) );
|
||||||
|
|
||||||
ICompositeNode node = NodeModelUtils.getNode( object );
|
ICompositeNode node = NodeModelUtils.getNode( object );
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
* The node model representation of the macro
|
* The node model representation of the macro
|
||||||
*/
|
*/
|
||||||
private void createMacroHyperlink( Paths paths, IFile file, EObject object,
|
private void createMacroHyperlink( Paths paths, IFile file, EObject object,
|
||||||
IHyperlinkAcceptor acceptor, ICompositeNode node )
|
IHyperlinkAcceptor acceptor, ICompositeNode node )
|
||||||
{
|
{
|
||||||
if( object instanceof WMLMacroCall == false ) {
|
if( object instanceof WMLMacroCall == false ) {
|
||||||
return;
|
return;
|
||||||
|
@ -83,7 +83,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
|
|
||||||
// get the define for the macro
|
// get the define for the macro
|
||||||
Define define = ProjectUtils.getCacheForProject( file.getProject( ) )
|
Define define = ProjectUtils.getCacheForProject( file.getProject( ) )
|
||||||
.getDefines( ).get( macro.getName( ) );
|
.getDefines( ).get( macro.getName( ) );
|
||||||
if( define == null || define.getLocation( ).length( ) <= 2 ) {
|
if( define == null || define.getLocation( ).length( ) <= 2 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
|
|
||||||
FileLocationOpenerHyperlink macroTarget = new FileLocationOpenerHyperlink( );
|
FileLocationOpenerHyperlink macroTarget = new FileLocationOpenerHyperlink( );
|
||||||
macroTarget.setHyperlinkRegion( new Region( node.getOffset( ), node
|
macroTarget.setHyperlinkRegion( new Region( node.getOffset( ), node
|
||||||
.getLength( ) ) );
|
.getLength( ) ) );
|
||||||
macroTarget.setFilePath( filePath );
|
macroTarget.setFilePath( filePath );
|
||||||
macroTarget.setLinenumber( define.getLineNum( ) );
|
macroTarget.setLinenumber( define.getLineNum( ) );
|
||||||
acceptor.accept( macroTarget );
|
acceptor.accept( macroTarget );
|
||||||
|
@ -120,12 +120,12 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
* The node model representation of the macro
|
* The node model representation of the macro
|
||||||
*/
|
*/
|
||||||
private void createMapHyperlink( Paths paths, EObject object,
|
private void createMapHyperlink( Paths paths, EObject object,
|
||||||
IHyperlinkAcceptor acceptor, ICompositeNode node )
|
IHyperlinkAcceptor acceptor, ICompositeNode node )
|
||||||
{
|
{
|
||||||
EObject container = object.eContainer( );
|
EObject container = object.eContainer( );
|
||||||
|
|
||||||
if( ! ( container instanceof WMLKey )
|
if( ! ( container instanceof WMLKey )
|
||||||
|| ! ( ( WMLKey ) container ).getName( ).equals( "map_data" ) ) {
|
|| ! ( ( WMLKey ) container ).getName( ).equals( "map_data" ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,17 +161,17 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
||||||
if( mapLocation.charAt( 0 ) == '~' ) {
|
if( mapLocation.charAt( 0 ) == '~' ) {
|
||||||
// expand the '~' character to user data dir
|
// expand the '~' character to user data dir
|
||||||
mapLocation = mapLocation
|
mapLocation = mapLocation
|
||||||
.replaceFirst( "~", paths.getUserDataDir( ) );
|
.replaceFirst( "~", paths.getUserDataDir( ) );
|
||||||
}
|
}
|
||||||
else if( mapLocation.startsWith( "campaigns/" ) ) {
|
else if( mapLocation.startsWith( "campaigns/" ) ) {
|
||||||
// expand the campaigns path
|
// expand the campaigns path
|
||||||
mapLocation = mapLocation.replaceFirst( "campaigns/",
|
mapLocation = mapLocation.replaceFirst( "campaigns/",
|
||||||
paths.getCampaignDir( ) );
|
paths.getCampaignDir( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MapOpenerHyperlink hyperlink = new MapOpenerHyperlink( );
|
MapOpenerHyperlink hyperlink = new MapOpenerHyperlink( );
|
||||||
hyperlink.setHyperlinkRegion( new Region( node.getOffset( ), node
|
hyperlink.setHyperlinkRegion( new Region( node.getOffset( ), node
|
||||||
.getLength( ) ) );
|
.getLength( ) ) );
|
||||||
hyperlink.setLocation( mapLocation );
|
hyperlink.setLocation( mapLocation );
|
||||||
acceptor.accept( hyperlink );
|
acceptor.accept( hyperlink );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,18 @@ package org.wesnoth.ui.syntax;
|
||||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;
|
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;
|
||||||
|
|
||||||
public class WMLAntlrTokenToAttributeIdMapper extends
|
public class WMLAntlrTokenToAttributeIdMapper extends
|
||||||
DefaultAntlrTokenToAttributeIdMapper
|
DefaultAntlrTokenToAttributeIdMapper
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected String calculateId( String tokenName, int tokenType )
|
protected String calculateId( String tokenName, int tokenType )
|
||||||
{
|
{
|
||||||
if( tokenName.equals( "'+'" ) || tokenName.equals( "'['" )
|
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;
|
return WMLHighlightingConfiguration.RULE_WML_TAG;
|
||||||
}
|
}
|
||||||
if( tokenName.equals( "'~'" ) || tokenName.equals( "'{'" )
|
if( tokenName.equals( "'~'" ) || tokenName.equals( "'{'" )
|
||||||
|| tokenName.equals( "'}'" ) ) //$NON-NLS-1$
|
|| tokenName.equals( "'}'" ) ) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return WMLHighlightingConfiguration.RULE_WML_MACRO_CALL;
|
return WMLHighlightingConfiguration.RULE_WML_MACRO_CALL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,32 +43,32 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
|
||||||
IRegion region = super.match( doc, offset );
|
IRegion region = super.match( doc, offset );
|
||||||
|
|
||||||
if( region == null && doc instanceof XtextDocument
|
if( region == null && doc instanceof XtextDocument
|
||||||
&& doc.getLength( ) > 0 ) {
|
&& doc.getLength( ) > 0 ) {
|
||||||
if( matchCnt == 2 ) {
|
if( matchCnt == 2 ) {
|
||||||
matchCnt = 0;
|
matchCnt = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
( ( XtextDocument ) doc )
|
( ( XtextDocument ) doc )
|
||||||
.readOnly( new IUnitOfWork< Boolean, XtextResource >( ) {
|
.readOnly( new IUnitOfWork< Boolean, XtextResource >( ) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean exec( XtextResource state )
|
public Boolean exec( XtextResource state )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
computeMatchingRegion( state, offset );
|
computeMatchingRegion( state, offset );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// refresh the highlighting
|
// refresh the highlighting
|
||||||
WMLEditor currentEditor = ( WMLEditor ) EditorUtils
|
WMLEditor currentEditor = ( WMLEditor ) EditorUtils
|
||||||
.getActiveXtextEditor( );
|
.getActiveXtextEditor( );
|
||||||
if( currentEditor != null
|
if( currentEditor != null
|
||||||
&& currentEditor.getHighlightingHelper( ) != null
|
&& currentEditor.getHighlightingHelper( ) != null
|
||||||
&& currentEditor.getHighlightingHelper( )
|
&& currentEditor.getHighlightingHelper( )
|
||||||
.getReconciler( ) != null ) {
|
.getReconciler( ) != null ) {
|
||||||
currentEditor.getHighlightingHelper( ).getReconciler( )
|
currentEditor.getHighlightingHelper( ).getReconciler( )
|
||||||
.refresh( );
|
.refresh( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void computeMatchingRegion( XtextResource state,
|
public synchronized void computeMatchingRegion( XtextResource state,
|
||||||
int offset )
|
int offset )
|
||||||
{
|
{
|
||||||
EObject object = WMLUtils.resolveElementAt( state, offset );
|
EObject object = WMLUtils.resolveElementAt( state, offset );
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ public class WMLCharacterPairMatcher extends DefaultCharacterPairMatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
state.eAdapters( )
|
state.eAdapters( )
|
||||||
.add( new WMLSyntaxColoringAdapter(
|
.add( new WMLSyntaxColoringAdapter(
|
||||||
WMLHighlightingConfiguration.RULE_MATCH_TAG, object ) );
|
WMLHighlightingConfiguration.RULE_MATCH_TAG, object ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// nothing new selected, just remove current adapter
|
// nothing new selected, just remove current adapter
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.xtext.ui.editor.utils.TextStyle;
|
||||||
import org.wesnoth.ui.Messages;
|
import org.wesnoth.ui.Messages;
|
||||||
|
|
||||||
public class WMLHighlightingConfiguration extends
|
public class WMLHighlightingConfiguration extends
|
||||||
DefaultHighlightingConfiguration
|
DefaultHighlightingConfiguration
|
||||||
{
|
{
|
||||||
public static final String RULE_WML_TAG = "wmlTag"; //$NON-NLS-1$
|
public static final String RULE_WML_TAG = "wmlTag"; //$NON-NLS-1$
|
||||||
public static final String RULE_WML_KEY = "wmlKey"; //$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 );
|
super.configure( acceptor );
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_TAG,
|
acceptor.acceptDefaultHighlighting( RULE_WML_TAG,
|
||||||
Messages.WMLHighlightingConfiguration_7, tagTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_7, tagTextStyle( ) );
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_KEY,
|
acceptor.acceptDefaultHighlighting( RULE_WML_KEY,
|
||||||
Messages.WMLHighlightingConfiguration_8, keyTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_8, keyTextStyle( ) );
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_CALL,
|
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_CALL,
|
||||||
Messages.WMLHighlightingConfiguration_9, macroTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_9, macroTextStyle( ) );
|
||||||
|
|
||||||
acceptor.acceptDefaultHighlighting( RULE_MATCH_TAG,
|
acceptor.acceptDefaultHighlighting( RULE_MATCH_TAG,
|
||||||
Messages.WMLHighlightingConfiguration_10, startEndTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_10, startEndTextStyle( ) );
|
||||||
|
|
||||||
// preproc
|
// preproc
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_DEFINE,
|
acceptor.acceptDefaultHighlighting( RULE_WML_MACRO_DEFINE,
|
||||||
Messages.WMLHighlightingConfiguration_11, preprocTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_11, preprocTextStyle( ) );
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_IF,
|
acceptor.acceptDefaultHighlighting( RULE_WML_IF,
|
||||||
Messages.WMLHighlightingConfiguration_12, preprocTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_12, preprocTextStyle( ) );
|
||||||
acceptor.acceptDefaultHighlighting( RULE_WML_TEXTDOMAIN,
|
acceptor.acceptDefaultHighlighting( RULE_WML_TEXTDOMAIN,
|
||||||
Messages.WMLHighlightingConfiguration_13, preprocTextStyle( ) );
|
Messages.WMLHighlightingConfiguration_13, preprocTextStyle( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextStyle preprocTextStyle( )
|
public TextStyle preprocTextStyle( )
|
||||||
|
|
|
@ -33,11 +33,11 @@ import org.wesnoth.wml.WMLTextdomain;
|
||||||
import org.wesnoth.wml.WmlPackage;
|
import org.wesnoth.wml.WmlPackage;
|
||||||
|
|
||||||
public class WMLSemanticHighlightingCalculator implements
|
public class WMLSemanticHighlightingCalculator implements
|
||||||
ISemanticHighlightingCalculator
|
ISemanticHighlightingCalculator
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void provideHighlightingFor( XtextResource resource,
|
public void provideHighlightingFor( XtextResource resource,
|
||||||
IHighlightedPositionAcceptor acceptor )
|
IHighlightedPositionAcceptor acceptor )
|
||||||
{
|
{
|
||||||
if( resource == null ) {
|
if( resource == null ) {
|
||||||
return;
|
return;
|
||||||
|
@ -51,56 +51,56 @@ public class WMLSemanticHighlightingCalculator implements
|
||||||
|
|
||||||
if( current instanceof WMLTag ) {
|
if( current instanceof WMLTag ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_TAG ) );
|
WMLHighlightingConfiguration.RULE_WML_TAG ) );
|
||||||
|
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_TAG__END_NAME ),
|
WmlPackage.Literals.WML_TAG__END_NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_TAG ) );
|
WMLHighlightingConfiguration.RULE_WML_TAG ) );
|
||||||
}
|
}
|
||||||
else if( current instanceof WMLKey ) {
|
else if( current instanceof WMLKey ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_KEY ) );
|
WMLHighlightingConfiguration.RULE_WML_KEY ) );
|
||||||
}
|
}
|
||||||
else if( current instanceof WMLMacroCall ) {
|
else if( current instanceof WMLMacroCall ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_MACRO_CALL ) );
|
WMLHighlightingConfiguration.RULE_WML_MACRO_CALL ) );
|
||||||
}
|
}
|
||||||
else if( current instanceof WMLTextdomain ) {
|
else if( current instanceof WMLTextdomain ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_TEXTDOMAIN ) );
|
WMLHighlightingConfiguration.RULE_WML_TEXTDOMAIN ) );
|
||||||
}
|
}
|
||||||
else if( current instanceof WMLPreprocIF ) {
|
else if( current instanceof WMLPreprocIF ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_IF ) );
|
WMLHighlightingConfiguration.RULE_WML_IF ) );
|
||||||
|
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_IF ) );
|
WMLHighlightingConfiguration.RULE_WML_IF ) );
|
||||||
}
|
}
|
||||||
else if( current instanceof WMLMacroDefine ) {
|
else if( current instanceof WMLMacroDefine ) {
|
||||||
toColor.add( Pair.create(
|
toColor.add( Pair.create(
|
||||||
getFirstFeatureNode( current,
|
getFirstFeatureNode( current,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
WmlPackage.Literals.WML_EXPRESSION__NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
|
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
|
||||||
|
|
||||||
toColor.add( Pair
|
toColor.add( Pair
|
||||||
.create(
|
.create(
|
||||||
getFirstFeatureNode(
|
getFirstFeatureNode(
|
||||||
current,
|
current,
|
||||||
WmlPackage.Literals.WML_MACRO_DEFINE__END_NAME ),
|
WmlPackage.Literals.WML_MACRO_DEFINE__END_NAME ),
|
||||||
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
|
WMLHighlightingConfiguration.RULE_WML_MACRO_DEFINE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we have any information specific information for
|
// check if we have any information specific information for
|
||||||
|
@ -139,7 +139,7 @@ public class WMLSemanticHighlightingCalculator implements
|
||||||
* The acceptor to add the node to
|
* The acceptor to add the node to
|
||||||
*/
|
*/
|
||||||
private void highlightNode( INode node, String id,
|
private void highlightNode( INode node, String id,
|
||||||
IHighlightedPositionAcceptor acceptor )
|
IHighlightedPositionAcceptor acceptor )
|
||||||
{
|
{
|
||||||
if( node == null ) {
|
if( node == null ) {
|
||||||
return;
|
return;
|
||||||
|
@ -151,7 +151,7 @@ public class WMLSemanticHighlightingCalculator implements
|
||||||
for( ILeafNode leaf: node.getLeafNodes( ) ) {
|
for( ILeafNode leaf: node.getLeafNodes( ) ) {
|
||||||
if( ! leaf.isHidden( ) ) {
|
if( ! leaf.isHidden( ) ) {
|
||||||
acceptor.addPosition( leaf.getOffset( ), leaf.getLength( ),
|
acceptor.addPosition( leaf.getOffset( ), leaf.getLength( ),
|
||||||
id );
|
id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,13 +168,13 @@ public class WMLSemanticHighlightingCalculator implements
|
||||||
* @return Null if there is no feature, or an {@link INode} node
|
* @return Null if there is no feature, or an {@link INode} node
|
||||||
*/
|
*/
|
||||||
public INode getFirstFeatureNode( EObject semantic,
|
public INode getFirstFeatureNode( EObject semantic,
|
||||||
EStructuralFeature feature )
|
EStructuralFeature feature )
|
||||||
{
|
{
|
||||||
if( feature == null ) {
|
if( feature == null ) {
|
||||||
return NodeModelUtils.findActualNodeFor( semantic );
|
return NodeModelUtils.findActualNodeFor( semantic );
|
||||||
}
|
}
|
||||||
List< INode > nodes = NodeModelUtils.findNodesForFeature( semantic,
|
List< INode > nodes = NodeModelUtils.findNodesForFeature( semantic,
|
||||||
feature );
|
feature );
|
||||||
if( ! nodes.isEmpty( ) ) {
|
if( ! nodes.isEmpty( ) ) {
|
||||||
return nodes.get( 0 );
|
return nodes.get( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Sat Aug 06 22:15:01 EEST 2011
|
#Mon Aug 08 23:52:12 EEST 2011
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
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.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=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.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_annotation=0
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=84
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=4
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
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_multiple_fields=16
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_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=16
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=20
|
||||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
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=16
|
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_imports=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
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_declaration=insert
|
||||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=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_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_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_empty_array_initializer_on_one_line=false
|
||||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
|
|
@ -19,25 +19,26 @@ public class Constants
|
||||||
{
|
{
|
||||||
/** Plugin related */
|
/** Plugin related */
|
||||||
public static final String PLUGIN_FULL_PATH = Constants.class
|
public static final String PLUGIN_FULL_PATH = Constants.class
|
||||||
.getProtectionDomain( )
|
.getProtectionDomain( )
|
||||||
.getCodeSource( )
|
.getCodeSource( )
|
||||||
.getLocation( )
|
.getLocation( )
|
||||||
.getPath( )
|
.getPath( )
|
||||||
+ "/"; //$NON-NLS-1$
|
+ "/"; //$NON-NLS-1$
|
||||||
public static final String PLUGIN_ID = "org.wesnoth"; //$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$
|
"os.name" ).toLowerCase( Locale.ENGLISH ); //$NON-NLS-1$
|
||||||
/**
|
/**
|
||||||
* The boolean value whether this machine is running windows or not
|
* The boolean value whether this machine is running windows or not
|
||||||
*/
|
*/
|
||||||
public static final boolean IS_WINDOWS_MACHINE = MACHINE_OS
|
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
|
* The boolean value whether this machine is running Machintosh or not
|
||||||
*/
|
*/
|
||||||
public static final boolean IS_MAC_MACHINE = MACHINE_OS
|
public static final boolean IS_MAC_MACHINE = MACHINE_OS
|
||||||
.contains( "mac" ); //$NON-NLS-1$
|
.contains( "mac" ); //$NON-NLS-1$
|
||||||
|
|
||||||
/** Preferences Constants **/
|
/** Preferences Constants **/
|
||||||
public static final String P_WESNOTH_EXEC_PATH = "wesnoth_exec_path"; //$NON-NLS-1$
|
public static final String P_WESNOTH_EXEC_PATH = "wesnoth_exec_path"; //$NON-NLS-1$
|
||||||
|
|
|
@ -60,14 +60,12 @@ public class Logger
|
||||||
throw new IOException( "Could not create the temporary folder." ); //$NON-NLS-1$
|
throw new IOException( "Could not create the temporary folder." ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
String logFilePath = String.format(
|
String logFilePath = String.format( "%s/logs/log%s.txt", //$NON-NLS-1$
|
||||||
"%s/logs/log%s.txt", //$NON-NLS-1$
|
WorkspaceUtils.getTemporaryFolder( ),
|
||||||
WorkspaceUtils.getTemporaryFolder( ),
|
WorkspaceUtils.getCurrentDateTime( ) );
|
||||||
WorkspaceUtils.getCurrentDateTime( ) );
|
String toolsLogFilePath = String.format( "%s/logs/tools_log%s.txt", //$NON-NLS-1$
|
||||||
String toolsLogFilePath = String.format(
|
WorkspaceUtils.getTemporaryFolder( ),
|
||||||
"%s/logs/tools_log%s.txt", //$NON-NLS-1$
|
WorkspaceUtils.getCurrentDateTime( ) );
|
||||||
WorkspaceUtils.getTemporaryFolder( ),
|
|
||||||
WorkspaceUtils.getCurrentDateTime( ) );
|
|
||||||
|
|
||||||
new File( WorkspaceUtils.getTemporaryFolder( ) + "/logs/" ).mkdirs( ); //$NON-NLS-1$
|
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$
|
log( "Error codes: 1 - INFO, 2 - WARNING, 4 - ERROR" ); //$NON-NLS-1$
|
||||||
|
|
||||||
toolLaunchLogWriter_ = new BufferedWriter( new FileWriter(
|
toolLaunchLogWriter_ = new BufferedWriter( new FileWriter(
|
||||||
toolsLogFilePath ) );
|
toolsLogFilePath ) );
|
||||||
logTool( "Logging started." ); //$NON-NLS-1$
|
logTool( "Logging started." ); //$NON-NLS-1$
|
||||||
logTool( "Error codes: 1 - INFO, 2 - WARNING, 4 - ERROR" ); //$NON-NLS-1$
|
logTool( "Error codes: 1 - INFO, 2 - WARNING, 4 - ERROR" ); //$NON-NLS-1$
|
||||||
|
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
JOptionPane
|
JOptionPane
|
||||||
.showMessageDialog(
|
.showMessageDialog(
|
||||||
null,
|
null,
|
||||||
"There was an error trying to open the log." + e.getMessage( ) ); //$NON-NLS-1$
|
"There was an error trying to open the log." + e.getMessage( ) ); //$NON-NLS-1$
|
||||||
e.printStackTrace( );
|
e.printStackTrace( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,15 +214,16 @@ public class Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logToWriter( BufferedWriter writer, String message,
|
private void logToWriter( BufferedWriter writer, String message,
|
||||||
int severity )
|
int severity )
|
||||||
{
|
{
|
||||||
if( writer != null ) {
|
if( writer != null ) {
|
||||||
try {
|
try {
|
||||||
writer.write( String
|
writer
|
||||||
|
.write( String
|
||||||
.format(
|
.format(
|
||||||
"%s | %d | %s\n", //$NON-NLS-1$
|
"%s | %d | %s\n", //$NON-NLS-1$
|
||||||
new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( new Date( ) ), //$NON-NLS-1$
|
new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( new Date( ) ), //$NON-NLS-1$
|
||||||
severity, message ) );
|
severity, message ) );
|
||||||
writer.flush( );
|
writer.flush( );
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
e.printStackTrace( );
|
e.printStackTrace( );
|
||||||
|
@ -233,7 +232,7 @@ public class Logger
|
||||||
|
|
||||||
// don't print to console the tools if there was no error/warning
|
// don't print to console the tools if there was no error/warning
|
||||||
if( writer != toolLaunchLogWriter_
|
if( writer != toolLaunchLogWriter_
|
||||||
|| ( writer == toolLaunchLogWriter_ && severity != IStatus.INFO ) ) {
|
|| ( writer == toolLaunchLogWriter_ && severity != IStatus.INFO ) ) {
|
||||||
System.out.println( message );
|
System.out.println( message );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class WesnothPlugin extends AbstractUIPlugin
|
||||||
{
|
{
|
||||||
// save the caches of the projects on disk
|
// save the caches of the projects on disk
|
||||||
for( Entry< IProject, ProjectCache > cache: ProjectUtils
|
for( Entry< IProject, ProjectCache > cache: ProjectUtils
|
||||||
.getProjectCaches( ).entrySet( ) ) {
|
.getProjectCaches( ).entrySet( ) ) {
|
||||||
cache.getValue( ).saveCache( );
|
cache.getValue( ).saveCache( );
|
||||||
}
|
}
|
||||||
PreprocessorUtils.getInstance( ).saveTimestamps( );
|
PreprocessorUtils.getInstance( ).saveTimestamps( );
|
||||||
|
|
|
@ -33,17 +33,19 @@ public class RegenerateBuildFiles extends ObjectActionDelegate
|
||||||
Object element = it.next( );
|
Object element = it.next( );
|
||||||
if( element instanceof IProject ) {
|
if( element instanceof IProject ) {
|
||||||
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
|
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
|
||||||
param.add( new ReplaceableParameter(
|
param
|
||||||
|
.add( new ReplaceableParameter(
|
||||||
"$$project_name", ( ( ( IProject ) element ).getName( ) ) ) ); //$NON-NLS-1$
|
"$$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$
|
"$$project_dir_name", ( ( IProject ) element ).getName( ) ) ); //$NON-NLS-1$
|
||||||
ResourceUtils.createFile( ( IProject ) element,
|
ResourceUtils.createFile( ( IProject ) element,
|
||||||
"build.xml", //$NON-NLS-1$
|
"build.xml", //$NON-NLS-1$
|
||||||
TemplateProvider.getInstance( ).getProcessedTemplate(
|
TemplateProvider.getInstance( ).getProcessedTemplate(
|
||||||
"build_xml", param ), true ); //$NON-NLS-1$
|
"build_xml", param ), true ); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
( ( IProject ) element ).refreshLocal( IResource.DEPTH_ONE,
|
( ( IProject ) element ).refreshLocal( IResource.DEPTH_ONE,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class ShowPlainPreprocessedConfig extends ObjectActionDelegate
|
||||||
public void run( IAction action )
|
public void run( IAction action )
|
||||||
{
|
{
|
||||||
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
|
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
|
||||||
WorkspaceUtils.getSelectedFile( WorkspaceUtils
|
WorkspaceUtils.getSelectedFile( WorkspaceUtils
|
||||||
.getWorkbenchWindow( ) ), true );
|
.getWorkbenchWindow( ) ), true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ public class ShowPreprocessedConfig extends ObjectActionDelegate
|
||||||
public void run( IAction action )
|
public void run( IAction action )
|
||||||
{
|
{
|
||||||
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
|
PreprocessorUtils.getInstance( ).openPreprocessedFileInEditor(
|
||||||
WorkspaceUtils.getSelectedFile( ), false );
|
WorkspaceUtils.getSelectedFile( ), false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,23 +30,23 @@ public class UploadAddon extends ObjectActionDelegate
|
||||||
public void run( IAction action )
|
public void run( IAction action )
|
||||||
{
|
{
|
||||||
final String fullPath = WorkspaceUtils.getSelectedResource( )
|
final String fullPath = WorkspaceUtils.getSelectedResource( )
|
||||||
.getLocation( ).toOSString( );
|
.getLocation( ).toOSString( );
|
||||||
ProgressMonitorDialog dialog = new ProgressMonitorDialog(
|
ProgressMonitorDialog dialog = new ProgressMonitorDialog(
|
||||||
WesnothPlugin.getShell( ) );
|
WesnothPlugin.getShell( ) );
|
||||||
try {
|
try {
|
||||||
dialog.run( false, false, new IRunnableWithProgress( ) {
|
dialog.run( false, false, new IRunnableWithProgress( ) {
|
||||||
@Override
|
@Override
|
||||||
public void run( IProgressMonitor monitor )
|
public void run( IProgressMonitor monitor )
|
||||||
throws InvocationTargetException, InterruptedException
|
throws InvocationTargetException, InterruptedException
|
||||||
{
|
{
|
||||||
monitor.beginTask( Messages.UploadAddon_0, 50 );
|
monitor.beginTask( Messages.UploadAddon_0, 50 );
|
||||||
monitor.worked( 10 );
|
monitor.worked( 10 );
|
||||||
OutputStream consoleStream = GUIUtils.createConsole(
|
OutputStream consoleStream = GUIUtils.createConsole(
|
||||||
Messages.UploadAddon_1, null, true )
|
Messages.UploadAddon_1, null, true )
|
||||||
.newOutputStream( );
|
.newOutputStream( );
|
||||||
WMLTools.uploadWesnothAddon( fullPath,
|
WMLTools.uploadWesnothAddon( fullPath,
|
||||||
new OutputStream[] { consoleStream },
|
new OutputStream[] { consoleStream },
|
||||||
new OutputStream[] { consoleStream } );
|
new OutputStream[] { consoleStream } );
|
||||||
monitor.worked( 40 );
|
monitor.worked( 40 );
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,24 +44,24 @@ public class WesnothProjectReport extends ObjectActionDelegate
|
||||||
int[] statistics = new int[3];
|
int[] statistics = new int[3];
|
||||||
|
|
||||||
File scenariosFolder = new File( container.getLocation( ).toOSString( )
|
File scenariosFolder = new File( container.getLocation( ).toOSString( )
|
||||||
+ "/scenarios" ); //$NON-NLS-1$
|
+ "/scenarios" ); //$NON-NLS-1$
|
||||||
if( scenariosFolder.exists( ) ) {
|
if( scenariosFolder.exists( ) ) {
|
||||||
statistics[0] = scenariosFolder.listFiles( ).length;
|
statistics[0] = scenariosFolder.listFiles( ).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
File mapsFolder = new File( container.getLocation( ).toOSString( )
|
File mapsFolder = new File( container.getLocation( ).toOSString( )
|
||||||
+ "/maps" ); //$NON-NLS-1$
|
+ "/maps" ); //$NON-NLS-1$
|
||||||
if( mapsFolder.exists( ) ) {
|
if( mapsFolder.exists( ) ) {
|
||||||
statistics[1] = mapsFolder.listFiles( ).length;
|
statistics[1] = mapsFolder.listFiles( ).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
File unitsFolder = new File( container.getLocation( ).toOSString( )
|
File unitsFolder = new File( container.getLocation( ).toOSString( )
|
||||||
+ "/units" ); //$NON-NLS-1$
|
+ "/units" ); //$NON-NLS-1$
|
||||||
if( unitsFolder.exists( ) ) {
|
if( unitsFolder.exists( ) ) {
|
||||||
statistics[2] = unitsFolder.listFiles( ).length;
|
statistics[2] = unitsFolder.listFiles( ).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.format( Messages.WesnothProjectReport_4, statistics[0],
|
return String.format( Messages.WesnothProjectReport_4, statistics[0],
|
||||||
statistics[1], statistics[2] );
|
statistics[1], statistics[2] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,8 @@ public class DependencyListBuilder implements Serializable
|
||||||
{
|
{
|
||||||
if( isCreated_ && ! force ) {
|
if( isCreated_ && ! force ) {
|
||||||
Logger.getInstance( )
|
Logger.getInstance( )
|
||||||
.log( "Skipping depedency list for project "
|
.log( "Skipping depedency list for project "
|
||||||
+ project_.getName( ) );
|
+ project_.getName( ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
// in case we need to add multiple subsequent files...
|
// in case we need to add multiple subsequent files...
|
||||||
DependencyListNode backupPrevious = previous_, newNode = null;
|
DependencyListNode backupPrevious = previous_, newNode = null;
|
||||||
String fileParentProjectPath = file.getParent( )
|
String fileParentProjectPath = file.getParent( )
|
||||||
.getProjectRelativePath( ).toString( );
|
.getProjectRelativePath( ).toString( );
|
||||||
|
|
||||||
// we add a file in an existing processed directory.
|
// we add a file in an existing processed directory.
|
||||||
if( directories_.contains( fileParentProjectPath ) ) {
|
if( directories_.contains( fileParentProjectPath ) ) {
|
||||||
|
@ -143,7 +143,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
|
|
||||||
// we found the place?
|
// we found the place?
|
||||||
if( ResourceUtils.wmlFileNameCompare( tmpNode.getFile( )
|
if( ResourceUtils.wmlFileNameCompare( tmpNode.getFile( )
|
||||||
.getName( ), fileName ) > 0 ) {
|
.getName( ), fileName ) > 0 ) {
|
||||||
|
|
||||||
previous_ = tmpNode.getPrevious( );
|
previous_ = tmpNode.getPrevious( );
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
|
|
||||||
// skip core library
|
// skip core library
|
||||||
if( container.getName( ).equals(
|
if( container.getName( ).equals(
|
||||||
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
|
WesnothProjectsExplorer.CORE_LIBRARY_NAME ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,14 +250,14 @@ public class DependencyListBuilder implements Serializable
|
||||||
if( ! directories_.contains( containerPath ) ) {
|
if( ! directories_.contains( containerPath ) ) {
|
||||||
directories_.add( containerPath );
|
directories_.add( containerPath );
|
||||||
directoriesEntries_.add( new ListDirectoryEntry( containerPath,
|
directoriesEntries_.add( new ListDirectoryEntry( containerPath,
|
||||||
null, null ) );
|
null, null ) );
|
||||||
|
|
||||||
toAddDirectoryEntry = true;
|
toAddDirectoryEntry = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// update the includes
|
// update the includes
|
||||||
directoriesEntries_.get( directoriesEntries_
|
directoriesEntries_.get( directoriesEntries_
|
||||||
.indexOf( containerPath ) ).Includes++;
|
.indexOf( containerPath ) ).Includes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( members.isEmpty( ) ) {
|
if( members.isEmpty( ) ) {
|
||||||
|
@ -270,7 +270,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
for( IResource resource: members ) {
|
for( IResource resource: members ) {
|
||||||
if( resource instanceof IContainer ) {
|
if( resource instanceof IContainer ) {
|
||||||
internal_addContainer( resource.getProjectRelativePath( )
|
internal_addContainer( resource.getProjectRelativePath( )
|
||||||
.toString( ) );
|
.toString( ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// just config files.
|
// just config files.
|
||||||
|
@ -289,8 +289,8 @@ public class DependencyListBuilder implements Serializable
|
||||||
if( toAddDirectoryEntry ) {
|
if( toAddDirectoryEntry ) {
|
||||||
// update the first directory node
|
// update the first directory node
|
||||||
directoriesEntries_.set( directories_.size( ) - 1,
|
directoriesEntries_.set( directories_.size( ) - 1,
|
||||||
new ListDirectoryEntry( containerPath,
|
new ListDirectoryEntry( containerPath,
|
||||||
firstNewNode, lastNode ) );
|
firstNewNode, lastNode ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if the current entry has null nodes
|
// if the current entry has null nodes
|
||||||
|
@ -298,17 +298,17 @@ public class DependencyListBuilder implements Serializable
|
||||||
// we need to update the references nodes
|
// we need to update the references nodes
|
||||||
|
|
||||||
ListDirectoryEntry entry = directoriesEntries_
|
ListDirectoryEntry entry = directoriesEntries_
|
||||||
.get( directories_.indexOf( containerPath ) );
|
.get( directories_.indexOf( containerPath ) );
|
||||||
|
|
||||||
if( entry.FirstNode == null
|
if( entry.FirstNode == null
|
||||||
|| ( entry.FirstNode != null && firstNewNode
|
|| ( entry.FirstNode != null && firstNewNode
|
||||||
.getIndex( ) < entry.FirstNode.getIndex( ) ) ) {
|
.getIndex( ) < entry.FirstNode.getIndex( ) ) ) {
|
||||||
entry.FirstNode = firstNewNode;
|
entry.FirstNode = firstNewNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( entry.LastNode == null
|
if( entry.LastNode == null
|
||||||
|| ( entry.LastNode != null && lastNode.getIndex( ) > entry.LastNode
|
|| ( entry.LastNode != null && lastNode.getIndex( ) > entry.LastNode
|
||||||
.getIndex( ) ) ) {
|
.getIndex( ) ) ) {
|
||||||
entry.LastNode = lastNode;
|
entry.LastNode = lastNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,12 +332,12 @@ public class DependencyListBuilder implements Serializable
|
||||||
// inserting is done between 2 nodes
|
// inserting is done between 2 nodes
|
||||||
if( previous_.getNext( ) != null ) {
|
if( previous_.getNext( ) != null ) {
|
||||||
int newIndex = ( previous_.getIndex( ) + previous_.getNext( )
|
int newIndex = ( previous_.getIndex( ) + previous_.getNext( )
|
||||||
.getIndex( ) ) / 2;
|
.getIndex( ) ) / 2;
|
||||||
|
|
||||||
if( newIndex > previous_.getIndex( )
|
if( newIndex > previous_.getIndex( )
|
||||||
+ DependencyListNode.INDEX_STEP ) {
|
+ DependencyListNode.INDEX_STEP ) {
|
||||||
newIndex = previous_.getIndex( )
|
newIndex = previous_.getIndex( )
|
||||||
+ DependencyListNode.INDEX_STEP;
|
+ DependencyListNode.INDEX_STEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
newNode.setIndex( newIndex );
|
newNode.setIndex( newIndex );
|
||||||
|
@ -364,7 +364,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
newNode.setNext( root );
|
newNode.setNext( root );
|
||||||
|
|
||||||
newNode.setIndex( root.getIndex( )
|
newNode.setIndex( root.getIndex( )
|
||||||
- DependencyListNode.INDEX_STEP );
|
- DependencyListNode.INDEX_STEP );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newNode.setIndex( currentIndex_ );
|
newNode.setIndex( currentIndex_ );
|
||||||
|
@ -411,7 +411,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileParentProjectPath = node.getFile( ).getParent( )
|
String fileParentProjectPath = node.getFile( ).getParent( )
|
||||||
.getProjectRelativePath( ).toString( );
|
.getProjectRelativePath( ).toString( );
|
||||||
|
|
||||||
list_.remove( node.getFile( ).getProjectRelativePath( ).toString( ) );
|
list_.remove( node.getFile( ).getProjectRelativePath( ).toString( ) );
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
if( node.getNext( ) == null ) {
|
if( node.getNext( ) == null ) {
|
||||||
if( node.getPrevious( ) != null ) {
|
if( node.getPrevious( ) != null ) {
|
||||||
currentIndex_ = node.getPrevious( ).getIndex( )
|
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 >( );
|
List< String > processedIncludes = new ArrayList< String >( );
|
||||||
|
|
||||||
for( int prevIndex = 0, newIndex = 0; prevIndex < prevLength
|
for( int prevIndex = 0, newIndex = 0; prevIndex < prevLength
|
||||||
&& newIndex < newLength; ) {
|
&& newIndex < newLength; ) {
|
||||||
String prevIncl = previousIncludes.get( prevIndex );
|
String prevIncl = previousIncludes.get( prevIndex );
|
||||||
String newIncl = newIncludes.get( prevIndex );
|
String newIncl = newIncludes.get( prevIndex );
|
||||||
|
|
||||||
|
@ -519,8 +519,8 @@ public class DependencyListBuilder implements Serializable
|
||||||
// get the directory entry for the previous include
|
// get the directory entry for the previous include
|
||||||
if( newIndex > 0 ) {
|
if( newIndex > 0 ) {
|
||||||
ListDirectoryEntry entry = directoriesEntries_
|
ListDirectoryEntry entry = directoriesEntries_
|
||||||
.get( directories_.indexOf( newIncludes
|
.get( directories_.indexOf( newIncludes
|
||||||
.get( newIndex - 1 ) ) );
|
.get( newIndex - 1 ) ) );
|
||||||
|
|
||||||
if( entry != null ) {
|
if( entry != null ) {
|
||||||
previous_ = entry.FirstNode;
|
previous_ = entry.FirstNode;
|
||||||
|
@ -546,13 +546,13 @@ public class DependencyListBuilder implements Serializable
|
||||||
if( ! processedIncludes.contains( prevIncl ) ) {
|
if( ! processedIncludes.contains( prevIncl ) ) {
|
||||||
|
|
||||||
ListDirectoryEntry prevEntry = directoriesEntries_
|
ListDirectoryEntry prevEntry = directoriesEntries_
|
||||||
.get( directories_.indexOf( prevIncl ) );
|
.get( directories_.indexOf( prevIncl ) );
|
||||||
ListDirectoryEntry newEntry = directoriesEntries_
|
ListDirectoryEntry newEntry = directoriesEntries_
|
||||||
.get( directories_.indexOf( newIncl ) );
|
.get( directories_.indexOf( newIncl ) );
|
||||||
|
|
||||||
if( prevEntry != null && newEntry != null
|
if( prevEntry != null && newEntry != null
|
||||||
&& prevEntry.FirstNode != null
|
&& prevEntry.FirstNode != null
|
||||||
&& newEntry.FirstNode != null ) {
|
&& newEntry.FirstNode != null ) {
|
||||||
|
|
||||||
// create a list for easier swap
|
// create a list for easier swap
|
||||||
List< DependencyListNode > nodes = new ArrayList< DependencyListNode >( );
|
List< DependencyListNode > nodes = new ArrayList< DependencyListNode >( );
|
||||||
|
@ -602,8 +602,8 @@ public class DependencyListBuilder implements Serializable
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"Null directory entry for" + "includes: "
|
"Null directory entry for" + "includes: "
|
||||||
+ prevIncl + " and " + newIncl );
|
+ prevIncl + " and " + newIncl );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ public class DependencyListBuilder implements Serializable
|
||||||
public int Includes;
|
public int Includes;
|
||||||
|
|
||||||
public ListDirectoryEntry( String name, DependencyListNode firstNode,
|
public ListDirectoryEntry( String name, DependencyListNode firstNode,
|
||||||
DependencyListNode lastNode )
|
DependencyListNode lastNode )
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
FirstNode = firstNode;
|
FirstNode = firstNode;
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class DependencyListNode implements Serializable
|
||||||
public static final int INDEX_STEP = 100000;
|
public static final int INDEX_STEP = 100000;
|
||||||
|
|
||||||
public static final QualifiedName PDL_INDEX = new QualifiedName(
|
public static final QualifiedName PDL_INDEX = new QualifiedName(
|
||||||
Constants.PLUGIN_ID,
|
Constants.PLUGIN_ID,
|
||||||
"pdl_index" ); //$NON-NLS-1$
|
"pdl_index" ); //$NON-NLS-1$
|
||||||
|
|
||||||
private DependencyListNode previous_;
|
private DependencyListNode previous_;
|
||||||
private DependencyListNode next_;
|
private DependencyListNode next_;
|
||||||
|
@ -86,7 +86,7 @@ public class DependencyListNode implements Serializable
|
||||||
{
|
{
|
||||||
if( includes_ == null || refresh ) {
|
if( includes_ == null || refresh ) {
|
||||||
includes_ = new ArrayList< String >(
|
includes_ = new ArrayList< String >(
|
||||||
ResourceUtils.getContainers( file_ ) );
|
ResourceUtils.getContainers( file_ ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return includes_;
|
return includes_;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
|
||||||
}
|
}
|
||||||
else if( element instanceof IAdaptable ) {
|
else if( element instanceof IAdaptable ) {
|
||||||
project = ( IProject ) ( ( IAdaptable ) element )
|
project = ( IProject ) ( ( IAdaptable ) element )
|
||||||
.getAdapter( IProject.class );
|
.getAdapter( IProject.class );
|
||||||
}
|
}
|
||||||
if( project != null ) {
|
if( project != null ) {
|
||||||
toggleNature( project );
|
toggleNature( project );
|
||||||
|
@ -65,12 +65,12 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
|
||||||
String[] newNatures = new String[natures.length - 1];
|
String[] newNatures = new String[natures.length - 1];
|
||||||
System.arraycopy( natures, 0, newNatures, 0, i );
|
System.arraycopy( natures, 0, newNatures, 0, i );
|
||||||
System.arraycopy( natures, i + 1, newNatures, i,
|
System.arraycopy( natures, i + 1, newNatures, i,
|
||||||
natures.length - i - 1 );
|
natures.length - i - 1 );
|
||||||
description.setNatureIds( newNatures );
|
description.setNatureIds( newNatures );
|
||||||
project.setDescription( description,
|
project.setDescription( description,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
project.refreshLocal( IResource.DEPTH_INFINITE,
|
project.refreshLocal( IResource.DEPTH_INFINITE,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class ToggleWesnothNatureAction extends ObjectActionDelegate
|
||||||
description.setNatureIds( newNatures );
|
description.setNatureIds( newNatures );
|
||||||
project.setDescription( description, new NullProgressMonitor( ) );
|
project.setDescription( description, new NullProgressMonitor( ) );
|
||||||
project.refreshLocal( IResource.DEPTH_INFINITE,
|
project.refreshLocal( IResource.DEPTH_INFINITE,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
|
||||||
}
|
}
|
||||||
else if( element instanceof IAdaptable ) {
|
else if( element instanceof IAdaptable ) {
|
||||||
project = ( IProject ) ( ( IAdaptable ) element )
|
project = ( IProject ) ( ( IAdaptable ) element )
|
||||||
.getAdapter( IProject.class );
|
.getAdapter( IProject.class );
|
||||||
}
|
}
|
||||||
if( project != null ) {
|
if( project != null ) {
|
||||||
toggleNature( project );
|
toggleNature( project );
|
||||||
|
@ -65,12 +65,12 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
|
||||||
String[] newNatures = new String[natures.length - 1];
|
String[] newNatures = new String[natures.length - 1];
|
||||||
System.arraycopy( natures, 0, newNatures, 0, i );
|
System.arraycopy( natures, 0, newNatures, 0, i );
|
||||||
System.arraycopy( natures, i + 1, newNatures, i,
|
System.arraycopy( natures, i + 1, newNatures, i,
|
||||||
natures.length - i - 1 );
|
natures.length - i - 1 );
|
||||||
description.setNatureIds( newNatures );
|
description.setNatureIds( newNatures );
|
||||||
project.setDescription( description,
|
project.setDescription( description,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
project.refreshLocal( IResource.DEPTH_INFINITE,
|
project.refreshLocal( IResource.DEPTH_INFINITE,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class ToggleXtextNatureAction extends ObjectActionDelegate
|
||||||
description.setNatureIds( newNatures );
|
description.setNatureIds( newNatures );
|
||||||
project.setDescription( description, new NullProgressMonitor( ) );
|
project.setDescription( description, new NullProgressMonitor( ) );
|
||||||
project.refreshLocal( IResource.DEPTH_INFINITE,
|
project.refreshLocal( IResource.DEPTH_INFINITE,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
@SuppressWarnings( "rawtypes" )
|
@SuppressWarnings( "rawtypes" )
|
||||||
@Override
|
@Override
|
||||||
protected IProject[] build( int kind, Map args, IProgressMonitor monitor )
|
protected IProject[] build( int kind, Map args, IProgressMonitor monitor )
|
||||||
throws CoreException
|
throws CoreException
|
||||||
{
|
{
|
||||||
project_ = getProject( );
|
project_ = getProject( );
|
||||||
if( WesnothInstallsUtils.setupInstallForResource( project_ ) == false ) {
|
if( WesnothInstallsUtils.setupInstallForResource( project_ ) == false ) {
|
||||||
|
@ -76,13 +76,13 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"Building project " + getProject( ).getName( ) + " ..." ); //$NON-NLS-1$
|
"Building project " + getProject( ).getName( ) + " ..." ); //$NON-NLS-1$
|
||||||
monitor.beginTask(
|
monitor.beginTask(
|
||||||
String.format( Messages.WesnothProjectBuilder_1,
|
String.format( Messages.WesnothProjectBuilder_1,
|
||||||
project_.getName( ) ), 100 );
|
project_.getName( ) ), 100 );
|
||||||
|
|
||||||
String installName = WesnothInstallsUtils
|
String installName = WesnothInstallsUtils
|
||||||
.getInstallNameForResource( project_ );
|
.getInstallNameForResource( project_ );
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
monitor.subTask( Messages.WesnothProjectBuilder_3 );
|
monitor.subTask( Messages.WesnothProjectBuilder_3 );
|
||||||
|
@ -133,7 +133,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
|
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"Done building project " + getProject( ).getName( ) );
|
"Done building project " + getProject( ).getName( ) );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +146,12 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
protected boolean fullBuild( final IProgressMonitor monitor )
|
protected boolean fullBuild( final IProgressMonitor monitor )
|
||||||
throws CoreException
|
throws CoreException
|
||||||
{
|
{
|
||||||
// clean all project cache
|
// clean all project cache
|
||||||
projectCache_.clear( );
|
projectCache_.clear( );
|
||||||
PreprocessorUtils.getInstance( ).clearTimestampsForPath(
|
PreprocessorUtils.getInstance( ).clearTimestampsForPath(
|
||||||
project_.getLocation( ).toOSString( ) );
|
project_.getLocation( ).toOSString( ) );
|
||||||
|
|
||||||
projectCache_.getDependencyList( ).createDependencyList( true );
|
projectCache_.getDependencyList( ).createDependencyList( true );
|
||||||
boolean foundCfg = false;
|
boolean foundCfg = false;
|
||||||
|
@ -159,7 +159,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
DependencyListNode node = null;
|
DependencyListNode node = null;
|
||||||
|
|
||||||
node = projectCache_.getDependencyList( ).getNode(
|
node = projectCache_.getDependencyList( ).getNode(
|
||||||
DependencyListBuilder.ROOT_NODE_KEY );
|
DependencyListBuilder.ROOT_NODE_KEY );
|
||||||
|
|
||||||
if( node != null ) {
|
if( node != null ) {
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
protected boolean incrementalBuild( IResourceDelta delta,
|
protected boolean incrementalBuild( IResourceDelta delta,
|
||||||
IProgressMonitor monitor ) throws CoreException
|
IProgressMonitor monitor ) throws CoreException
|
||||||
{
|
{
|
||||||
boolean foundCfg = false;
|
boolean foundCfg = false;
|
||||||
|
|
||||||
|
@ -212,15 +212,15 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
if( deltaKind == IResourceDelta.REMOVED ) {
|
if( deltaKind == IResourceDelta.REMOVED ) {
|
||||||
projectCache_.getDependencyList( ).removeNode( file );
|
projectCache_.getDependencyList( ).removeNode( file );
|
||||||
projectCache_.getWMLConfigs( ).remove(
|
projectCache_.getWMLConfigs( ).remove(
|
||||||
file.getProjectRelativePath( ).toString( ) );
|
file.getProjectRelativePath( ).toString( ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( deltaKind == IResourceDelta.ADDED ) {
|
else if( deltaKind == IResourceDelta.ADDED ) {
|
||||||
DependencyListNode newNode = list.addNode( file );
|
DependencyListNode newNode = list.addNode( file );
|
||||||
if( newNode == null ) {
|
if( newNode == null ) {
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"Couldn't create a new" + "PDL node for file: "
|
"Couldn't create a new" + "PDL node for file: "
|
||||||
+ file.getFullPath( ).toString( ) );
|
+ file.getFullPath( ).toString( ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nodesToProcess.add( newNode );
|
nodesToProcess.add( newNode );
|
||||||
|
@ -230,9 +230,9 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
DependencyListNode node = list.getNode( file );
|
DependencyListNode node = list.getNode( file );
|
||||||
if( node == null ) {
|
if( node == null ) {
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"Couldn't find file "
|
"Couldn't find file "
|
||||||
+ file.getFullPath( ).toString( )
|
+ file.getFullPath( ).toString( )
|
||||||
+ " in PDL!." );
|
+ " in PDL!." );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nodesToProcess.add( node );
|
nodesToProcess.add( node );
|
||||||
|
@ -241,39 +241,39 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"unknown delta kind: " + deltaKind );
|
"unknown delta kind: " + deltaKind );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip core library files
|
// skip core library files
|
||||||
if( resource instanceof IContainer
|
if( resource instanceof IContainer
|
||||||
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
|
&& WesnothProjectsExplorer.CORE_LIBRARY_NAME
|
||||||
.equals( resource.getName( ) ) ) {
|
.equals( resource.getName( ) ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
deltasQueue
|
deltasQueue
|
||||||
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
|
.addAll( Arrays.asList( deltaItem.getAffectedChildren( ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the list by index (ascending)
|
// sort the list by index (ascending)
|
||||||
Collections.sort( nodesToProcess,
|
Collections.sort( nodesToProcess,
|
||||||
new Comparator< DependencyListNode >( ) {
|
new Comparator< DependencyListNode >( ) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare( DependencyListNode o1,
|
public int compare( DependencyListNode o1,
|
||||||
DependencyListNode o2 )
|
DependencyListNode o2 )
|
||||||
{
|
{
|
||||||
if( o1.getIndex( ) < o2.getIndex( ) ) {
|
if( o1.getIndex( ) < o2.getIndex( ) ) {
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
|
||||||
else if( o1.getIndex( ) == o2.getIndex( ) ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
} );
|
else if( o1.getIndex( ) == o2.getIndex( ) ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
foundCfg = ( ! nodesToProcess.isEmpty( ) );
|
foundCfg = ( ! nodesToProcess.isEmpty( ) );
|
||||||
// process nodes
|
// process nodes
|
||||||
|
@ -297,7 +297,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
private boolean runAntJob( Paths paths, IProgressMonitor monitor )
|
private boolean runAntJob( Paths paths, IProgressMonitor monitor )
|
||||||
{
|
{
|
||||||
String buildXMLPath = project_.getLocation( ).toOSString( )
|
String buildXMLPath = project_.getLocation( ).toOSString( )
|
||||||
+ "/build.xml";
|
+ "/build.xml";
|
||||||
// check for 'build.xml' existance
|
// check for 'build.xml' existance
|
||||||
if( new File( buildXMLPath ).exists( ) == true ) {
|
if( new File( buildXMLPath ).exists( ) == true ) {
|
||||||
// run the ant job to copy the whole project
|
// run the ant job to copy the whole project
|
||||||
|
@ -313,7 +313,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
|
|
||||||
if( result == null ) {
|
if( result == null ) {
|
||||||
Logger.getInstance( ).log( "error running the ant job", //$NON-NLS-1$
|
Logger.getInstance( ).log( "error running the ant job", //$NON-NLS-1$
|
||||||
Messages.WesnothProjectBuilder_13 );
|
Messages.WesnothProjectBuilder_13 );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkResource( IResource resource,
|
protected boolean checkResource( IResource resource,
|
||||||
IProgressMonitor monitor )
|
IProgressMonitor monitor )
|
||||||
{
|
{
|
||||||
monitor.worked( 5 );
|
monitor.worked( 5 );
|
||||||
if( resource.exists( ) == false || monitor.isCanceled( ) ) {
|
if( resource.exists( ) == false || monitor.isCanceled( ) ) {
|
||||||
|
@ -335,13 +335,13 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
IFile file = ( IFile ) resource;
|
IFile file = ( IFile ) resource;
|
||||||
String filePath = file.getProjectRelativePath( ).toString( );
|
String filePath = file.getProjectRelativePath( ).toString( );
|
||||||
String macrosFilePath = PreprocessorUtils.getInstance( )
|
String macrosFilePath = PreprocessorUtils.getInstance( )
|
||||||
.getMacrosLocation( file );
|
.getMacrosLocation( file );
|
||||||
|
|
||||||
Logger.getInstance( ).log( "Resource: " + filePath ); //$NON-NLS-1$
|
Logger.getInstance( ).log( "Resource: " + filePath ); //$NON-NLS-1$
|
||||||
|
|
||||||
try {
|
try {
|
||||||
monitor.subTask( String.format(
|
monitor.subTask( String.format(
|
||||||
Messages.WesnothProjectBuilder_19, filePath ) );
|
Messages.WesnothProjectBuilder_19, filePath ) );
|
||||||
|
|
||||||
List< String > defines = new ArrayList< String >( );
|
List< String > defines = new ArrayList< String >( );
|
||||||
// parse the core only if we don't have any macros file
|
// 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
|
// we use a single _MACROS_.cfg file for each project
|
||||||
PreprocessorUtils.getInstance( ).preprocessFile( file,
|
PreprocessorUtils.getInstance( ).preprocessFile( file,
|
||||||
macrosFilePath, defines );
|
macrosFilePath, defines );
|
||||||
monitor.worked( 5 );
|
monitor.worked( 5 );
|
||||||
|
|
||||||
// process the AST ( Abstract Syntax Tree ) to get info for the
|
// process the AST ( Abstract Syntax Tree ) to get info for the
|
||||||
// file
|
// file
|
||||||
monitor.subTask( String.format(
|
monitor.subTask( String.format(
|
||||||
Messages.WesnothProjectBuilder_22, filePath ) );
|
Messages.WesnothProjectBuilder_22, filePath ) );
|
||||||
|
|
||||||
WMLConfig config = projectCache_.getWMLConfig( filePath );
|
WMLConfig config = projectCache_.getWMLConfig( filePath );
|
||||||
SimpleWMLParser parser = new SimpleWMLParser( file, config,
|
SimpleWMLParser parser = new SimpleWMLParser( file, config,
|
||||||
projectCache_ );
|
projectCache_ );
|
||||||
parser.parse( );
|
parser.parse( );
|
||||||
|
|
||||||
monitor.worked( 10 );
|
monitor.worked( 10 );
|
||||||
|
@ -375,17 +375,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
|
|
||||||
@SuppressWarnings( "unused" )
|
@SuppressWarnings( "unused" )
|
||||||
private void runWMLLint( String installName, IProgressMonitor monitor,
|
private void runWMLLint( String installName, IProgressMonitor monitor,
|
||||||
IFile file )
|
IFile file )
|
||||||
{
|
{
|
||||||
monitor.subTask( String.format( "Running WMLlint on file %s ...",
|
monitor.subTask( String.format( "Running WMLlint on file %s ...",
|
||||||
file.getName( ) ) );
|
file.getName( ) ) );
|
||||||
ExternalToolInvoker tool = WMLTools.runWMLLint( installName, file
|
ExternalToolInvoker tool = WMLTools.runWMLLint( installName, file
|
||||||
.getLocation( ).toOSString( ), false, false );
|
.getLocation( ).toOSString( ), false, false );
|
||||||
tool.waitForTool( );
|
tool.waitForTool( );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file.deleteMarkers( Constants.MARKER_WMLLINT, false,
|
file.deleteMarkers( Constants.MARKER_WMLLINT, false,
|
||||||
IResource.DEPTH_INFINITE );
|
IResource.DEPTH_INFINITE );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
@ -407,17 +407,17 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( "unused" )
|
@SuppressWarnings( "unused" )
|
||||||
private void runWMLScope( String installName, IProgressMonitor monitor,
|
private void runWMLScope( String installName, IProgressMonitor monitor,
|
||||||
IFile file )
|
IFile file )
|
||||||
{
|
{
|
||||||
monitor.subTask( String.format( "Running WMLScope on file %s ...",
|
monitor.subTask( String.format( "Running WMLScope on file %s ...",
|
||||||
file.getName( ) ) );
|
file.getName( ) ) );
|
||||||
ExternalToolInvoker tool = WMLTools.runWMLScope( installName, file
|
ExternalToolInvoker tool = WMLTools.runWMLScope( installName, file
|
||||||
.getLocation( ).toOSString( ), false );
|
.getLocation( ).toOSString( ), false );
|
||||||
tool.waitForTool( );
|
tool.waitForTool( );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file.deleteMarkers( Constants.MARKER_WMLSCOPE, false,
|
file.deleteMarkers( Constants.MARKER_WMLSCOPE, false,
|
||||||
IResource.DEPTH_INFINITE );
|
IResource.DEPTH_INFINITE );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class WesnothProjectNature implements IProjectNature
|
||||||
int configured = 0;
|
int configured = 0;
|
||||||
for( int i = 0; i < commands.length; ++i ) {
|
for( int i = 0; i < commands.length; ++i ) {
|
||||||
if( commands[i].getBuilderName( ).equals(
|
if( commands[i].getBuilderName( ).equals(
|
||||||
Constants.BUIILDER_WESNOTH ) ) {
|
Constants.BUIILDER_WESNOTH ) ) {
|
||||||
wesnothConfigured = true;
|
wesnothConfigured = true;
|
||||||
configured++;
|
configured++;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class WesnothProjectNature implements IProjectNature
|
||||||
}
|
}
|
||||||
|
|
||||||
ICommand[] newCommands = new ICommand[commands.length
|
ICommand[] newCommands = new ICommand[commands.length
|
||||||
+ ( 2 - configured )];
|
+ ( 2 - configured )];
|
||||||
System.arraycopy( commands, 0, newCommands, 0, commands.length );
|
System.arraycopy( commands, 0, newCommands, 0, commands.length );
|
||||||
if( wesnothConfigured == false ) {
|
if( wesnothConfigured == false ) {
|
||||||
ICommand command = desc.newCommand( );
|
ICommand command = desc.newCommand( );
|
||||||
|
@ -69,13 +69,13 @@ public class WesnothProjectNature implements IProjectNature
|
||||||
ICommand[] commands = description.getBuildSpec( );
|
ICommand[] commands = description.getBuildSpec( );
|
||||||
for( int i = 0; i < commands.length; ++i ) {
|
for( int i = 0; i < commands.length; ++i ) {
|
||||||
if( commands[i].getBuilderName( ).equals(
|
if( commands[i].getBuilderName( ).equals(
|
||||||
Constants.BUIILDER_WESNOTH )
|
Constants.BUIILDER_WESNOTH )
|
||||||
|| commands[i].getBuilderName( ).equals(
|
|| commands[i].getBuilderName( ).equals(
|
||||||
Constants.BUILDER_XTEXT ) ) {
|
Constants.BUILDER_XTEXT ) ) {
|
||||||
ICommand[] newCommands = new ICommand[commands.length - 1];
|
ICommand[] newCommands = new ICommand[commands.length - 1];
|
||||||
System.arraycopy( commands, 0, newCommands, 0, i );
|
System.arraycopy( commands, 0, newCommands, 0, i );
|
||||||
System.arraycopy( commands, i + 1, newCommands, i,
|
System.arraycopy( commands, i + 1, newCommands, i,
|
||||||
commands.length - i - 1 );
|
commands.length - i - 1 );
|
||||||
description.setBuildSpec( newCommands );
|
description.setBuildSpec( newCommands );
|
||||||
project.setDescription( description, null );
|
project.setDescription( description, null );
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,26 +38,26 @@ public class WMLFormatter extends AbstractDeclarativeFormatter
|
||||||
|
|
||||||
// no space after '[' and '[/'
|
// no space after '[' and '[/'
|
||||||
c.setNoSpace( ).after(
|
c.setNoSpace( ).after(
|
||||||
f.getWMLTagAccess( ).getLeftSquareBracketKeyword_0( ) );
|
f.getWMLTagAccess( ).getLeftSquareBracketKeyword_0( ) );
|
||||||
c.setNoSpace( ).after(
|
c.setNoSpace( ).after(
|
||||||
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
|
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
|
||||||
|
|
||||||
// no space before and after ']'
|
// no space before and after ']'
|
||||||
c.setNoSpace( ).around(
|
c.setNoSpace( ).around(
|
||||||
f.getWMLTagAccess( ).getRightSquareBracketKeyword_3( ) );
|
f.getWMLTagAccess( ).getRightSquareBracketKeyword_3( ) );
|
||||||
c.setNoSpace( ).around(
|
c.setNoSpace( ).around(
|
||||||
f.getWMLTagAccess( ).getRightSquareBracketKeyword_7( ) );
|
f.getWMLTagAccess( ).getRightSquareBracketKeyword_7( ) );
|
||||||
|
|
||||||
// no space before and after the '=' in 'key=value'
|
// no space before and after the '=' in 'key=value'
|
||||||
c.setNoSpace( ).around( f.getWMLKeyAccess( ).getEqualsSignKeyword_1( ) );
|
c.setNoSpace( ).around( f.getWMLKeyAccess( ).getEqualsSignKeyword_1( ) );
|
||||||
|
|
||||||
// one indentation after tag ...
|
// one indentation after tag ...
|
||||||
c.setIndentationIncrement( ).before(
|
c.setIndentationIncrement( ).before(
|
||||||
f.getWMLTagAccess( ).getExpressionsAssignment_4( ) );
|
f.getWMLTagAccess( ).getExpressionsAssignment_4( ) );
|
||||||
|
|
||||||
// but get back the [/<tagname>]
|
// but get back the [/<tagname>]
|
||||||
c.setIndentationDecrement( ).before(
|
c.setIndentationDecrement( ).before(
|
||||||
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
|
f.getWMLTagAccess( ).getLeftSquareBracketSolidusKeyword_5( ) );
|
||||||
|
|
||||||
c.setLinewrap( 0, 1, 2 ).before( f.getSL_COMMENTRule( ) );
|
c.setLinewrap( 0, 1, 2 ).before( f.getSL_COMMENTRule( ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ public class ImportMapHandler extends AbstractHandler
|
||||||
IFolder selectedFolder = WorkspaceUtils.getSelectedFolder( );
|
IFolder selectedFolder = WorkspaceUtils.getSelectedFolder( );
|
||||||
if( selectedFolder == null ) {
|
if( selectedFolder == null ) {
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"no directory selected (importMapHandler)", //$NON-NLS-1$
|
"no directory selected (importMapHandler)", //$NON-NLS-1$
|
||||||
Messages.ImportMapHandler_1 );
|
Messages.ImportMapHandler_1 );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! selectedFolder.getName( ).equals( "maps" ) && //$NON-NLS-1$
|
if( ! selectedFolder.getName( ).equals( "maps" ) && //$NON-NLS-1$
|
||||||
GUIUtils.showMessageBox( Messages.ImportMapHandler_3,
|
GUIUtils.showMessageBox( Messages.ImportMapHandler_3,
|
||||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
|
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,15 @@ public class OpenMapInEditorHandler extends AbstractHandler
|
||||||
IFile selectedFile = WorkspaceUtils.getSelectedFile( );
|
IFile selectedFile = WorkspaceUtils.getSelectedFile( );
|
||||||
if( selectedFile == null ) {
|
if( selectedFile == null ) {
|
||||||
Logger.getInstance( ).log( "file null (open map handler)", //$NON-NLS-1$
|
Logger.getInstance( ).log( "file null (open map handler)", //$NON-NLS-1$
|
||||||
Messages.OpenMapInEditorHandler_1 );
|
Messages.OpenMapInEditorHandler_1 );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! selectedFile.getName( ).endsWith( ".map" ) ) //$NON-NLS-1$
|
if( ! selectedFile.getName( ).endsWith( ".map" ) ) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"non-map file selected: " + selectedFile.getName( ), //$NON-NLS-1$
|
"non-map file selected: " + selectedFile.getName( ), //$NON-NLS-1$
|
||||||
Messages.OpenMapInEditorHandler_4 );
|
Messages.OpenMapInEditorHandler_4 );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,35 +55,35 @@ public class ImportProjectPage extends WizardPageTemplate
|
||||||
};
|
};
|
||||||
|
|
||||||
projectPathField_ = new DirectoryFieldEditor( "project_path",
|
projectPathField_ = new DirectoryFieldEditor( "project_path",
|
||||||
"Directory to import:", container );
|
"Directory to import:", container );
|
||||||
projectPathField_.getTextControl( container ).addModifyListener(
|
projectPathField_.getTextControl( container ).addModifyListener(
|
||||||
listener );
|
listener );
|
||||||
|
|
||||||
Label lblNewLabel = new Label( container, SWT.NONE );
|
Label lblNewLabel = new Label( container, SWT.NONE );
|
||||||
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
lblNewLabel.setText( "Project Name:" );
|
lblNewLabel.setText( "Project Name:" );
|
||||||
|
|
||||||
txtProjectName_ = new Text( container, SWT.BORDER );
|
txtProjectName_ = new Text( container, SWT.BORDER );
|
||||||
txtProjectName_.setLayoutData( new GridData( SWT.FILL, SWT.TOP, true,
|
txtProjectName_.setLayoutData( new GridData( SWT.FILL, SWT.TOP, true,
|
||||||
false, 2, 1 ) );
|
false, 2, 1 ) );
|
||||||
txtProjectName_.addModifyListener( listener );
|
txtProjectName_.addModifyListener( listener );
|
||||||
|
|
||||||
Label lblWesnothInstall = new Label( container, SWT.NONE );
|
Label lblWesnothInstall = new Label( container, SWT.NONE );
|
||||||
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
lblWesnothInstall.setText( "Wesnoth install:" );
|
lblWesnothInstall.setText( "Wesnoth install:" );
|
||||||
|
|
||||||
cmbInstalls_ = new Combo( container, SWT.READ_ONLY );
|
cmbInstalls_ = new Combo( container, SWT.READ_ONLY );
|
||||||
cmbInstalls_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
cmbInstalls_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 2, 1 ) );
|
false, 2, 1 ) );
|
||||||
WesnothInstallsUtils.fillComboWithInstalls( cmbInstalls_ );
|
WesnothInstallsUtils.fillComboWithInstalls( cmbInstalls_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updatePageIsComplete( )
|
protected void updatePageIsComplete( )
|
||||||
{
|
{
|
||||||
setPageComplete( ! txtProjectName_.getText( ).isEmpty( )
|
setPageComplete( ! txtProjectName_.getText( ).isEmpty( )
|
||||||
&& new File( projectPathField_.getStringValue( ) ).exists( ) );
|
&& new File( projectPathField_.getStringValue( ) ).exists( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.wesnoth.projects.ProjectUtils;
|
||||||
import org.wesnoth.wizards.WizardTemplate;
|
import org.wesnoth.wizards.WizardTemplate;
|
||||||
|
|
||||||
public class ImportProjectWizard extends WizardTemplate implements
|
public class ImportProjectWizard extends WizardTemplate implements
|
||||||
IImportWizard
|
IImportWizard
|
||||||
{
|
{
|
||||||
private ImportProjectPage page0_;
|
private ImportProjectPage page0_;
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public class ImportProjectWizard extends WizardTemplate implements
|
||||||
public void run( IProgressMonitor monitor )
|
public void run( IProgressMonitor monitor )
|
||||||
{
|
{
|
||||||
ProjectUtils.createWesnothProject( page0_.getProjectName( ),
|
ProjectUtils.createWesnothProject( page0_.getProjectName( ),
|
||||||
page0_.getProjectPath( ),
|
page0_.getProjectPath( ),
|
||||||
page0_.getSelectedInstallName( ), monitor );
|
page0_.getSelectedInstallName( ), monitor );
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,12 +44,12 @@ public class SelectWesnothInstallDialog extends Dialog
|
||||||
|
|
||||||
Label lblWesnothInstall = new Label( composite, SWT.NONE );
|
Label lblWesnothInstall = new Label( composite, SWT.NONE );
|
||||||
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
lblWesnothInstall.setText( "Wesnoth Install:" );
|
lblWesnothInstall.setText( "Wesnoth Install:" );
|
||||||
|
|
||||||
cmbInstall_ = new Combo( composite, SWT.READ_ONLY );
|
cmbInstall_ = new Combo( composite, SWT.READ_ONLY );
|
||||||
GridData gd_cmbInstall_ = new GridData( SWT.FILL, SWT.CENTER, true,
|
GridData gd_cmbInstall_ = new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_cmbInstall_.widthHint = 163;
|
gd_cmbInstall_.widthHint = 163;
|
||||||
cmbInstall_.setLayoutData( gd_cmbInstall_ );
|
cmbInstall_.setLayoutData( gd_cmbInstall_ );
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class WesnothInstallsUtils
|
||||||
List< WesnothInstall > installsList = new ArrayList< WesnothInstall >( );
|
List< WesnothInstall > installsList = new ArrayList< WesnothInstall >( );
|
||||||
// unpack installs
|
// unpack installs
|
||||||
String[] installs = Preferences.getString(
|
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 ) {
|
for( String str: installs ) {
|
||||||
if( str.isEmpty( ) ) {
|
if( str.isEmpty( ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -49,7 +49,7 @@ public class WesnothInstallsUtils
|
||||||
|
|
||||||
if( tokens.length != 2 ) {
|
if( tokens.length != 2 ) {
|
||||||
Logger.getInstance( ).logError(
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class WesnothInstallsUtils
|
||||||
installs.append( install.getVersion( ) );
|
installs.append( install.getVersion( ) );
|
||||||
}
|
}
|
||||||
Preferences.getPreferences( ).setValue( Constants.P_INST_INSTALL_LIST,
|
Preferences.getPreferences( ).setValue( Constants.P_INST_INSTALL_LIST,
|
||||||
installs.toString( ) );
|
installs.toString( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,7 @@ public class WesnothInstallsUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
return getInstallNameForResource( ResourcesPlugin.getWorkspace( )
|
return getInstallNameForResource( ResourcesPlugin.getWorkspace( )
|
||||||
.getRoot( ).findMember( resourcePath ) );
|
.getRoot( ).findMember( resourcePath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +113,7 @@ public class WesnothInstallsUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProjectUtils.getCacheForProject( resource.getProject( ) )
|
return ProjectUtils.getCacheForProject( resource.getProject( ) )
|
||||||
.getInstallName( );
|
.getInstallName( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,14 +125,14 @@ public class WesnothInstallsUtils
|
||||||
* The new install name
|
* The new install name
|
||||||
*/
|
*/
|
||||||
public static void setInstallNameForResource( IResource resource,
|
public static void setInstallNameForResource( IResource resource,
|
||||||
String newInstallName )
|
String newInstallName )
|
||||||
{
|
{
|
||||||
if( resource == null ) {
|
if( resource == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectUtils.getCacheForProject( resource.getProject( ) )
|
ProjectUtils.getCacheForProject( resource.getProject( ) )
|
||||||
.setInstallName( newInstallName );
|
.setInstallName( newInstallName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@ public class WesnothInstallsUtils
|
||||||
|
|
||||||
// select the first if there is no other selected
|
// select the first if there is no other selected
|
||||||
if( comboBox.getSelectionIndex( ) == - 1
|
if( comboBox.getSelectionIndex( ) == - 1
|
||||||
&& comboBox.getItemCount( ) > 0 ) {
|
&& comboBox.getItemCount( ) > 0 ) {
|
||||||
comboBox.select( 0 );
|
comboBox.select( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,10 +187,10 @@ public class WesnothInstallsUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GUIUtils
|
if( GUIUtils
|
||||||
.showMessageBox( String.format(
|
.showMessageBox( String.format(
|
||||||
Messages.WesnothInstallsUtils_1, resource
|
Messages.WesnothInstallsUtils_1, resource
|
||||||
.getProject( ).getName( ) ),
|
.getProject( ).getName( ) ),
|
||||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
|
SWT.ICON_QUESTION | SWT.YES | SWT.NO ) == SWT.NO ) {
|
||||||
return false; // no hope :(
|
return false; // no hope :(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class DoubleInputDialog extends Dialog
|
||||||
private String val1String = "", val2String = ""; //$NON-NLS-1$ //$NON-NLS-2$
|
private String val1String = "", val2String = ""; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
public DoubleInputDialog( Shell parentShell, String value1String,
|
public DoubleInputDialog( Shell parentShell, String value1String,
|
||||||
String value2String )
|
String value2String )
|
||||||
{
|
{
|
||||||
super( parentShell );
|
super( parentShell );
|
||||||
setShellStyle( SWT.DIALOG_TRIM );
|
setShellStyle( SWT.DIALOG_TRIM );
|
||||||
|
@ -53,21 +53,21 @@ public class DoubleInputDialog extends Dialog
|
||||||
lblValue1.setText( val1String );
|
lblValue1.setText( val1String );
|
||||||
Label label = new Label( container, SWT.NONE );
|
Label label = new Label( container, SWT.NONE );
|
||||||
label.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false, false,
|
label.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false, false,
|
||||||
1, 1 ) );
|
1, 1 ) );
|
||||||
|
|
||||||
txtValue1_ = new Text( container, SWT.BORDER );
|
txtValue1_ = new Text( container, SWT.BORDER );
|
||||||
txtValue1_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
txtValue1_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
|
|
||||||
lblValue2 = new Label( container, SWT.NONE );
|
lblValue2 = new Label( container, SWT.NONE );
|
||||||
lblValue2.setText( val2String );
|
lblValue2.setText( val2String );
|
||||||
Label label_3 = new Label( container, SWT.NONE );
|
Label label_3 = new Label( container, SWT.NONE );
|
||||||
label_3.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
label_3.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
|
|
||||||
txtValue2_ = new Text( container, SWT.BORDER );
|
txtValue2_ = new Text( container, SWT.BORDER );
|
||||||
txtValue2_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
txtValue2_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,9 @@ public class DoubleInputDialog extends Dialog
|
||||||
protected void createButtonsForButtonBar( Composite parent )
|
protected void createButtonsForButtonBar( Composite parent )
|
||||||
{
|
{
|
||||||
createButton( parent, IDialogConstants.OK_ID,
|
createButton( parent, IDialogConstants.OK_ID,
|
||||||
IDialogConstants.OK_LABEL, true );
|
IDialogConstants.OK_LABEL, true );
|
||||||
createButton( parent, IDialogConstants.CANCEL_ID,
|
createButton( parent, IDialogConstants.CANCEL_ID,
|
||||||
IDialogConstants.CANCEL_LABEL, false );
|
IDialogConstants.CANCEL_LABEL, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class RegexStringFieldEditor extends StringFieldEditor
|
||||||
* doesn't match the regex
|
* doesn't match the regex
|
||||||
*/
|
*/
|
||||||
public RegexStringFieldEditor( String name, String labelText, String regex,
|
public RegexStringFieldEditor( String name, String labelText, String regex,
|
||||||
String errorMessage, Composite parent )
|
String errorMessage, Composite parent )
|
||||||
{
|
{
|
||||||
super( name, labelText, parent );
|
super( name, labelText, parent );
|
||||||
regex_ = regex;
|
regex_ = regex;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
|
|
||||||
public abstract class AbstractPreferencePage extends FieldEditorPreferencePage
|
public abstract class AbstractPreferencePage extends FieldEditorPreferencePage
|
||||||
implements IWorkbenchPreferencePage
|
implements IWorkbenchPreferencePage
|
||||||
{
|
{
|
||||||
public AbstractPreferencePage( int style )
|
public AbstractPreferencePage( int style )
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ public abstract class AbstractPreferencePage extends FieldEditorPreferencePage
|
||||||
protected void addField( FieldEditor editor, String tooltip )
|
protected void addField( FieldEditor editor, String tooltip )
|
||||||
{
|
{
|
||||||
editor.getLabelControl( getFieldEditorParent( ) ).setToolTipText(
|
editor.getLabelControl( getFieldEditorParent( ) ).setToolTipText(
|
||||||
tooltip );
|
tooltip );
|
||||||
super.addField( editor );
|
super.addField( editor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,21 +53,21 @@ public class AddonUploadPreferencePage extends AbstractPreferencePage
|
||||||
protected void createFieldEditors( )
|
protected void createFieldEditors( )
|
||||||
{
|
{
|
||||||
addField(
|
addField(
|
||||||
new StringFieldEditor( Constants.P_WAU_PASSWORD,
|
new StringFieldEditor( Constants.P_WAU_PASSWORD,
|
||||||
Messages.AddonUploadPreferencePage_11,
|
Messages.AddonUploadPreferencePage_11,
|
||||||
getFieldEditorParent( ) ),
|
getFieldEditorParent( ) ),
|
||||||
Messages.AddonUploadPreferencePage_12 );
|
Messages.AddonUploadPreferencePage_12 );
|
||||||
addField( new BooleanFieldEditor( Constants.P_WAU_VERBOSE,
|
addField( new BooleanFieldEditor( Constants.P_WAU_VERBOSE,
|
||||||
Messages.AddonUploadPreferencePage_13, 1,
|
Messages.AddonUploadPreferencePage_13, 1,
|
||||||
getFieldEditorParent( ) ) );
|
getFieldEditorParent( ) ) );
|
||||||
|
|
||||||
addField(
|
addField(
|
||||||
new RegexStringFieldEditor( Constants.P_WAU_ADDRESS,
|
new RegexStringFieldEditor( Constants.P_WAU_ADDRESS,
|
||||||
Messages.AddonUploadPreferencePage_14,
|
Messages.AddonUploadPreferencePage_14,
|
||||||
Messages.AddonUploadPreferencePage_15,
|
Messages.AddonUploadPreferencePage_15,
|
||||||
Messages.AddonUploadPreferencePage_16,
|
Messages.AddonUploadPreferencePage_16,
|
||||||
getFieldEditorParent( ) ),
|
getFieldEditorParent( ) ),
|
||||||
Messages.AddonUploadPreferencePage_17 );
|
Messages.AddonUploadPreferencePage_17 );
|
||||||
|
|
||||||
StringBuilder ports = new StringBuilder( );
|
StringBuilder ports = new StringBuilder( );
|
||||||
StringBuilder portsRegex = new StringBuilder( );
|
StringBuilder portsRegex = new StringBuilder( );
|
||||||
|
@ -75,20 +75,20 @@ public class AddonUploadPreferencePage extends AbstractPreferencePage
|
||||||
for( Entry< String, String > item: ADDON_SERVER_PORTS.entrySet( ) ) {
|
for( Entry< String, String > item: ADDON_SERVER_PORTS.entrySet( ) ) {
|
||||||
portsRegex.append( item.getKey( ) + "|" ); //$NON-NLS-1$
|
portsRegex.append( item.getKey( ) + "|" ); //$NON-NLS-1$
|
||||||
ports.append( String.format(
|
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.deleteCharAt( portsRegex.length( ) - 1 );
|
||||||
portsRegex.append( ")*" ); //$NON-NLS-1$
|
portsRegex.append( ")*" ); //$NON-NLS-1$
|
||||||
|
|
||||||
// System.out.println(portsRegex.toString());
|
// System.out.println(portsRegex.toString());
|
||||||
addField(
|
addField(
|
||||||
new RegexStringFieldEditor( Constants.P_WAU_PORT,
|
new RegexStringFieldEditor( Constants.P_WAU_PORT,
|
||||||
Messages.AddonUploadPreferencePage_22,
|
Messages.AddonUploadPreferencePage_22,
|
||||||
portsRegex.toString( ),
|
portsRegex.toString( ),
|
||||||
Messages.AddonUploadPreferencePage_23,
|
Messages.AddonUploadPreferencePage_23,
|
||||||
getFieldEditorParent( ) ),
|
getFieldEditorParent( ) ),
|
||||||
Messages.AddonUploadPreferencePage_24 );
|
Messages.AddonUploadPreferencePage_24 );
|
||||||
addField( new LabelFieldEditor( Messages.AddonUploadPreferencePage_25
|
addField( new LabelFieldEditor( Messages.AddonUploadPreferencePage_25
|
||||||
+ ports.toString( ), getFieldEditorParent( ) ) );
|
+ ports.toString( ), getFieldEditorParent( ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ public class AdvancedPreferencePage extends AbstractPreferencePage
|
||||||
protected void createFieldEditors( )
|
protected void createFieldEditors( )
|
||||||
{
|
{
|
||||||
addField( new BooleanFieldEditor( Constants.P_NO_TERRAIN_GFX,
|
addField( new BooleanFieldEditor( Constants.P_NO_TERRAIN_GFX,
|
||||||
Messages.AdvancedPreferencePage_1,
|
Messages.AdvancedPreferencePage_1,
|
||||||
BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent( ) ),
|
BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent( ) ),
|
||||||
Messages.AdvancedPreferencePage_2 );
|
Messages.AdvancedPreferencePage_2 );
|
||||||
|
|
||||||
addField( new BooleanFieldEditor( Constants.P_WML_VALIDATION,
|
addField( new BooleanFieldEditor( Constants.P_WML_VALIDATION,
|
||||||
"WML Validation, parent", BooleanFieldEditor.SEPARATE_LABEL,
|
"WML Validation, parent", BooleanFieldEditor.SEPARATE_LABEL,
|
||||||
getFieldEditorParent( ) ),
|
getFieldEditorParent( ) ),
|
||||||
"If checked, the WML Editor will validate some of the "
|
"If checked, the WML Editor will validate some of the "
|
||||||
+ "written WML to check for semantic errors." );
|
+ "written WML to check for semantic errors." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class Preferences extends AbstractPreferenceInitializer
|
||||||
public static void initializeToDefault( )
|
public static void initializeToDefault( )
|
||||||
{
|
{
|
||||||
IPreferenceStore store = WesnothPlugin.getDefault( )
|
IPreferenceStore store = WesnothPlugin.getDefault( )
|
||||||
.getPreferenceStore( );
|
.getPreferenceStore( );
|
||||||
// general settings
|
// general settings
|
||||||
store.setDefault( Constants.P_WESNOTH_EXEC_PATH, "" ); //$NON-NLS-1$
|
store.setDefault( Constants.P_WESNOTH_EXEC_PATH, "" ); //$NON-NLS-1$
|
||||||
store.setDefault( Constants.P_WESNOTH_WORKING_DIR, "" ); //$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 )
|
public static void setDefaultInstallName( String newInstallName )
|
||||||
{
|
{
|
||||||
getPreferences( ).setValue( Constants.P_INST_DEFAULT_INSTALL,
|
getPreferences( ).setValue( Constants.P_INST_DEFAULT_INSTALL,
|
||||||
newInstallName );
|
newInstallName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,7 +251,7 @@ public class Preferences extends AbstractPreferenceInitializer
|
||||||
public String getUserDir( )
|
public String getUserDir( )
|
||||||
{
|
{
|
||||||
return getString( installPrefix_ + Constants.P_WESNOTH_USER_DIR )
|
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( )
|
public String getWorkingDir( )
|
||||||
{
|
{
|
||||||
return getString( installPrefix_ + Constants.P_WESNOTH_WORKING_DIR )
|
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( )
|
public String getWMLToolsDir( )
|
||||||
{
|
{
|
||||||
return getString( installPrefix_ + Constants.P_WESNOTH_WMLTOOLS_DIR )
|
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( )
|
public String getWesnothExecutablePath( )
|
||||||
{
|
{
|
||||||
return getString( installPrefix_ + Constants.P_WESNOTH_EXEC_PATH )
|
return getString( installPrefix_ + Constants.P_WESNOTH_EXEC_PATH )
|
||||||
.replace( '\\', '/' );
|
.replace( '\\', '/' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,31 +30,31 @@ public class WMLToolsPreferencePage extends AbstractPreferencePage
|
||||||
protected void createFieldEditors( )
|
protected void createFieldEditors( )
|
||||||
{
|
{
|
||||||
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_1,
|
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_1,
|
||||||
getFieldEditorParent( ) ) );
|
getFieldEditorParent( ) ) );
|
||||||
addField( new BooleanFieldEditor( Constants.P_WMLINDENT_DRYRUN,
|
addField( new BooleanFieldEditor( Constants.P_WMLINDENT_DRYRUN,
|
||||||
Messages.WMLToolsPreferencePage_2, 1, getFieldEditorParent( ) ) );
|
Messages.WMLToolsPreferencePage_2, 1, getFieldEditorParent( ) ) );
|
||||||
addField( new BooleanFieldEditor( Constants.P_WMLINDENT_VERBOSE,
|
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( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_5,
|
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_5,
|
||||||
getFieldEditorParent( ) ) );
|
getFieldEditorParent( ) ) );
|
||||||
addField( new ScaleFieldEditor( Constants.P_WMLSCOPE_VERBOSE_LEVEL,
|
addField( new ScaleFieldEditor( Constants.P_WMLSCOPE_VERBOSE_LEVEL,
|
||||||
Messages.WMLToolsPreferencePage_6, getFieldEditorParent( ), 0,
|
Messages.WMLToolsPreferencePage_6, getFieldEditorParent( ), 0,
|
||||||
2, 1, 1 ) );
|
2, 1, 1 ) );
|
||||||
addField( new BooleanFieldEditor( Constants.P_WMLSCOPE_COLLISIONS,
|
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( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_9,
|
addField( new LabelFieldEditor( Messages.WMLToolsPreferencePage_9,
|
||||||
getFieldEditorParent( ) ) );
|
getFieldEditorParent( ) ) );
|
||||||
addField( new BooleanFieldEditor( Constants.P_WMLLINT_DRYRUN,
|
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,
|
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,
|
addField( new ScaleFieldEditor( Constants.P_WMLLINT_VERBOSE_LEVEL,
|
||||||
Messages.WMLToolsPreferencePage_12, getFieldEditorParent( ), 0,
|
Messages.WMLToolsPreferencePage_12, getFieldEditorParent( ), 0,
|
||||||
3, 1, 1 ) );
|
3, 1, 1 ) );
|
||||||
addField( new LabelFieldEditor( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
|
addField( new LabelFieldEditor( "", getFieldEditorParent( ) ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,50 +113,50 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
};
|
};
|
||||||
|
|
||||||
wesnothExecutableField_ = new FileFieldEditor( "", //$NON-NLS-1$
|
wesnothExecutableField_ = new FileFieldEditor( "", //$NON-NLS-1$
|
||||||
Messages.WesnothPreferencesPage_5, getFieldEditorParent( ) );
|
Messages.WesnothPreferencesPage_5, getFieldEditorParent( ) );
|
||||||
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
|
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
|
||||||
.addFocusListener( new FocusListener( ) {
|
.addFocusListener( new FocusListener( ) {
|
||||||
@Override
|
@Override
|
||||||
public void focusLost( FocusEvent e )
|
public void focusLost( FocusEvent e )
|
||||||
{
|
{
|
||||||
checkState( );
|
checkState( );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void focusGained( FocusEvent e )
|
public void focusGained( FocusEvent e )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
|
wesnothExecutableField_.getTextControl( getFieldEditorParent( ) )
|
||||||
.addModifyListener( new ModifyListener( ) {
|
.addModifyListener( new ModifyListener( ) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void modifyText( ModifyEvent e )
|
public void modifyText( ModifyEvent e )
|
||||||
{
|
{
|
||||||
checkState( );
|
checkState( );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
addField( wesnothExecutableField_, Messages.WesnothPreferencesPage_6 );
|
addField( wesnothExecutableField_, Messages.WesnothPreferencesPage_6 );
|
||||||
|
|
||||||
wesnothWorkingDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
wesnothWorkingDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
||||||
Messages.WesnothPreferencesPage_7, getFieldEditorParent( ) );
|
Messages.WesnothPreferencesPage_7, getFieldEditorParent( ) );
|
||||||
wesnothWorkingDirField_.getTextControl( getFieldEditorParent( ) )
|
wesnothWorkingDirField_.getTextControl( getFieldEditorParent( ) )
|
||||||
.addModifyListener( listener );
|
.addModifyListener( listener );
|
||||||
addField( wesnothWorkingDirField_, Messages.WesnothPreferencesPage_8 );
|
addField( wesnothWorkingDirField_, Messages.WesnothPreferencesPage_8 );
|
||||||
|
|
||||||
wesnothUserDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
wesnothUserDirField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
||||||
Messages.WesnothPreferencesPage_9, getFieldEditorParent( ) );
|
Messages.WesnothPreferencesPage_9, getFieldEditorParent( ) );
|
||||||
addField( wesnothUserDirField_, Messages.WesnothPreferencesPage_10 );
|
addField( wesnothUserDirField_, Messages.WesnothPreferencesPage_10 );
|
||||||
|
|
||||||
wmlToolsField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
wmlToolsField_ = new DirectoryFieldEditor( "", //$NON-NLS-1$
|
||||||
Messages.WesnothPreferencesPage_11, getFieldEditorParent( ) );
|
Messages.WesnothPreferencesPage_11, getFieldEditorParent( ) );
|
||||||
addField( wmlToolsField_, Messages.WesnothPreferencesPage_12 );
|
addField( wmlToolsField_, Messages.WesnothPreferencesPage_12 );
|
||||||
|
|
||||||
addField( new FileFieldEditor( Constants.P_PYTHON_PATH,
|
addField( new FileFieldEditor( Constants.P_PYTHON_PATH,
|
||||||
Messages.WesnothPreferencesPage_13, getFieldEditorParent( ) ) );
|
Messages.WesnothPreferencesPage_13, getFieldEditorParent( ) ) );
|
||||||
|
|
||||||
addField( new LabelFieldEditor( Messages.WesnothPreferencesPage_14,
|
addField( new LabelFieldEditor( Messages.WesnothPreferencesPage_14,
|
||||||
getFieldEditorParent( ) ) );
|
getFieldEditorParent( ) ) );
|
||||||
|
|
||||||
// update the default
|
// update the default
|
||||||
updateInterface( installs_.get( Preferences.getDefaultInstallName( ) ) );
|
updateInterface( installs_.get( Preferences.getDefaultInstallName( ) ) );
|
||||||
|
@ -169,11 +169,11 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
Composite installComposite = new Composite( parent, 0 );
|
Composite installComposite = new Composite( parent, 0 );
|
||||||
installComposite.setLayout( new GridLayout( 2, false ) );
|
installComposite.setLayout( new GridLayout( 2, false ) );
|
||||||
installComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
|
installComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
|
||||||
true, 1, 1 ) );
|
true, 1, 1 ) );
|
||||||
|
|
||||||
// create install manager
|
// create install manager
|
||||||
installsTableViewer_ = new TableViewer( installComposite, SWT.BORDER
|
installsTableViewer_ = new TableViewer( installComposite, SWT.BORDER
|
||||||
| SWT.FULL_SELECTION );
|
| SWT.FULL_SELECTION );
|
||||||
installsTable_ = installsTableViewer_.getTable( );
|
installsTable_ = installsTableViewer_.getTable( );
|
||||||
installsTable_.addMouseListener( new MouseAdapter( ) {
|
installsTable_.addMouseListener( new MouseAdapter( ) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,19 +184,19 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
} );
|
} );
|
||||||
installsTable_.setHeaderVisible( true );
|
installsTable_.setHeaderVisible( true );
|
||||||
installsTable_.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
|
installsTable_.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
|
||||||
true, 1, 1 ) );
|
true, 1, 1 ) );
|
||||||
|
|
||||||
TableColumn tblclmnName = new TableColumn( installsTable_, SWT.NONE );
|
TableColumn tblclmnName = new TableColumn( installsTable_, SWT.NONE );
|
||||||
tblclmnName.setWidth( 150 );
|
tblclmnName.setWidth( 150 );
|
||||||
tblclmnName.setText( Messages.WesnothInstallsPage_5 );
|
tblclmnName.setText( Messages.WesnothInstallsPage_5 );
|
||||||
|
|
||||||
TableColumn tblclmnWesnothVersion = new TableColumn( installsTable_,
|
TableColumn tblclmnWesnothVersion = new TableColumn( installsTable_,
|
||||||
SWT.NONE );
|
SWT.NONE );
|
||||||
tblclmnWesnothVersion.setWidth( 70 );
|
tblclmnWesnothVersion.setWidth( 70 );
|
||||||
tblclmnWesnothVersion.setText( Messages.WesnothInstallsPage_6 );
|
tblclmnWesnothVersion.setText( Messages.WesnothInstallsPage_6 );
|
||||||
|
|
||||||
TableColumn tblclmnIsDefault = new TableColumn( installsTable_,
|
TableColumn tblclmnIsDefault = new TableColumn( installsTable_,
|
||||||
SWT.NONE );
|
SWT.NONE );
|
||||||
tblclmnIsDefault.setWidth( 70 );
|
tblclmnIsDefault.setWidth( 70 );
|
||||||
tblclmnIsDefault.setText( Messages.WesnothInstallsPage_7 );
|
tblclmnIsDefault.setText( Messages.WesnothInstallsPage_7 );
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
fl_composite.marginHeight = 10;
|
fl_composite.marginHeight = 10;
|
||||||
composite.setLayout( fl_composite );
|
composite.setLayout( fl_composite );
|
||||||
GridData gd_composite = new GridData( SWT.FILL, SWT.CENTER, true,
|
GridData gd_composite = new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_composite.widthHint = 80;
|
gd_composite.widthHint = 80;
|
||||||
composite.setLayoutData( gd_composite );
|
composite.setLayoutData( gd_composite );
|
||||||
|
|
||||||
|
@ -251,14 +251,14 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
txtInstallName_.setText( Messages.WesnothInstallsPage_12 );
|
txtInstallName_.setText( Messages.WesnothInstallsPage_12 );
|
||||||
txtInstallName_.setEditable( false );
|
txtInstallName_.setEditable( false );
|
||||||
txtInstallName_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtInstallName_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
txtInstallName_.addVerifyListener( new VerifyListener( ) {
|
txtInstallName_.addVerifyListener( new VerifyListener( ) {
|
||||||
|
|
||||||
private boolean isCharOk( char character )
|
private boolean isCharOk( char character )
|
||||||
{
|
{
|
||||||
return ( character >= 'a' && character <= 'z' )
|
return ( character >= 'a' && character <= 'z' )
|
||||||
|| ( character >= 'A' && character <= 'Z' )
|
|| ( character >= 'A' && character <= 'Z' )
|
||||||
|| ( character >= '0' && character <= '9' );
|
|| ( character >= '0' && character <= '9' );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -276,9 +276,9 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e.doit = isCharOk( e.character ) || e.keyCode == SWT.BS
|
e.doit = isCharOk( e.character ) || e.keyCode == SWT.BS
|
||||||
|| e.keyCode == SWT.ARROW_LEFT
|
|| e.keyCode == SWT.ARROW_LEFT
|
||||||
|| e.keyCode == SWT.ARROW_RIGHT
|
|| e.keyCode == SWT.ARROW_RIGHT
|
||||||
|| e.keyCode == SWT.DEL;
|
|| e.keyCode == SWT.DEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -288,7 +288,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
|
|
||||||
cmbVersion_ = new Combo( parent, SWT.READ_ONLY );
|
cmbVersion_ = new Combo( parent, SWT.READ_ONLY );
|
||||||
cmbVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
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( "1.9.x" ); //$NON-NLS-1$
|
||||||
cmbVersion_.add( "trunk" ); //$NON-NLS-1$
|
cmbVersion_.add( "trunk" ); //$NON-NLS-1$
|
||||||
|
@ -322,23 +322,24 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
// unset all settings.
|
// unset all settings.
|
||||||
IPreferenceStore prefs = Preferences.getPreferences( );
|
IPreferenceStore prefs = Preferences.getPreferences( );
|
||||||
String installPrefix = Preferences.getInstallPrefix( install
|
String installPrefix = Preferences.getInstallPrefix( install
|
||||||
.getName( ) );
|
.getName( ) );
|
||||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_EXEC_PATH );
|
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_EXEC_PATH );
|
||||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_USER_DIR );
|
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_USER_DIR );
|
||||||
prefs.setToDefault( installPrefix
|
prefs.setToDefault( installPrefix
|
||||||
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
|
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
|
||||||
prefs.setToDefault( installPrefix + Constants.P_WESNOTH_WORKING_DIR );
|
prefs
|
||||||
|
.setToDefault( installPrefix + Constants.P_WESNOTH_WORKING_DIR );
|
||||||
|
|
||||||
// unset the default install if this was that
|
// unset the default install if this was that
|
||||||
// and select another one (the first) - if any - as default
|
// and select another one (the first) - if any - as default
|
||||||
if( install.getName( )
|
if( install.getName( )
|
||||||
.equals( Preferences.getDefaultInstallName( ) ) ) {
|
.equals( Preferences.getDefaultInstallName( ) ) ) {
|
||||||
Preferences.setDefaultInstallName( "" ); //$NON-NLS-1$
|
Preferences.setDefaultInstallName( "" ); //$NON-NLS-1$
|
||||||
|
|
||||||
if( ! installs_.isEmpty( ) ) {
|
if( ! installs_.isEmpty( ) ) {
|
||||||
// get the first item from the iterator
|
// get the first item from the iterator
|
||||||
Iterator< WesnothInstall > itor = installs_.values( )
|
Iterator< WesnothInstall > itor = installs_.values( )
|
||||||
.iterator( );
|
.iterator( );
|
||||||
setInstallAsDefault( itor.next( ) );
|
setInstallAsDefault( itor.next( ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,8 +371,8 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
cmbVersion_.setText( install == null ? "": install.getVersion( ) ); //$NON-NLS-1$
|
cmbVersion_.setText( install == null ? "": install.getVersion( ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
setFieldsPreferenceName(
|
setFieldsPreferenceName(
|
||||||
install == null ? "": Preferences.getInstallPrefix( install.getName( ) ), //$NON-NLS-1$
|
install == null ? "": Preferences.getInstallPrefix( install.getName( ) ), //$NON-NLS-1$
|
||||||
true );
|
true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -383,19 +384,19 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
* True to load the current stored preference
|
* True to load the current stored preference
|
||||||
*/
|
*/
|
||||||
private void setFieldsPreferenceName( String installPrefix,
|
private void setFieldsPreferenceName( String installPrefix,
|
||||||
boolean loadPreferences )
|
boolean loadPreferences )
|
||||||
{
|
{
|
||||||
wesnothExecutableField_.setPreferenceName( installPrefix
|
wesnothExecutableField_.setPreferenceName( installPrefix
|
||||||
+ Constants.P_WESNOTH_EXEC_PATH );
|
+ Constants.P_WESNOTH_EXEC_PATH );
|
||||||
|
|
||||||
wesnothUserDirField_.setPreferenceName( installPrefix
|
wesnothUserDirField_.setPreferenceName( installPrefix
|
||||||
+ Constants.P_WESNOTH_USER_DIR );
|
+ Constants.P_WESNOTH_USER_DIR );
|
||||||
|
|
||||||
wesnothWorkingDirField_.setPreferenceName( installPrefix
|
wesnothWorkingDirField_.setPreferenceName( installPrefix
|
||||||
+ Constants.P_WESNOTH_WORKING_DIR );
|
+ Constants.P_WESNOTH_WORKING_DIR );
|
||||||
|
|
||||||
wmlToolsField_.setPreferenceName( installPrefix
|
wmlToolsField_.setPreferenceName( installPrefix
|
||||||
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
|
+ Constants.P_WESNOTH_WMLTOOLS_DIR );
|
||||||
|
|
||||||
if( loadPreferences ) {
|
if( loadPreferences ) {
|
||||||
wesnothUserDirField_.setStringValue( "" ); //$NON-NLS-1$
|
wesnothUserDirField_.setStringValue( "" ); //$NON-NLS-1$
|
||||||
|
@ -421,12 +422,12 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
String wesnothExecName = new File( wesnothExec ).getName( );
|
String wesnothExecName = new File( wesnothExec ).getName( );
|
||||||
|
|
||||||
if( wesnothWorkingDirField_.getStringValue( ).isEmpty( )
|
if( wesnothWorkingDirField_.getStringValue( ).isEmpty( )
|
||||||
&& ! wesnothExec.isEmpty( )
|
&& ! wesnothExec.isEmpty( )
|
||||||
&& new File( wesnothExec.substring( 0,
|
&& new File( wesnothExec.substring( 0,
|
||||||
wesnothExec.lastIndexOf( wesnothExecName ) ) )
|
wesnothExec.lastIndexOf( wesnothExecName ) ) )
|
||||||
.exists( ) ) {
|
.exists( ) ) {
|
||||||
wesnothWorkingDirField_.setStringValue( wesnothExec.substring(
|
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 >( );
|
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
||||||
params.add( new 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( )
|
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
|
||||||
.getProcessedTemplate( os + "_exec", params ) ), //$NON-NLS-1$
|
.getProcessedTemplate( os + "_exec", params ) ), //$NON-NLS-1$
|
||||||
wesnothExecutableField_ );
|
wesnothExecutableField_ );
|
||||||
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
|
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
|
||||||
.getProcessedTemplate( os + "_data", params ) ), //$NON-NLS-1$
|
.getProcessedTemplate( os + "_data", params ) ), //$NON-NLS-1$
|
||||||
wesnothWorkingDirField_ );
|
wesnothWorkingDirField_ );
|
||||||
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
|
testPaths( StringUtils.getLines( TemplateProvider.getInstance( )
|
||||||
.getProcessedTemplate( os + "_user", params ) ), //$NON-NLS-1$
|
.getProcessedTemplate( os + "_user", params ) ), //$NON-NLS-1$
|
||||||
wesnothUserDirField_ );
|
wesnothUserDirField_ );
|
||||||
|
|
||||||
// guess the working dir based on executable's path
|
// guess the working dir based on executable's path
|
||||||
Text textControl = wesnothWorkingDirField_
|
Text textControl = wesnothWorkingDirField_
|
||||||
.getTextControl( getFieldEditorParent( ) );
|
.getTextControl( getFieldEditorParent( ) );
|
||||||
|
|
||||||
String workingDirValue = wesnothWorkingDirField_.getStringValue( );
|
String workingDirValue = wesnothWorkingDirField_.getStringValue( );
|
||||||
String wesnothExecValue = wesnothExecutableField_.getStringValue( );
|
String wesnothExecValue = wesnothExecutableField_.getStringValue( );
|
||||||
|
|
||||||
if( workingDirValue.isEmpty( )
|
if( workingDirValue.isEmpty( )
|
||||||
&& ! wesnothExecValue.isEmpty( )
|
&& ! wesnothExecValue.isEmpty( )
|
||||||
&& new File(
|
&& new File(
|
||||||
wesnothExecValue.substring( 0, wesnothExecValue
|
wesnothExecValue.substring( 0, wesnothExecValue
|
||||||
.lastIndexOf( new File( wesnothExecValue )
|
.lastIndexOf( new File( wesnothExecValue )
|
||||||
.getName( ) ) ) ).exists( ) ) {
|
.getName( ) ) ) ).exists( ) ) {
|
||||||
textControl.setText( wesnothExecValue.substring( 0,
|
textControl.setText( wesnothExecValue.substring( 0,
|
||||||
wesnothExecValue.lastIndexOf( new File( wesnothExecValue )
|
wesnothExecValue.lastIndexOf( new File( wesnothExecValue )
|
||||||
.getName( ) ) ) );
|
.getName( ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// guess the wmltools path
|
// guess the wmltools path
|
||||||
if( wmlToolsField_.getStringValue( ).isEmpty( )
|
if( wmlToolsField_.getStringValue( ).isEmpty( )
|
||||||
&& ! workingDirValue.isEmpty( ) ) {
|
&& ! workingDirValue.isEmpty( ) ) {
|
||||||
String path = workingDirValue + "/data/tools"; //$NON-NLS-1$
|
String path = workingDirValue + "/data/tools"; //$NON-NLS-1$
|
||||||
if( testWMLToolsPath( path ) ) {
|
if( testWMLToolsPath( path ) ) {
|
||||||
wmlToolsField_.setStringValue( path );
|
wmlToolsField_.setStringValue( path );
|
||||||
|
@ -509,7 +510,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
for( String tool: wmlToolsList_ ) {
|
for( String tool: wmlToolsList_ ) {
|
||||||
if( ! ( new File( path + IPath.SEPARATOR + tool ).exists( ) ) ) {
|
if( ! ( new File( path + IPath.SEPARATOR + tool ).exists( ) ) ) {
|
||||||
setErrorMessage( String.format(
|
setErrorMessage( String.format(
|
||||||
Messages.WesnothPreferencesPage_24, tool ) );
|
Messages.WesnothPreferencesPage_24, tool ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,10 +551,10 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
private boolean isFieldsEmpty( )
|
private boolean isFieldsEmpty( )
|
||||||
{
|
{
|
||||||
return wmlToolsField_.getStringValue( ).isEmpty( )
|
return wmlToolsField_.getStringValue( ).isEmpty( )
|
||||||
&& wesnothExecutableField_.getStringValue( ).isEmpty( )
|
&& wesnothExecutableField_.getStringValue( ).isEmpty( )
|
||||||
&& wesnothUserDirField_.getStringValue( ).isEmpty( )
|
&& wesnothUserDirField_.getStringValue( ).isEmpty( )
|
||||||
&& wesnothWorkingDirField_.getStringValue( ).isEmpty( )
|
&& wesnothWorkingDirField_.getStringValue( ).isEmpty( )
|
||||||
&& txtInstallName_.getText( ).isEmpty( );
|
&& txtInstallName_.getText( ).isEmpty( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -573,7 +574,8 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
// if we haven't completed anything,
|
// if we haven't completed anything,
|
||||||
// we can skip the saving without alerting the user.
|
// we can skip the saving without alerting the user.
|
||||||
if( ! isFieldsEmpty ) {
|
if( ! isFieldsEmpty ) {
|
||||||
GUIUtils.showErrorMessageBox( Messages.WesnothInstallsPage_19 );
|
GUIUtils
|
||||||
|
.showErrorMessageBox( Messages.WesnothInstallsPage_19 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// we consider successfully save if the fields are all
|
// we consider successfully save if the fields are all
|
||||||
|
@ -588,10 +590,10 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
|
|
||||||
// update the fields preferences names
|
// update the fields preferences names
|
||||||
setFieldsPreferenceName(
|
setFieldsPreferenceName(
|
||||||
Preferences.getInstallPrefix( installName ), false );
|
Preferences.getInstallPrefix( installName ), false );
|
||||||
|
|
||||||
WesnothInstall newInstall = new WesnothInstall( installName,
|
WesnothInstall newInstall = new WesnothInstall( installName,
|
||||||
cmbVersion_.getText( ) );
|
cmbVersion_.getText( ) );
|
||||||
|
|
||||||
installs_.put( installName, newInstall );
|
installs_.put( installName, newInstall );
|
||||||
|
|
||||||
|
@ -658,7 +660,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TableLabelProvider extends LabelProvider implements
|
private static class TableLabelProvider extends LabelProvider implements
|
||||||
ITableLabelProvider
|
ITableLabelProvider
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Image getColumnImage( Object element, int columnIndex )
|
public Image getColumnImage( Object element, int columnIndex )
|
||||||
|
@ -681,7 +683,7 @@ public class WesnothInstallsPage extends AbstractPreferencePage
|
||||||
else if( columnIndex == 2 ) { // is Default ?
|
else if( columnIndex == 2 ) { // is Default ?
|
||||||
|
|
||||||
if( install.getName( ).equals(
|
if( install.getName( ).equals(
|
||||||
Preferences.getDefaultInstallName( ) ) ) {
|
Preferences.getDefaultInstallName( ) ) ) {
|
||||||
return Messages.WesnothInstallsPage_21;
|
return Messages.WesnothInstallsPage_21;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,24 +62,24 @@ public class WesnothPreferencesPage extends AbstractPreferencePage
|
||||||
public void widgetSelected( SelectionEvent e )
|
public void widgetSelected( SelectionEvent e )
|
||||||
{
|
{
|
||||||
if( GUIUtils
|
if( GUIUtils
|
||||||
.showMessageBox(
|
.showMessageBox(
|
||||||
"Are you sure you want to clear the plugin preferences?",
|
"Are you sure you want to clear the plugin preferences?",
|
||||||
SWT.YES | SWT.NO ) == SWT.NO ) {
|
SWT.YES | SWT.NO ) == SWT.NO ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the preferences
|
// clear the preferences
|
||||||
IEclipsePreferences root = Platform.getPreferencesService( )
|
IEclipsePreferences root = Platform.getPreferencesService( )
|
||||||
.getRootNode( );
|
.getRootNode( );
|
||||||
try {
|
try {
|
||||||
for( String rootName: root.childrenNames( ) ) {
|
for( String rootName: root.childrenNames( ) ) {
|
||||||
|
|
||||||
org.osgi.service.prefs.Preferences childNode = root
|
org.osgi.service.prefs.Preferences childNode = root
|
||||||
.node( rootName );
|
.node( rootName );
|
||||||
for( String childName: childNode.childrenNames( ) ) {
|
for( String childName: childNode.childrenNames( ) ) {
|
||||||
|
|
||||||
org.osgi.service.prefs.Preferences node = childNode
|
org.osgi.service.prefs.Preferences node = childNode
|
||||||
.node( childName );
|
.node( childName );
|
||||||
|
|
||||||
if( childName.startsWith( "org.wesnoth" ) ) {
|
if( childName.startsWith( "org.wesnoth" ) ) {
|
||||||
try {
|
try {
|
||||||
|
@ -101,15 +101,15 @@ public class WesnothPreferencesPage extends AbstractPreferencePage
|
||||||
|
|
||||||
// clear the plugin's dirs
|
// clear the plugin's dirs
|
||||||
File pluginDir = WesnothPlugin.getDefault( ).getStateLocation( )
|
File pluginDir = WesnothPlugin.getDefault( ).getStateLocation( )
|
||||||
.toFile( ).getParentFile( );
|
.toFile( ).getParentFile( );
|
||||||
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
|
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
|
||||||
+ "/org.wesnoth" );
|
+ "/org.wesnoth" );
|
||||||
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
|
ResourceUtils.deleteDirectory( pluginDir.getAbsolutePath( )
|
||||||
+ "/org.wesnoth.ui" );
|
+ "/org.wesnoth.ui" );
|
||||||
|
|
||||||
// clear the temporary files
|
// clear the temporary files
|
||||||
File[] files = new File( WorkspaceUtils.getTemporaryFolder( ) )
|
File[] files = new File( WorkspaceUtils.getTemporaryFolder( ) )
|
||||||
.listFiles( );
|
.listFiles( );
|
||||||
|
|
||||||
for( File file: files ) {
|
for( File file: files ) {
|
||||||
// don't remove the logs
|
// don't remove the logs
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Define
|
||||||
private List< String > args_;
|
private List< String > args_;
|
||||||
|
|
||||||
public Define( String name, String value, String textdomain, int linenum,
|
public Define( String name, String value, String textdomain, int linenum,
|
||||||
String location, List< String > args )
|
String location, List< String > args )
|
||||||
{
|
{
|
||||||
name_ = name;
|
name_ = name;
|
||||||
value_ = value;
|
value_ = value;
|
||||||
|
@ -112,18 +112,18 @@ public class Define
|
||||||
* @return Returns a map of defines
|
* @return Returns a map of defines
|
||||||
*/
|
*/
|
||||||
public static Map< String, Define > readDefines( String installName,
|
public static Map< String, Define > readDefines( String installName,
|
||||||
String file )
|
String file )
|
||||||
{
|
{
|
||||||
DefinesSAXHandler handler = ( DefinesSAXHandler ) ResourceUtils
|
DefinesSAXHandler handler = ( DefinesSAXHandler ) ResourceUtils
|
||||||
.getWMLSAXHandlerFromResource( installName, file,
|
.getWMLSAXHandlerFromResource( installName, file,
|
||||||
new DefinesSAXHandler( ) );
|
new DefinesSAXHandler( ) );
|
||||||
|
|
||||||
if( handler != null ) {
|
if( handler != null ) {
|
||||||
return handler.getDefines( );
|
return handler.getDefines( );
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.getInstance( ).log(
|
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 );
|
return new HashMap< String, Define >( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class DefinesSAXHandler extends DefaultHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement( String uri, String localName, String qName,
|
public void startElement( String uri, String localName, String qName,
|
||||||
Attributes attributes ) throws SAXException
|
Attributes attributes ) throws SAXException
|
||||||
{
|
{
|
||||||
super.startElement( uri, localName, qName, attributes );
|
super.startElement( uri, localName, qName, attributes );
|
||||||
stack_.push( qName );
|
stack_.push( qName );
|
||||||
|
@ -51,7 +51,7 @@ public class DefinesSAXHandler extends DefaultHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endElement( String uri, String localName, String qName )
|
public void endElement( String uri, String localName, String qName )
|
||||||
throws SAXException
|
throws SAXException
|
||||||
{
|
{
|
||||||
super.endElement( uri, localName, qName );
|
super.endElement( uri, localName, qName );
|
||||||
stack_.pop( );
|
stack_.pop( );
|
||||||
|
@ -60,7 +60,7 @@ public class DefinesSAXHandler extends DefaultHandler
|
||||||
{
|
{
|
||||||
// create the define
|
// create the define
|
||||||
defines_.put( name_, new Define( name_, value_, textdomain_,
|
defines_.put( name_, new Define( name_, value_, textdomain_,
|
||||||
linenum_, location_, arguments_ ) );
|
linenum_, location_, arguments_ ) );
|
||||||
// reset values
|
// reset values
|
||||||
resetValues( );
|
resetValues( );
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class DefinesSAXHandler extends DefaultHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void characters( char[] ch, int start, int length )
|
public void characters( char[] ch, int start, int length )
|
||||||
throws SAXException
|
throws SAXException
|
||||||
{
|
{
|
||||||
super.characters( ch, start, length );
|
super.characters( ch, start, length );
|
||||||
if( stack_.isEmpty( ) ) {
|
if( stack_.isEmpty( ) ) {
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class PreprocessorUtils
|
||||||
private Map< String, Long > filesTimeStamps_ = new HashMap< String, Long >( );
|
private Map< String, Long > filesTimeStamps_ = new HashMap< String, Long >( );
|
||||||
|
|
||||||
private static final String PREPROCESSED_FILE_PATH = WorkspaceUtils
|
private static final String PREPROCESSED_FILE_PATH = WorkspaceUtils
|
||||||
.getTemporaryFolder( )
|
.getTemporaryFolder( )
|
||||||
+ "preprocessed.txt";
|
+ "preprocessed.txt";
|
||||||
|
|
||||||
private PreprocessorUtils( )
|
private PreprocessorUtils( )
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ public class PreprocessorUtils
|
||||||
public int preprocessFile( IFile file, List< String > defines )
|
public int preprocessFile( IFile file, List< String > defines )
|
||||||
{
|
{
|
||||||
return preprocessFile( file, getPreprocessedFileLocation( file ),
|
return preprocessFile( file, getPreprocessedFileLocation( file ),
|
||||||
getMacrosLocation( file ), defines, true );
|
getMacrosLocation( file ), defines, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,10 +94,10 @@ public class PreprocessorUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int preprocessFile( IFile file, String macrosFile,
|
public int preprocessFile( IFile file, String macrosFile,
|
||||||
List< String > defines )
|
List< String > defines )
|
||||||
{
|
{
|
||||||
return preprocessFile( file, getPreprocessedFileLocation( file ),
|
return preprocessFile( file, getPreprocessedFileLocation( file ),
|
||||||
macrosFile, defines, true );
|
macrosFile, defines, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,14 +121,14 @@ public class PreprocessorUtils
|
||||||
* 1 - there was an error
|
* 1 - there was an error
|
||||||
*/
|
*/
|
||||||
public int preprocessFile( IFile file, String targetDirectory,
|
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( );
|
String filePath = file.getLocation( ).toOSString( );
|
||||||
if( filesTimeStamps_.containsKey( filePath )
|
if( filesTimeStamps_.containsKey( filePath )
|
||||||
&& filesTimeStamps_.get( filePath ) >= new File( filePath )
|
&& filesTimeStamps_.get( filePath ) >= new File( filePath )
|
||||||
.lastModified( ) ) {
|
.lastModified( ) ) {
|
||||||
Logger.getInstance( ).logTool(
|
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;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ public class PreprocessorUtils
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Paths paths = Preferences
|
Paths paths = Preferences
|
||||||
.getPaths( ProjectUtils.getCacheForProject(
|
.getPaths( ProjectUtils.getCacheForProject(
|
||||||
file.getProject( ) ).getInstallName( ) );
|
file.getProject( ) ).getInstallName( ) );
|
||||||
|
|
||||||
List< String > arguments = new ArrayList< String >( );
|
List< String > arguments = new ArrayList< String >( );
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class PreprocessorUtils
|
||||||
|
|
||||||
StringBuilder definesArg = new StringBuilder( );
|
StringBuilder definesArg = new StringBuilder( );
|
||||||
for( Iterator< String > itor = defines.iterator( ); itor
|
for( Iterator< String > itor = defines.iterator( ); itor
|
||||||
.hasNext( ); ) {
|
.hasNext( ); ) {
|
||||||
if( definesArg.length( ) > 0 ) {
|
if( definesArg.length( ) > 0 ) {
|
||||||
definesArg.append( "," ); //$NON-NLS-1$
|
definesArg.append( "," ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public class PreprocessorUtils
|
||||||
|
|
||||||
Logger.getInstance( ).logTool( "preprocessing file: " + filePath ); //$NON-NLS-1$
|
Logger.getInstance( ).logTool( "preprocessing file: " + filePath ); //$NON-NLS-1$
|
||||||
ExternalToolInvoker wesnoth = new ExternalToolInvoker(
|
ExternalToolInvoker wesnoth = new ExternalToolInvoker(
|
||||||
paths.getWesnothExecutablePath( ), arguments );
|
paths.getWesnothExecutablePath( ), arguments );
|
||||||
wesnoth.runTool( );
|
wesnoth.runTool( );
|
||||||
if( waitForIt ) {
|
if( waitForIt ) {
|
||||||
return wesnoth.waitForTool( );
|
return wesnoth.waitForTool( );
|
||||||
|
@ -216,11 +216,11 @@ public class PreprocessorUtils
|
||||||
{
|
{
|
||||||
if( file == null || ! file.exists( ) ) {
|
if( file == null || ! file.exists( ) ) {
|
||||||
Logger.getInstance( ).log( "file null or non existent.", //$NON-NLS-1$
|
Logger.getInstance( ).log( "file null or non existent.", //$NON-NLS-1$
|
||||||
Messages.PreprocessorUtils_12 );
|
Messages.PreprocessorUtils_12 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EditorUtils
|
EditorUtils
|
||||||
.openEditor( getPreprocessedFilePath( file, openPlain, true ) );
|
.openEditor( getPreprocessedFilePath( file, openPlain, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,12 +236,12 @@ public class PreprocessorUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IFileStore getPreprocessedFilePath( IFile file, boolean plain,
|
public IFileStore getPreprocessedFilePath( IFile file, boolean plain,
|
||||||
boolean create )
|
boolean create )
|
||||||
{
|
{
|
||||||
IFileStore preprocFile = EFS.getLocalFileSystem( ).getStore(
|
IFileStore preprocFile = EFS.getLocalFileSystem( ).getStore(
|
||||||
new Path( getPreprocessedFileLocation( file ) ) );
|
new Path( getPreprocessedFileLocation( file ) ) );
|
||||||
preprocFile = preprocFile.getChild( file.getName( )
|
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( ) ) {
|
if( create && ! preprocFile.fetchInfo( ).exists( ) ) {
|
||||||
preprocessFile( file, null );
|
preprocessFile( file, null );
|
||||||
}
|
}
|
||||||
|
@ -259,8 +259,8 @@ public class PreprocessorUtils
|
||||||
String targetDirectory = WorkspaceUtils.getTemporaryFolder( );
|
String targetDirectory = WorkspaceUtils.getTemporaryFolder( );
|
||||||
targetDirectory += file.getProject( ).getName( ) + "/"; //$NON-NLS-1$
|
targetDirectory += file.getProject( ).getName( ) + "/"; //$NON-NLS-1$
|
||||||
targetDirectory += file.getParent( ).getProjectRelativePath( )
|
targetDirectory += file.getParent( ).getProjectRelativePath( )
|
||||||
.toOSString( )
|
.toOSString( )
|
||||||
+ "/"; //$NON-NLS-1$
|
+ "/"; //$NON-NLS-1$
|
||||||
return targetDirectory;
|
return targetDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ public class PreprocessorUtils
|
||||||
public String getMacrosLocation( IResource resource )
|
public String getMacrosLocation( IResource resource )
|
||||||
{
|
{
|
||||||
return WorkspaceUtils
|
return WorkspaceUtils
|
||||||
.getProjectTemporaryFolder( resource.getProject( ) )
|
.getProjectTemporaryFolder( resource.getProject( ) )
|
||||||
+ "/_MACROS_.cfg"; //$NON-NLS-1$
|
+ "/_MACROS_.cfg"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,12 +290,13 @@ public class PreprocessorUtils
|
||||||
DialogSettings settings = new DialogSettings( "preprocessed" ); //$NON-NLS-1$
|
DialogSettings settings = new DialogSettings( "preprocessed" ); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
settings.put(
|
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 >( );
|
List< String > timestamps = new ArrayList< String >( );
|
||||||
for( Long timestamp: filesTimeStamps_.values( ) ) {
|
for( Long timestamp: filesTimeStamps_.values( ) ) {
|
||||||
timestamps.add( timestamp.toString( ) );
|
timestamps.add( timestamp.toString( ) );
|
||||||
}
|
}
|
||||||
settings.put(
|
settings
|
||||||
|
.put(
|
||||||
"timestamps", timestamps.toArray( new String[timestamps.size( )] ) ); //$NON-NLS-1$
|
"timestamps", timestamps.toArray( new String[timestamps.size( )] ) ); //$NON-NLS-1$
|
||||||
settings.save( PREPROCESSED_FILE_PATH );
|
settings.save( PREPROCESSED_FILE_PATH );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
|
@ -322,10 +323,10 @@ public class PreprocessorUtils
|
||||||
String[] timestamps = settings.getArray( "timestamps" ); //$NON-NLS-1$
|
String[] timestamps = settings.getArray( "timestamps" ); //$NON-NLS-1$
|
||||||
String[] files = settings.getArray( "files" ); //$NON-NLS-1$
|
String[] files = settings.getArray( "files" ); //$NON-NLS-1$
|
||||||
if( timestamps != null && files != null
|
if( timestamps != null && files != null
|
||||||
&& timestamps.length == files.length ) {
|
&& timestamps.length == files.length ) {
|
||||||
for( int index = 0; index < files.length; ++index ) {
|
for( int index = 0; index < files.length; ++index ) {
|
||||||
filesTimeStamps_.put( files[index],
|
filesTimeStamps_.put( files[index],
|
||||||
Long.valueOf( timestamps[index] ) );
|
Long.valueOf( timestamps[index] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
|
@ -342,7 +343,7 @@ public class PreprocessorUtils
|
||||||
public void clearTimestampsForPath( String path )
|
public void clearTimestampsForPath( String path )
|
||||||
{
|
{
|
||||||
Iterator< Entry< String, Long >> itor = filesTimeStamps_.entrySet( )
|
Iterator< Entry< String, Long >> itor = filesTimeStamps_.entrySet( )
|
||||||
.iterator( );
|
.iterator( );
|
||||||
|
|
||||||
while( itor.hasNext( ) ) {
|
while( itor.hasNext( ) ) {
|
||||||
Entry< String, Long > entry = itor.next( );
|
Entry< String, Long > entry = itor.next( );
|
||||||
|
|
|
@ -23,25 +23,25 @@ import org.wesnoth.Messages;
|
||||||
public class ActionWiper implements IStartup, IPerspectiveListener
|
public class ActionWiper implements IStartup, IPerspectiveListener
|
||||||
{
|
{
|
||||||
private static final String[] ACTIONS_2_WIPE = new String[] {
|
private static final String[] ACTIONS_2_WIPE = new String[] {
|
||||||
"org.eclipse.search.searchActionSet", //$NON-NLS-1$
|
"org.eclipse.search.searchActionSet", //$NON-NLS-1$
|
||||||
"org.eclipse.debug.ui.breakpointActionSet", //$NON-NLS-1$
|
"org.eclipse.debug.ui.breakpointActionSet", //$NON-NLS-1$
|
||||||
"org.eclipse.debug.ui.debugActionSet", //$NON-NLS-1$
|
"org.eclipse.debug.ui.debugActionSet", //$NON-NLS-1$
|
||||||
"org.eclipse.debug.ui.launchActionSet", //$NON-NLS-1$
|
"org.eclipse.debug.ui.launchActionSet", //$NON-NLS-1$
|
||||||
"org.eclipse.debug.ui.profileActionSet", //$NON-NLS-1$
|
"org.eclipse.debug.ui.profileActionSet", //$NON-NLS-1$
|
||||||
"org.eclipse.ui.externaltools.ExternalToolsSet" //$NON-NLS-1$
|
"org.eclipse.ui.externaltools.ExternalToolsSet" //$NON-NLS-1$
|
||||||
// "org.eclipse.ui.edit.text.actionSet.presentation",
|
// "org.eclipse.ui.edit.text.actionSet.presentation",
|
||||||
// "org.eclipse.ui.edit.text.actionSet.openExternalFile",
|
// "org.eclipse.ui.edit.text.actionSet.openExternalFile",
|
||||||
// "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
|
// "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
|
||||||
// "org.eclipse.ui.edit.text.actionSet.navigation",
|
// "org.eclipse.ui.edit.text.actionSet.navigation",
|
||||||
// "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
|
// "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
|
||||||
// "org.eclipse.update.ui.softwareUpdates"
|
// "org.eclipse.update.ui.softwareUpdates"
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void earlyStartup( )
|
public void earlyStartup( )
|
||||||
{
|
{
|
||||||
IWorkbenchWindow[] windows = PlatformUI.getWorkbench( )
|
IWorkbenchWindow[] windows = PlatformUI.getWorkbench( )
|
||||||
.getWorkbenchWindows( );
|
.getWorkbenchWindows( );
|
||||||
for( int i = 0; i < windows.length; i++ ) {
|
for( int i = 0; i < windows.length; i++ ) {
|
||||||
IWorkbenchPage page = windows[i].getActivePage( );
|
IWorkbenchPage page = windows[i].getActivePage( );
|
||||||
if( page != null ) {
|
if( page != null ) {
|
||||||
|
@ -74,14 +74,14 @@ public class ActionWiper implements IStartup, IPerspectiveListener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perspectiveActivated( IWorkbenchPage page,
|
public void perspectiveActivated( IWorkbenchPage page,
|
||||||
IPerspectiveDescriptor perspective )
|
IPerspectiveDescriptor perspective )
|
||||||
{
|
{
|
||||||
wipeActions( page );
|
wipeActions( page );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perspectiveChanged( IWorkbenchPage page,
|
public void perspectiveChanged( IWorkbenchPage page,
|
||||||
IPerspectiveDescriptor perspective, String changeId )
|
IPerspectiveDescriptor perspective, String changeId )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,11 @@ public class WMLPerspective implements IPerspectiveFactory
|
||||||
|
|
||||||
// Place navigator and outline to left of editor area.
|
// Place navigator and outline to left of editor area.
|
||||||
IFolderLayout left = layout.createFolder(
|
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 );
|
left.addView( WesnothProjectsExplorer.ID_PROJECTS_EXPLORER );
|
||||||
|
|
||||||
IFolderLayout bottom = layout.createFolder(
|
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_PROBLEM_VIEW );
|
||||||
bottom.addView( IPageLayout.ID_PROGRESS_VIEW );
|
bottom.addView( IPageLayout.ID_PROGRESS_VIEW );
|
||||||
bottom.addView( IConsoleConstants.ID_CONSOLE_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$
|
bottom.addView( "org.eclipse.pde.runtime.LogView" ); //$NON-NLS-1$
|
||||||
|
|
||||||
IFolderLayout right = layout.createFolder(
|
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 );
|
right.addView( IPageLayout.ID_OUTLINE );
|
||||||
|
|
||||||
layout.addPerspectiveShortcut( WMLPERSPECTIVE_ID );
|
layout.addPerspectiveShortcut( WMLPERSPECTIVE_ID );
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class WesnothApplication implements IApplication
|
||||||
Logger.getInstance( ).startLogger( );
|
Logger.getInstance( ).startLogger( );
|
||||||
try {
|
try {
|
||||||
int returnCode = PlatformUI.createAndRunWorkbench( display,
|
int returnCode = PlatformUI.createAndRunWorkbench( display,
|
||||||
new WesnothWorkbenchAdvisor( ) );
|
new WesnothWorkbenchAdvisor( ) );
|
||||||
if( returnCode == PlatformUI.RETURN_RESTART ) {
|
if( returnCode == PlatformUI.RETURN_RESTART ) {
|
||||||
return IApplication.EXIT_RESTART;
|
return IApplication.EXIT_RESTART;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class WesnothWorkbenchAdvisor extends WorkbenchAdvisorHack
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
|
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
|
||||||
IWorkbenchWindowConfigurer configurer )
|
IWorkbenchWindowConfigurer configurer )
|
||||||
{
|
{
|
||||||
return new WesnothWorkbenchWindowAdvisor( configurer );
|
return new WesnothWorkbenchWindowAdvisor( configurer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionBarAdvisor createActionBarAdvisor(
|
public ActionBarAdvisor createActionBarAdvisor(
|
||||||
IActionBarConfigurer configurer )
|
IActionBarConfigurer configurer )
|
||||||
{
|
{
|
||||||
return new WesnothActionBarAdvisor( configurer );
|
return new WesnothActionBarAdvisor( configurer );
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
|
||||||
public void postWindowCreate( )
|
public void postWindowCreate( )
|
||||||
{
|
{
|
||||||
getWindowConfigurer( ).getWindow( ).getActivePage( )
|
getWindowConfigurer( ).getWindow( ).getActivePage( )
|
||||||
.hideActionSet( "org.eclipse.ui.run" ); //$NON-NLS-1$
|
.hideActionSet( "org.eclipse.ui.run" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,7 +58,7 @@ public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace( ).save( true,
|
ResourcesPlugin.getWorkspace( ).save( true,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,10 +284,10 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
// set default build handler -- can't be done until the shell is
|
// set default build handler -- can't be done until the shell is
|
||||||
// available
|
// available
|
||||||
IAction buildHandler = new BuildAction(
|
IAction buildHandler = new BuildAction(
|
||||||
page.getWorkbenchWindow( ),
|
page.getWorkbenchWindow( ),
|
||||||
IncrementalProjectBuilder.INCREMENTAL_BUILD );
|
IncrementalProjectBuilder.INCREMENTAL_BUILD );
|
||||||
( ( RetargetActionWithDefault ) buildProjectAction )
|
( ( RetargetActionWithDefault ) buildProjectAction )
|
||||||
.setDefaultHandler( buildHandler );
|
.setDefaultHandler( buildHandler );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getWindow( ).addPageListener( pageListener );
|
getWindow( ).addPageListener( pageListener );
|
||||||
|
@ -296,13 +296,13 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
public void propertyChange( Preferences.PropertyChangeEvent event )
|
public void propertyChange( Preferences.PropertyChangeEvent event )
|
||||||
{
|
{
|
||||||
if( event.getProperty( ).equals(
|
if( event.getProperty( ).equals(
|
||||||
ResourcesPlugin.PREF_AUTO_BUILDING ) ) {
|
ResourcesPlugin.PREF_AUTO_BUILDING ) ) {
|
||||||
updateBuildActions( false );
|
updateBuildActions( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
|
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
|
||||||
.addPropertyChangeListener( prefListener );
|
.addPropertyChangeListener( prefListener );
|
||||||
|
|
||||||
// listener for the "close editors automatically"
|
// listener for the "close editors automatically"
|
||||||
// preference change
|
// preference change
|
||||||
|
@ -310,18 +310,18 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
public void propertyChange( PropertyChangeEvent event )
|
public void propertyChange( PropertyChangeEvent event )
|
||||||
{
|
{
|
||||||
if( event.getProperty( ).equals(
|
if( event.getProperty( ).equals(
|
||||||
IPreferenceConstants.REUSE_EDITORS_BOOLEAN ) ) {
|
IPreferenceConstants.REUSE_EDITORS_BOOLEAN ) ) {
|
||||||
if( window.getShell( ) != null
|
if( window.getShell( ) != null
|
||||||
&& ! window.getShell( ).isDisposed( ) ) {
|
&& ! window.getShell( ).isDisposed( ) ) {
|
||||||
// this property change notification could be from a
|
// this property change notification could be from a
|
||||||
// non-ui thread
|
// non-ui thread
|
||||||
window.getShell( ).getDisplay( )
|
window.getShell( ).getDisplay( )
|
||||||
.syncExec( new Runnable( ) {
|
.syncExec( new Runnable( ) {
|
||||||
public void run( )
|
public void run( )
|
||||||
{
|
{
|
||||||
updatePinActionToolbar( );
|
updatePinActionToolbar( );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
* WorkbenchActionBuilder.
|
* WorkbenchActionBuilder.
|
||||||
*/
|
*/
|
||||||
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
|
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
|
||||||
.addPropertyChangeListener( propPrefListener );
|
.addPropertyChangeListener( propPrefListener );
|
||||||
// listen for project description changes, which can affect enablement
|
// listen for project description changes, which can affect enablement
|
||||||
// of build actions
|
// of build actions
|
||||||
resourceListener = new IResourceChangeListener( ) {
|
resourceListener = new IResourceChangeListener( ) {
|
||||||
|
@ -360,7 +360,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ResourcesPlugin.getWorkspace( ).addResourceChangeListener(
|
ResourcesPlugin.getWorkspace( ).addResourceChangeListener(
|
||||||
resourceListener, IResourceChangeEvent.POST_CHANGE );
|
resourceListener, IResourceChangeEvent.POST_CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -384,44 +384,44 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
{ // Set up the context Menu
|
{ // Set up the context Menu
|
||||||
coolbarPopupMenuManager = new MenuManager( );
|
coolbarPopupMenuManager = new MenuManager( );
|
||||||
coolbarPopupMenuManager.add( new ActionContributionItem(
|
coolbarPopupMenuManager.add( new ActionContributionItem(
|
||||||
lockToolBarAction ) );
|
lockToolBarAction ) );
|
||||||
coolbarPopupMenuManager.add( new ActionContributionItem(
|
coolbarPopupMenuManager.add( new ActionContributionItem(
|
||||||
editActionSetAction ) );
|
editActionSetAction ) );
|
||||||
coolBar.setContextMenuManager( coolbarPopupMenuManager );
|
coolBar.setContextMenuManager( coolbarPopupMenuManager );
|
||||||
IMenuService menuService = ( IMenuService ) window
|
IMenuService menuService = ( IMenuService ) window
|
||||||
.getService( IMenuService.class );
|
.getService( IMenuService.class );
|
||||||
menuService.populateContributionManager( coolbarPopupMenuManager,
|
menuService.populateContributionManager( coolbarPopupMenuManager,
|
||||||
"popup:windowCoolbarContextMenu" ); //$NON-NLS-1$
|
"popup:windowCoolbarContextMenu" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_FILE ) );
|
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_FILE ) );
|
||||||
{ // File Group
|
{ // File Group
|
||||||
IToolBarManager fileToolBar = actionBarConfigurer
|
IToolBarManager fileToolBar = actionBarConfigurer
|
||||||
.createToolBarManager( );
|
.createToolBarManager( );
|
||||||
fileToolBar
|
fileToolBar
|
||||||
.add( new Separator( IWorkbenchActionConstants.NEW_GROUP ) );
|
.add( new Separator( IWorkbenchActionConstants.NEW_GROUP ) );
|
||||||
fileToolBar.add( newWizardDropDownAction );
|
fileToolBar.add( newWizardDropDownAction );
|
||||||
fileToolBar
|
fileToolBar
|
||||||
.add( new GroupMarker( IWorkbenchActionConstants.NEW_EXT ) );
|
.add( new GroupMarker( IWorkbenchActionConstants.NEW_EXT ) );
|
||||||
fileToolBar.add( new GroupMarker(
|
fileToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.SAVE_GROUP ) );
|
IWorkbenchActionConstants.SAVE_GROUP ) );
|
||||||
fileToolBar.add( saveAction );
|
fileToolBar.add( saveAction );
|
||||||
fileToolBar.add( saveAllAction );
|
fileToolBar.add( saveAllAction );
|
||||||
fileToolBar.add( new GroupMarker(
|
fileToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.SAVE_EXT ) );
|
IWorkbenchActionConstants.SAVE_EXT ) );
|
||||||
fileToolBar.add( getPrintItem( ) );
|
fileToolBar.add( getPrintItem( ) );
|
||||||
fileToolBar.add( new GroupMarker(
|
fileToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.PRINT_EXT ) );
|
IWorkbenchActionConstants.PRINT_EXT ) );
|
||||||
|
|
||||||
fileToolBar.add( new Separator(
|
fileToolBar.add( new Separator(
|
||||||
IWorkbenchActionConstants.BUILD_GROUP ) );
|
IWorkbenchActionConstants.BUILD_GROUP ) );
|
||||||
fileToolBar.add( new GroupMarker(
|
fileToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.BUILD_EXT ) );
|
IWorkbenchActionConstants.BUILD_EXT ) );
|
||||||
fileToolBar.add( new Separator(
|
fileToolBar.add( new Separator(
|
||||||
IWorkbenchActionConstants.MB_ADDITIONS ) );
|
IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
|
|
||||||
// Add to the cool bar manager
|
// Add to the cool bar manager
|
||||||
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
||||||
fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE ) );
|
fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
coolBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
coolBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
|
@ -429,20 +429,20 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_NAV ) );
|
coolBar.add( new GroupMarker( IIDEActionConstants.GROUP_NAV ) );
|
||||||
{ // Navigate group
|
{ // Navigate group
|
||||||
IToolBarManager navToolBar = actionBarConfigurer
|
IToolBarManager navToolBar = actionBarConfigurer
|
||||||
.createToolBarManager( );
|
.createToolBarManager( );
|
||||||
navToolBar.add( new Separator(
|
navToolBar.add( new Separator(
|
||||||
IWorkbenchActionConstants.HISTORY_GROUP ) );
|
IWorkbenchActionConstants.HISTORY_GROUP ) );
|
||||||
navToolBar.add( new GroupMarker(
|
navToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.GROUP_APP ) );
|
IWorkbenchActionConstants.GROUP_APP ) );
|
||||||
navToolBar.add( backwardHistoryAction );
|
navToolBar.add( backwardHistoryAction );
|
||||||
navToolBar.add( forwardHistoryAction );
|
navToolBar.add( forwardHistoryAction );
|
||||||
navToolBar
|
navToolBar
|
||||||
.add( new Separator( IWorkbenchActionConstants.PIN_GROUP ) );
|
.add( new Separator( IWorkbenchActionConstants.PIN_GROUP ) );
|
||||||
navToolBar.add( getPinEditorItem( ) );
|
navToolBar.add( getPinEditorItem( ) );
|
||||||
|
|
||||||
// Add to the cool bar manager
|
// Add to the cool bar manager
|
||||||
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
||||||
navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE ) );
|
navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
coolBar.add( new GroupMarker( IWorkbenchActionConstants.GROUP_EDITOR ) );
|
coolBar.add( new GroupMarker( IWorkbenchActionConstants.GROUP_EDITOR ) );
|
||||||
|
@ -451,16 +451,16 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
|
|
||||||
{ // Help group
|
{ // Help group
|
||||||
IToolBarManager helpToolBar = actionBarConfigurer
|
IToolBarManager helpToolBar = actionBarConfigurer
|
||||||
.createToolBarManager( );
|
.createToolBarManager( );
|
||||||
helpToolBar.add( new Separator(
|
helpToolBar.add( new Separator(
|
||||||
IWorkbenchActionConstants.GROUP_HELP ) );
|
IWorkbenchActionConstants.GROUP_HELP ) );
|
||||||
// helpToolBar.add(searchComboItem);
|
// helpToolBar.add(searchComboItem);
|
||||||
// Add the group for applications to contribute
|
// Add the group for applications to contribute
|
||||||
helpToolBar.add( new GroupMarker(
|
helpToolBar.add( new GroupMarker(
|
||||||
IWorkbenchActionConstants.GROUP_APP ) );
|
IWorkbenchActionConstants.GROUP_APP ) );
|
||||||
// Add to the cool bar manager
|
// Add to the cool bar manager
|
||||||
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
coolBar.add( actionBarConfigurer.createToolBarContributionItem(
|
||||||
helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP ) );
|
helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -486,8 +486,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createFileMenu( )
|
private MenuManager createFileMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_file,
|
IDEWorkbenchMessages.Workbench_file,
|
||||||
IWorkbenchActionConstants.M_FILE );
|
IWorkbenchActionConstants.M_FILE );
|
||||||
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_START ) );
|
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_START ) );
|
||||||
{
|
{
|
||||||
// create the New submenu, using the same id for it as the New
|
// 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 ) );
|
newMenu.add( new Separator( newId ) );
|
||||||
this.newWizardMenu = new NewWizardMenu( getWindow( ) );
|
this.newWizardMenu = new NewWizardMenu( getWindow( ) );
|
||||||
newMenu.add( this.newWizardMenu );
|
newMenu.add( this.newWizardMenu );
|
||||||
newMenu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
newMenu
|
||||||
|
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
menu.add( newMenu );
|
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
|
// looking for it when Cmd-Q is invoked (or Quit is chosen from the
|
||||||
// application menu.
|
// application menu.
|
||||||
ActionContributionItem quitItem = new ActionContributionItem(
|
ActionContributionItem quitItem = new ActionContributionItem(
|
||||||
quitAction );
|
quitAction );
|
||||||
quitItem.setVisible( ! Util.isMac( ) );
|
quitItem.setVisible( ! Util.isMac( ) );
|
||||||
menu.add( quitItem );
|
menu.add( quitItem );
|
||||||
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) );
|
menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) );
|
||||||
|
@ -559,8 +560,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createEditMenu( )
|
private MenuManager createEditMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_edit,
|
IDEWorkbenchMessages.Workbench_edit,
|
||||||
IWorkbenchActionConstants.M_EDIT );
|
IWorkbenchActionConstants.M_EDIT );
|
||||||
menu.add( new GroupMarker( IWorkbenchActionConstants.EDIT_START ) );
|
menu.add( new GroupMarker( IWorkbenchActionConstants.EDIT_START ) );
|
||||||
|
|
||||||
menu.add( undoAction );
|
menu.add( undoAction );
|
||||||
|
@ -597,20 +598,20 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createNavigateMenu( )
|
private MenuManager createNavigateMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_navigate,
|
IDEWorkbenchMessages.Workbench_navigate,
|
||||||
IWorkbenchActionConstants.M_NAVIGATE );
|
IWorkbenchActionConstants.M_NAVIGATE );
|
||||||
menu.add( new GroupMarker( IWorkbenchActionConstants.NAV_START ) );
|
menu.add( new GroupMarker( IWorkbenchActionConstants.NAV_START ) );
|
||||||
menu.add( goIntoAction );
|
menu.add( goIntoAction );
|
||||||
|
|
||||||
MenuManager goToSubMenu = new MenuManager(
|
MenuManager goToSubMenu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_goTo,
|
IDEWorkbenchMessages.Workbench_goTo,
|
||||||
IWorkbenchActionConstants.GO_TO );
|
IWorkbenchActionConstants.GO_TO );
|
||||||
menu.add( goToSubMenu );
|
menu.add( goToSubMenu );
|
||||||
goToSubMenu.add( backAction );
|
goToSubMenu.add( backAction );
|
||||||
goToSubMenu.add( forwardAction );
|
goToSubMenu.add( forwardAction );
|
||||||
goToSubMenu.add( upAction );
|
goToSubMenu.add( upAction );
|
||||||
goToSubMenu
|
goToSubMenu
|
||||||
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
|
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.OPEN_EXT ) );
|
menu.add( new Separator( IWorkbenchActionConstants.OPEN_EXT ) );
|
||||||
for( int i = 2; i < 5; ++i ) {
|
for( int i = 2; i < 5; ++i ) {
|
||||||
|
@ -619,11 +620,11 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.SHOW_EXT ) );
|
menu.add( new Separator( IWorkbenchActionConstants.SHOW_EXT ) );
|
||||||
{
|
{
|
||||||
MenuManager showInSubMenu = new MenuManager(
|
MenuManager showInSubMenu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_showIn, "showIn" ); //$NON-NLS-1$
|
IDEWorkbenchMessages.Workbench_showIn, "showIn" ); //$NON-NLS-1$
|
||||||
showInSubMenu.setActionDefinitionId( showInQuickMenu
|
showInSubMenu.setActionDefinitionId( showInQuickMenu
|
||||||
.getActionDefinitionId( ) );
|
.getActionDefinitionId( ) );
|
||||||
showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN
|
showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN
|
||||||
.create( getWindow( ) ) );
|
.create( getWindow( ) ) );
|
||||||
menu.add( showInSubMenu );
|
menu.add( showInSubMenu );
|
||||||
}
|
}
|
||||||
for( int i = 2; i < 5; ++i ) {
|
for( int i = 2; i < 5; ++i ) {
|
||||||
|
@ -648,8 +649,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createProjectMenu( )
|
private MenuManager createProjectMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_project,
|
IDEWorkbenchMessages.Workbench_project,
|
||||||
IWorkbenchActionConstants.M_PROJECT );
|
IWorkbenchActionConstants.M_PROJECT );
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.PROJ_START ) );
|
menu.add( new Separator( IWorkbenchActionConstants.PROJ_START ) );
|
||||||
|
|
||||||
menu.add( getOpenProjectItem( ) );
|
menu.add( getOpenProjectItem( ) );
|
||||||
|
@ -677,8 +678,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createWindowMenu( )
|
private MenuManager createWindowMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_window,
|
IDEWorkbenchMessages.Workbench_window,
|
||||||
IWorkbenchActionConstants.M_WINDOW );
|
IWorkbenchActionConstants.M_WINDOW );
|
||||||
|
|
||||||
menu.add( newWindowAction );
|
menu.add( newWindowAction );
|
||||||
menu.add( newEditorAction );
|
menu.add( newEditorAction );
|
||||||
|
@ -693,7 +694,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
|
|
||||||
// See the comment for quit in createFileMenu
|
// See the comment for quit in createFileMenu
|
||||||
ActionContributionItem openPreferencesItem = new ActionContributionItem(
|
ActionContributionItem openPreferencesItem = new ActionContributionItem(
|
||||||
openPreferencesAction );
|
openPreferencesAction );
|
||||||
openPreferencesItem.setVisible( ! Util.isMac( ) );
|
openPreferencesItem.setVisible( ! Util.isMac( ) );
|
||||||
menu.add( openPreferencesItem );
|
menu.add( openPreferencesItem );
|
||||||
|
|
||||||
|
@ -709,17 +710,17 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
{
|
{
|
||||||
String openText = IDEWorkbenchMessages.Workbench_openPerspective;
|
String openText = IDEWorkbenchMessages.Workbench_openPerspective;
|
||||||
MenuManager changePerspMenuMgr = new MenuManager( openText,
|
MenuManager changePerspMenuMgr = new MenuManager( openText,
|
||||||
"openPerspective" ); //$NON-NLS-1$
|
"openPerspective" ); //$NON-NLS-1$
|
||||||
IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST
|
IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST
|
||||||
.create( getWindow( ) );
|
.create( getWindow( ) );
|
||||||
changePerspMenuMgr.add( changePerspMenuItem );
|
changePerspMenuMgr.add( changePerspMenuItem );
|
||||||
menu.add( changePerspMenuMgr );
|
menu.add( changePerspMenuMgr );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
MenuManager showViewMenuMgr = new MenuManager(
|
MenuManager showViewMenuMgr = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_showView, "showView" ); //$NON-NLS-1$
|
IDEWorkbenchMessages.Workbench_showView, "showView" ); //$NON-NLS-1$
|
||||||
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST
|
IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST
|
||||||
.create( getWindow( ) );
|
.create( getWindow( ) );
|
||||||
showViewMenuMgr.add( showViewMenu );
|
showViewMenuMgr.add( showViewMenu );
|
||||||
menu.add( showViewMenuMgr );
|
menu.add( showViewMenuMgr );
|
||||||
}
|
}
|
||||||
|
@ -737,9 +738,9 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private void addWorkingSetBuildActions( MenuManager menu )
|
private void addWorkingSetBuildActions( MenuManager menu )
|
||||||
{
|
{
|
||||||
buildWorkingSetMenu = new MenuManager(
|
buildWorkingSetMenu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_buildSet );
|
IDEWorkbenchMessages.Workbench_buildSet );
|
||||||
IContributionItem workingSetBuilds = new BuildSetMenu( window,
|
IContributionItem workingSetBuilds = new BuildSetMenu( window,
|
||||||
getActionBarConfigurer( ) );
|
getActionBarConfigurer( ) );
|
||||||
buildWorkingSetMenu.add( workingSetBuilds );
|
buildWorkingSetMenu.add( workingSetBuilds );
|
||||||
menu.add( buildWorkingSetMenu );
|
menu.add( buildWorkingSetMenu );
|
||||||
}
|
}
|
||||||
|
@ -750,7 +751,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private void addKeyboardShortcuts( MenuManager menu )
|
private void addKeyboardShortcuts( MenuManager menu )
|
||||||
{
|
{
|
||||||
MenuManager subMenu = new MenuManager(
|
MenuManager subMenu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_shortcuts, "shortcuts" ); //$NON-NLS-1$
|
IDEWorkbenchMessages.Workbench_shortcuts, "shortcuts" ); //$NON-NLS-1$
|
||||||
menu.add( subMenu );
|
menu.add( subMenu );
|
||||||
subMenu.add( showPartPaneMenuAction );
|
subMenu.add( showPartPaneMenuAction );
|
||||||
subMenu.add( showViewMenuAction );
|
subMenu.add( showViewMenuAction );
|
||||||
|
@ -777,8 +778,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private MenuManager createHelpMenu( )
|
private MenuManager createHelpMenu( )
|
||||||
{
|
{
|
||||||
MenuManager menu = new MenuManager(
|
MenuManager menu = new MenuManager(
|
||||||
IDEWorkbenchMessages.Workbench_help,
|
IDEWorkbenchMessages.Workbench_help,
|
||||||
IWorkbenchActionConstants.M_HELP );
|
IWorkbenchActionConstants.M_HELP );
|
||||||
addSeparatorOrGroupMarker( menu, "group.intro" ); //$NON-NLS-1$
|
addSeparatorOrGroupMarker( menu, "group.intro" ); //$NON-NLS-1$
|
||||||
// See if a welcome or intro page is specified
|
// See if a welcome or intro page is specified
|
||||||
if( introAction != null ) {
|
if( introAction != null ) {
|
||||||
|
@ -810,7 +811,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$
|
menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
ActionContributionItem aboutItem = new ActionContributionItem(
|
ActionContributionItem aboutItem = new ActionContributionItem(
|
||||||
aboutAction );
|
aboutAction );
|
||||||
aboutItem.setVisible( ! Util.isMac( ) );
|
aboutItem.setVisible( ! Util.isMac( ) );
|
||||||
menu.add( aboutItem );
|
menu.add( aboutItem );
|
||||||
menu.add( new GroupMarker( "group.about.ext" ) ); //$NON-NLS-1$
|
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$
|
String prefId = "useSeparator." + menu.getId( ) + "." + groupId; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
boolean addExtraSeparators = IDEWorkbenchPlugin.getDefault( )
|
boolean addExtraSeparators = IDEWorkbenchPlugin.getDefault( )
|
||||||
.getPreferenceStore( ).getBoolean( prefId );
|
.getPreferenceStore( ).getBoolean( prefId );
|
||||||
if( addExtraSeparators ) {
|
if( addExtraSeparators ) {
|
||||||
menu.add( new Separator( groupId ) );
|
menu.add( new Separator( groupId ) );
|
||||||
}
|
}
|
||||||
|
@ -854,29 +855,29 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
}
|
}
|
||||||
isDisposed = true;
|
isDisposed = true;
|
||||||
IMenuService menuService = ( IMenuService ) window
|
IMenuService menuService = ( IMenuService ) window
|
||||||
.getService( IMenuService.class );
|
.getService( IMenuService.class );
|
||||||
menuService.releaseContributions( coolbarPopupMenuManager );
|
menuService.releaseContributions( coolbarPopupMenuManager );
|
||||||
coolbarPopupMenuManager.dispose( );
|
coolbarPopupMenuManager.dispose( );
|
||||||
|
|
||||||
getActionBarConfigurer( ).getStatusLineManager( ).remove(
|
getActionBarConfigurer( ).getStatusLineManager( ).remove(
|
||||||
statusLineItem );
|
statusLineItem );
|
||||||
if( pageListener != null ) {
|
if( pageListener != null ) {
|
||||||
window.removePageListener( pageListener );
|
window.removePageListener( pageListener );
|
||||||
pageListener = null;
|
pageListener = null;
|
||||||
}
|
}
|
||||||
if( prefListener != null ) {
|
if( prefListener != null ) {
|
||||||
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
|
ResourcesPlugin.getPlugin( ).getPluginPreferences( )
|
||||||
.removePropertyChangeListener( prefListener );
|
.removePropertyChangeListener( prefListener );
|
||||||
prefListener = null;
|
prefListener = null;
|
||||||
}
|
}
|
||||||
if( propPrefListener != null ) {
|
if( propPrefListener != null ) {
|
||||||
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
|
WorkbenchPlugin.getDefault( ).getPreferenceStore( )
|
||||||
.removePropertyChangeListener( propPrefListener );
|
.removePropertyChangeListener( propPrefListener );
|
||||||
propPrefListener = null;
|
propPrefListener = null;
|
||||||
}
|
}
|
||||||
if( resourceListener != null ) {
|
if( resourceListener != null ) {
|
||||||
ResourcesPlugin.getWorkspace( ).removeResourceChangeListener(
|
ResourcesPlugin.getWorkspace( ).removeResourceChangeListener(
|
||||||
resourceListener );
|
resourceListener );
|
||||||
resourceListener = null;
|
resourceListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,7 +1015,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
register( newWizardAction );
|
register( newWizardAction );
|
||||||
|
|
||||||
newWizardDropDownAction = IDEActionFactory.NEW_WIZARD_DROP_DOWN
|
newWizardDropDownAction = IDEActionFactory.NEW_WIZARD_DROP_DOWN
|
||||||
.create( window );
|
.create( window );
|
||||||
register( newWizardDropDownAction );
|
register( newWizardDropDownAction );
|
||||||
|
|
||||||
importResourcesAction = ActionFactory.IMPORT.create( window );
|
importResourcesAction = ActionFactory.IMPORT.create( window );
|
||||||
|
@ -1030,7 +1031,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
register( cleanAction );
|
register( cleanAction );
|
||||||
|
|
||||||
toggleAutoBuildAction = IDEActionFactory.BUILD_AUTOMATICALLY
|
toggleAutoBuildAction = IDEActionFactory.BUILD_AUTOMATICALLY
|
||||||
.create( window );
|
.create( window );
|
||||||
register( toggleAutoBuildAction );
|
register( toggleAutoBuildAction );
|
||||||
|
|
||||||
saveAction = ActionFactory.SAVE.create( window );
|
saveAction = ActionFactory.SAVE.create( window );
|
||||||
|
@ -1083,8 +1084,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
|
|
||||||
aboutAction = ActionFactory.ABOUT.create( window );
|
aboutAction = ActionFactory.ABOUT.create( window );
|
||||||
aboutAction
|
aboutAction
|
||||||
.setImageDescriptor( IDEInternalWorkbenchImages
|
.setImageDescriptor( IDEInternalWorkbenchImages
|
||||||
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD ) );
|
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD ) );
|
||||||
register( aboutAction );
|
register( aboutAction );
|
||||||
|
|
||||||
openPreferencesAction = ActionFactory.PREFERENCES.create( window );
|
openPreferencesAction = ActionFactory.PREFERENCES.create( window );
|
||||||
|
@ -1101,7 +1102,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
register( showViewMenuAction );
|
register( showViewMenuAction );
|
||||||
|
|
||||||
showPartPaneMenuAction = ActionFactory.SHOW_PART_PANE_MENU
|
showPartPaneMenuAction = ActionFactory.SHOW_PART_PANE_MENU
|
||||||
.create( window );
|
.create( window );
|
||||||
register( showPartPaneMenuAction );
|
register( showPartPaneMenuAction );
|
||||||
|
|
||||||
nextEditorAction = ActionFactory.NEXT_EDITOR.create( window );
|
nextEditorAction = ActionFactory.NEXT_EDITOR.create( window );
|
||||||
|
@ -1119,10 +1120,10 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
nextPerspectiveAction = ActionFactory.NEXT_PERSPECTIVE.create( window );
|
nextPerspectiveAction = ActionFactory.NEXT_PERSPECTIVE.create( window );
|
||||||
register( nextPerspectiveAction );
|
register( nextPerspectiveAction );
|
||||||
prevPerspectiveAction = ActionFactory.PREVIOUS_PERSPECTIVE
|
prevPerspectiveAction = ActionFactory.PREVIOUS_PERSPECTIVE
|
||||||
.create( window );
|
.create( window );
|
||||||
register( prevPerspectiveAction );
|
register( prevPerspectiveAction );
|
||||||
ActionFactory.linkCycleActionPair( nextPerspectiveAction,
|
ActionFactory.linkCycleActionPair( nextPerspectiveAction,
|
||||||
prevPerspectiveAction );
|
prevPerspectiveAction );
|
||||||
|
|
||||||
activateEditorAction = ActionFactory.ACTIVATE_EDITOR.create( window );
|
activateEditorAction = ActionFactory.ACTIVATE_EDITOR.create( window );
|
||||||
register( activateEditorAction );
|
register( activateEditorAction );
|
||||||
|
@ -1137,7 +1138,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
register( switchToEditorAction );
|
register( switchToEditorAction );
|
||||||
|
|
||||||
workbookEditorsAction = ActionFactory.SHOW_WORKBOOK_EDITORS
|
workbookEditorsAction = ActionFactory.SHOW_WORKBOOK_EDITORS
|
||||||
.create( window );
|
.create( window );
|
||||||
register( workbookEditorsAction );
|
register( workbookEditorsAction );
|
||||||
|
|
||||||
quickAccessAction = ActionFactory.SHOW_QUICK_ACCESS.create( window );
|
quickAccessAction = ActionFactory.SHOW_QUICK_ACCESS.create( window );
|
||||||
|
@ -1151,12 +1152,12 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create( window );
|
lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create( window );
|
||||||
register( lockToolBarAction );
|
register( lockToolBarAction );
|
||||||
resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE
|
resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE
|
||||||
.create( window );
|
.create( window );
|
||||||
register( resetPerspectiveAction );
|
register( resetPerspectiveAction );
|
||||||
closePerspAction = ActionFactory.CLOSE_PERSPECTIVE.create( window );
|
closePerspAction = ActionFactory.CLOSE_PERSPECTIVE.create( window );
|
||||||
register( closePerspAction );
|
register( closePerspAction );
|
||||||
closeAllPerspsAction = ActionFactory.CLOSE_ALL_PERSPECTIVES
|
closeAllPerspsAction = ActionFactory.CLOSE_ALL_PERSPECTIVES
|
||||||
.create( window );
|
.create( window );
|
||||||
register( closeAllPerspsAction );
|
register( closeAllPerspsAction );
|
||||||
|
|
||||||
forwardHistoryAction = ActionFactory.FORWARD_HISTORY.create( window );
|
forwardHistoryAction = ActionFactory.FORWARD_HISTORY.create( window );
|
||||||
|
@ -1187,14 +1188,14 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
|
|
||||||
nextAction = ActionFactory.NEXT.create( window );
|
nextAction = ActionFactory.NEXT.create( window );
|
||||||
nextAction
|
nextAction
|
||||||
.setImageDescriptor( IDEInternalWorkbenchImages
|
.setImageDescriptor( IDEInternalWorkbenchImages
|
||||||
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV ) );
|
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV ) );
|
||||||
register( nextAction );
|
register( nextAction );
|
||||||
|
|
||||||
previousAction = ActionFactory.PREVIOUS.create( window );
|
previousAction = ActionFactory.PREVIOUS.create( window );
|
||||||
previousAction
|
previousAction
|
||||||
.setImageDescriptor( IDEInternalWorkbenchImages
|
.setImageDescriptor( IDEInternalWorkbenchImages
|
||||||
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV ) );
|
.getImageDescriptor( IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV ) );
|
||||||
register( previousAction );
|
register( previousAction );
|
||||||
|
|
||||||
buildProjectAction = IDEActionFactory.BUILD_PROJECT.create( window );
|
buildProjectAction = IDEActionFactory.BUILD_PROJECT.create( window );
|
||||||
|
@ -1204,7 +1205,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
register( openWorkspaceAction );
|
register( openWorkspaceAction );
|
||||||
|
|
||||||
projectPropertyDialogAction = IDEActionFactory.OPEN_PROJECT_PROPERTIES
|
projectPropertyDialogAction = IDEActionFactory.OPEN_PROJECT_PROPERTIES
|
||||||
.create( window );
|
.create( window );
|
||||||
register( projectPropertyDialogAction );
|
register( projectPropertyDialogAction );
|
||||||
|
|
||||||
if( window.getWorkbench( ).getIntroManager( ).hasIntro( ) ) {
|
if( window.getWorkbench( ).getIntroManager( ).hasIntro( ) ) {
|
||||||
|
@ -1242,7 +1243,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
AboutInfo[] infos = null;
|
AboutInfo[] infos = null;
|
||||||
|
|
||||||
IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault( )
|
IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault( )
|
||||||
.getPreferenceStore( );
|
.getPreferenceStore( );
|
||||||
|
|
||||||
// Optimization: avoid obtaining the about infos if the platform state
|
// Optimization: avoid obtaining the about infos if the platform state
|
||||||
// is
|
// is
|
||||||
|
@ -1285,7 +1286,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
String showTipsAndTricks = prefs.getString( tipsAndTricksKey );
|
String showTipsAndTricks = prefs.getString( tipsAndTricksKey );
|
||||||
if( sameState && "true".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
|
if( sameState && "true".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
|
||||||
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
|
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
|
||||||
.create( window );
|
.create( window );
|
||||||
register( tipsAndTricksAction );
|
register( tipsAndTricksAction );
|
||||||
}
|
}
|
||||||
else if( sameState && "false".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
|
else if( sameState && "false".equals( showTipsAndTricks ) ) { //$NON-NLS-1$
|
||||||
|
@ -1300,7 +1301,7 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
prefs.setValue( tipsAndTricksKey, String.valueOf( found ) );
|
prefs.setValue( tipsAndTricksKey, String.valueOf( found ) );
|
||||||
if( found ) {
|
if( found ) {
|
||||||
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
|
tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS
|
||||||
.create( window );
|
.create( window );
|
||||||
register( tipsAndTricksAction );
|
register( tipsAndTricksAction );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1363,28 +1364,28 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace( );
|
IWorkspace workspace = ResourcesPlugin.getWorkspace( );
|
||||||
IProject[] projects = workspace.getRoot( ).getProjects( );
|
IProject[] projects = workspace.getRoot( ).getProjects( );
|
||||||
boolean enabled = BuildUtilities.isEnabled( projects,
|
boolean enabled = BuildUtilities.isEnabled( projects,
|
||||||
IncrementalProjectBuilder.INCREMENTAL_BUILD );
|
IncrementalProjectBuilder.INCREMENTAL_BUILD );
|
||||||
// update menu bar actions in project menu
|
// update menu bar actions in project menu
|
||||||
updateCommandEnablement( buildAllAction.getActionDefinitionId( ) );
|
updateCommandEnablement( buildAllAction.getActionDefinitionId( ) );
|
||||||
buildProjectAction.setEnabled( enabled );
|
buildProjectAction.setEnabled( enabled );
|
||||||
toggleAutoBuildAction.setChecked( workspace.isAutoBuilding( ) );
|
toggleAutoBuildAction.setChecked( workspace.isAutoBuilding( ) );
|
||||||
cleanAction.setEnabled( BuildUtilities.isEnabled( projects,
|
cleanAction.setEnabled( BuildUtilities.isEnabled( projects,
|
||||||
IncrementalProjectBuilder.CLEAN_BUILD ) );
|
IncrementalProjectBuilder.CLEAN_BUILD ) );
|
||||||
|
|
||||||
// update the cool bar build button
|
// update the cool bar build button
|
||||||
ICoolBarManager coolBarManager = getActionBarConfigurer( )
|
ICoolBarManager coolBarManager = getActionBarConfigurer( )
|
||||||
.getCoolBarManager( );
|
.getCoolBarManager( );
|
||||||
IContributionItem cbItem = coolBarManager
|
IContributionItem cbItem = coolBarManager
|
||||||
.find( IWorkbenchActionConstants.TOOLBAR_FILE );
|
.find( IWorkbenchActionConstants.TOOLBAR_FILE );
|
||||||
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
|
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
|
||||||
// This should not happen
|
// This should not happen
|
||||||
IDEWorkbenchPlugin
|
IDEWorkbenchPlugin
|
||||||
.log( "File toolbar contribution item is missing" ); //$NON-NLS-1$
|
.log( "File toolbar contribution item is missing" ); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
|
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
|
||||||
IToolBarManager toolBarManager = toolBarItem
|
IToolBarManager toolBarManager = toolBarItem
|
||||||
.getToolBarManager( );
|
.getToolBarManager( );
|
||||||
if( toolBarManager == null ) {
|
if( toolBarManager == null ) {
|
||||||
// error if this happens, file toolbar assumed to always
|
// error if this happens, file toolbar assumed to always
|
||||||
// exist
|
// exist
|
||||||
|
@ -1396,8 +1397,8 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
boolean found = toolBarManager.find( buildAllAction.getId( ) ) != null;
|
boolean found = toolBarManager.find( buildAllAction.getId( ) ) != null;
|
||||||
if( enabled && ! found ) {
|
if( enabled && ! found ) {
|
||||||
toolBarManager.appendToGroup(
|
toolBarManager.appendToGroup(
|
||||||
IWorkbenchActionConstants.BUILD_GROUP,
|
IWorkbenchActionConstants.BUILD_GROUP,
|
||||||
buildAllAction );
|
buildAllAction );
|
||||||
toolBarManager.update( false );
|
toolBarManager.update( false );
|
||||||
toolBarItem.update( ICoolBarManager.SIZE );
|
toolBarItem.update( ICoolBarManager.SIZE );
|
||||||
}
|
}
|
||||||
|
@ -1411,9 +1412,9 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private void updateCommandEnablement( String commandId )
|
private void updateCommandEnablement( String commandId )
|
||||||
{
|
{
|
||||||
IHandlerService handlerService = ( IHandlerService ) window
|
IHandlerService handlerService = ( IHandlerService ) window
|
||||||
.getService( IHandlerService.class );
|
.getService( IHandlerService.class );
|
||||||
ICommandService commandService = ( ICommandService ) window
|
ICommandService commandService = ( ICommandService ) window
|
||||||
.getService( ICommandService.class );
|
.getService( ICommandService.class );
|
||||||
if( handlerService != null && commandService != null ) {
|
if( handlerService != null && commandService != null ) {
|
||||||
Command buildAllCmd = commandService.getCommand( commandId );
|
Command buildAllCmd = commandService.getCommand( commandId );
|
||||||
buildAllCmd.setEnabled( handlerService.getCurrentState( ) );
|
buildAllCmd.setEnabled( handlerService.getCurrentState( ) );
|
||||||
|
@ -1441,13 +1442,13 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
{
|
{
|
||||||
|
|
||||||
ICoolBarManager coolBarManager = getActionBarConfigurer( )
|
ICoolBarManager coolBarManager = getActionBarConfigurer( )
|
||||||
.getCoolBarManager( );
|
.getCoolBarManager( );
|
||||||
IContributionItem cbItem = coolBarManager
|
IContributionItem cbItem = coolBarManager
|
||||||
.find( IWorkbenchActionConstants.TOOLBAR_NAVIGATE );
|
.find( IWorkbenchActionConstants.TOOLBAR_NAVIGATE );
|
||||||
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
|
if( ! ( cbItem instanceof IToolBarContributionItem ) ) {
|
||||||
// This should not happen
|
// This should not happen
|
||||||
IDEWorkbenchPlugin
|
IDEWorkbenchPlugin
|
||||||
.log( "Navigation toolbar contribution item is missing" ); //$NON-NLS-1$
|
.log( "Navigation toolbar contribution item is missing" ); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
|
IToolBarContributionItem toolBarItem = ( IToolBarContributionItem ) cbItem;
|
||||||
|
@ -1470,157 +1471,157 @@ public class WorkbenchActionBuilder extends ActionBarAdvisor
|
||||||
private IContributionItem getCutItem( )
|
private IContributionItem getCutItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.CUT.getId( ),
|
return getItem( ActionFactory.CUT.getId( ),
|
||||||
ActionFactory.CUT.getCommandId( ), ISharedImages.IMG_TOOL_CUT,
|
ActionFactory.CUT.getCommandId( ), ISharedImages.IMG_TOOL_CUT,
|
||||||
ISharedImages.IMG_TOOL_CUT_DISABLED,
|
ISharedImages.IMG_TOOL_CUT_DISABLED,
|
||||||
WorkbenchMessages.Workbench_cut,
|
WorkbenchMessages.Workbench_cut,
|
||||||
WorkbenchMessages.Workbench_cutToolTip, null );
|
WorkbenchMessages.Workbench_cutToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getCopyItem( )
|
private IContributionItem getCopyItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.COPY.getId( ),
|
return getItem( ActionFactory.COPY.getId( ),
|
||||||
ActionFactory.COPY.getCommandId( ),
|
ActionFactory.COPY.getCommandId( ),
|
||||||
ISharedImages.IMG_TOOL_COPY,
|
ISharedImages.IMG_TOOL_COPY,
|
||||||
ISharedImages.IMG_TOOL_COPY_DISABLED,
|
ISharedImages.IMG_TOOL_COPY_DISABLED,
|
||||||
WorkbenchMessages.Workbench_copy,
|
WorkbenchMessages.Workbench_copy,
|
||||||
WorkbenchMessages.Workbench_copyToolTip, null );
|
WorkbenchMessages.Workbench_copyToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getPasteItem( )
|
private IContributionItem getPasteItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.PASTE.getId( ),
|
return getItem( ActionFactory.PASTE.getId( ),
|
||||||
ActionFactory.PASTE.getCommandId( ),
|
ActionFactory.PASTE.getCommandId( ),
|
||||||
ISharedImages.IMG_TOOL_PASTE,
|
ISharedImages.IMG_TOOL_PASTE,
|
||||||
ISharedImages.IMG_TOOL_PASTE_DISABLED,
|
ISharedImages.IMG_TOOL_PASTE_DISABLED,
|
||||||
WorkbenchMessages.Workbench_paste,
|
WorkbenchMessages.Workbench_paste,
|
||||||
WorkbenchMessages.Workbench_pasteToolTip, null );
|
WorkbenchMessages.Workbench_pasteToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getPrintItem( )
|
private IContributionItem getPrintItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.PRINT.getId( ),
|
return getItem( ActionFactory.PRINT.getId( ),
|
||||||
ActionFactory.PRINT.getCommandId( ),
|
ActionFactory.PRINT.getCommandId( ),
|
||||||
ISharedImages.IMG_ETOOL_PRINT_EDIT,
|
ISharedImages.IMG_ETOOL_PRINT_EDIT,
|
||||||
ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED,
|
ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED,
|
||||||
WorkbenchMessages.Workbench_print,
|
WorkbenchMessages.Workbench_print,
|
||||||
WorkbenchMessages.Workbench_printToolTip, null );
|
WorkbenchMessages.Workbench_printToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getSelectAllItem( )
|
private IContributionItem getSelectAllItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.SELECT_ALL.getId( ),
|
return getItem( ActionFactory.SELECT_ALL.getId( ),
|
||||||
ActionFactory.SELECT_ALL.getCommandId( ), null, null,
|
ActionFactory.SELECT_ALL.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_selectAll,
|
WorkbenchMessages.Workbench_selectAll,
|
||||||
WorkbenchMessages.Workbench_selectAllToolTip, null );
|
WorkbenchMessages.Workbench_selectAllToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getFindItem( )
|
private IContributionItem getFindItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.FIND.getId( ),
|
return getItem( ActionFactory.FIND.getId( ),
|
||||||
ActionFactory.FIND.getCommandId( ), null, null,
|
ActionFactory.FIND.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_findReplace,
|
WorkbenchMessages.Workbench_findReplace,
|
||||||
WorkbenchMessages.Workbench_findReplaceToolTip, null );
|
WorkbenchMessages.Workbench_findReplaceToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getBookmarkItem( )
|
private IContributionItem getBookmarkItem( )
|
||||||
{
|
{
|
||||||
return getItem( IDEActionFactory.BOOKMARK.getId( ),
|
return getItem( IDEActionFactory.BOOKMARK.getId( ),
|
||||||
IDEActionFactory.BOOKMARK.getCommandId( ), null, null,
|
IDEActionFactory.BOOKMARK.getCommandId( ), null, null,
|
||||||
IDEWorkbenchMessages.Workbench_addBookmark,
|
IDEWorkbenchMessages.Workbench_addBookmark,
|
||||||
IDEWorkbenchMessages.Workbench_addBookmarkToolTip, null );
|
IDEWorkbenchMessages.Workbench_addBookmarkToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getTaskItem( )
|
private IContributionItem getTaskItem( )
|
||||||
{
|
{
|
||||||
return getItem( IDEActionFactory.ADD_TASK.getId( ),
|
return getItem( IDEActionFactory.ADD_TASK.getId( ),
|
||||||
IDEActionFactory.ADD_TASK.getCommandId( ), null, null,
|
IDEActionFactory.ADD_TASK.getCommandId( ), null, null,
|
||||||
IDEWorkbenchMessages.Workbench_addTask,
|
IDEWorkbenchMessages.Workbench_addTask,
|
||||||
IDEWorkbenchMessages.Workbench_addTaskToolTip, null );
|
IDEWorkbenchMessages.Workbench_addTaskToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getDeleteItem( )
|
private IContributionItem getDeleteItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.DELETE.getId( ),
|
return getItem( ActionFactory.DELETE.getId( ),
|
||||||
ActionFactory.DELETE.getCommandId( ),
|
ActionFactory.DELETE.getCommandId( ),
|
||||||
ISharedImages.IMG_TOOL_DELETE,
|
ISharedImages.IMG_TOOL_DELETE,
|
||||||
ISharedImages.IMG_TOOL_DELETE_DISABLED,
|
ISharedImages.IMG_TOOL_DELETE_DISABLED,
|
||||||
WorkbenchMessages.Workbench_delete,
|
WorkbenchMessages.Workbench_delete,
|
||||||
WorkbenchMessages.Workbench_deleteToolTip,
|
WorkbenchMessages.Workbench_deleteToolTip,
|
||||||
IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION );
|
IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getRevertItem( )
|
private IContributionItem getRevertItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.REVERT.getId( ),
|
return getItem( ActionFactory.REVERT.getId( ),
|
||||||
ActionFactory.REVERT.getCommandId( ), null, null,
|
ActionFactory.REVERT.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_revert,
|
WorkbenchMessages.Workbench_revert,
|
||||||
WorkbenchMessages.Workbench_revertToolTip, null );
|
WorkbenchMessages.Workbench_revertToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getRefreshItem( )
|
private IContributionItem getRefreshItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.REFRESH.getId( ),
|
return getItem( ActionFactory.REFRESH.getId( ),
|
||||||
ActionFactory.REFRESH.getCommandId( ), null, null,
|
ActionFactory.REFRESH.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_refresh,
|
WorkbenchMessages.Workbench_refresh,
|
||||||
WorkbenchMessages.Workbench_refreshToolTip, null );
|
WorkbenchMessages.Workbench_refreshToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getPropertiesItem( )
|
private IContributionItem getPropertiesItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.PROPERTIES.getId( ),
|
return getItem( ActionFactory.PROPERTIES.getId( ),
|
||||||
ActionFactory.PROPERTIES.getCommandId( ), null, null,
|
ActionFactory.PROPERTIES.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_properties,
|
WorkbenchMessages.Workbench_properties,
|
||||||
WorkbenchMessages.Workbench_propertiesToolTip, null );
|
WorkbenchMessages.Workbench_propertiesToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getMoveItem( )
|
private IContributionItem getMoveItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.MOVE.getId( ),
|
return getItem( ActionFactory.MOVE.getId( ),
|
||||||
ActionFactory.MOVE.getCommandId( ), null, null,
|
ActionFactory.MOVE.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_move,
|
WorkbenchMessages.Workbench_move,
|
||||||
WorkbenchMessages.Workbench_moveToolTip, null );
|
WorkbenchMessages.Workbench_moveToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getRenameItem( )
|
private IContributionItem getRenameItem( )
|
||||||
{
|
{
|
||||||
return getItem( ActionFactory.RENAME.getId( ),
|
return getItem( ActionFactory.RENAME.getId( ),
|
||||||
ActionFactory.RENAME.getCommandId( ), null, null,
|
ActionFactory.RENAME.getCommandId( ), null, null,
|
||||||
WorkbenchMessages.Workbench_rename,
|
WorkbenchMessages.Workbench_rename,
|
||||||
WorkbenchMessages.Workbench_renameToolTip, null );
|
WorkbenchMessages.Workbench_renameToolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getOpenProjectItem( )
|
private IContributionItem getOpenProjectItem( )
|
||||||
{
|
{
|
||||||
return getItem( IDEActionFactory.OPEN_PROJECT.getId( ),
|
return getItem( IDEActionFactory.OPEN_PROJECT.getId( ),
|
||||||
IDEActionFactory.OPEN_PROJECT.getCommandId( ), null, null,
|
IDEActionFactory.OPEN_PROJECT.getCommandId( ), null, null,
|
||||||
IDEWorkbenchMessages.OpenResourceAction_text,
|
IDEWorkbenchMessages.OpenResourceAction_text,
|
||||||
IDEWorkbenchMessages.OpenResourceAction_toolTip, null );
|
IDEWorkbenchMessages.OpenResourceAction_toolTip, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getCloseProjectItem( )
|
private IContributionItem getCloseProjectItem( )
|
||||||
{
|
{
|
||||||
return getItem( IDEActionFactory.CLOSE_PROJECT.getId( ),
|
return getItem( IDEActionFactory.CLOSE_PROJECT.getId( ),
|
||||||
IDEActionFactory.CLOSE_PROJECT.getCommandId( ), null, null,
|
IDEActionFactory.CLOSE_PROJECT.getCommandId( ), null, null,
|
||||||
IDEWorkbenchMessages.CloseResourceAction_text,
|
IDEWorkbenchMessages.CloseResourceAction_text,
|
||||||
IDEWorkbenchMessages.CloseResourceAction_text, null );
|
IDEWorkbenchMessages.CloseResourceAction_text, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IContributionItem getItem( String actionId, String commandId,
|
private IContributionItem getItem( String actionId, String commandId,
|
||||||
String image, String disabledImage, String label, String tooltip,
|
String image, String disabledImage, String label, String tooltip,
|
||||||
String helpContextId )
|
String helpContextId )
|
||||||
{
|
{
|
||||||
ISharedImages sharedImages = getWindow( ).getWorkbench( )
|
ISharedImages sharedImages = getWindow( ).getWorkbench( )
|
||||||
.getSharedImages( );
|
.getSharedImages( );
|
||||||
|
|
||||||
IActionCommandMappingService acms = ( IActionCommandMappingService ) getWindow( )
|
IActionCommandMappingService acms = ( IActionCommandMappingService ) getWindow( )
|
||||||
.getService( IActionCommandMappingService.class );
|
.getService( IActionCommandMappingService.class );
|
||||||
acms.map( actionId, commandId );
|
acms.map( actionId, commandId );
|
||||||
|
|
||||||
CommandContributionItemParameter commandParm = new CommandContributionItemParameter(
|
CommandContributionItemParameter commandParm = new CommandContributionItemParameter(
|
||||||
getWindow( ), actionId, commandId, null,
|
getWindow( ), actionId, commandId, null,
|
||||||
sharedImages.getImageDescriptor( image ),
|
sharedImages.getImageDescriptor( image ),
|
||||||
sharedImages.getImageDescriptor( disabledImage ), null, label,
|
sharedImages.getImageDescriptor( disabledImage ), null, label,
|
||||||
null, tooltip, CommandContributionItem.STYLE_PUSH, null, false );
|
null, tooltip, CommandContributionItem.STYLE_PUSH, null, false );
|
||||||
return new CommandContributionItem( commandParm );
|
return new CommandContributionItem( commandParm );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,96 +57,96 @@ public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor
|
||||||
|
|
||||||
|
|
||||||
Bundle ideBundle = Platform
|
Bundle ideBundle = Platform
|
||||||
.getBundle( IDEWorkbenchPlugin.IDE_WORKBENCH );
|
.getBundle( IDEWorkbenchPlugin.IDE_WORKBENCH );
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
|
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, PATH_ETOOL
|
||||||
+ "build_exec.gif", false ); //$NON-NLS-1$
|
+ "build_exec.gif", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
|
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER,
|
||||||
PATH_ETOOL + "build_exec.gif", false ); //$NON-NLS-1$
|
PATH_ETOOL + "build_exec.gif", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
|
IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED,
|
||||||
PATH_DTOOL + "build_exec.gif", false ); //$NON-NLS-1$
|
PATH_DTOOL + "build_exec.gif", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
|
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, PATH_ETOOL
|
||||||
+ "search_src.gif", false ); //$NON-NLS-1$
|
+ "search_src.gif", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
|
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER,
|
||||||
PATH_ETOOL + "search_src.gif", false ); //$NON-NLS-1$
|
PATH_ETOOL + "search_src.gif", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
|
IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED,
|
||||||
PATH_DTOOL + "search_src.gif", false ); //$NON-NLS-1$
|
PATH_DTOOL + "search_src.gif", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
|
IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL
|
||||||
+ "next_nav.gif", false ); //$NON-NLS-1$
|
+ "next_nav.gif", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV, PATH_ETOOL
|
IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV, PATH_ETOOL
|
||||||
+ "prev_nav.gif", false ); //$NON-NLS-1$
|
+ "prev_nav.gif", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWPRJ_WIZ, PATH_WIZBAN
|
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWPRJ_WIZ, PATH_WIZBAN
|
||||||
+ "newprj_wiz.png", false ); //$NON-NLS-1$
|
+ "newprj_wiz.png", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFOLDER_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFOLDER_WIZ,
|
||||||
PATH_WIZBAN + "newfolder_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "newfolder_wiz.png", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFILE_WIZ, PATH_WIZBAN
|
IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFILE_WIZ, PATH_WIZBAN
|
||||||
+ "newfile_wiz.png", false ); //$NON-NLS-1$
|
+ "newfile_wiz.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTDIR_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTDIR_WIZ,
|
||||||
PATH_WIZBAN + "importdir_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "importdir_wiz.png", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTZIP_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTZIP_WIZ,
|
||||||
PATH_WIZBAN + "importzip_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "importzip_wiz.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTDIR_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTDIR_WIZ,
|
||||||
PATH_WIZBAN + "exportdir_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "exportdir_wiz.png", false ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTZIP_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTZIP_WIZ,
|
||||||
PATH_WIZBAN + "exportzip_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "exportzip_wiz.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ,
|
IDEInternalWorkbenchImages.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ,
|
||||||
PATH_WIZBAN + "workset_wiz.png", false ); //$NON-NLS-1$
|
PATH_WIZBAN + "workset_wiz.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, PATH_WIZBAN
|
IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, PATH_WIZBAN
|
||||||
+ "saveas_wiz.png", false ); //$NON-NLS-1$
|
+ "saveas_wiz.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG, PATH_WIZBAN
|
IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG, PATH_WIZBAN
|
||||||
+ "quick_fix.png", false ); //$NON-NLS-1$
|
+ "quick_fix.png", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT,
|
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,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
|
IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
|
||||||
+ "cprj_obj.gif", true ); //$NON-NLS-1$
|
+ "cprj_obj.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OPEN_MARKER,
|
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
|
// Quick fix icons
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
|
IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED,
|
||||||
PATH_ELOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
|
PATH_ELOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
|
IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED,
|
||||||
PATH_DLOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
|
PATH_DLOCALTOOL + "smartmode_co.gif", true ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
|
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_WARNING,
|
||||||
PATH_OBJECT + "quickfix_warning_obj.gif", true ); //$NON-NLS-1$
|
PATH_OBJECT + "quickfix_warning_obj.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_ERROR, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_FIXABLE_ERROR, PATH_OBJECT
|
||||||
+ "quickfix_error_obj.gif", true ); //$NON-NLS-1$
|
+ "quickfix_error_obj.gif", true ); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
// task objects
|
// task objects
|
||||||
|
@ -158,51 +158,51 @@ public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor
|
||||||
// PATH_OBJECT+"lprio_tsk.gif");
|
// PATH_OBJECT+"lprio_tsk.gif");
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK,
|
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,
|
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,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_COMPLETE_TSK, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_COMPLETE_TSK, PATH_OBJECT
|
||||||
+ "complete_tsk.gif", true ); //$NON-NLS-1$
|
+ "complete_tsk.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_INCOMPLETE_TSK, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_INCOMPLETE_TSK, PATH_OBJECT
|
||||||
+ "incomplete_tsk.gif", true ); //$NON-NLS-1$
|
+ "incomplete_tsk.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_ITEM, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_ITEM, PATH_OBJECT
|
||||||
+ "welcome_item.gif", true ); //$NON-NLS-1$
|
+ "welcome_item.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER, PATH_OBJECT
|
||||||
+ "welcome_banner.gif", true ); //$NON-NLS-1$
|
+ "welcome_banner.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_ERROR_PATH, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_ERROR_PATH, PATH_OBJECT
|
||||||
+ "error_tsk.gif", true ); //$NON-NLS-1$
|
+ "error_tsk.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_WARNING_PATH, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_WARNING_PATH, PATH_OBJECT
|
||||||
+ "warn_tsk.gif", true ); //$NON-NLS-1$
|
+ "warn_tsk.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_OBJS_INFO_PATH, PATH_OBJECT
|
IDEInternalWorkbenchImages.IMG_OBJS_INFO_PATH, PATH_OBJECT
|
||||||
+ "info_tsk.gif", true ); //$NON-NLS-1$
|
+ "info_tsk.gif", true ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_LCL_FLAT_LAYOUT, PATH_ELOCALTOOL
|
IDEInternalWorkbenchImages.IMG_LCL_FLAT_LAYOUT, PATH_ELOCALTOOL
|
||||||
+ "flatLayout.gif", true ); //$NON-NLS-1$
|
+ "flatLayout.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_LCL_HIERARCHICAL_LAYOUT,
|
IDEInternalWorkbenchImages.IMG_LCL_HIERARCHICAL_LAYOUT,
|
||||||
PATH_ELOCALTOOL + "hierarchicalLayout.gif", true ); //$NON-NLS-1$
|
PATH_ELOCALTOOL + "hierarchicalLayout.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEM_CATEGORY,
|
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEM_CATEGORY,
|
||||||
PATH_ETOOL + "problem_category.gif", true ); //$NON-NLS-1$
|
PATH_ETOOL + "problem_category.gif", true ); //$NON-NLS-1$
|
||||||
|
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW, PATH_EVIEW
|
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW, PATH_EVIEW
|
||||||
+ "problems_view.gif", true ); //$NON-NLS-1$
|
+ "problems_view.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_ERROR,
|
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_ERROR,
|
||||||
PATH_EVIEW + "problems_view_error.gif", true ); //$NON-NLS-1$
|
PATH_EVIEW + "problems_view_error.gif", true ); //$NON-NLS-1$
|
||||||
declareWorkbenchImage( ideBundle,
|
declareWorkbenchImage( ideBundle,
|
||||||
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_WARNING,
|
IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_WARNING,
|
||||||
PATH_EVIEW + "problems_view_warning.gif", true ); //$NON-NLS-1$
|
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
|
* @see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor#declareImage
|
||||||
*/
|
*/
|
||||||
private void declareWorkbenchImage( Bundle ideBundle, String symbolicName,
|
private void declareWorkbenchImage( Bundle ideBundle, String symbolicName,
|
||||||
String path, boolean shared )
|
String path, boolean shared )
|
||||||
{
|
{
|
||||||
URL url = FileLocator.find( ideBundle, new Path( path ), null );
|
URL url = FileLocator.find( ideBundle, new Path( path ), null );
|
||||||
ImageDescriptor desc = ImageDescriptor.createFromURL( url );
|
ImageDescriptor desc = ImageDescriptor.createFromURL( url );
|
||||||
|
|
|
@ -71,9 +71,9 @@ public class ProjectCache implements Serializable
|
||||||
definesTimestamp_ = - 1;
|
definesTimestamp_ = - 1;
|
||||||
|
|
||||||
wesnothFile_ = new File( project.getLocation( ).toOSString( )
|
wesnothFile_ = new File( project.getLocation( ).toOSString( )
|
||||||
+ "/.wesnoth" ); //$NON-NLS-1$
|
+ "/.wesnoth" ); //$NON-NLS-1$
|
||||||
definesFile_ = new File( PreprocessorUtils.getInstance( )
|
definesFile_ = new File( PreprocessorUtils.getInstance( )
|
||||||
.getMacrosLocation( project ) );
|
.getMacrosLocation( project ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,13 +134,13 @@ public class ProjectCache implements Serializable
|
||||||
public void loadCache( )
|
public void loadCache( )
|
||||||
{
|
{
|
||||||
ResourceUtils
|
ResourceUtils
|
||||||
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
|
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
FileInputStream inputStream = new FileInputStream( wesnothFile_ );
|
FileInputStream inputStream = new FileInputStream( wesnothFile_ );
|
||||||
ObjectInputStream deserializer = new ObjectInputStream(
|
ObjectInputStream deserializer = new ObjectInputStream(
|
||||||
inputStream );
|
inputStream );
|
||||||
ProjectCache cache = ( ProjectCache ) deserializer.readObject( );
|
ProjectCache cache = ( ProjectCache ) deserializer.readObject( );
|
||||||
|
|
||||||
properties_ = cache.properties_;
|
properties_ = cache.properties_;
|
||||||
|
@ -176,12 +176,12 @@ public class ProjectCache implements Serializable
|
||||||
public boolean saveCache( )
|
public boolean saveCache( )
|
||||||
{
|
{
|
||||||
ResourceUtils
|
ResourceUtils
|
||||||
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
|
.createWesnothFile( wesnothFile_.getAbsolutePath( ), false );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileOutputStream outputStream = new FileOutputStream( wesnothFile_ );
|
FileOutputStream outputStream = new FileOutputStream( wesnothFile_ );
|
||||||
ObjectOutputStream serializer = new ObjectOutputStream(
|
ObjectOutputStream serializer = new ObjectOutputStream(
|
||||||
outputStream );
|
outputStream );
|
||||||
serializer.writeObject( this );
|
serializer.writeObject( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -209,7 +209,7 @@ public class ProjectCache implements Serializable
|
||||||
}
|
}
|
||||||
|
|
||||||
defines_ = Define.readDefines( getInstallName( ),
|
defines_ = Define.readDefines( getInstallName( ),
|
||||||
definesFile_.getAbsolutePath( ) );
|
definesFile_.getAbsolutePath( ) );
|
||||||
definesTimestamp_ = definesFile_.lastModified( );
|
definesTimestamp_ = definesFile_.lastModified( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ public class ProjectCache implements Serializable
|
||||||
public String getInstallName( )
|
public String getInstallName( )
|
||||||
{
|
{
|
||||||
return Preferences.getString( Constants.P_INST_NAME_PREFIX
|
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 )
|
public void setInstallName( String newInstallName )
|
||||||
{
|
{
|
||||||
Preferences.getPreferences( ).setValue(
|
Preferences.getPreferences( ).setValue(
|
||||||
Constants.P_INST_NAME_PREFIX + project_.getName( ),
|
Constants.P_INST_NAME_PREFIX + project_.getName( ),
|
||||||
newInstallName );
|
newInstallName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ProjectUtils
|
||||||
* @return A map with properties of the project
|
* @return A map with properties of the project
|
||||||
*/
|
*/
|
||||||
public static Map< String, String > getPropertiesForProject(
|
public static Map< String, String > getPropertiesForProject(
|
||||||
IProject project )
|
IProject project )
|
||||||
{
|
{
|
||||||
return getCacheForProject( project ).getProperties( );
|
return getCacheForProject( project ).getProperties( );
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class ProjectUtils
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static IProject createWesnothProject( String name, String location,
|
public static IProject createWesnothProject( String name, String location,
|
||||||
String installName, IProgressMonitor monitor )
|
String installName, IProgressMonitor monitor )
|
||||||
{
|
{
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( );
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( );
|
||||||
IProject newProject = root.getProject( name );
|
IProject newProject = root.getProject( name );
|
||||||
|
@ -96,7 +96,7 @@ public class ProjectUtils
|
||||||
// root
|
// root
|
||||||
if( ! location.equals( root.getLocation( ).toOSString( ) ) ) {
|
if( ! location.equals( root.getLocation( ).toOSString( ) ) ) {
|
||||||
description = ResourcesPlugin.getWorkspace( )
|
description = ResourcesPlugin.getWorkspace( )
|
||||||
.newProjectDescription( name );
|
.newProjectDescription( name );
|
||||||
description.setLocation( new Path( location ) );
|
description.setLocation( new Path( location ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ public class ProjectUtils
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static int createWesnothProject( IProject handle,
|
public static int createWesnothProject( IProject handle,
|
||||||
IProjectDescription description, String installName,
|
IProjectDescription description, String installName,
|
||||||
IProgressMonitor monitor )
|
IProgressMonitor monitor )
|
||||||
{
|
{
|
||||||
if( handle == null || handle.exists( ) ) {
|
if( handle == null || handle.exists( ) ) {
|
||||||
return - 1;
|
return - 1;
|
||||||
|
@ -133,7 +133,7 @@ public class ProjectUtils
|
||||||
|
|
||||||
if( handle.getLocation( ) == null && description != null ) {
|
if( handle.getLocation( ) == null && description != null ) {
|
||||||
projectPath = description.getLocationURI( ).getPath( )
|
projectPath = description.getLocationURI( ).getPath( )
|
||||||
.toString( ).substring( 1 );
|
.toString( ).substring( 1 );
|
||||||
}
|
}
|
||||||
else if( handle.getLocation( ) != null ) {
|
else if( handle.getLocation( ) != null ) {
|
||||||
projectPath = handle.getLocation( ).toOSString( );
|
projectPath = handle.getLocation( ).toOSString( );
|
||||||
|
@ -141,8 +141,8 @@ public class ProjectUtils
|
||||||
else {
|
else {
|
||||||
// project is in workspace
|
// project is in workspace
|
||||||
projectPath = ResourcesPlugin.getWorkspace( ).getRoot( )
|
projectPath = ResourcesPlugin.getWorkspace( ).getRoot( )
|
||||||
.getLocation( ).toOSString( )
|
.getLocation( ).toOSString( )
|
||||||
+ "/" + handle.getProject( ).getName( );
|
+ "/" + handle.getProject( ).getName( );
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.subTask( Messages.ProjectUtils_0 );
|
monitor.subTask( Messages.ProjectUtils_0 );
|
||||||
|
@ -154,7 +154,7 @@ public class ProjectUtils
|
||||||
monitor.worked( 5 );
|
monitor.worked( 5 );
|
||||||
|
|
||||||
monitor.subTask( String.format( Messages.ProjectUtils_4,
|
monitor.subTask( String.format( Messages.ProjectUtils_4,
|
||||||
handle.getName( ) ) );
|
handle.getName( ) ) );
|
||||||
|
|
||||||
// create the project
|
// create the project
|
||||||
if( description == null ) {
|
if( description == null ) {
|
||||||
|
@ -171,12 +171,12 @@ public class ProjectUtils
|
||||||
// add wesnoth nature
|
// add wesnoth nature
|
||||||
IProjectDescription tmpDescription = handle.getDescription( );
|
IProjectDescription tmpDescription = handle.getDescription( );
|
||||||
tmpDescription
|
tmpDescription
|
||||||
.setNatureIds( new String[] { Constants.NATURE_WESNOTH /*
|
.setNatureIds( new String[] { Constants.NATURE_WESNOTH /*
|
||||||
* ,
|
* ,
|
||||||
* Constants
|
* Constants
|
||||||
* .
|
* .
|
||||||
* NATURE_XTEXT
|
* NATURE_XTEXT
|
||||||
*/} );
|
*/} );
|
||||||
handle.setDescription( tmpDescription, monitor );
|
handle.setDescription( tmpDescription, monitor );
|
||||||
monitor.worked( 5 );
|
monitor.worked( 5 );
|
||||||
|
|
||||||
|
@ -185,18 +185,18 @@ public class ProjectUtils
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
String normalizedPath = StringUtils.normalizePath( projectPath );
|
String normalizedPath = StringUtils.normalizePath( projectPath );
|
||||||
if( ! normalizedPath.contains( StringUtils.normalizePath( paths
|
if( ! normalizedPath.contains( StringUtils.normalizePath( paths
|
||||||
.getCampaignDir( ) ) )
|
.getCampaignDir( ) ) )
|
||||||
&& ! normalizedPath.contains( StringUtils
|
&& ! normalizedPath.contains( StringUtils
|
||||||
.normalizePath( paths.getAddonsDir( ) ) ) ) {
|
.normalizePath( paths.getAddonsDir( ) ) ) ) {
|
||||||
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
|
ArrayList< ReplaceableParameter > param = new ArrayList< ReplaceableParameter >( );
|
||||||
param.add( new ReplaceableParameter(
|
param.add( new ReplaceableParameter(
|
||||||
"$$project_name", handle.getName( ) ) ); //$NON-NLS-1$
|
"$$project_name", handle.getName( ) ) ); //$NON-NLS-1$
|
||||||
param.add( new ReplaceableParameter(
|
param.add( new ReplaceableParameter(
|
||||||
"$$project_dir_name", handle.getName( ) ) ); //$NON-NLS-1$
|
"$$project_dir_name", handle.getName( ) ) ); //$NON-NLS-1$
|
||||||
ResourceUtils.createFile( handle,
|
ResourceUtils.createFile( handle,
|
||||||
"build.xml", //$NON-NLS-1$
|
"build.xml", //$NON-NLS-1$
|
||||||
TemplateProvider.getInstance( ).getProcessedTemplate(
|
TemplateProvider.getInstance( ).getProcessedTemplate(
|
||||||
"build_xml", param ), true ); //$NON-NLS-1$
|
"build_xml", param ), true ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
monitor.worked( 10 );
|
monitor.worked( 10 );
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,12 @@ public class WesnothProjectPage extends PropertyPage
|
||||||
|
|
||||||
Label lblNewLabel = new Label( grpGeneral, SWT.NONE );
|
Label lblNewLabel = new Label( grpGeneral, SWT.NONE );
|
||||||
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
lblNewLabel.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
lblNewLabel.setText( Messages.WesnothProjectPage_1 );
|
lblNewLabel.setText( Messages.WesnothProjectPage_1 );
|
||||||
|
|
||||||
cmbInstall_ = new Combo( grpGeneral, SWT.READ_ONLY );
|
cmbInstall_ = new Combo( grpGeneral, SWT.READ_ONLY );
|
||||||
cmbInstall_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
cmbInstall_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
|
|
||||||
// fill the installs
|
// fill the installs
|
||||||
List< WesnothInstall > installs = WesnothInstallsUtils.getInstalls( );
|
List< WesnothInstall > installs = WesnothInstallsUtils.getInstalls( );
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class SchemaParser
|
||||||
public void parseSchema( boolean force )
|
public void parseSchema( boolean force )
|
||||||
{
|
{
|
||||||
parseSchemaFile( force, Preferences.getPaths( installName_ )
|
parseSchemaFile( force, Preferences.getPaths( installName_ )
|
||||||
.getSchemaPath( ) );
|
.getSchemaPath( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +113,7 @@ public class SchemaParser
|
||||||
{
|
{
|
||||||
if( parsingDone_ && ! force ) {
|
if( parsingDone_ && ! force ) {
|
||||||
Logger.getInstance( ).log(
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class SchemaParser
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.getInstance( ).log(
|
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 );
|
File schemaFile = new File( schemaPath );
|
||||||
String res = ResourceUtils.getFileContents( schemaFile );
|
String res = ResourceUtils.getFileContents( schemaFile );
|
||||||
String[] lines = StringUtils.getLines( res );
|
String[] lines = StringUtils.getLines( res );
|
||||||
|
@ -135,7 +135,7 @@ public class SchemaParser
|
||||||
String line = lines[index];
|
String line = lines[index];
|
||||||
// skip comments and empty lines
|
// skip comments and empty lines
|
||||||
if( StringUtils.startsWith( line, "#" )
|
if( StringUtils.startsWith( line, "#" )
|
||||||
|| line.matches( "^[\t ]*$" ) ) {
|
|| line.matches( "^[\t ]*$" ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,24 +147,24 @@ public class SchemaParser
|
||||||
// propagate the 'needsexpanding' property to upper levels
|
// propagate the 'needsexpanding' property to upper levels
|
||||||
boolean expand = false;
|
boolean expand = false;
|
||||||
if( ! tagStack.isEmpty( )
|
if( ! tagStack.isEmpty( )
|
||||||
&& tags_.containsKey( tagStack.peek( ) ) ) {
|
&& tags_.containsKey( tagStack.peek( ) ) ) {
|
||||||
expand = tags_.get( tagStack.peek( ) )
|
expand = tags_.get( tagStack.peek( ) )
|
||||||
.is_NeedingExpansion( );
|
.is_NeedingExpansion( );
|
||||||
}
|
}
|
||||||
|
|
||||||
tagStack.pop( );
|
tagStack.pop( );
|
||||||
|
|
||||||
if( ! tagStack.isEmpty( )
|
if( ! tagStack.isEmpty( )
|
||||||
&& tags_.containsKey( tagStack.peek( ) )
|
&& tags_.containsKey( tagStack.peek( ) )
|
||||||
&& expand == true ) {
|
&& expand == true ) {
|
||||||
tags_.get( tagStack.peek( ) ).set_NeedingExpansion(
|
tags_.get( tagStack.peek( ) ).set_NeedingExpansion(
|
||||||
expand );
|
expand );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// opening tag
|
// opening tag
|
||||||
else {
|
else {
|
||||||
String tagName = line.substring(
|
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 simpleTagName = tagName;
|
||||||
String extendedTagName = ""; //$NON-NLS-1$
|
String extendedTagName = ""; //$NON-NLS-1$
|
||||||
if( tagName.split( ":" ).length > 1 ) //$NON-NLS-1$
|
if( tagName.split( ":" ).length > 1 ) //$NON-NLS-1$
|
||||||
|
@ -182,13 +182,13 @@ public class SchemaParser
|
||||||
currentTag = tags_.get( simpleTagName );
|
currentTag = tags_.get( simpleTagName );
|
||||||
currentTag.set_InhertedTagName( extendedTagName );
|
currentTag.set_InhertedTagName( extendedTagName );
|
||||||
currentTag.set_NeedingExpansion( ! extendedTagName
|
currentTag.set_NeedingExpansion( ! extendedTagName
|
||||||
.isEmpty( ) );
|
.isEmpty( ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WMLTag tag = WmlFactory2.eINSTANCE.createWMLTag(
|
WMLTag tag = WmlFactory2.eINSTANCE.createWMLTag(
|
||||||
simpleTagName, extendedTagName );
|
simpleTagName, extendedTagName );
|
||||||
tag.set_NeedingExpansion( ! extendedTagName
|
tag.set_NeedingExpansion( ! extendedTagName
|
||||||
.isEmpty( ) );
|
.isEmpty( ) );
|
||||||
currentTag = tag;
|
currentTag = tag;
|
||||||
tags_.put( simpleTagName, tag );
|
tags_.put( simpleTagName, tag );
|
||||||
}
|
}
|
||||||
|
@ -202,12 +202,12 @@ public class SchemaParser
|
||||||
String[] tokens = line.split( "=" ); //$NON-NLS-1$
|
String[] tokens = line.split( "=" ); //$NON-NLS-1$
|
||||||
if( tokens.length != 2 ) {
|
if( tokens.length != 2 ) {
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"Error. invalid primitive on line :" + index ); //$NON-NLS-1$
|
"Error. invalid primitive on line :" + index ); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
primitives_.put( tokens[0].trim( ),
|
primitives_.put( tokens[0].trim( ),
|
||||||
StringUtils.trimQuotes( tokens[1].trim( ) ) );
|
StringUtils.trimQuotes( tokens[1].trim( ) ) );
|
||||||
}
|
}
|
||||||
else if( tagStack.peek( ).equals( "description" ) ) //$NON-NLS-1$
|
else if( tagStack.peek( ).equals( "description" ) ) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
|
@ -220,8 +220,8 @@ public class SchemaParser
|
||||||
value.append( tokens[1] + "\n" ); //$NON-NLS-1$
|
value.append( tokens[1] + "\n" ); //$NON-NLS-1$
|
||||||
++index;
|
++index;
|
||||||
while( StringUtils.countOf( lines[index], '"' ) % 2 == 0
|
while( StringUtils.countOf( lines[index], '"' ) % 2 == 0
|
||||||
&& ! StringUtils.startsWith( lines[index], "#" ) && //$NON-NLS-1$
|
&& ! StringUtils.startsWith( lines[index], "#" ) && //$NON-NLS-1$
|
||||||
index < lines.length ) {
|
index < lines.length ) {
|
||||||
value.append( lines[index] + "\n" ); //$NON-NLS-1$
|
value.append( lines[index] + "\n" ); //$NON-NLS-1$
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ public class SchemaParser
|
||||||
// get rid of the quotes
|
// get rid of the quotes
|
||||||
if( value.length( ) >= 2 ) {
|
if( value.length( ) >= 2 ) {
|
||||||
value = new StringBuilder( value.substring( 1,
|
value = new StringBuilder( value.substring( 1,
|
||||||
value.length( ) - 1 ) );
|
value.length( ) - 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentTag != null ) {
|
if( currentTag != null ) {
|
||||||
|
@ -248,22 +248,23 @@ public class SchemaParser
|
||||||
String tmpLine = line.trim( );
|
String tmpLine = line.trim( );
|
||||||
if( line.contains( "#" ) ) {
|
if( line.contains( "#" ) ) {
|
||||||
tmpLine = line
|
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$
|
String[] tokens = tmpLine.split( "=" ); //$NON-NLS-1$
|
||||||
|
|
||||||
if( tokens.length != 2 ) {
|
if( tokens.length != 2 ) {
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"Error. invalid attribute on line :" + index ); //$NON-NLS-1$
|
"Error. invalid attribute on line :" + index ); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] value = tokens[1].substring( 1,
|
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 ) {
|
if( value.length != 2 ) {
|
||||||
Logger.getInstance( )
|
Logger
|
||||||
.logError(
|
.getInstance( )
|
||||||
"Error. invalid attribute value on line:" + index ); //$NON-NLS-1$
|
.logError(
|
||||||
|
"Error. invalid attribute value on line:" + index ); //$NON-NLS-1$
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +277,8 @@ public class SchemaParser
|
||||||
// tag wasn't created yet
|
// tag wasn't created yet
|
||||||
if( targetTag == null ) {
|
if( targetTag == null ) {
|
||||||
targetTag = WmlFactory2.eINSTANCE
|
targetTag = WmlFactory2.eINSTANCE
|
||||||
.createWMLTag( value[1], "",
|
.createWMLTag( value[1], "",
|
||||||
getCardinality( value[0] ) );
|
getCardinality( value[0] ) );
|
||||||
tags_.put( value[1], targetTag );
|
tags_.put( value[1], targetTag );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,17 +286,18 @@ public class SchemaParser
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( primitives_.get( value[1] ) == null ) {
|
if( primitives_.get( value[1] ) == null ) {
|
||||||
Logger.getInstance( )
|
Logger
|
||||||
.logError(
|
.getInstance( )
|
||||||
"Undefined primitive type in schema.cfg for: " + value[1] ); //$NON-NLS-1$
|
.logError(
|
||||||
|
"Undefined primitive type in schema.cfg for: " + value[1] ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTag.getExpressions( ).add(
|
currentTag.getExpressions( ).add(
|
||||||
WmlFactory2.eINSTANCE.createWMLKey(
|
WmlFactory2.eINSTANCE.createWMLKey(
|
||||||
tokens[0],
|
tokens[0],
|
||||||
primitives_.get( value[1] ),
|
primitives_.get( value[1] ),
|
||||||
getCardinality( value[0] ),
|
getCardinality( value[0] ),
|
||||||
value[1].equals( "tstring" ) ) );
|
value[1].equals( "tstring" ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -346,7 +348,7 @@ public class SchemaParser
|
||||||
private void sortChildren( WMLTag tag )
|
private void sortChildren( WMLTag tag )
|
||||||
{
|
{
|
||||||
WMLExpression[] expressions = ( WMLExpression[] ) tag.getExpressions( )
|
WMLExpression[] expressions = ( WMLExpression[] ) tag.getExpressions( )
|
||||||
.toArray( );
|
.toArray( );
|
||||||
Arrays.sort( expressions, new CardinalityComparator( ) );
|
Arrays.sort( expressions, new CardinalityComparator( ) );
|
||||||
tag.getExpressions( ).clear( );
|
tag.getExpressions( ).clear( );
|
||||||
|
|
||||||
|
@ -399,7 +401,7 @@ public class SchemaParser
|
||||||
* That is, after the sort the required wmlexpressions will be first
|
* That is, after the sort the required wmlexpressions will be first
|
||||||
*/
|
*/
|
||||||
public static class CardinalityComparator implements
|
public static class CardinalityComparator implements
|
||||||
Comparator< WMLExpression >, Serializable
|
Comparator< WMLExpression >, Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 6103884038547449868L;
|
private static final long serialVersionUID = 6103884038547449868L;
|
||||||
|
|
||||||
|
|
|
@ -62,16 +62,16 @@ public class TemplateProvider
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File varsFile = new File( Constants.PLUGIN_FULL_PATH
|
File varsFile = new File( Constants.PLUGIN_FULL_PATH
|
||||||
+ "/templates/cac/variables.txt" );
|
+ "/templates/cac/variables.txt" );
|
||||||
cacs_.put( "variables", Arrays.asList( StringUtils
|
cacs_.put( "variables", Arrays.asList( StringUtils
|
||||||
.getLines( ResourceUtils.getFileContents( varsFile, true,
|
.getLines( ResourceUtils.getFileContents( varsFile, true,
|
||||||
true ) ) ) );
|
true ) ) ) );
|
||||||
|
|
||||||
File eventsFile = new File( Constants.PLUGIN_FULL_PATH
|
File eventsFile = new File( Constants.PLUGIN_FULL_PATH
|
||||||
+ "/templates/cac/events.txt" );
|
+ "/templates/cac/events.txt" );
|
||||||
cacs_.put( "events", Arrays.asList( StringUtils
|
cacs_.put( "events", Arrays.asList( StringUtils
|
||||||
.getLines( ResourceUtils.getFileContents( eventsFile, true,
|
.getLines( ResourceUtils.getFileContents( eventsFile, true,
|
||||||
true ) ) ) );
|
true ) ) ) );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,10 @@ public class TemplateProvider
|
||||||
templates_.clear( );
|
templates_.clear( );
|
||||||
try {
|
try {
|
||||||
Logger.getInstance( ).log( "reading templates from: " + //$NON-NLS-1$
|
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(
|
BufferedReader reader = new BufferedReader( new FileReader(
|
||||||
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME ) );
|
Constants.PLUGIN_FULL_PATH + Constants.TEMPLATES_FILENAME ) );
|
||||||
BufferedReader tmpReader;
|
BufferedReader tmpReader;
|
||||||
String line, tmpLine;
|
String line, tmpLine;
|
||||||
StringBuilder content = new StringBuilder( );
|
StringBuilder content = new StringBuilder( );
|
||||||
|
@ -105,17 +105,17 @@ public class TemplateProvider
|
||||||
|
|
||||||
if( tokensStrings.length != 2 ) {
|
if( tokensStrings.length != 2 ) {
|
||||||
Logger.getInstance( ).logWarn(
|
Logger.getInstance( ).logWarn(
|
||||||
"TemplateIndex line " + line
|
"TemplateIndex line " + line
|
||||||
+ "is not properly formatted" );
|
+ "is not properly formatted" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
content.setLength( 0 );
|
content.setLength( 0 );
|
||||||
|
|
||||||
if( new File( Constants.PLUGIN_FULL_PATH + tokensStrings[1] )
|
if( new File( Constants.PLUGIN_FULL_PATH + tokensStrings[1] )
|
||||||
.exists( ) ) {
|
.exists( ) ) {
|
||||||
tmpReader = new BufferedReader( new FileReader(
|
tmpReader = new BufferedReader( new FileReader(
|
||||||
Constants.PLUGIN_FULL_PATH + tokensStrings[1] ) );
|
Constants.PLUGIN_FULL_PATH + tokensStrings[1] ) );
|
||||||
while( ( tmpLine = tmpReader.readLine( ) ) != null ) {
|
while( ( tmpLine = tmpReader.readLine( ) ) != null ) {
|
||||||
content.append( tmpLine + '\n' );
|
content.append( tmpLine + '\n' );
|
||||||
}
|
}
|
||||||
|
@ -139,10 +139,10 @@ public class TemplateProvider
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getProcessedTemplate( String templateName,
|
public String getProcessedTemplate( String templateName,
|
||||||
List< ReplaceableParameter > parameters )
|
List< ReplaceableParameter > parameters )
|
||||||
{
|
{
|
||||||
String tmpTemplate = TemplateProvider.getInstance( ).getTemplate(
|
String tmpTemplate = TemplateProvider.getInstance( ).getTemplate(
|
||||||
templateName );
|
templateName );
|
||||||
if( tmpTemplate == null || parameters == null ) {
|
if( tmpTemplate == null || parameters == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -156,11 +156,11 @@ public class TemplateProvider
|
||||||
for( ReplaceableParameter param: parameters ) {
|
for( ReplaceableParameter param: parameters ) {
|
||||||
if( template[i].contains( param.paramName ) ) {
|
if( template[i].contains( param.paramName ) ) {
|
||||||
template[i] = StringUtils.replaceWithIndent( template[i],
|
template[i] = StringUtils.replaceWithIndent( template[i],
|
||||||
param.paramName, param.paramValue );
|
param.paramName, param.paramValue );
|
||||||
|
|
||||||
if( ! templateName.equals( "build_xml" ) && //$NON-NLS-1$
|
if( ! templateName.equals( "build_xml" ) && //$NON-NLS-1$
|
||||||
( param.paramValue == null || param.paramValue
|
( param.paramValue == null || param.paramValue
|
||||||
.isEmpty( ) ) ) {
|
.isEmpty( ) ) ) {
|
||||||
// we don't have any value supplied -
|
// we don't have any value supplied -
|
||||||
// let's comment that line (if it's not already
|
// let's comment that line (if it's not already
|
||||||
// commented)
|
// commented)
|
||||||
|
@ -229,7 +229,7 @@ public class TemplateProvider
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Pair< List< Pair< String, String >>, List< String >> getFilesDirectories(
|
public Pair< List< Pair< String, String >>, List< String >> getFilesDirectories(
|
||||||
String structureTemplate )
|
String structureTemplate )
|
||||||
{
|
{
|
||||||
List< Pair< String, String >> files = new ArrayList< Pair< String, String >>( );
|
List< Pair< String, String >> files = new ArrayList< Pair< String, String >>( );
|
||||||
List< String > dirs = new ArrayList< String >( );
|
List< String > dirs = new ArrayList< String >( );
|
||||||
|
@ -245,16 +245,18 @@ public class TemplateProvider
|
||||||
|
|
||||||
// oops. error
|
// oops. error
|
||||||
if( tmpLine.length != 2 ) {
|
if( tmpLine.length != 2 ) {
|
||||||
Logger.getInstance( )
|
Logger
|
||||||
.logError(
|
.getInstance( )
|
||||||
String.format(
|
.logError(
|
||||||
"error parsing 'structure template' (%s) on line %s", //$NON-NLS-1$
|
String
|
||||||
structureTemplate, line ) );
|
.format(
|
||||||
|
"error parsing 'structure template' (%s) on line %s", //$NON-NLS-1$
|
||||||
|
structureTemplate, line ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
files.add( new Pair< String, String >( tmpLine[0].trim( ),
|
files.add( new Pair< String, String >( tmpLine[0].trim( ),
|
||||||
tmpLine[1].trim( ) ) );
|
tmpLine[1].trim( ) ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dirs.add( line.trim( ) );
|
dirs.add( line.trim( ) );
|
||||||
|
@ -262,6 +264,6 @@ public class TemplateProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair< List< Pair< String, String >>, List< String >>( files,
|
return new Pair< List< Pair< String, String >>, List< String >>( files,
|
||||||
dirs );
|
dirs );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class AntUtils
|
||||||
* @return null if the build didn't success
|
* @return null if the build didn't success
|
||||||
*/
|
*/
|
||||||
public static String runAnt( String antFile,
|
public static String runAnt( String antFile,
|
||||||
Map< String, String > properties, boolean recordOutput )
|
Map< String, String > properties, boolean recordOutput )
|
||||||
{
|
{
|
||||||
Project project = new Project( );
|
Project project = new Project( );
|
||||||
ByteArrayOutputStream out = null;
|
ByteArrayOutputStream out = null;
|
||||||
|
@ -56,7 +56,7 @@ public class AntUtils
|
||||||
ProjectHelper.configureProject( project, buildFile );
|
ProjectHelper.configureProject( project, buildFile );
|
||||||
|
|
||||||
Iterator< Entry< String, String >> iterator = properties.entrySet( )
|
Iterator< Entry< String, String >> iterator = properties.entrySet( )
|
||||||
.iterator( );
|
.iterator( );
|
||||||
while( iterator.hasNext( ) ) {
|
while( iterator.hasNext( ) ) {
|
||||||
Entry< String, String > key = iterator.next( );
|
Entry< String, String > key = iterator.next( );
|
||||||
project.setUserProperty( key.getKey( ), key.getValue( ) );
|
project.setUserProperty( key.getKey( ), key.getValue( ) );
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class EditorUtils
|
||||||
public static void writeInEditor( IEditorPart targetEditor, String content )
|
public static void writeInEditor( IEditorPart targetEditor, String content )
|
||||||
{
|
{
|
||||||
int offset = ( ( ITextSelection ) getTextEditor( targetEditor )
|
int offset = ( ( ITextSelection ) getTextEditor( targetEditor )
|
||||||
.getSelectionProvider( ).getSelection( ) ).getOffset( );
|
.getSelectionProvider( ).getSelection( ) ).getOffset( );
|
||||||
try {
|
try {
|
||||||
getEditorDocument( targetEditor ).replace( offset, 0, content );
|
getEditorDocument( targetEditor ).replace( offset, 0, content );
|
||||||
} catch( BadLocationException e ) {
|
} catch( BadLocationException e ) {
|
||||||
|
@ -76,14 +76,14 @@ public class EditorUtils
|
||||||
* the string to replace the current content
|
* the string to replace the current content
|
||||||
*/
|
*/
|
||||||
public static void replaceEditorText( IEditorPart targetEditor,
|
public static void replaceEditorText( IEditorPart targetEditor,
|
||||||
String content )
|
String content )
|
||||||
{
|
{
|
||||||
if( targetEditor == null ) {
|
if( targetEditor == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
getEditorDocument( targetEditor ).replace( 0,
|
getEditorDocument( targetEditor ).replace( 0,
|
||||||
getEditorDocument( targetEditor ).getLength( ), content );
|
getEditorDocument( targetEditor ).getLength( ), content );
|
||||||
} catch( BadLocationException e ) {
|
} catch( BadLocationException e ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class EditorUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
IDocumentProvider dp = getTextEditor( targetEditor )
|
IDocumentProvider dp = getTextEditor( targetEditor )
|
||||||
.getDocumentProvider( );
|
.getDocumentProvider( );
|
||||||
return dp.getDocument( targetEditor.getEditorInput( ) );
|
return dp.getDocument( targetEditor.getEditorInput( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class EditorUtils
|
||||||
public static IEditorPart getEditedFile( )
|
public static IEditorPart getEditedFile( )
|
||||||
{
|
{
|
||||||
return WorkspaceUtils.getWorkbenchWindow( ).getPages( )[0]
|
return WorkspaceUtils.getWorkbenchWindow( ).getPages( )[0]
|
||||||
.getActiveEditor( );
|
.getActiveEditor( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +164,7 @@ public class EditorUtils
|
||||||
public static IEditorPart openEditor( IFile file, boolean activatePage )
|
public static IEditorPart openEditor( IFile file, boolean activatePage )
|
||||||
{
|
{
|
||||||
IWorkbenchPage page = WorkspaceUtils.getWorkbenchWindow( )
|
IWorkbenchPage page = WorkspaceUtils.getWorkbenchWindow( )
|
||||||
.getActivePage( );
|
.getActivePage( );
|
||||||
try {
|
try {
|
||||||
return IDE.openEditor( page, file, activatePage );
|
return IDE.openEditor( page, file, activatePage );
|
||||||
} catch( PartInitException e ) {
|
} catch( PartInitException e ) {
|
||||||
|
@ -182,7 +182,7 @@ public class EditorUtils
|
||||||
public static IEditorPart openEditor( String file )
|
public static IEditorPart openEditor( String file )
|
||||||
{
|
{
|
||||||
return openEditor( EFS.getLocalFileSystem( )
|
return openEditor( EFS.getLocalFileSystem( )
|
||||||
.getStore( new Path( file ) ) );
|
.getStore( new Path( file ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,7 +195,7 @@ public class EditorUtils
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return IDE.openEditorOnFileStore( WorkspaceUtils
|
return IDE.openEditorOnFileStore( WorkspaceUtils
|
||||||
.getWorkbenchWindow( ).getActivePage( ), file );
|
.getWorkbenchWindow( ).getActivePage( ), file );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class ExternalToolInvoker
|
||||||
|
|
||||||
processBuilder_ = new ProcessBuilder( commandline );
|
processBuilder_ = new ProcessBuilder( commandline );
|
||||||
Logger.getInstance( ).logTool(
|
Logger.getInstance( ).logTool(
|
||||||
String.format( "Invoking tool %s with args: %s", //$NON-NLS-1$
|
String.format( "Invoking tool %s with args: %s", //$NON-NLS-1$
|
||||||
fileName, arguments ) );
|
fileName, arguments ) );
|
||||||
|
|
||||||
outputContent_ = new StringBuilder( );
|
outputContent_ = new StringBuilder( );
|
||||||
errorContent_ = new StringBuilder( );
|
errorContent_ = new StringBuilder( );
|
||||||
|
@ -85,10 +85,10 @@ public class ExternalToolInvoker
|
||||||
Reader stderrReader = null;
|
Reader stderrReader = null;
|
||||||
|
|
||||||
if( arguments_.get( 0 ).toLowerCase( Locale.ENGLISH )
|
if( arguments_.get( 0 ).toLowerCase( Locale.ENGLISH )
|
||||||
.contains( "wesnoth.exe" ) && //$NON-NLS-1$
|
.contains( "wesnoth.exe" ) && //$NON-NLS-1$
|
||||||
Constants.IS_WINDOWS_MACHINE ) {
|
Constants.IS_WINDOWS_MACHINE ) {
|
||||||
String wesnothParent = new File( arguments_.get( 0 ) )
|
String wesnothParent = new File( arguments_.get( 0 ) )
|
||||||
.getParent( ) + "/"; //$NON-NLS-1$
|
.getParent( ) + "/"; //$NON-NLS-1$
|
||||||
if( new File( wesnothParent + "stdout.txt" ).exists( ) ) {
|
if( new File( wesnothParent + "stdout.txt" ).exists( ) ) {
|
||||||
stdoutReader = new FileReader( wesnothParent + "stdout.txt" ); //$NON-NLS-1$
|
stdoutReader = new FileReader( wesnothParent + "stdout.txt" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -385,11 +385,11 @@ public class ExternalToolInvoker
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker launchTool( final String fileName,
|
public static ExternalToolInvoker launchTool( final String fileName,
|
||||||
final List< String > args, final OutputStream[] stdout,
|
final List< String > args, final OutputStream[] stdout,
|
||||||
final OutputStream[] stderr )
|
final OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
final ExternalToolInvoker toolInvoker = new ExternalToolInvoker(
|
final ExternalToolInvoker toolInvoker = new ExternalToolInvoker(
|
||||||
fileName, args );
|
fileName, args );
|
||||||
toolInvoker.runTool( );
|
toolInvoker.runTool( );
|
||||||
Thread outputStreamThread = new Thread( new Runnable( ) {
|
Thread outputStreamThread = new Thread( new Runnable( ) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class GUIUtils
|
||||||
public static int showInfoMessageBox( final String message )
|
public static int showInfoMessageBox( final String message )
|
||||||
{
|
{
|
||||||
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), 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 )
|
public static int showWarnMessageBox( final String message )
|
||||||
{
|
{
|
||||||
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), 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 )
|
public static int showErrorMessageBox( final String message )
|
||||||
{
|
{
|
||||||
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), 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 )
|
public static int showMessageBox( final String message, final int style )
|
||||||
{
|
{
|
||||||
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
|
return showMessageBox( WorkspaceUtils.getWorkbenchWindow( ), message,
|
||||||
style );
|
style );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ public class GUIUtils
|
||||||
* the message to print
|
* the message to print
|
||||||
*/
|
*/
|
||||||
public static int showMessageBox( final IWorkbenchWindow window,
|
public static int showMessageBox( final IWorkbenchWindow window,
|
||||||
final String message )
|
final String message )
|
||||||
{
|
{
|
||||||
return showMessageBox( window, message, SWT.ICON_INFORMATION );
|
return showMessageBox( window, message, SWT.ICON_INFORMATION );
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class GUIUtils
|
||||||
* the message to print
|
* the message to print
|
||||||
*/
|
*/
|
||||||
public static int showMessageBox( final IWorkbenchWindow window,
|
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 ) {
|
if( window == null || window.getShell( ) == null || message == null ) {
|
||||||
return - 1;
|
return - 1;
|
||||||
|
@ -136,11 +136,11 @@ public class GUIUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static MessageConsole createConsole( String consoleTitle,
|
public static MessageConsole createConsole( String consoleTitle,
|
||||||
ImageDescriptor imageDescriptor, boolean activate )
|
ImageDescriptor imageDescriptor, boolean activate )
|
||||||
{
|
{
|
||||||
MessageConsole console = null;
|
MessageConsole console = null;
|
||||||
IConsoleManager conMan = ConsolePlugin.getDefault( )
|
IConsoleManager conMan = ConsolePlugin.getDefault( )
|
||||||
.getConsoleManager( );
|
.getConsoleManager( );
|
||||||
IConsole[] existing = conMan.getConsoles( );
|
IConsole[] existing = conMan.getConsoles( );
|
||||||
for( int i = 0; i < existing.length; i++ ) {
|
for( int i = 0; i < existing.length; i++ ) {
|
||||||
if( consoleTitle.equals( existing[i].getName( ) ) ) {
|
if( consoleTitle.equals( existing[i].getName( ) ) ) {
|
||||||
|
|
|
@ -69,12 +69,12 @@ public class GameUtils
|
||||||
String scenarioId = null;
|
String scenarioId = null;
|
||||||
|
|
||||||
campaignId = ProjectUtils.getCacheForProject(
|
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 ) {
|
if( scenario == true && selectedResource instanceof IFile ) {
|
||||||
scenarioId = ProjectUtils.getCacheForProject(
|
scenarioId = ProjectUtils.getCacheForProject(
|
||||||
selectedResource.getProject( ) ).getWMLConfig(
|
selectedResource.getProject( ) ).getWMLConfig(
|
||||||
selectedResource.getProjectRelativePath( ).toString( ) ).ScenarioId;
|
selectedResource.getProjectRelativePath( ).toString( ) ).ScenarioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( campaignId == null ) {
|
if( campaignId == null ) {
|
||||||
|
@ -99,9 +99,9 @@ public class GameUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
startGame(
|
startGame(
|
||||||
WesnothInstallsUtils
|
WesnothInstallsUtils
|
||||||
.getInstallNameForResource( selectedResource ),
|
.getInstallNameForResource( selectedResource ),
|
||||||
args );
|
args );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
@ -119,9 +119,9 @@ public class GameUtils
|
||||||
else {
|
else {
|
||||||
WesnothInstallsUtils.setupInstallForResource( selectedRes );
|
WesnothInstallsUtils.setupInstallForResource( selectedRes );
|
||||||
startGame(
|
startGame(
|
||||||
WesnothInstallsUtils
|
WesnothInstallsUtils
|
||||||
.getInstallNameForResource( selectedRes ),
|
.getInstallNameForResource( selectedRes ),
|
||||||
null );
|
null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,10 +156,10 @@ public class GameUtils
|
||||||
args.add( workingDir );
|
args.add( workingDir );
|
||||||
|
|
||||||
MessageConsole console = GUIUtils.createConsole( Messages.GameUtils_9,
|
MessageConsole console = GUIUtils.createConsole( Messages.GameUtils_9,
|
||||||
null, true );
|
null, true );
|
||||||
ExternalToolInvoker.launchTool( wesnothExec, args,
|
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( ) ) {
|
if( file == null || ! file.exists( ) ) {
|
||||||
Logger.getInstance( ).log( "non-existing map file", //$NON-NLS-1$
|
Logger.getInstance( ).log( "non-existing map file", //$NON-NLS-1$
|
||||||
Messages.GameUtils_12 );
|
Messages.GameUtils_12 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class GameUtils
|
||||||
public static void startEditor( String mapName )
|
public static void startEditor( String mapName )
|
||||||
{
|
{
|
||||||
startGame( WesnothInstallsUtils.getInstallNameForResource( mapName ),
|
startGame( WesnothInstallsUtils.getInstallNameForResource( mapName ),
|
||||||
getEditorLaunchArguments( mapName ) );
|
getEditorLaunchArguments( mapName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class ListUtils
|
||||||
* @return A string with the string representation of that objects
|
* @return A string with the string representation of that objects
|
||||||
*/
|
*/
|
||||||
public static String concatenateList( List< ? extends Object > list,
|
public static String concatenateList( List< ? extends Object > list,
|
||||||
String separator )
|
String separator )
|
||||||
{
|
{
|
||||||
if( list == null || list.isEmpty( ) ) {
|
if( list == null || list.isEmpty( ) ) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
|
|
@ -28,12 +28,12 @@ public class MapUtils
|
||||||
{
|
{
|
||||||
if( WorkspaceUtils.getSelectedFolder( ) == null ) {
|
if( WorkspaceUtils.getSelectedFolder( ) == null ) {
|
||||||
Logger.getInstance( ).log( "no directory selected (importMap)", //$NON-NLS-1$
|
Logger.getInstance( ).log( "no directory selected (importMap)", //$NON-NLS-1$
|
||||||
Messages.MapUtils_1 );
|
Messages.MapUtils_1 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog mapDialog = new FileDialog( WesnothPlugin.getShell( ),
|
FileDialog mapDialog = new FileDialog( WesnothPlugin.getShell( ),
|
||||||
SWT.OPEN );
|
SWT.OPEN );
|
||||||
mapDialog.setText( Messages.MapUtils_2 );
|
mapDialog.setText( Messages.MapUtils_2 );
|
||||||
mapDialog.setFilterExtensions( new String[] { "*.map" } ); //$NON-NLS-1$
|
mapDialog.setFilterExtensions( new String[] { "*.map" } ); //$NON-NLS-1$
|
||||||
String file = mapDialog.open( );
|
String file = mapDialog.open( );
|
||||||
|
@ -45,19 +45,19 @@ public class MapUtils
|
||||||
try {
|
try {
|
||||||
File source = new File( file );
|
File source = new File( file );
|
||||||
File target = new File( WorkspaceUtils.getSelectedFolder( )
|
File target = new File( WorkspaceUtils.getSelectedFolder( )
|
||||||
.getLocation( ).toOSString( )
|
.getLocation( ).toOSString( )
|
||||||
+ IPath.SEPARATOR + source.getName( ) );
|
+ IPath.SEPARATOR + source.getName( ) );
|
||||||
|
|
||||||
if( target.exists( ) ) {
|
if( target.exists( ) ) {
|
||||||
if( GUIUtils.showMessageBox( Messages.MapUtils_4,
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUtils.copyTo( source, target );
|
ResourceUtils.copyTo( source, target );
|
||||||
WorkspaceUtils.getSelectedFolder( ).refreshLocal(
|
WorkspaceUtils.getSelectedFolder( ).refreshLocal(
|
||||||
IResource.DEPTH_INFINITE, null );
|
IResource.DEPTH_INFINITE, null );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class ResourceUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileContents( File file, boolean skipEmptyLines,
|
public static String getFileContents( File file, boolean skipEmptyLines,
|
||||||
boolean skipCommentLines )
|
boolean skipCommentLines )
|
||||||
{
|
{
|
||||||
if( ! file.exists( ) || ! file.isFile( ) ) {
|
if( ! file.exists( ) || ! file.isFile( ) ) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
@ -107,7 +107,7 @@ public class ResourceUtils
|
||||||
try {
|
try {
|
||||||
String line = ""; //$NON-NLS-1$
|
String line = ""; //$NON-NLS-1$
|
||||||
reader = new BufferedReader( new InputStreamReader(
|
reader = new BufferedReader( new InputStreamReader(
|
||||||
new FileInputStream( file ) ) );
|
new FileInputStream( file ) ) );
|
||||||
while( ( line = reader.readLine( ) ) != null ) {
|
while( ( line = reader.readLine( ) ) != null ) {
|
||||||
if( skipEmptyLines && line.isEmpty( ) ) {
|
if( skipEmptyLines && line.isEmpty( ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -158,7 +158,7 @@ public class ResourceUtils
|
||||||
* the contents of the resource or null if no contents needed
|
* the contents of the resource or null if no contents needed
|
||||||
*/
|
*/
|
||||||
public static void createResource( IResource resource, IProject project,
|
public static void createResource( IResource resource, IProject project,
|
||||||
String resourceName, InputStream input )
|
String resourceName, InputStream input )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if( ! project.isOpen( ) ) {
|
if( ! project.isOpen( ) ) {
|
||||||
|
@ -171,18 +171,18 @@ public class ResourceUtils
|
||||||
|
|
||||||
if( resource instanceof IFile ) {
|
if( resource instanceof IFile ) {
|
||||||
( ( IFile ) resource ).create( input, true,
|
( ( IFile ) resource ).create( input, true,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
}
|
}
|
||||||
else if( resource instanceof IFolder ) {
|
else if( resource instanceof IFolder ) {
|
||||||
( ( IFolder ) resource ).create( true, true,
|
( ( IFolder ) resource ).create( true, true,
|
||||||
new NullProgressMonitor( ) );
|
new NullProgressMonitor( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
Logger.getInstance( ).logError(
|
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,
|
GUIUtils.showMessageBox( Messages.ResourceUtils_5 + resourceName,
|
||||||
SWT.ICON_ERROR );
|
SWT.ICON_ERROR );
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ public class ResourceUtils
|
||||||
* true to overwrite the file if it already exists
|
* true to overwrite the file if it already exists
|
||||||
*/
|
*/
|
||||||
public static void createFile( IProject project, String fileName,
|
public static void createFile( IProject project, String fileName,
|
||||||
String fileContentsString, boolean overwrite )
|
String fileContentsString, boolean overwrite )
|
||||||
{
|
{
|
||||||
IFile file = project.getFile( fileName );
|
IFile file = project.getFile( fileName );
|
||||||
if( fileContentsString == null ) {
|
if( fileContentsString == null ) {
|
||||||
|
@ -267,7 +267,7 @@ public class ResourceUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(
|
||||||
fileContentsString.getBytes( ) );
|
fileContentsString.getBytes( ) );
|
||||||
createResource( file, project, fileName, inputStream );
|
createResource( file, project, fileName, inputStream );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ public class ResourceUtils
|
||||||
File wesnothFile = new File( path );
|
File wesnothFile = new File( path );
|
||||||
try {
|
try {
|
||||||
if( force == true
|
if( force == true
|
||||||
|| ( force == false && wesnothFile.exists( ) == false ) ) {
|
|| ( force == false && wesnothFile.exists( ) == false ) ) {
|
||||||
createNewFile( wesnothFile.getAbsolutePath( ) );
|
createNewFile( wesnothFile.getAbsolutePath( ) );
|
||||||
}
|
}
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
|
@ -302,14 +302,14 @@ public class ResourceUtils
|
||||||
* The parameters list to replace in the template of 'build.xml'
|
* The parameters list to replace in the template of 'build.xml'
|
||||||
*/
|
*/
|
||||||
public static void createBuildXMLFile( String path,
|
public static void createBuildXMLFile( String path,
|
||||||
List< ReplaceableParameter > params )
|
List< ReplaceableParameter > params )
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
File antFile = new File( path );
|
File antFile = new File( path );
|
||||||
createNewFile( antFile.getAbsolutePath( ) );
|
createNewFile( antFile.getAbsolutePath( ) );
|
||||||
FileWriter writer = new FileWriter( antFile );
|
FileWriter writer = new FileWriter( antFile );
|
||||||
writer.write( TemplateProvider.getInstance( ).getProcessedTemplate(
|
writer.write( TemplateProvider.getInstance( ).getProcessedTemplate(
|
||||||
"build_xml", params ) ); //$NON-NLS-1$
|
"build_xml", params ) ); //$NON-NLS-1$
|
||||||
writer.close( );
|
writer.close( );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
|
@ -369,10 +369,10 @@ public class ResourceUtils
|
||||||
public static boolean isValidFilePath( String filePath )
|
public static boolean isValidFilePath( String filePath )
|
||||||
{
|
{
|
||||||
boolean valid = filePath != null && ! filePath.isEmpty( )
|
boolean valid = filePath != null && ! filePath.isEmpty( )
|
||||||
&& new File( filePath ).exists( );
|
&& new File( filePath ).exists( );
|
||||||
if( valid == false && ! StringUtils.isNullOrEmpty( filePath ) ) {
|
if( valid == false && ! StringUtils.isNullOrEmpty( filePath ) ) {
|
||||||
Logger.getInstance( ).logWarn(
|
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;
|
return valid;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ public class ResourceUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
return StringUtils.normalizePath( path ).contains(
|
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(
|
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 )
|
public static boolean isConfigFile( IResource resource )
|
||||||
{
|
{
|
||||||
return resource instanceof IFile
|
return resource instanceof IFile
|
||||||
&& resource.getName( ).toLowerCase( Locale.ENGLISH )
|
&& resource.getName( ).toLowerCase( Locale.ENGLISH )
|
||||||
.endsWith( ".cfg" ); //$NON-NLS-1$
|
.endsWith( ".cfg" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -476,13 +476,13 @@ public class ResourceUtils
|
||||||
IContainer container = resource.getParent( );
|
IContainer container = resource.getParent( );
|
||||||
if( container != null ) {
|
if( container != null ) {
|
||||||
while( container.getParent( ) != null
|
while( container.getParent( ) != null
|
||||||
&& container.getParent( ) != resource
|
&& container.getParent( ) != resource
|
||||||
.getProject( ) ) {
|
.getProject( ) ) {
|
||||||
container = container.getParent( );
|
container = container.getParent( );
|
||||||
}
|
}
|
||||||
IFile file = project.getFile( container
|
IFile file = project.getFile( container
|
||||||
.getProjectRelativePath( ).toOSString( )
|
.getProjectRelativePath( ).toOSString( )
|
||||||
+ "/_main.cfg" ); //$NON-NLS-1$
|
+ "/_main.cfg" ); //$NON-NLS-1$
|
||||||
if( file.exists( ) ) {
|
if( file.exists( ) ) {
|
||||||
targetResource = file;
|
targetResource = file;
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ public class ResourceUtils
|
||||||
public static String getCampaignID( IResource resource )
|
public static String getCampaignID( IResource resource )
|
||||||
{
|
{
|
||||||
SimpleWMLParser parser = new SimpleWMLParser(
|
SimpleWMLParser parser = new SimpleWMLParser(
|
||||||
getMainConfigLocation( resource ) );
|
getMainConfigLocation( resource ) );
|
||||||
parser.parse( );
|
parser.parse( );
|
||||||
return parser.getParsedConfig( ).CampaignId;
|
return parser.getParsedConfig( ).CampaignId;
|
||||||
}
|
}
|
||||||
|
@ -537,10 +537,10 @@ public class ResourceUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static DefaultHandler getWMLSAXHandlerFromResource(
|
public static DefaultHandler getWMLSAXHandlerFromResource(
|
||||||
String installName, String resourcePath, DefaultHandler saxHandler )
|
String installName, String resourcePath, DefaultHandler saxHandler )
|
||||||
{
|
{
|
||||||
ExternalToolInvoker parser = WMLTools.runWMLParser2( installName,
|
ExternalToolInvoker parser = WMLTools.runWMLParser2( installName,
|
||||||
resourcePath );
|
resourcePath );
|
||||||
if( parser == null ) {
|
if( parser == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -549,12 +549,12 @@ public class ResourceUtils
|
||||||
saxparser = SAXParserFactory.newInstance( ).newSAXParser( );
|
saxparser = SAXParserFactory.newInstance( ).newSAXParser( );
|
||||||
|
|
||||||
saxparser
|
saxparser
|
||||||
.parse( new InputSource( parser.getStdout( ) ), saxHandler );
|
.parse( new InputSource( parser.getStdout( ) ), saxHandler );
|
||||||
return saxHandler;
|
return saxHandler;
|
||||||
} catch( SAXException e ) {
|
} catch( SAXException e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
Logger.getInstance( ).logError(
|
Logger.getInstance( ).logError(
|
||||||
"Using output: " + parser.getOutputContent( ) ); //$NON-NLS-1$
|
"Using output: " + parser.getOutputContent( ) ); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
|
@ -598,14 +598,14 @@ public class ResourceUtils
|
||||||
|
|
||||||
String sourceFile = line.substring( 1, pivotIndex - 1 );
|
String sourceFile = line.substring( 1, pivotIndex - 1 );
|
||||||
int lineNumber = Integer.parseInt( line.substring( pivotIndex
|
int lineNumber = Integer.parseInt( line.substring( pivotIndex
|
||||||
+ pivot.length( ),
|
+ pivot.length( ),
|
||||||
line.indexOf( ":", pivotIndex + pivot.length( ) + 1 ) ) ); //$NON-NLS-1$
|
line.indexOf( ":", pivotIndex + pivot.length( ) + 1 ) ) ); //$NON-NLS-1$
|
||||||
String message = line.substring( line.indexOf(
|
String message = line.substring( line.indexOf(
|
||||||
" ", pivotIndex + pivot.length( ) + 1 ) ); //$NON-NLS-1$
|
" ", pivotIndex + pivot.length( ) + 1 ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
// Get the file
|
// Get the file
|
||||||
IFile file = ResourcesPlugin.getWorkspace( ).getRoot( )
|
IFile file = ResourcesPlugin.getWorkspace( ).getRoot( )
|
||||||
.getFileForLocation( new Path( sourceFile ) );
|
.getFileForLocation( new Path( sourceFile ) );
|
||||||
if( file.exists( ) == false ) {
|
if( file.exists( ) == false ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -640,10 +640,10 @@ public class ResourceUtils
|
||||||
public static IResource getWorkspaceResource( Resource emfResource )
|
public static IResource getWorkspaceResource( Resource emfResource )
|
||||||
{
|
{
|
||||||
return ResourcesPlugin
|
return ResourcesPlugin
|
||||||
.getWorkspace( )
|
.getWorkspace( )
|
||||||
.getRoot( )
|
.getRoot( )
|
||||||
.getFile(
|
.getFile(
|
||||||
new Path( emfResource.getURI( ).toPlatformString( true ) ) );
|
new Path( emfResource.getURI( ).toPlatformString( true ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,7 +689,7 @@ public class ResourceUtils
|
||||||
*/
|
*/
|
||||||
// TODO: check for including a specific config file?
|
// TODO: check for including a specific config file?
|
||||||
if( ! ( text.startsWith( "{campaigns" ) ) && //$NON-NLS-1$
|
if( ! ( text.startsWith( "{campaigns" ) ) && //$NON-NLS-1$
|
||||||
! ( text.equals( "{~add-ons" ) ) ) {
|
! ( text.equals( "{~add-ons" ) ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,12 +699,12 @@ public class ResourceUtils
|
||||||
|
|
||||||
|
|
||||||
if( projectPath.contains( WMLUtils.toString( macro.getParameters( )
|
if( projectPath.contains( WMLUtils.toString( macro.getParameters( )
|
||||||
.get( 1 ) ) ) ) {
|
.get( 1 ) ) ) ) {
|
||||||
String subString = text.replace( "}", "" )
|
String subString = text.replace( "}", "" )
|
||||||
.replaceFirst( "\\{campaigns/", "" )
|
.replaceFirst( "\\{campaigns/", "" )
|
||||||
.replaceFirst( "\\{~add-ons/", "" );
|
.replaceFirst( "\\{~add-ons/", "" );
|
||||||
containersToAdd.add( subString.substring( subString
|
containersToAdd.add( subString.substring( subString
|
||||||
.indexOf( '/' ) ) );
|
.indexOf( '/' ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ public class ResourceUtils
|
||||||
int index = Integer.MAX_VALUE;
|
int index = Integer.MAX_VALUE;
|
||||||
try {
|
try {
|
||||||
index = Integer.parseInt( file
|
index = Integer.parseInt( file
|
||||||
.getPersistentProperty( DependencyListNode.PDL_INDEX ) );
|
.getPersistentProperty( DependencyListNode.PDL_INDEX ) );
|
||||||
} catch( CoreException e ) {
|
} catch( CoreException e ) {
|
||||||
// not interested
|
// not interested
|
||||||
} catch( NumberFormatException e ) {
|
} catch( NumberFormatException e ) {
|
||||||
|
@ -739,7 +739,7 @@ public class ResourceUtils
|
||||||
* @see http://wiki.wesnoth.org/PreprocessorRef
|
* @see http://wiki.wesnoth.org/PreprocessorRef
|
||||||
*/
|
*/
|
||||||
public static class WMLFilesComparator implements Comparator< IResource >,
|
public static class WMLFilesComparator implements Comparator< IResource >,
|
||||||
Serializable
|
Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1045365969430128101L;
|
private static final long serialVersionUID = 1045365969430128101L;
|
||||||
|
@ -748,7 +748,7 @@ public class ResourceUtils
|
||||||
public int compare( IResource o1, IResource o2 )
|
public int compare( IResource o1, IResource o2 )
|
||||||
{
|
{
|
||||||
return ResourceUtils.wmlFileNameCompare( o1.getName( ),
|
return ResourceUtils.wmlFileNameCompare( o1.getName( ),
|
||||||
o2.getName( ) );
|
o2.getName( ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,23 +766,23 @@ public class ResourceUtils
|
||||||
{
|
{
|
||||||
// _initial.cfg is always the "lowest"
|
// _initial.cfg is always the "lowest"
|
||||||
if( fileName1.equals( "_initial.cfg" )
|
if( fileName1.equals( "_initial.cfg" )
|
||||||
&& ! ( fileName2.equals( "_initial.cfg" ) ) ) {
|
&& ! ( fileName2.equals( "_initial.cfg" ) ) ) {
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fileName2.equals( "_initial.cfg" )
|
if( fileName2.equals( "_initial.cfg" )
|
||||||
&& ! ( fileName1.equals( "_initial.cfg" ) ) ) {
|
&& ! ( fileName1.equals( "_initial.cfg" ) ) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _final.cfg is always the "highest"
|
// _final.cfg is always the "highest"
|
||||||
if( fileName1.equals( "_final.cfg" )
|
if( fileName1.equals( "_final.cfg" )
|
||||||
&& ! ( fileName2.equals( "_final.cfg" ) ) ) {
|
&& ! ( fileName2.equals( "_final.cfg" ) ) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fileName2.equals( "_final.cfg" )
|
if( fileName2.equals( "_final.cfg" )
|
||||||
&& ! ( fileName1.equals( "_final.cfg" ) ) ) {
|
&& ! ( fileName1.equals( "_final.cfg" ) ) ) {
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class StringUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern pattern = Pattern
|
Pattern pattern = Pattern
|
||||||
.compile( "[\t ]*" + Pattern.quote( sequence ) ); //$NON-NLS-1$
|
.compile( "[\t ]*" + Pattern.quote( sequence ) ); //$NON-NLS-1$
|
||||||
Matcher matcher = pattern.matcher( target );
|
Matcher matcher = pattern.matcher( target );
|
||||||
return( matcher.find( ) && matcher.start( ) == 0 );
|
return( matcher.find( ) && matcher.start( ) == 0 );
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class StringUtils
|
||||||
while( tmpString.contains( new String( new char[] { character } ) ) ) {
|
while( tmpString.contains( new String( new char[] { character } ) ) ) {
|
||||||
++cnt;
|
++cnt;
|
||||||
tmpString = tmpString
|
tmpString = tmpString
|
||||||
.substring( tmpString.indexOf( character ) + 1 );
|
.substring( tmpString.indexOf( character ) + 1 );
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class StringUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String removeIncorrectCharacters( String target,
|
public static String removeIncorrectCharacters( String target,
|
||||||
char character, boolean removeTrailing, boolean removePreceding )
|
char character, boolean removeTrailing, boolean removePreceding )
|
||||||
{
|
{
|
||||||
if( target == null ) {
|
if( target == null ) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
@ -125,7 +125,7 @@ public class StringUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
if( target.charAt( i ) == character
|
if( target.charAt( i ) == character
|
||||||
&& ( ( removeTrailing && i == target.length( ) ) || ( removePreceding && i == 0 ) ) ) {
|
&& ( ( removeTrailing && i == target.length( ) ) || ( removePreceding && i == 0 ) ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class StringUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
while( string.charAt( string.length( ) - 1 ) == '/'
|
while( string.charAt( string.length( ) - 1 ) == '/'
|
||||||
|| string.charAt( string.length( ) - 1 ) == '\\' ) {
|
|| string.charAt( string.length( ) - 1 ) == '\\' ) {
|
||||||
string = string.substring( 0, string.length( ) - 1 );
|
string = string.substring( 0, string.length( ) - 1 );
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
|
@ -243,7 +243,7 @@ public class StringUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String replaceWithIndent( String string, String source,
|
public static String replaceWithIndent( String string, String source,
|
||||||
String target )
|
String target )
|
||||||
{
|
{
|
||||||
if( string == null ) {
|
if( string == null ) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
@ -264,7 +264,7 @@ public class StringUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.replace( source,
|
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 >( );
|
List< String > groupList = new ArrayList< String >( );
|
||||||
try {
|
try {
|
||||||
Pattern regex = Pattern
|
Pattern regex = Pattern
|
||||||
.compile( regexStr, Pattern.CASE_INSENSITIVE );
|
.compile( regexStr, Pattern.CASE_INSENSITIVE );
|
||||||
Matcher regexMatcher = regex.matcher( targetString );
|
Matcher regexMatcher = regex.matcher( targetString );
|
||||||
while( regexMatcher.find( ) ) {
|
while( regexMatcher.find( ) ) {
|
||||||
groupList.add( regexMatcher.group( ) );
|
groupList.add( regexMatcher.group( ) );
|
||||||
|
|
|
@ -55,8 +55,8 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLIndent( String installName,
|
public static ExternalToolInvoker runWMLIndent( String installName,
|
||||||
String resourcePath, String stdin, boolean dryrun,
|
String resourcePath, String stdin, boolean dryrun,
|
||||||
OutputStream[] stdout, OutputStream[] stderr )
|
OutputStream[] stdout, OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class WMLTools
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dryrun
|
if( dryrun
|
||||||
|| Preferences.getBool( Constants.P_WMLINDENT_DRYRUN ) == true ) {
|
|| Preferences.getBool( Constants.P_WMLINDENT_DRYRUN ) == true ) {
|
||||||
arguments.add( "--dryrun" ); //$NON-NLS-1$
|
arguments.add( "--dryrun" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,17 +95,17 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLParser2( String installName,
|
public static ExternalToolInvoker runWMLParser2( String installName,
|
||||||
String resourcePath )
|
String resourcePath )
|
||||||
{
|
{
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
||||||
|| ! checkWMLTool( paths, "wesnoth/wmlparser2.py" ) ) {
|
|| ! checkWMLTool( paths, "wesnoth/wmlparser2.py" ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
File wmlparserFile = new File( paths.getWMLToolsDir( )
|
File wmlparserFile = new File( paths.getWMLToolsDir( )
|
||||||
+ "/wesnoth/wmlparser2.py" ); //$NON-NLS-1$
|
+ "/wesnoth/wmlparser2.py" ); //$NON-NLS-1$
|
||||||
|
|
||||||
List< String > arguments = new ArrayList< String >( );
|
List< String > arguments = new ArrayList< String >( );
|
||||||
|
|
||||||
|
@ -149,10 +149,10 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLLint( String installName,
|
public static ExternalToolInvoker runWMLLint( String installName,
|
||||||
String resourcePath, boolean dryrun, boolean showProgress )
|
String resourcePath, boolean dryrun, boolean showProgress )
|
||||||
{
|
{
|
||||||
return runWMLLint( installName, resourcePath, dryrun, 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
|
* The array of streams where to output the stderr content
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLLint( String installName,
|
public static ExternalToolInvoker runWMLLint( String installName,
|
||||||
String resourcePath, boolean dryrun, boolean showProgress,
|
String resourcePath, boolean dryrun, boolean showProgress,
|
||||||
OutputStream[] stdout, OutputStream[] stderr )
|
OutputStream[] stdout, OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
||||||
|| ! checkWMLTool( paths, Tools.WMLLINT.toString( ) ) ) {
|
|| ! checkWMLTool( paths, Tools.WMLLINT.toString( ) ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class WMLTools
|
||||||
arguments.add( wmllintFile.getAbsolutePath( ) );
|
arguments.add( wmllintFile.getAbsolutePath( ) );
|
||||||
|
|
||||||
int verboseLevel = Preferences
|
int verboseLevel = Preferences
|
||||||
.getInt( Constants.P_WMLLINT_VERBOSE_LEVEL );
|
.getInt( Constants.P_WMLLINT_VERBOSE_LEVEL );
|
||||||
for( int i = 1; i <= verboseLevel; i++ ) {
|
for( int i = 1; i <= verboseLevel; i++ ) {
|
||||||
arguments.add( "-v" ); //$NON-NLS-1$
|
arguments.add( "-v" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -221,10 +221,10 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLScope( String installName,
|
public static ExternalToolInvoker runWMLScope( String installName,
|
||||||
String resourcePath, boolean showProgress )
|
String resourcePath, boolean showProgress )
|
||||||
{
|
{
|
||||||
return runWMLScope( installName, resourcePath, 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
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWMLScope( String installName,
|
public static ExternalToolInvoker runWMLScope( String installName,
|
||||||
String resourcePath, boolean showProgress, OutputStream[] stdout,
|
String resourcePath, boolean showProgress, OutputStream[] stdout,
|
||||||
OutputStream[] stderr )
|
OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
if( ! ResourceUtils.isValidFilePath( resourcePath )
|
||||||
|| ! checkWMLTool( paths, Tools.WMLSCOPE.toString( ) ) ) {
|
|| ! checkWMLTool( paths, Tools.WMLSCOPE.toString( ) ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public class WMLTools
|
||||||
|
|
||||||
arguments.add( wmlscopeFile.getAbsolutePath( ) );
|
arguments.add( wmlscopeFile.getAbsolutePath( ) );
|
||||||
int verboseLevel = Preferences
|
int verboseLevel = Preferences
|
||||||
.getInt( Constants.P_WMLSCOPE_VERBOSE_LEVEL );
|
.getInt( Constants.P_WMLSCOPE_VERBOSE_LEVEL );
|
||||||
|
|
||||||
if( verboseLevel > 0 ) {
|
if( verboseLevel > 0 ) {
|
||||||
arguments.add( "-w" ); //$NON-NLS-1$
|
arguments.add( "-w" ); //$NON-NLS-1$
|
||||||
|
@ -292,7 +292,7 @@ public class WMLTools
|
||||||
* argument for launching the tool
|
* argument for launching the tool
|
||||||
*/
|
*/
|
||||||
public static void runWMLToolAsWorkspaceJob( final Tools tool,
|
public static void runWMLToolAsWorkspaceJob( final Tools tool,
|
||||||
final String targetPath )
|
final String targetPath )
|
||||||
{
|
{
|
||||||
// TODO: remove/rework this hackish method.
|
// TODO: remove/rework this hackish method.
|
||||||
if( tool == Tools.WESNOTH_ADDON_MANAGER ) {
|
if( tool == Tools.WESNOTH_ADDON_MANAGER ) {
|
||||||
|
@ -300,7 +300,7 @@ public class WMLTools
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditorReference[] editors = WorkspaceUtils.getWorkbenchWindow( )
|
IEditorReference[] editors = WorkspaceUtils.getWorkbenchWindow( )
|
||||||
.getPages( )[0].getEditorReferences( );
|
.getPages( )[0].getEditorReferences( );
|
||||||
|
|
||||||
for( IEditorReference editor: editors ) {
|
for( IEditorReference editor: editors ) {
|
||||||
if( editor.isDirty( ) ) {
|
if( editor.isDirty( ) ) {
|
||||||
|
@ -330,11 +330,11 @@ public class WMLTools
|
||||||
try {
|
try {
|
||||||
monitor.beginTask( toolName, 1050 );
|
monitor.beginTask( toolName, 1050 );
|
||||||
MessageConsole console = GUIUtils.createConsole( toolName
|
MessageConsole console = GUIUtils.createConsole( toolName
|
||||||
+ Messages.WMLTools_29, null, true );
|
+ Messages.WMLTools_29, null, true );
|
||||||
OutputStream[] stdout = new OutputStream[] { console
|
OutputStream[] stdout = new OutputStream[] { console
|
||||||
.newMessageStream( ) };
|
.newMessageStream( ) };
|
||||||
OutputStream[] stderr = new OutputStream[] { console
|
OutputStream[] stderr = new OutputStream[] { console
|
||||||
.newMessageStream( ) };
|
.newMessageStream( ) };
|
||||||
|
|
||||||
String location;
|
String location;
|
||||||
IResource resource = null;
|
IResource resource = null;
|
||||||
|
@ -355,33 +355,33 @@ public class WMLTools
|
||||||
}
|
}
|
||||||
|
|
||||||
installName = WesnothInstallsUtils
|
installName = WesnothInstallsUtils
|
||||||
.getInstallNameForResource( resource );
|
.getInstallNameForResource( resource );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( tool ) {
|
switch( tool ) {
|
||||||
case WMLINDENT:
|
case WMLINDENT:
|
||||||
if( selFile != null && targetPath == null ) {
|
if( selFile != null && targetPath == null ) {
|
||||||
String stdin = EditorUtils.getEditorDocument( )
|
String stdin = EditorUtils.getEditorDocument( )
|
||||||
.get( );
|
.get( );
|
||||||
// don't output to stdout as we will put that in
|
// don't output to stdout as we will put that in
|
||||||
// the editor
|
// the editor
|
||||||
toolInvoker = WMLTools.runWMLIndent(
|
toolInvoker = WMLTools.runWMLIndent(
|
||||||
installName, null, stdin, false, null,
|
installName, null, stdin, false, null,
|
||||||
stdout );
|
stdout );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toolInvoker = WMLTools.runWMLIndent(
|
toolInvoker = WMLTools.runWMLIndent(
|
||||||
installName, location, null, false,
|
installName, location, null, false,
|
||||||
stdout, stderr );
|
stdout, stderr );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WMLLINT:
|
case WMLLINT:
|
||||||
toolInvoker = WMLTools.runWMLLint( installName,
|
toolInvoker = WMLTools.runWMLLint( installName,
|
||||||
location, true, false, stdout, stderr );
|
location, true, false, stdout, stderr );
|
||||||
break;
|
break;
|
||||||
case WMLSCOPE:
|
case WMLSCOPE:
|
||||||
toolInvoker = WMLTools.runWMLScope( installName,
|
toolInvoker = WMLTools.runWMLScope( installName,
|
||||||
location, false, stdout, stderr );
|
location, false, stdout, stderr );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
monitor.worked( 50 );
|
monitor.worked( 50 );
|
||||||
|
@ -421,26 +421,26 @@ public class WMLTools
|
||||||
stdoutWatcher.start( );
|
stdoutWatcher.start( );
|
||||||
toolInvoker.waitForTool( );
|
toolInvoker.waitForTool( );
|
||||||
if( tool == Tools.WMLINDENT && selFile != null
|
if( tool == Tools.WMLINDENT && selFile != null
|
||||||
&& targetPath == null ) {
|
&& targetPath == null ) {
|
||||||
EditorUtils.replaceEditorText( toolInvoker
|
EditorUtils.replaceEditorText( toolInvoker
|
||||||
.getOutputContent( ) );
|
.getOutputContent( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tool == Tools.WMLSCOPE ) {
|
if( tool == Tools.WMLSCOPE ) {
|
||||||
if( resource != null ) {
|
if( resource != null ) {
|
||||||
resource.deleteMarkers( Constants.MARKER_WMLSCOPE,
|
resource.deleteMarkers( Constants.MARKER_WMLSCOPE,
|
||||||
false, IResource.DEPTH_INFINITE );
|
false, IResource.DEPTH_INFINITE );
|
||||||
}
|
}
|
||||||
parseAndAddMarkers( toolInvoker.getOutputContent( ),
|
parseAndAddMarkers( toolInvoker.getOutputContent( ),
|
||||||
Constants.MARKER_WMLSCOPE );
|
Constants.MARKER_WMLSCOPE );
|
||||||
}
|
}
|
||||||
else if( tool == Tools.WMLLINT ) {
|
else if( tool == Tools.WMLLINT ) {
|
||||||
if( resource != null ) {
|
if( resource != null ) {
|
||||||
resource.deleteMarkers( Constants.MARKER_WMLLINT,
|
resource.deleteMarkers( Constants.MARKER_WMLLINT,
|
||||||
false, IResource.DEPTH_INFINITE );
|
false, IResource.DEPTH_INFINITE );
|
||||||
}
|
}
|
||||||
parseAndAddMarkers( toolInvoker.getOutputContent( ),
|
parseAndAddMarkers( toolInvoker.getOutputContent( ),
|
||||||
Constants.MARKER_WMLLINT );
|
Constants.MARKER_WMLLINT );
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.worked( 50 );
|
monitor.worked( 50 );
|
||||||
|
@ -466,18 +466,18 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker uploadWesnothAddon( String containerPath,
|
public static ExternalToolInvoker uploadWesnothAddon( String containerPath,
|
||||||
OutputStream[] stdout, OutputStream[] stderr )
|
OutputStream[] stdout, OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
if( ! ResourceUtils.isValidFilePath( containerPath ) ) {
|
if( ! ResourceUtils.isValidFilePath( containerPath ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return runWesnothAddonManager(
|
return runWesnothAddonManager(
|
||||||
WesnothInstallsUtils.getInstallNameForResource( containerPath ),
|
WesnothInstallsUtils.getInstallNameForResource( containerPath ),
|
||||||
Preferences.getString( Constants.P_WAU_PASSWORD ),
|
Preferences.getString( Constants.P_WAU_PASSWORD ),
|
||||||
Preferences.getString( Constants.P_WAU_PORT ),
|
Preferences.getString( Constants.P_WAU_PORT ),
|
||||||
Arrays.asList( "-u", containerPath ) // upload container
|
Arrays.asList( "-u", containerPath ) // upload container
|
||||||
, stdout, stderr );
|
, stdout, stderr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -498,9 +498,9 @@ public class WMLTools
|
||||||
* @return null if there were errors or an ExternalToolInvoker instance
|
* @return null if there were errors or an ExternalToolInvoker instance
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runWesnothAddonManager(
|
public static ExternalToolInvoker runWesnothAddonManager(
|
||||||
String installName, String password, String port,
|
String installName, String password, String port,
|
||||||
List< String > extraArguments, OutputStream[] stdout,
|
List< String > extraArguments, OutputStream[] stdout,
|
||||||
OutputStream[] stderr )
|
OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
Paths paths = Preferences.getPaths( installName );
|
Paths paths = Preferences.getPaths( installName );
|
||||||
if( ! checkWMLTool( paths, Tools.WESNOTH_ADDON_MANAGER.toString( ) ) ) {
|
if( ! checkWMLTool( paths, Tools.WESNOTH_ADDON_MANAGER.toString( ) ) ) {
|
||||||
|
@ -508,7 +508,7 @@ public class WMLTools
|
||||||
}
|
}
|
||||||
|
|
||||||
File wmllintFile = new File( paths.getWMLToolsDir( )
|
File wmllintFile = new File( paths.getWMLToolsDir( )
|
||||||
+ "/wesnoth_addon_manager" ); //$NON-NLS-1$
|
+ "/wesnoth_addon_manager" ); //$NON-NLS-1$
|
||||||
List< String > arguments = new ArrayList< String >( );
|
List< String > arguments = new ArrayList< String >( );
|
||||||
arguments.add( wmllintFile.getAbsolutePath( ) );
|
arguments.add( wmllintFile.getAbsolutePath( ) );
|
||||||
|
|
||||||
|
@ -542,8 +542,8 @@ public class WMLTools
|
||||||
|
|
||||||
for( String line: lines ) {
|
for( String line: lines ) {
|
||||||
if( line.startsWith( "#" ) || //$NON-NLS-1$
|
if( line.startsWith( "#" ) || //$NON-NLS-1$
|
||||||
line.matches( "^[\\t ]*$" ) || //$NON-NLS-1$
|
line.matches( "^[\\t ]*$" ) || //$NON-NLS-1$
|
||||||
line.startsWith( "wmllint:" ) ) {
|
line.startsWith( "wmllint:" ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( line.startsWith( "%%" ) ) //$NON-NLS-1$
|
if( line.startsWith( "%%" ) ) //$NON-NLS-1$
|
||||||
|
@ -574,9 +574,9 @@ public class WMLTools
|
||||||
{
|
{
|
||||||
String pythonPath = Preferences.getString( Constants.P_PYTHON_PATH );
|
String pythonPath = Preferences.getString( Constants.P_PYTHON_PATH );
|
||||||
if( pythonPath.isEmpty( )
|
if( pythonPath.isEmpty( )
|
||||||
|| ( pythonPath.matches( "^.*(/|\\\\).*$" ) && ! ResourceUtils
|
|| ( pythonPath.matches( "^.*(/|\\\\).*$" ) && ! ResourceUtils
|
||||||
.isValidFilePath( Preferences
|
.isValidFilePath( Preferences
|
||||||
.getString( Constants.P_PYTHON_PATH ) ) ) ) {
|
.getString( Constants.P_PYTHON_PATH ) ) ) ) {
|
||||||
GUIUtils.showWarnMessageBox( Messages.WMLTools_42 );
|
GUIUtils.showWarnMessageBox( Messages.WMLTools_42 );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ public class WMLTools
|
||||||
|
|
||||||
if( ! wmlToolFile.exists( ) ) {
|
if( ! wmlToolFile.exists( ) ) {
|
||||||
GUIUtils.showErrorMessageBox( String.format(
|
GUIUtils.showErrorMessageBox( String.format(
|
||||||
Messages.WMLTools_47, wmlToolFile ) );
|
Messages.WMLTools_47, wmlToolFile ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,12 +624,12 @@ public class WMLTools
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ExternalToolInvoker runPythonScript(
|
public static ExternalToolInvoker runPythonScript(
|
||||||
List< String > arguments, String stdin, boolean stderrMonitoring,
|
List< String > arguments, String stdin, boolean stderrMonitoring,
|
||||||
boolean stdoutMonitoring, final OutputStream[] stdout,
|
boolean stdoutMonitoring, final OutputStream[] stdout,
|
||||||
final OutputStream[] stderr )
|
final OutputStream[] stderr )
|
||||||
{
|
{
|
||||||
final ExternalToolInvoker pyscript = new ExternalToolInvoker(
|
final ExternalToolInvoker pyscript = new ExternalToolInvoker(
|
||||||
Preferences.getString( Constants.P_PYTHON_PATH ), arguments );
|
Preferences.getString( Constants.P_PYTHON_PATH ), arguments );
|
||||||
|
|
||||||
pyscript.runTool( );
|
pyscript.runTool( );
|
||||||
if( stderrMonitoring == true || ( stderr != null && stderr.length > 0 ) ) {
|
if( stderrMonitoring == true || ( stderr != null && stderr.length > 0 ) ) {
|
||||||
|
@ -641,7 +641,7 @@ public class WMLTools
|
||||||
if( stdin != null ) {
|
if( stdin != null ) {
|
||||||
try {
|
try {
|
||||||
BufferedWriter stdinStream = new BufferedWriter(
|
BufferedWriter stdinStream = new BufferedWriter(
|
||||||
new OutputStreamWriter( pyscript.getStdin( ) ) );
|
new OutputStreamWriter( pyscript.getStdin( ) ) );
|
||||||
stdinStream.write( stdin );
|
stdinStream.write( stdin );
|
||||||
stdinStream.close( );
|
stdinStream.close( );
|
||||||
} catch( IOException e ) {
|
} catch( IOException e ) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class WMLUtils
|
||||||
public static WMLRoot getWMLRoot( IFile file )
|
public static WMLRoot getWMLRoot( IFile file )
|
||||||
{
|
{
|
||||||
URI uri = URI.createPlatformResourceURI(
|
URI uri = URI.createPlatformResourceURI(
|
||||||
file.getFullPath( ).toString( ), true );
|
file.getFullPath( ).toString( ), true );
|
||||||
ResourceSet resourceSet = new ResourceSetImpl( );
|
ResourceSet resourceSet = new ResourceSetImpl( );
|
||||||
Resource resource = resourceSet.getResource( uri, true );
|
Resource resource = resourceSet.getResource( uri, true );
|
||||||
if( resource == null || resource.getContents( ).isEmpty( ) ) {
|
if( resource == null || resource.getContents( ).isEmpty( ) ) {
|
||||||
|
@ -159,11 +159,11 @@ public class WMLUtils
|
||||||
for( WMLExpression expression: tag.getExpressions( ) ) {
|
for( WMLExpression expression: tag.getExpressions( ) ) {
|
||||||
if( expression.isWMLKey( ) ) {
|
if( expression.isWMLKey( ) ) {
|
||||||
res.append( indent + "\t"
|
res.append( indent + "\t"
|
||||||
+ toWMLString( expression.asWMLKey( ) ) );
|
+ toWMLString( expression.asWMLKey( ) ) );
|
||||||
}
|
}
|
||||||
else if( expression.isWMLTag( ) ) {
|
else if( expression.isWMLTag( ) ) {
|
||||||
res.append( indent + "\t"
|
res.append( indent + "\t"
|
||||||
+ toWMLString( expression.asWMLTag( ) ) );
|
+ toWMLString( expression.asWMLTag( ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +199,6 @@ public class WMLUtils
|
||||||
private static String toCleanedUpText( EObject obj )
|
private static String toCleanedUpText( EObject obj )
|
||||||
{
|
{
|
||||||
return NodeModelUtils.getNode( obj ).getText( )
|
return NodeModelUtils.getNode( obj ).getText( )
|
||||||
.replaceFirst( "(\\n|\\r| )+", "" );
|
.replaceFirst( "(\\n|\\r| )+", "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class WizardUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int launchWizard( WizardTemplate wizard, Shell shell,
|
public static int launchWizard( WizardTemplate wizard, Shell shell,
|
||||||
IStructuredSelection selection )
|
IStructuredSelection selection )
|
||||||
{
|
{
|
||||||
if( wizard == null ) {
|
if( wizard == null ) {
|
||||||
return Window.CANCEL;
|
return Window.CANCEL;
|
||||||
|
@ -44,18 +44,17 @@ public class WizardUtils
|
||||||
wizardDialog.create( );
|
wizardDialog.create( );
|
||||||
int x = shell.getBounds( ).x, y = shell.getBounds( ).y;
|
int x = shell.getBounds( ).x, y = shell.getBounds( ).y;
|
||||||
x += ( ( shell.getBounds( ).width - wizardDialog.getShell( )
|
x += ( ( shell.getBounds( ).width - wizardDialog.getShell( )
|
||||||
.getBounds( ).width ) / 2 );
|
.getBounds( ).width ) / 2 );
|
||||||
y += ( ( shell.getBounds( ).height - wizardDialog.getShell( )
|
y += ( ( shell.getBounds( ).height - wizardDialog.getShell( )
|
||||||
.getBounds( ).height ) / 2 );
|
.getBounds( ).height ) / 2 );
|
||||||
wizardDialog.getShell( ).setLocation( x, y );
|
wizardDialog.getShell( ).setLocation( x, y );
|
||||||
|
|
||||||
wizardDialog.setHelpAvailable( true );
|
wizardDialog.setHelpAvailable( true );
|
||||||
WesnothPlugin
|
WesnothPlugin
|
||||||
.getDefault( )
|
.getDefault( )
|
||||||
.getWorkbench( )
|
.getWorkbench( )
|
||||||
.getHelpSystem( )
|
.getHelpSystem( )
|
||||||
.setHelp( wizardDialog.getShell( ),
|
.setHelp( wizardDialog.getShell( ), "org.wesnoth.help.wizardHelp" ); //$NON-NLS-1$
|
||||||
"org.wesnoth.help.wizardHelp" ); //$NON-NLS-1$
|
|
||||||
|
|
||||||
return wizardDialog.open( );
|
return wizardDialog.open( );
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class WorkspaceUtils
|
||||||
{
|
{
|
||||||
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
||||||
if( selection == null
|
if( selection == null
|
||||||
|| ! ( selection.getFirstElement( ) instanceof IProject ) ) {
|
|| ! ( selection.getFirstElement( ) instanceof IProject ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class WorkspaceUtils
|
||||||
public static IProject getProject( String name )
|
public static IProject getProject( String name )
|
||||||
{
|
{
|
||||||
IProject proj = ResourcesPlugin.getWorkspace( ).getRoot( )
|
IProject proj = ResourcesPlugin.getWorkspace( ).getRoot( )
|
||||||
.getProject( name );
|
.getProject( name );
|
||||||
if( proj.exists( ) ) {
|
if( proj.exists( ) ) {
|
||||||
return proj;
|
return proj;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public class WorkspaceUtils
|
||||||
{
|
{
|
||||||
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
||||||
if( selection == null
|
if( selection == null
|
||||||
|| ! ( selection.getFirstElement( ) instanceof IFolder ) ) {
|
|| ! ( selection.getFirstElement( ) instanceof IFolder ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class WorkspaceUtils
|
||||||
{
|
{
|
||||||
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
IStructuredSelection selection = getSelectedStructuredSelection( window );
|
||||||
if( selection == null
|
if( selection == null
|
||||||
|| ! ( selection.getFirstElement( ) instanceof IFile ) ) {
|
|| ! ( selection.getFirstElement( ) instanceof IFile ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ( IFile ) selection.getFirstElement( );
|
return ( IFile ) selection.getFirstElement( );
|
||||||
|
@ -156,7 +156,7 @@ public class WorkspaceUtils
|
||||||
public static IStructuredSelection getSelectedStructuredSelection( )
|
public static IStructuredSelection getSelectedStructuredSelection( )
|
||||||
{
|
{
|
||||||
return getSelectedStructuredSelection( WorkspaceUtils
|
return getSelectedStructuredSelection( WorkspaceUtils
|
||||||
.getWorkbenchWindow( ) );
|
.getWorkbenchWindow( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +167,7 @@ public class WorkspaceUtils
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IStructuredSelection getSelectedStructuredSelection(
|
public static IStructuredSelection getSelectedStructuredSelection(
|
||||||
final IWorkbenchWindow window )
|
final IWorkbenchWindow window )
|
||||||
{
|
{
|
||||||
if( window == null ) {
|
if( window == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -185,7 +185,7 @@ public class WorkspaceUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
setResult( ( IStructuredSelection ) window
|
setResult( ( IStructuredSelection ) window
|
||||||
.getSelectionService( ).getSelection( ) );
|
.getSelectionService( ).getSelection( ) );
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
e.printStackTrace( );
|
e.printStackTrace( );
|
||||||
}
|
}
|
||||||
|
@ -204,8 +204,8 @@ public class WorkspaceUtils
|
||||||
{
|
{
|
||||||
IStructuredSelection selection = getSelectedStructuredSelection( );
|
IStructuredSelection selection = getSelectedStructuredSelection( );
|
||||||
if( selection == null
|
if( selection == null
|
||||||
|| ! ( selection.getFirstElement( ) instanceof IFolder || selection
|
|| ! ( selection.getFirstElement( ) instanceof IFolder || selection
|
||||||
.getFirstElement( ) instanceof IProject ) ) {
|
.getFirstElement( ) instanceof IProject ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class WorkspaceUtils
|
||||||
{
|
{
|
||||||
if( temporaryFolder_ == null || temporaryFolder_.isEmpty( ) ) {
|
if( temporaryFolder_ == null || temporaryFolder_.isEmpty( ) ) {
|
||||||
temporaryFolder_ = System.getProperty( "java.io.tmpdir" ) + //$NON-NLS-1$
|
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_ );
|
File tmpFile = new File( temporaryFolder_ );
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ public class WorkspaceUtils
|
||||||
public static String getCurrentDateTime( )
|
public static String getCurrentDateTime( )
|
||||||
{
|
{
|
||||||
return new SimpleDateFormat( "yyyy_MM_dd_HH_mm_ss" )
|
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(
|
String result = Preferences.getPaths(
|
||||||
WesnothInstallsUtils.getInstallNameForResource( resource ) )
|
WesnothInstallsUtils.getInstallNameForResource( resource ) )
|
||||||
.getAddonsDir( );
|
.getAddonsDir( );
|
||||||
result += resource.getProject( ).getName( ) + IPath.SEPARATOR;
|
result += resource.getProject( ).getName( ) + IPath.SEPARATOR;
|
||||||
result += resource.getProjectRelativePath( ).toOSString( );
|
result += resource.getProjectRelativePath( ).toOSString( );
|
||||||
return result;
|
return result;
|
||||||
|
@ -375,8 +375,8 @@ public class WorkspaceUtils
|
||||||
|
|
||||||
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), false ) ) {
|
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), false ) ) {
|
||||||
PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
|
PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
|
||||||
WesnothPlugin.getShell( ),
|
WesnothPlugin.getShell( ),
|
||||||
"org.wesnoth.preferences.InstallsPage", null, null ); //$NON-NLS-1$
|
"org.wesnoth.preferences.InstallsPage", null, null ); //$NON-NLS-1$
|
||||||
pref.open( );
|
pref.open( );
|
||||||
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), true ) ) {
|
if( ! checkPathsAreSet( Preferences.getDefaultInstallName( ), true ) ) {
|
||||||
GUIUtils.showErrorMessageBox( Messages.WorkspaceUtils_7 );
|
GUIUtils.showErrorMessageBox( Messages.WorkspaceUtils_7 );
|
||||||
|
@ -396,47 +396,48 @@ public class WorkspaceUtils
|
||||||
// automatically import 'special' folders as projects
|
// automatically import 'special' folders as projects
|
||||||
List< File > userAddonsFiles = new ArrayList< File >( );
|
List< File > userAddonsFiles = new ArrayList< File >( );
|
||||||
Paths paths = Preferences.getPaths( Preferences
|
Paths paths = Preferences.getPaths( Preferences
|
||||||
.getDefaultInstallName( ) );
|
.getDefaultInstallName( ) );
|
||||||
|
|
||||||
if( GUIUtils.showMessageBox( Messages.WorkspaceUtils_18,
|
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
|
// useraddons/add-ons/data
|
||||||
File[] tmp = new File( paths.getAddonsDir( ) )
|
File[] tmp = new File( paths.getAddonsDir( ) )
|
||||||
.listFiles( );
|
.listFiles( );
|
||||||
if( tmp != null ) {
|
if( tmp != null ) {
|
||||||
userAddonsFiles.addAll( Arrays.asList( tmp ) );
|
userAddonsFiles.addAll( Arrays.asList( tmp ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.beginTask( Messages.WorkspaceUtils_22,
|
monitor.beginTask( Messages.WorkspaceUtils_22,
|
||||||
userAddonsFiles.size( ) * 10 );
|
userAddonsFiles.size( ) * 10 );
|
||||||
|
|
||||||
for( File file: userAddonsFiles ) {
|
for( File file: userAddonsFiles ) {
|
||||||
if( file.isDirectory( ) == false
|
if( file.isDirectory( ) == false
|
||||||
|| file.getName( ).startsWith( "." ) ) {
|
|| file.getName( ).startsWith( "." ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String projectName = file.getName( );
|
String projectName = file.getName( );
|
||||||
if( ResourceUtils.isCampaignDirPath( paths,
|
if( ResourceUtils.isCampaignDirPath( paths,
|
||||||
file.getAbsolutePath( ) ) ) {
|
file.getAbsolutePath( ) ) ) {
|
||||||
projectName = "_Mainline_" + file.getName( ); //$NON-NLS-1$
|
projectName = "_Mainline_" + file.getName( ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectUtils.createWesnothProject( projectName,
|
ProjectUtils.createWesnothProject( projectName,
|
||||||
file.getAbsolutePath( ),
|
file.getAbsolutePath( ),
|
||||||
paths.getInstallName( ), monitor );
|
paths.getInstallName( ), monitor );
|
||||||
|
|
||||||
monitor.worked( 10 );
|
monitor.worked( 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( guided ) {
|
if( guided ) {
|
||||||
GUIUtils.showInfoMessageBox( Messages.WorkspaceUtils_25 );
|
GUIUtils
|
||||||
|
.showInfoMessageBox( Messages.WorkspaceUtils_25 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.getInstance( ).log(
|
Logger.getInstance( ).log(
|
||||||
"setupWorkspace was successful", //$NON-NLS-1$
|
"setupWorkspace was successful", //$NON-NLS-1$
|
||||||
Messages.WorkspaceUtils_29 );
|
Messages.WorkspaceUtils_29 );
|
||||||
}
|
}
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
Logger.getInstance( ).logException( e );
|
Logger.getInstance( ).logException( e );
|
||||||
|
@ -459,16 +460,16 @@ public class WorkspaceUtils
|
||||||
* the user if conditions are not met
|
* the user if conditions are not met
|
||||||
*/
|
*/
|
||||||
public static boolean checkPathsAreSet( String installName,
|
public static boolean checkPathsAreSet( String installName,
|
||||||
boolean displayWarning )
|
boolean displayWarning )
|
||||||
{
|
{
|
||||||
if( ! ResourceUtils.isValidFilePath( Preferences.getPaths( installName )
|
if( ! ResourceUtils.isValidFilePath( Preferences.getPaths( installName )
|
||||||
.getWesnothExecutablePath( ) )
|
.getWesnothExecutablePath( ) )
|
||||||
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
||||||
installName ).getUserDir( ) )
|
installName ).getUserDir( ) )
|
||||||
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
||||||
installName ).getWMLToolsDir( ) )
|
installName ).getWMLToolsDir( ) )
|
||||||
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
|| ! ResourceUtils.isValidFilePath( Preferences.getPaths(
|
||||||
installName ).getWorkingDir( ) ) ) {
|
installName ).getWorkingDir( ) ) ) {
|
||||||
if( displayWarning ) {
|
if( displayWarning ) {
|
||||||
GUIUtils.showWarnMessageBox( Messages.WorkspaceUtils_33 );
|
GUIUtils.showWarnMessageBox( Messages.WorkspaceUtils_33 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
private SchemaParser getSchema( EObject object )
|
private SchemaParser getSchema( EObject object )
|
||||||
{
|
{
|
||||||
return SchemaParser.getInstance( WesnothInstallsUtils
|
return SchemaParser.getInstance( WesnothInstallsUtils
|
||||||
.getInstallNameForResource( ResourceUtils
|
.getInstallNameForResource( ResourceUtils
|
||||||
.getWorkspaceResource( object.eResource( ) ) ) );
|
.getWorkspaceResource( object.eResource( ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidationEnabled( )
|
private boolean isValidationEnabled( )
|
||||||
|
@ -78,7 +78,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
|
|
||||||
if( ! tag.getName( ).equals( tag.getEndName( ) ) ) {
|
if( ! tag.getName( ).equals( tag.getEndName( ) ) ) {
|
||||||
warning( Messages.WMLJavaValidator_0,
|
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 );
|
ICompositeNode node = NodeModelUtils.getNode( tag );
|
||||||
if( node != null ) {
|
if( node != null ) {
|
||||||
ILeafNode parentNode = NodeModelUtils.findLeafNodeAtOffset(
|
ILeafNode parentNode = NodeModelUtils.findLeafNodeAtOffset(
|
||||||
node.getParent( ), node.getParent( ).getOffset( ) + 2 );
|
node.getParent( ), node.getParent( ).getOffset( ) + 2 );
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
String searchName = parentNode.getText( );
|
String searchName = parentNode.getText( );
|
||||||
|
@ -112,14 +112,14 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
}
|
}
|
||||||
if( found == false ) {
|
if( found == false ) {
|
||||||
warning( Messages.WMLJavaValidator_1,
|
warning( Messages.WMLJavaValidator_1,
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTagsCardinalities( SchemaParser schema,
|
private void checkTagsCardinalities( SchemaParser schema,
|
||||||
Iterable< WMLTag > tags )
|
Iterable< WMLTag > tags )
|
||||||
{
|
{
|
||||||
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
|
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
|
||||||
|
|
||||||
|
@ -141,14 +141,14 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
|
|
||||||
if( schemaTag.getAllowedCount( ) < entry.getValue( ) ) {
|
if( schemaTag.getAllowedCount( ) < entry.getValue( ) ) {
|
||||||
warning( "Tag " + entry.getKey( ) + " cannot appear more"
|
warning( "Tag " + entry.getKey( ) + " cannot appear more"
|
||||||
+ "than " + schemaTag.getAllowedCount( ) + " times. ",
|
+ "than " + schemaTag.getAllowedCount( ) + " times. ",
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkKeysCardinalities( WMLTag parentTag,
|
private void checkKeysCardinalities( WMLTag parentTag,
|
||||||
Iterable< WMLKey > keys )
|
Iterable< WMLKey > keys )
|
||||||
{
|
{
|
||||||
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
|
Map< String, Integer > ocurrences = new HashMap< String, Integer >( );
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
|
|
||||||
for( Entry< String, Integer > entry: ocurrences.entrySet( ) ) {
|
for( Entry< String, Integer > entry: ocurrences.entrySet( ) ) {
|
||||||
WMLKey schemaKey = WMLUtils
|
WMLKey schemaKey = WMLUtils
|
||||||
.getKeyByName( parentTag, entry.getKey( ) );
|
.getKeyByName( parentTag, entry.getKey( ) );
|
||||||
|
|
||||||
if( schemaKey == null ) {
|
if( schemaKey == null ) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -171,11 +171,11 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
|
|
||||||
if( schemaKey.getAllowedCount( ) < entry.getValue( ) ) {
|
if( schemaKey.getAllowedCount( ) < entry.getValue( ) ) {
|
||||||
warning(
|
warning(
|
||||||
"Key " + entry.getKey( ) + ", in tag "
|
"Key " + entry.getKey( ) + ", in tag "
|
||||||
+ parentTag.getName( )
|
+ parentTag.getName( )
|
||||||
+ "cannot appear more than "
|
+ "cannot appear more than "
|
||||||
+ schemaKey.getAllowedCount( ) + " times. ",
|
+ schemaKey.getAllowedCount( ) + " times. ",
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
checkTagsCardinalities( getSchema( root ),
|
checkTagsCardinalities( getSchema( root ),
|
||||||
Iterables.filter( root.getExpressions( ), WMLTag.class ) );
|
Iterables.filter( root.getExpressions( ), WMLTag.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Check( CheckType.NORMAL )
|
@Check( CheckType.NORMAL )
|
||||||
|
@ -200,10 +200,10 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
|
|
||||||
SchemaParser schema = getSchema( tag );
|
SchemaParser schema = getSchema( tag );
|
||||||
checkTagsCardinalities( schema,
|
checkTagsCardinalities( schema,
|
||||||
Iterables.filter( tag.getExpressions( ), WMLTag.class ) );
|
Iterables.filter( tag.getExpressions( ), WMLTag.class ) );
|
||||||
|
|
||||||
checkKeysCardinalities( tag,
|
checkKeysCardinalities( tag,
|
||||||
Iterables.filter( tag.getExpressions( ), WMLKey.class ) );
|
Iterables.filter( tag.getExpressions( ), WMLKey.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Check( CheckType.NORMAL )
|
@Check( CheckType.NORMAL )
|
||||||
|
@ -214,12 +214,12 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
IResource resource = ResourceUtils.getWorkspaceResource( call
|
IResource resource = ResourceUtils.getWorkspaceResource( call
|
||||||
.eResource( ) );
|
.eResource( ) );
|
||||||
ProjectCache cache = ProjectUtils.getCacheForProject( resource
|
ProjectCache cache = ProjectUtils.getCacheForProject( resource
|
||||||
.getProject( ) );
|
.getProject( ) );
|
||||||
if( ! cache.getDefines( ).containsKey( call.getName( ) ) ) {
|
if( ! cache.getDefines( ).containsKey( call.getName( ) ) ) {
|
||||||
warning( "Undefined macro: " + call.getName( ),
|
warning( "Undefined macro: " + call.getName( ),
|
||||||
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
WmlPackage.Literals.WML_EXPRESSION__NAME );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class AddonsView extends ViewPart
|
||||||
grpAddonsList.setLayout( new FillLayout( SWT.HORIZONTAL ) );
|
grpAddonsList.setLayout( new FillLayout( SWT.HORIZONTAL ) );
|
||||||
|
|
||||||
tableAddons_ = new Table( grpAddonsList, SWT.BORDER
|
tableAddons_ = new Table( grpAddonsList, SWT.BORDER
|
||||||
| SWT.FULL_SELECTION );
|
| SWT.FULL_SELECTION );
|
||||||
tableAddons_.setHeaderVisible( true );
|
tableAddons_.setHeaderVisible( true );
|
||||||
tableAddons_.setLinesVisible( true );
|
tableAddons_.setLinesVisible( true );
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class AddonsView extends ViewPart
|
||||||
|
|
||||||
cmbAddonServer_ = new Combo( grpOptions, SWT.NONE );
|
cmbAddonServer_ = new Combo( grpOptions, SWT.NONE );
|
||||||
GridData gd_cmbAddonServer = new GridData( SWT.FILL, SWT.FILL, false,
|
GridData gd_cmbAddonServer = new GridData( SWT.FILL, SWT.FILL, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_cmbAddonServer.widthHint = 148;
|
gd_cmbAddonServer.widthHint = 148;
|
||||||
cmbAddonServer_.setLayoutData( gd_cmbAddonServer );
|
cmbAddonServer_.setLayoutData( gd_cmbAddonServer );
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ public class AddonsView extends ViewPart
|
||||||
public void widgetSelected( SelectionEvent e )
|
public void widgetSelected( SelectionEvent e )
|
||||||
{
|
{
|
||||||
PreferencesUtil.createPreferenceDialogOn(
|
PreferencesUtil.createPreferenceDialogOn(
|
||||||
getViewSite( ).getShell( ),
|
getViewSite( ).getShell( ),
|
||||||
AddonUploadPreferencePage.ID_ADDON_PREFERENCE_PAGE,
|
AddonUploadPreferencePage.ID_ADDON_PREFERENCE_PAGE,
|
||||||
null, null ).open( );
|
null, null ).open( );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
btnOpenAddonManager.setText( "Open Addon Manager preferences" );
|
btnOpenAddonManager.setText( "Open Addon Manager preferences" );
|
||||||
|
@ -157,10 +157,10 @@ public class AddonsView extends ViewPart
|
||||||
ports_.clear( );
|
ports_.clear( );
|
||||||
// fill the addons
|
// fill the addons
|
||||||
for( Entry< String, String > server: AddonUploadPreferencePage.ADDON_SERVER_PORTS
|
for( Entry< String, String > server: AddonUploadPreferencePage.ADDON_SERVER_PORTS
|
||||||
.entrySet( ) ) {
|
.entrySet( ) ) {
|
||||||
|
|
||||||
cmbAddonServer_.add( String.format( "%s ( port: %s )",
|
cmbAddonServer_.add( String.format( "%s ( port: %s )",
|
||||||
server.getValue( ), server.getKey( ) ) );
|
server.getValue( ), server.getKey( ) ) );
|
||||||
ports_.add( server.getKey( ) );
|
ports_.add( server.getKey( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ public class AddonsView extends ViewPart
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IStatus runInWorkspace( final IProgressMonitor monitor )
|
public IStatus runInWorkspace( final IProgressMonitor monitor )
|
||||||
throws CoreException
|
throws CoreException
|
||||||
{
|
{
|
||||||
monitor.beginTask( "Downloading addon " + addonName, 100 );
|
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
|
// ask the user to select the install for the project
|
||||||
SelectWesnothInstallDialog dialog = new SelectWesnothInstallDialog(
|
SelectWesnothInstallDialog dialog = new SelectWesnothInstallDialog(
|
||||||
null );
|
null );
|
||||||
if( dialog.open( ) == SWT.OK ) {
|
if( dialog.open( ) == SWT.OK ) {
|
||||||
setResult( dialog.getSelectedInstallName( ) );
|
setResult( dialog.getSelectedInstallName( ) );
|
||||||
}
|
}
|
||||||
|
@ -230,17 +230,17 @@ public class AddonsView extends ViewPart
|
||||||
final Paths paths = Preferences.getPaths( installName );
|
final Paths paths = Preferences.getPaths( installName );
|
||||||
|
|
||||||
OutputStream console = GUIUtils.createConsole(
|
OutputStream console = GUIUtils.createConsole(
|
||||||
"Wesnoth Addon Manager", null, false )
|
"Wesnoth Addon Manager", null, false )
|
||||||
.newOutputStream( );
|
.newOutputStream( );
|
||||||
|
|
||||||
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
|
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
|
||||||
installName,
|
installName,
|
||||||
null,
|
null,
|
||||||
currentPort_,
|
currentPort_,
|
||||||
Arrays.asList( "-d", addonName, "-c",
|
Arrays.asList( "-d", addonName, "-c",
|
||||||
paths.getAddonsDir( ) ),
|
paths.getAddonsDir( ) ),
|
||||||
new OutputStream[] { console },
|
new OutputStream[] { console },
|
||||||
new OutputStream[] { console } );
|
new OutputStream[] { console } );
|
||||||
|
|
||||||
tool.waitForTool( );
|
tool.waitForTool( );
|
||||||
|
|
||||||
|
@ -248,13 +248,13 @@ public class AddonsView extends ViewPart
|
||||||
|
|
||||||
// ask user if he wants to create a project
|
// ask user if he wants to create a project
|
||||||
if( GUIUtils
|
if( GUIUtils
|
||||||
.showMessageBox(
|
.showMessageBox(
|
||||||
"Do you want to create a new project for the downloaded addon?",
|
"Do you want to create a new project for the downloaded addon?",
|
||||||
SWT.YES | SWT.NO ) == SWT.YES ) {
|
SWT.YES | SWT.NO ) == SWT.YES ) {
|
||||||
|
|
||||||
ProjectUtils.createWesnothProject( addonName,
|
ProjectUtils.createWesnothProject( addonName,
|
||||||
paths.getAddonsDir( ) + addonName, installName,
|
paths.getAddonsDir( ) + addonName, installName,
|
||||||
monitor );
|
monitor );
|
||||||
}
|
}
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
|
|
||||||
|
@ -270,7 +270,8 @@ public class AddonsView extends ViewPart
|
||||||
protected void refreshAddons( )
|
protected void refreshAddons( )
|
||||||
{
|
{
|
||||||
if( loading_ ) {
|
if( loading_ ) {
|
||||||
GUIUtils.showInfoMessageBox( "Please wait for the previous query to finish." );
|
GUIUtils
|
||||||
|
.showInfoMessageBox( "Please wait for the previous query to finish." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ public class AddonsView extends ViewPart
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IStatus runInWorkspace( IProgressMonitor monitor )
|
public IStatus runInWorkspace( IProgressMonitor monitor )
|
||||||
throws CoreException
|
throws CoreException
|
||||||
{
|
{
|
||||||
monitor.beginTask( "Retrieving list...", 100 );
|
monitor.beginTask( "Retrieving list...", 100 );
|
||||||
monitor.worked( 10 );
|
monitor.worked( 10 );
|
||||||
|
@ -300,14 +301,14 @@ public class AddonsView extends ViewPart
|
||||||
String installName = Preferences.getDefaultInstallName( );
|
String installName = Preferences.getDefaultInstallName( );
|
||||||
|
|
||||||
OutputStream stderr = GUIUtils.createConsole(
|
OutputStream stderr = GUIUtils.createConsole(
|
||||||
"Wesnoth Addon Manager", null, false )
|
"Wesnoth Addon Manager", null, false )
|
||||||
.newOutputStream( );
|
.newOutputStream( );
|
||||||
|
|
||||||
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
|
ExternalToolInvoker tool = WMLTools.runWesnothAddonManager(
|
||||||
installName, null, currentPort_,
|
installName, null, currentPort_,
|
||||||
Arrays.asList( "-w", "-l" ), // list addons in raw
|
Arrays.asList( "-w", "-l" ), // list addons in raw
|
||||||
// mode
|
// mode
|
||||||
null, new OutputStream[] { stderr } );
|
null, new OutputStream[] { stderr } );
|
||||||
tool.waitForTool( );
|
tool.waitForTool( );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +317,7 @@ public class AddonsView extends ViewPart
|
||||||
* "5 - downloads", "size", "timestamp", "translate"]]
|
* "5 - downloads", "size", "timestamp", "translate"]]
|
||||||
*/
|
*/
|
||||||
final String[] lines = StringUtils.getLines( tool
|
final String[] lines = StringUtils.getLines( tool
|
||||||
.getOutputContent( ) );
|
.getOutputContent( ) );
|
||||||
final List< String[] > addons = new ArrayList< String[] >( );
|
final List< String[] > addons = new ArrayList< String[] >( );
|
||||||
|
|
||||||
String[] tmpColumns = null;
|
String[] tmpColumns = null;
|
||||||
|
@ -353,8 +354,8 @@ public class AddonsView extends ViewPart
|
||||||
// got something interesting? parse it
|
// got something interesting? parse it
|
||||||
if( tmpColumns != null && index != - 1 ) {
|
if( tmpColumns != null && index != - 1 ) {
|
||||||
tmpColumns[index] = line.substring(
|
tmpColumns[index] = line.substring(
|
||||||
line.indexOf( '\'' ) + 1,
|
line.indexOf( '\'' ) + 1,
|
||||||
line.lastIndexOf( '\'' ) ).trim( );
|
line.lastIndexOf( '\'' ) ).trim( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,10 +368,10 @@ public class AddonsView extends ViewPart
|
||||||
for( String[] addon: addons ) {
|
for( String[] addon: addons ) {
|
||||||
|
|
||||||
TableItem tableItem = new TableItem(
|
TableItem tableItem = new TableItem(
|
||||||
tableAddons_, SWT.NONE );
|
tableAddons_, SWT.NONE );
|
||||||
tableItem.setText( new String[] { addon[0],
|
tableItem.setText( new String[] { addon[0],
|
||||||
addon[1], addon[2], addon[3], addon[4],
|
addon[1], addon[2], addon[3], addon[4],
|
||||||
addon[5] } );
|
addon[5] } );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||||
import org.eclipse.ui.navigator.CommonNavigator;
|
import org.eclipse.ui.navigator.CommonNavigator;
|
||||||
|
|
||||||
public class WesnothProjectsExplorer extends CommonNavigator implements
|
public class WesnothProjectsExplorer extends CommonNavigator implements
|
||||||
IPersistableElement, IElementFactory
|
IPersistableElement, IElementFactory
|
||||||
{
|
{
|
||||||
public static final String ID_PROJECTS_EXPLORER = "org.wesnoth.views.WesnothProjectsExplorer"; //$NON-NLS-1$
|
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 ) ) {
|
if( adapter.equals( IWorkbenchAdapter.class ) ) {
|
||||||
return ResourcesPlugin.getWorkspace( ).getRoot( )
|
return ResourcesPlugin.getWorkspace( ).getRoot( )
|
||||||
.getAdapter( adapter );
|
.getAdapter( adapter );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class WizardPageTemplate extends WizardPage
|
||||||
public void createControl( Composite parent )
|
public void createControl( Composite parent )
|
||||||
{
|
{
|
||||||
WesnothPlugin.getDefault( ).getWorkbench( ).getHelpSystem( )
|
WesnothPlugin.getDefault( ).getWorkbench( ).getHelpSystem( )
|
||||||
.setHelp( getShell( ), "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
|
.setHelp( getShell( ), "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,20 +41,20 @@ public class WizardPageTemplate extends WizardPage
|
||||||
public IPath handleBrowseContainer( )
|
public IPath handleBrowseContainer( )
|
||||||
{
|
{
|
||||||
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
|
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
|
||||||
getShell( ), ResourcesPlugin.getWorkspace( ).getRoot( ), false,
|
getShell( ), ResourcesPlugin.getWorkspace( ).getRoot( ), false,
|
||||||
Messages.NewWizardPageTemplate_1 );
|
Messages.NewWizardPageTemplate_1 );
|
||||||
if( dialog.open( ) == Window.OK ) {
|
if( dialog.open( ) == Window.OK ) {
|
||||||
Object[] result = dialog.getResult( );
|
Object[] result = dialog.getResult( );
|
||||||
if( result.length == 1 ) {
|
if( result.length == 1 ) {
|
||||||
try {
|
try {
|
||||||
getWizard( ).selectionContainer_ = ResourcesPlugin
|
getWizard( ).selectionContainer_ = ResourcesPlugin
|
||||||
.getWorkspace( ).getRoot( )
|
.getWorkspace( ).getRoot( )
|
||||||
.getFolder( ( Path ) result[0] );
|
.getFolder( ( Path ) result[0] );
|
||||||
} catch( IllegalArgumentException e ) {
|
} catch( IllegalArgumentException e ) {
|
||||||
// the path is a project
|
// the path is a project
|
||||||
getWizard( ).selectionContainer_ = ResourcesPlugin
|
getWizard( ).selectionContainer_ = ResourcesPlugin
|
||||||
.getWorkspace( ).getRoot( )
|
.getWorkspace( ).getRoot( )
|
||||||
.getProject( result[0].toString( ) );
|
.getProject( result[0].toString( ) );
|
||||||
}
|
}
|
||||||
return ( Path ) result[0];
|
return ( Path ) result[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class WizardProjectPageTemplate extends WizardNewProjectCreationPage
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public WizardProjectPageTemplate( String pageName, String title,
|
public WizardProjectPageTemplate( String pageName, String title,
|
||||||
String message )
|
String message )
|
||||||
{
|
{
|
||||||
super( pageName );
|
super( pageName );
|
||||||
|
|
||||||
|
@ -54,19 +54,19 @@ public class WizardProjectPageTemplate extends WizardNewProjectCreationPage
|
||||||
{
|
{
|
||||||
super.createControl( parent );
|
super.createControl( parent );
|
||||||
Composite composite = new Composite( ( Composite ) getControl( ),
|
Composite composite = new Composite( ( Composite ) getControl( ),
|
||||||
SWT.NULL );
|
SWT.NULL );
|
||||||
composite.setLayout( new GridLayout( 2, false ) );
|
composite.setLayout( new GridLayout( 2, false ) );
|
||||||
|
|
||||||
Label lblWesnothInstall = new Label( composite, SWT.NONE );
|
Label lblWesnothInstall = new Label( composite, SWT.NONE );
|
||||||
lblWesnothInstall
|
lblWesnothInstall
|
||||||
.setToolTipText( "Select the wesnoth install this project corresponds to." );
|
.setToolTipText( "Select the wesnoth install this project corresponds to." );
|
||||||
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
lblWesnothInstall.setLayoutData( new GridData( SWT.RIGHT, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
lblWesnothInstall.setText( "Wesnoth Install:" );
|
lblWesnothInstall.setText( "Wesnoth Install:" );
|
||||||
|
|
||||||
cmbInstalls_ = new Combo( composite, SWT.READ_ONLY );
|
cmbInstalls_ = new Combo( composite, SWT.READ_ONLY );
|
||||||
GridData gd_cmbInstalls = new GridData( SWT.FILL, SWT.CENTER, true,
|
GridData gd_cmbInstalls = new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_cmbInstalls.widthHint = 154;
|
gd_cmbInstalls.widthHint = 154;
|
||||||
cmbInstalls_.setLayoutData( gd_cmbInstalls );
|
cmbInstalls_.setLayoutData( gd_cmbInstalls );
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class WizardProjectPageTemplate extends WizardNewProjectCreationPage
|
||||||
Paths paths = Preferences.getPaths( getSelectedInstallName( ) );
|
Paths paths = Preferences.getPaths( getSelectedInstallName( ) );
|
||||||
String projectPath = getProjectHandle( ).getLocation( ).toOSString( );
|
String projectPath = getProjectHandle( ).getLocation( ).toOSString( );
|
||||||
return( ! ResourceUtils.isCampaignDirPath( paths, projectPath ) && ! ResourceUtils
|
return( ! ResourceUtils.isCampaignDirPath( paths, projectPath ) && ! ResourceUtils
|
||||||
.isUserAddonsDirPath( paths, projectPath ) );
|
.isUserAddonsDirPath( paths, projectPath ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,42 +102,42 @@ public class WizardProjectPageTemplate extends WizardNewProjectCreationPage
|
||||||
* @return The newly created project's handle
|
* @return The newly created project's handle
|
||||||
*/
|
*/
|
||||||
public IProject createProject( IProgressMonitor monitor,
|
public IProject createProject( IProgressMonitor monitor,
|
||||||
String templateName, List< ReplaceableParameter > params,
|
String templateName, List< ReplaceableParameter > params,
|
||||||
boolean generatePBL )
|
boolean generatePBL )
|
||||||
{
|
{
|
||||||
monitor.subTask( "Creating the project structure" );
|
monitor.subTask( "Creating the project structure" );
|
||||||
|
|
||||||
IProject currentProject = ProjectUtils.createWesnothProject(
|
IProject currentProject = ProjectUtils.createWesnothProject(
|
||||||
getProjectName( ), getLocationPath( ).toOSString( ),
|
getProjectName( ), getLocationPath( ).toOSString( ),
|
||||||
getSelectedInstallName( ), monitor );
|
getSelectedInstallName( ), monitor );
|
||||||
monitor.worked( 2 );
|
monitor.worked( 2 );
|
||||||
|
|
||||||
String projectTemplate = TemplateProvider.getInstance( )
|
String projectTemplate = TemplateProvider.getInstance( )
|
||||||
.getProcessedTemplate( templateName, params );
|
.getProcessedTemplate( templateName, params );
|
||||||
|
|
||||||
List< Pair< String, String >> files;
|
List< Pair< String, String >> files;
|
||||||
List< String > dirs;
|
List< String > dirs;
|
||||||
Pair< List< Pair< String, String >>, List< String >> tmp = TemplateProvider
|
Pair< List< Pair< String, String >>, List< String >> tmp = TemplateProvider
|
||||||
.getInstance( ).getFilesDirectories( projectTemplate );
|
.getInstance( ).getFilesDirectories( projectTemplate );
|
||||||
files = tmp.First;
|
files = tmp.First;
|
||||||
dirs = tmp.Second;
|
dirs = tmp.Second;
|
||||||
|
|
||||||
for( Pair< String, String > file: files ) {
|
for( Pair< String, String > file: files ) {
|
||||||
if( file.Second.equals( "pbl" ) && //$NON-NLS-1$
|
if( file.Second.equals( "pbl" ) && //$NON-NLS-1$
|
||||||
! generatePBL ) {
|
! generatePBL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( file.Second.equals( "build_xml" ) && //$NON-NLS-1$
|
if( file.Second.equals( "build_xml" ) && //$NON-NLS-1$
|
||||||
! needsBuildXML( ) ) {
|
! needsBuildXML( ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUtils.createFile(
|
ResourceUtils.createFile(
|
||||||
currentProject,
|
currentProject,
|
||||||
file.First,
|
file.First,
|
||||||
TemplateProvider.getInstance( ).getProcessedTemplate(
|
TemplateProvider.getInstance( ).getProcessedTemplate(
|
||||||
file.Second, params ), true );
|
file.Second, params ), true );
|
||||||
monitor.worked( 1 );
|
monitor.worked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class WizardTemplate extends Wizard implements INewWizard
|
||||||
public void createPageControls( Composite pageContainer )
|
public void createPageControls( Composite pageContainer )
|
||||||
{
|
{
|
||||||
WesnothPlugin.getDefault( ).getWorkbench( ).getHelpSystem( )
|
WesnothPlugin.getDefault( ).getWorkbench( ).getHelpSystem( )
|
||||||
.setHelp( pageContainer, "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
|
.setHelp( pageContainer, "org.wesnoth.wizardHelp" ); //$NON-NLS-1$
|
||||||
|
|
||||||
super.createPageControls( pageContainer );
|
super.createPageControls( pageContainer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class CampaignNewWizard extends WizardTemplate
|
||||||
public void addPages( )
|
public void addPages( )
|
||||||
{
|
{
|
||||||
page0_ = new WizardProjectPageTemplate( "campaignPage0",
|
page0_ = new WizardProjectPageTemplate( "campaignPage0",
|
||||||
Messages.CampaignPage0_1, Messages.CampaignPage0_2 );
|
Messages.CampaignPage0_1, Messages.CampaignPage0_2 );
|
||||||
addPage( page0_ );
|
addPage( page0_ );
|
||||||
|
|
||||||
page1_ = new CampaignPage1( );
|
page1_ = new CampaignPage1( );
|
||||||
|
@ -57,17 +57,17 @@ public class CampaignNewWizard extends WizardTemplate
|
||||||
getContainer( ).run( false, false, new IRunnableWithProgress( ) {
|
getContainer( ).run( false, false, new IRunnableWithProgress( ) {
|
||||||
@Override
|
@Override
|
||||||
public void run( IProgressMonitor monitor )
|
public void run( IProgressMonitor monitor )
|
||||||
throws InvocationTargetException, InterruptedException
|
throws InvocationTargetException, InterruptedException
|
||||||
{
|
{
|
||||||
IProject currentProject = page0_.createProject( monitor,
|
IProject currentProject = page0_.createProject( monitor,
|
||||||
"campaign_structure", getParameters( ),
|
"campaign_structure", getParameters( ),
|
||||||
page1_.needsPBLFile( ) );
|
page1_.needsPBLFile( ) );
|
||||||
|
|
||||||
// store some campaign-related info
|
// store some campaign-related info
|
||||||
ProjectUtils.getPropertiesForProject( currentProject ).put(
|
ProjectUtils.getPropertiesForProject( currentProject ).put(
|
||||||
"difficulties", page2_.getDifficulties( ) ); //$NON-NLS-1$
|
"difficulties", page2_.getDifficulties( ) ); //$NON-NLS-1$
|
||||||
ProjectUtils.getCacheForProject( currentProject )
|
ProjectUtils.getCacheForProject( currentProject )
|
||||||
.saveCache( );
|
.saveCache( );
|
||||||
|
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
}
|
}
|
||||||
|
@ -84,33 +84,37 @@ public class CampaignNewWizard extends WizardTemplate
|
||||||
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
||||||
|
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$campaign_name", page1_.getCampaignName( ) ) ); //$NON-NLS-1$
|
"$$campaign_name", page1_.getCampaignName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$author", page1_.getAuthor( ) ) ); //$NON-NLS-1$
|
params
|
||||||
params.add( new ReplaceableParameter( "$$version", page1_.getVersion( ) ) ); //$NON-NLS-1$
|
.add( new ReplaceableParameter( "$$author", page1_.getAuthor( ) ) ); //$NON-NLS-1$
|
||||||
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$version", page1_.getVersion( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$description", page1_.getCampaignDescription( ) ) ); //$NON-NLS-1$
|
"$$description", page1_.getCampaignDescription( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$icon", page1_.getIconPath( ) ) ); //$NON-NLS-1$
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$icon", page1_.getIconPath( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$email", page1_.getEmail( ) ) ); //$NON-NLS-1$
|
params.add( new ReplaceableParameter( "$$email", page1_.getEmail( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$passphrase", page1_.getPassphrase( ) ) ); //$NON-NLS-1$
|
"$$passphrase", page1_.getPassphrase( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$translations_dir", page1_.getTranslationDir( ) ) ); //$NON-NLS-1$
|
"$$translations_dir", page1_.getTranslationDir( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$campaign_id", page2_.getCampaignId( ) ) ); //$NON-NLS-1$
|
"$$campaign_id", page2_.getCampaignId( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$abrev", page2_.getAbbrev( ) ) ); //$NON-NLS-1$
|
params.add( new ReplaceableParameter( "$$abrev", page2_.getAbbrev( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$define", page2_.getDefine( ) ) ); //$NON-NLS-1$
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$define", page2_.getDefine( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$difficulties", page2_.getDifficulties( ) ) ); //$NON-NLS-1$
|
"$$difficulties", page2_.getDifficulties( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$first_scenario", page2_.getFirstScenario( ) ) ); //$NON-NLS-1$
|
"$$first_scenario", page2_.getFirstScenario( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$project_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
"$$project_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$project_dir_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
"$$project_dir_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$type", page1_.isMultiplayer( ) ? "campaign_mp": "campaign" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
"$$type", page1_.isMultiplayer( ) ? "campaign_mp": "campaign" ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtCampaignName_ = new Text( container, SWT.BORDER );
|
txtCampaignName_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtCampaignName_ = new GridData( SWT.FILL, SWT.CENTER,
|
GridData gd_txtCampaignName_ = new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 );
|
false, false, 1, 1 );
|
||||||
gd_txtCampaignName_.heightHint = 15;
|
gd_txtCampaignName_.heightHint = 15;
|
||||||
txtCampaignName_.setLayoutData( gd_txtCampaignName_ );
|
txtCampaignName_.setLayoutData( gd_txtCampaignName_ );
|
||||||
txtCampaignName_.addModifyListener( updatePageCompleteListener );
|
txtCampaignName_.addModifyListener( updatePageCompleteListener );
|
||||||
|
@ -75,7 +75,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtVersion_ = new Text( container, SWT.BORDER );
|
txtVersion_ = new Text( container, SWT.BORDER );
|
||||||
txtVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
txtVersion_.addModifyListener( updatePageCompleteListener );
|
txtVersion_.addModifyListener( updatePageCompleteListener );
|
||||||
|
|
||||||
Label lblFormat = new Label( container, SWT.NONE );
|
Label lblFormat = new Label( container, SWT.NONE );
|
||||||
|
@ -87,11 +87,11 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtTranslationDir_ = new Text( container, SWT.BORDER );
|
txtTranslationDir_ = new Text( container, SWT.BORDER );
|
||||||
txtTranslationDir_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtTranslationDir_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
|
|
||||||
chkMultiCampaign_ = new Button( container, SWT.CHECK );
|
chkMultiCampaign_ = new Button( container, SWT.CHECK );
|
||||||
GridData gd_chkMultiCampaign_ = new GridData( SWT.LEFT, SWT.CENTER,
|
GridData gd_chkMultiCampaign_ = new GridData( SWT.LEFT, SWT.CENTER,
|
||||||
false, false, 2, 1 );
|
false, false, 2, 1 );
|
||||||
gd_chkMultiCampaign_.widthHint = 236;
|
gd_chkMultiCampaign_.widthHint = 236;
|
||||||
chkMultiCampaign_.setLayoutData( gd_chkMultiCampaign_ );
|
chkMultiCampaign_.setLayoutData( gd_chkMultiCampaign_ );
|
||||||
chkMultiCampaign_.setText( Messages.CampaignPage1_10 );
|
chkMultiCampaign_.setText( Messages.CampaignPage1_10 );
|
||||||
|
@ -99,7 +99,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
chkGeneratePBL_ = new Button( container, SWT.CHECK );
|
chkGeneratePBL_ = new Button( container, SWT.CHECK );
|
||||||
chkGeneratePBL_.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER,
|
chkGeneratePBL_.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER,
|
||||||
false, false, 3, 1 ) );
|
false, false, 3, 1 ) );
|
||||||
chkGeneratePBL_.setText( Messages.CampaignPage1_11 );
|
chkGeneratePBL_.setText( Messages.CampaignPage1_11 );
|
||||||
|
|
||||||
Label lblAuthor = new Label( container, SWT.NONE );
|
Label lblAuthor = new Label( container, SWT.NONE );
|
||||||
|
@ -107,7 +107,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtAuthor_ = new Text( container, SWT.BORDER );
|
txtAuthor_ = new Text( container, SWT.BORDER );
|
||||||
txtAuthor_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtAuthor_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblDescription = new Label( container, SWT.NONE );
|
Label lblDescription = new Label( container, SWT.NONE );
|
||||||
|
@ -115,7 +115,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtEmail_ = new Text( container, SWT.BORDER );
|
txtEmail_ = new Text( container, SWT.BORDER );
|
||||||
txtEmail_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtEmail_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblDescription_1 = new Label( container, SWT.NONE );
|
Label lblDescription_1 = new Label( container, SWT.NONE );
|
||||||
|
@ -123,7 +123,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtDescription_ = new Text( container, SWT.BORDER );
|
txtDescription_ = new Text( container, SWT.BORDER );
|
||||||
txtDescription_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtDescription_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblIcon = new Label( container, SWT.NONE );
|
Label lblIcon = new Label( container, SWT.NONE );
|
||||||
|
@ -131,7 +131,7 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtPassphrase_ = new Text( container, SWT.BORDER );
|
txtPassphrase_ = new Text( container, SWT.BORDER );
|
||||||
txtPassphrase_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtPassphrase_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblIcon_1 = new Label( container, SWT.NONE );
|
Label lblIcon_1 = new Label( container, SWT.NONE );
|
||||||
|
@ -139,13 +139,13 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtIcon_ = new Text( container, SWT.BORDER );
|
txtIcon_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtIcon_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
GridData gd_txtIcon_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_txtIcon_.widthHint = 163;
|
gd_txtIcon_.widthHint = 163;
|
||||||
txtIcon_.setLayoutData( gd_txtIcon_ );
|
txtIcon_.setLayoutData( gd_txtIcon_ );
|
||||||
|
|
||||||
Label lblRelativeToThe_1 = new Label( container, SWT.NONE );
|
Label lblRelativeToThe_1 = new Label( container, SWT.NONE );
|
||||||
GridData gd_lblRelativeToThe_1 = new GridData( SWT.FILL, SWT.CENTER,
|
GridData gd_lblRelativeToThe_1 = new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 );
|
false, false, 1, 1 );
|
||||||
gd_lblRelativeToThe_1.widthHint = 285;
|
gd_lblRelativeToThe_1.widthHint = 285;
|
||||||
lblRelativeToThe_1.setLayoutData( gd_lblRelativeToThe_1 );
|
lblRelativeToThe_1.setLayoutData( gd_lblRelativeToThe_1 );
|
||||||
lblRelativeToThe_1.setToolTipText( Messages.CampaignPage1_17 );
|
lblRelativeToThe_1.setToolTipText( Messages.CampaignPage1_17 );
|
||||||
|
@ -167,8 +167,8 @@ public class CampaignPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
// match the pattern x.y.z
|
// match the pattern x.y.z
|
||||||
if( txtVersion_.getText( ).isEmpty( )
|
if( txtVersion_.getText( ).isEmpty( )
|
||||||
|| ! ( txtVersion_.getText( )
|
|| ! ( txtVersion_.getText( )
|
||||||
.matches( "[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*" ) ) ) //$NON-NLS-1$
|
.matches( "[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*" ) ) ) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
setErrorMessage( Messages.CampaignPage1_21 );
|
setErrorMessage( Messages.CampaignPage1_21 );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -77,12 +77,12 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
txtDifficulties_.setText( txtDifficulties_.getText( )
|
txtDifficulties_.setText( txtDifficulties_.getText( )
|
||||||
.replace( dif, "" ) ); //$NON-NLS-1$
|
.replace( dif, "" ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
txtDifficulties_.setText( StringUtils
|
txtDifficulties_.setText( StringUtils
|
||||||
.removeIncorrectCharacters(
|
.removeIncorrectCharacters(
|
||||||
txtDifficulties_.getText( ), ',', true, true ) );
|
txtDifficulties_.getText( ), ',', true, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,7 +98,7 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
|
|
||||||
txtID_ = new Text( container, SWT.BORDER );
|
txtID_ = new Text( container, SWT.BORDER );
|
||||||
txtID_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false,
|
txtID_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false,
|
||||||
1, 1 ) );
|
1, 1 ) );
|
||||||
txtID_.addModifyListener( modifyListener );
|
txtID_.addModifyListener( modifyListener );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
@ -109,7 +109,7 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
|
|
||||||
txtAbbrev_ = new Text( container, SWT.BORDER );
|
txtAbbrev_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtAbbrev_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
GridData gd_txtAbbrev_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_txtAbbrev_.widthHint = 278;
|
gd_txtAbbrev_.widthHint = 278;
|
||||||
txtAbbrev_.setLayoutData( gd_txtAbbrev_ );
|
txtAbbrev_.setLayoutData( gd_txtAbbrev_ );
|
||||||
txtAbbrev_.addModifyListener( modifyListener );
|
txtAbbrev_.addModifyListener( modifyListener );
|
||||||
|
@ -122,7 +122,7 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
|
|
||||||
txtDefine_ = new Text( container, SWT.BORDER );
|
txtDefine_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtDefine_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
GridData gd_txtDefine_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_txtDefine_.widthHint = 207;
|
gd_txtDefine_.widthHint = 207;
|
||||||
txtDefine_.setLayoutData( gd_txtDefine_ );
|
txtDefine_.setLayoutData( gd_txtDefine_ );
|
||||||
txtDefine_.addModifyListener( modifyListener );
|
txtDefine_.addModifyListener( modifyListener );
|
||||||
|
@ -135,7 +135,7 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
|
|
||||||
txtDifficulties_ = new Text( container, SWT.BORDER );
|
txtDifficulties_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtDifficulties_ = new GridData( SWT.FILL, SWT.CENTER,
|
GridData gd_txtDifficulties_ = new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 );
|
false, false, 1, 1 );
|
||||||
gd_txtDifficulties_.widthHint = 208;
|
gd_txtDifficulties_.widthHint = 208;
|
||||||
txtDifficulties_.setLayoutData( gd_txtDifficulties_ );
|
txtDifficulties_.setLayoutData( gd_txtDifficulties_ );
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public class CampaignPage2 extends WizardPageTemplate
|
||||||
|
|
||||||
txtFirstScenario_ = new Text( container, SWT.BORDER );
|
txtFirstScenario_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtFirstScenario_ = new GridData( SWT.FILL, SWT.CENTER,
|
GridData gd_txtFirstScenario_ = new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 );
|
false, false, 1, 1 );
|
||||||
gd_txtFirstScenario_.widthHint = 206;
|
gd_txtFirstScenario_.widthHint = 206;
|
||||||
txtFirstScenario_.setLayoutData( gd_txtFirstScenario_ );
|
txtFirstScenario_.setLayoutData( gd_txtFirstScenario_ );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class EmptyProjectNewWizard extends WizardTemplate
|
||||||
public void addPages( )
|
public void addPages( )
|
||||||
{
|
{
|
||||||
page0_ = new WizardProjectPageTemplate( "emptyProjectPage0",
|
page0_ = new WizardProjectPageTemplate( "emptyProjectPage0",
|
||||||
Messages.EmptyProjectPage0_1, Messages.EmptyProjectPage0_2 );
|
Messages.EmptyProjectPage0_1, Messages.EmptyProjectPage0_2 );
|
||||||
addPage( page0_ );
|
addPage( page0_ );
|
||||||
|
|
||||||
page1_ = new EmptyProjectPage1( );
|
page1_ = new EmptyProjectPage1( );
|
||||||
|
@ -57,10 +57,10 @@ public class EmptyProjectNewWizard extends WizardTemplate
|
||||||
getContainer( ).run( false, false, new IRunnableWithProgress( ) {
|
getContainer( ).run( false, false, new IRunnableWithProgress( ) {
|
||||||
@Override
|
@Override
|
||||||
public void run( IProgressMonitor monitor )
|
public void run( IProgressMonitor monitor )
|
||||||
throws InvocationTargetException, InterruptedException
|
throws InvocationTargetException, InterruptedException
|
||||||
{
|
{
|
||||||
page0_.createProject( monitor, "empty_project",
|
page0_.createProject( monitor, "empty_project",
|
||||||
getParameters( ), page1_.getGeneratePBLFile( ) );
|
getParameters( ), page1_.getGeneratePBLFile( ) );
|
||||||
monitor.done( );
|
monitor.done( );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -76,22 +76,25 @@ public class EmptyProjectNewWizard extends WizardTemplate
|
||||||
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
List< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
||||||
|
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$campaign_name", page1_.getCampaignName( ) ) ); //$NON-NLS-1$
|
"$$campaign_name", page1_.getCampaignName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$author", page1_.getAuthor( ) ) ); //$NON-NLS-1$
|
params
|
||||||
params.add( new ReplaceableParameter( "$$version", page1_.getVersion( ) ) ); //$NON-NLS-1$
|
.add( new ReplaceableParameter( "$$author", page1_.getAuthor( ) ) ); //$NON-NLS-1$
|
||||||
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$version", page1_.getVersion( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$description", page1_.getPBLDescription( ) ) ); //$NON-NLS-1$
|
"$$description", page1_.getPBLDescription( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$icon", page1_.getIconPath( ) ) ); //$NON-NLS-1$
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$icon", page1_.getIconPath( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$email", page1_.getEmail( ) ) ); //$NON-NLS-1$
|
params.add( new ReplaceableParameter( "$$email", page1_.getEmail( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$passphrase", page1_.getPassphrase( ) ) ); //$NON-NLS-1$
|
"$$passphrase", page1_.getPassphrase( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$translations_dir", page1_.getTranslationDir( ) ) ); //$NON-NLS-1$
|
"$$translations_dir", page1_.getTranslationDir( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$project_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
"$$project_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$project_dir_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
"$$project_dir_name", page0_.getProjectName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$type", page1_.getType( ) ) ); //$NON-NLS-1$
|
params.add( new ReplaceableParameter( "$$type", page1_.getType( ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
chkGeneratePBL_ = new Button( container, SWT.CHECK );
|
chkGeneratePBL_ = new Button( container, SWT.CHECK );
|
||||||
chkGeneratePBL_.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER,
|
chkGeneratePBL_.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER,
|
||||||
false, false, 3, 1 ) );
|
false, false, 3, 1 ) );
|
||||||
chkGeneratePBL_.setText( Messages.EmptyProjectPage1_4 );
|
chkGeneratePBL_.setText( Messages.EmptyProjectPage1_4 );
|
||||||
|
|
||||||
Label _lblTitle = new Label( container, SWT.NONE );
|
Label _lblTitle = new Label( container, SWT.NONE );
|
||||||
|
@ -70,7 +70,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtTitle_ = new Text( container, SWT.BORDER );
|
txtTitle_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtTitle_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
GridData gd_txtTitle_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_txtTitle_.heightHint = 15;
|
gd_txtTitle_.heightHint = 15;
|
||||||
txtTitle_.setLayoutData( gd_txtTitle_ );
|
txtTitle_.setLayoutData( gd_txtTitle_ );
|
||||||
txtTitle_.addModifyListener( updatePageCompleteListener );
|
txtTitle_.addModifyListener( updatePageCompleteListener );
|
||||||
|
@ -83,7 +83,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtVersion_ = new Text( container, SWT.BORDER );
|
txtVersion_ = new Text( container, SWT.BORDER );
|
||||||
txtVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtVersion_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
txtVersion_.addModifyListener( updatePageCompleteListener );
|
txtVersion_.addModifyListener( updatePageCompleteListener );
|
||||||
|
|
||||||
Label lblFormat = new Label( container, SWT.NONE );
|
Label lblFormat = new Label( container, SWT.NONE );
|
||||||
|
@ -95,7 +95,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtTranslationDir_ = new Text( container, SWT.BORDER );
|
txtTranslationDir_ = new Text( container, SWT.BORDER );
|
||||||
txtTranslationDir_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtTranslationDir_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
|
|
||||||
Label lblRelativeToThe = new Label( container, SWT.NONE );
|
Label lblRelativeToThe = new Label( container, SWT.NONE );
|
||||||
lblRelativeToThe.setText( Messages.EmptyProjectPage1_16 );
|
lblRelativeToThe.setText( Messages.EmptyProjectPage1_16 );
|
||||||
|
@ -105,7 +105,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtAuthor_ = new Text( container, SWT.BORDER );
|
txtAuthor_ = new Text( container, SWT.BORDER );
|
||||||
txtAuthor_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtAuthor_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblDescription = new Label( container, SWT.NONE );
|
Label lblDescription = new Label( container, SWT.NONE );
|
||||||
|
@ -113,7 +113,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtEmail_ = new Text( container, SWT.BORDER );
|
txtEmail_ = new Text( container, SWT.BORDER );
|
||||||
txtEmail_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
txtEmail_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblDescription_1 = new Label( container, SWT.NONE );
|
Label lblDescription_1 = new Label( container, SWT.NONE );
|
||||||
|
@ -121,17 +121,17 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtDescription_ = new Text( container, SWT.BORDER );
|
txtDescription_ = new Text( container, SWT.BORDER );
|
||||||
txtDescription_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtDescription_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblType = new Label( container, SWT.NONE );
|
Label lblType = new Label( container, SWT.NONE );
|
||||||
lblType.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
lblType.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
lblType.setText( Messages.EmptyProjectPage1_20 );
|
lblType.setText( Messages.EmptyProjectPage1_20 );
|
||||||
|
|
||||||
txtType_ = new Text( container, SWT.BORDER );
|
txtType_ = new Text( container, SWT.BORDER );
|
||||||
txtType_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
txtType_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true,
|
||||||
false, 1, 1 ) );
|
false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblIcon = new Label( container, SWT.NONE );
|
Label lblIcon = new Label( container, SWT.NONE );
|
||||||
|
@ -139,7 +139,7 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtPassphrase_ = new Text( container, SWT.BORDER );
|
txtPassphrase_ = new Text( container, SWT.BORDER );
|
||||||
txtPassphrase_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
txtPassphrase_.setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 ) );
|
false, false, 1, 1 ) );
|
||||||
new Label( container, SWT.NONE );
|
new Label( container, SWT.NONE );
|
||||||
|
|
||||||
Label lblIcon_1 = new Label( container, SWT.NONE );
|
Label lblIcon_1 = new Label( container, SWT.NONE );
|
||||||
|
@ -147,13 +147,13 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
txtIcon_ = new Text( container, SWT.BORDER );
|
txtIcon_ = new Text( container, SWT.BORDER );
|
||||||
GridData gd_txtIcon_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
GridData gd_txtIcon_ = new GridData( SWT.FILL, SWT.CENTER, false,
|
||||||
false, 1, 1 );
|
false, 1, 1 );
|
||||||
gd_txtIcon_.widthHint = 163;
|
gd_txtIcon_.widthHint = 163;
|
||||||
txtIcon_.setLayoutData( gd_txtIcon_ );
|
txtIcon_.setLayoutData( gd_txtIcon_ );
|
||||||
|
|
||||||
Label lblRelativeToThe_1 = new Label( container, SWT.NONE );
|
Label lblRelativeToThe_1 = new Label( container, SWT.NONE );
|
||||||
GridData gd_lblRelativeToThe_1 = new GridData( SWT.FILL, SWT.CENTER,
|
GridData gd_lblRelativeToThe_1 = new GridData( SWT.FILL, SWT.CENTER,
|
||||||
false, false, 1, 1 );
|
false, false, 1, 1 );
|
||||||
gd_lblRelativeToThe_1.widthHint = 285;
|
gd_lblRelativeToThe_1.widthHint = 285;
|
||||||
lblRelativeToThe_1.setLayoutData( gd_lblRelativeToThe_1 );
|
lblRelativeToThe_1.setLayoutData( gd_lblRelativeToThe_1 );
|
||||||
lblRelativeToThe_1.setToolTipText( Messages.EmptyProjectPage1_23 );
|
lblRelativeToThe_1.setToolTipText( Messages.EmptyProjectPage1_23 );
|
||||||
|
@ -175,8 +175,8 @@ public class EmptyProjectPage1 extends WizardPageTemplate
|
||||||
|
|
||||||
// match the pattern x.y.z
|
// match the pattern x.y.z
|
||||||
if( txtVersion_.getText( ).isEmpty( )
|
if( txtVersion_.getText( ).isEmpty( )
|
||||||
|| ! ( txtVersion_.getText( )
|
|| ! ( txtVersion_.getText( )
|
||||||
.matches( "[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*" ) ) ) //$NON-NLS-1$
|
.matches( "[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*" ) ) ) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
setMessage( Messages.EmptyProjectPage1_35, IMessageProvider.WARNING );
|
setMessage( Messages.EmptyProjectPage1_35, IMessageProvider.WARNING );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class EraNewWizard extends WizardTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doFinish( String containerName, String fileName,
|
private void doFinish( String containerName, String fileName,
|
||||||
IProgressMonitor monitor ) throws CoreException
|
IProgressMonitor monitor ) throws CoreException
|
||||||
{
|
{
|
||||||
// create a sample file
|
// create a sample file
|
||||||
monitor.beginTask( Messages.EraNewWizard_1 + fileName, 10 );
|
monitor.beginTask( Messages.EraNewWizard_1 + fileName, 10 );
|
||||||
|
@ -119,7 +119,7 @@ public class EraNewWizard extends WizardTemplate
|
||||||
public void run( )
|
public void run( )
|
||||||
{
|
{
|
||||||
IWorkbenchPage page = PlatformUI.getWorkbench( )
|
IWorkbenchPage page = PlatformUI.getWorkbench( )
|
||||||
.getActiveWorkbenchWindow( ).getActivePage( );
|
.getActiveWorkbenchWindow( ).getActivePage( );
|
||||||
try {
|
try {
|
||||||
IDE.openEditor( page, file, true );
|
IDE.openEditor( page, file, true );
|
||||||
} catch( PartInitException e ) {
|
} catch( PartInitException e ) {
|
||||||
|
@ -135,16 +135,17 @@ public class EraNewWizard extends WizardTemplate
|
||||||
ArrayList< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
ArrayList< ReplaceableParameter > params = new ArrayList< ReplaceableParameter >( );
|
||||||
|
|
||||||
params.add( new ReplaceableParameter( "$$era_id", page0_.getEraID( ) ) ); //$NON-NLS-1$
|
params.add( new ReplaceableParameter( "$$era_id", page0_.getEraID( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter( "$$era_name", page0_.getEraName( ) ) ); //$NON-NLS-1$
|
params
|
||||||
|
.add( new ReplaceableParameter( "$$era_name", page0_.getEraName( ) ) ); //$NON-NLS-1$
|
||||||
params.add( new ReplaceableParameter(
|
params.add( new ReplaceableParameter(
|
||||||
"$$require_era", String.valueOf( page0_.getRequiresEra( ) ) ) ); //$NON-NLS-1$
|
"$$require_era", String.valueOf( page0_.getRequiresEra( ) ) ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
String template = TemplateProvider.getInstance( ).getProcessedTemplate(
|
String template = TemplateProvider.getInstance( ).getProcessedTemplate(
|
||||||
"era", params ); //$NON-NLS-1$
|
"era", params ); //$NON-NLS-1$
|
||||||
|
|
||||||
if( template == null ) {
|
if( template == null ) {
|
||||||
Logger.getInstance( ).log( "'era' template not found", //$NON-NLS-1$
|
Logger.getInstance( ).log( "'era' template not found", //$NON-NLS-1$
|
||||||
Messages.EraNewWizard_8 );
|
Messages.EraNewWizard_8 );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue