id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
1,200
<s> package org . rubypeople . rdt . internal . ui . text . hyperlinks ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IExtensionRegistry ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . hyperlink . IHyperlink ; import org . eclipse . jface . text . hyperlink . IHyperlinkDetector ; import org . eclipse . ui . IEditorInput ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . ui . text . hyperlinks . IHyperlinkProvider ; public class RubyHyperLinkDetector implements IHyperlinkDetector { public static final String RDT_UI_NAMESPACE = "" ; public static final String RDT_UI_HYPERLINKPROVIDER = "" ; private List fExtensions ; private final IEditorInput fEditorInput ; public RubyHyperLinkDetector ( IEditorInput editorInput ) { this . fEditorInput = editorInput ; } private IExtensionPoint [ ] getExtensionPoints ( ) { IExtensionRegistry reg = Platform . getExtensionRegistry ( ) ; return reg . getExtensionPoints ( RDT_UI_NAMESPACE ) ; } private List initExtensions ( ) { if ( fExtensions != null ) return fExtensions ; fExtensions = new ArrayList ( ) ; IExtensionPoint [ ] points = getExtensionPoints ( ) ; IExtensionPoint point = getExtensionPoint ( points ) ; if ( point != null ) { IExtension [ ] exts = point . getExtensions ( ) ; for ( int i = 0 ; i < exts . length ; i ++ ) { IConfigurationElement [ ] elem = exts [ i ]
1,201
<s> package org . rubypeople . rdt . internal . ti ; import junit . framework . Test ; import junit . framework . TestSuite ;
1,202
<s> package com . aptana . rdt . internal . parser . warnings ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . IProblem ; public class LocalsMaskingMethodsVisitor extends RubyLintVisitor { private Map < Node , Collection < LocalAsgnNode > > locals ; private HashSet < String > methods ; private List < Node > scopes ; public LocalsMaskingMethodsVisitor ( String contents ) { super ( AptanaRDTPlugin . getDefault ( ) . getOptions ( ) , contents ) ; init ( ) ; } private void init ( ) { locals = new HashMap < Node , Collection < LocalAsgnNode > > ( ) ; methods = new HashSet < String > ( ) ; scopes = new ArrayList < Node > ( ) ; } @ Override public Object visitRootNode ( RootNode visited ) { init ( ) ; enterScope ( visited ) ; Object ret = super . visitRootNode ( visited ) ; exitScope ( ) ; return ret ; } private void enterScope ( Node scopingNode ) { scopes . add ( scopingNode ) ; } private void exitScope ( ) { scopes . remove ( scopes . size ( ) - 1 ) ; } @ Override protected String getOptionKey ( ) { return AptanaRDTPlugin . COMPILER_PB_LOCAL_MASKS_METHOD ; } @ Override protected int getProblemID ( ) { return IProblem . LocalMaskingMethod ; } public Object visitClassNode ( ClassNode iVisited ) { methods . clear ( ) ; locals . clear ( ) ; enterScope ( iVisited ) ; Object ret = super . visitClassNode ( iVisited ) ; findMaskingLocals ( ) ; exitScope ( ) ; return ret ; } @ Override public Object visitFCallNode ( FCallNode iVisited ) {
1,203
<s> package de . fuberlin . wiwiss . d2rq . map ; import java . io . IOException ; import java . net . URI ; import java . sql . SQLException ; import java . util . HashMap ; import java . util . Map ; import java . util . Properties ; import com . hp . hpl . jena . rdf . model . Resource ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . sql . ConnectedDB ; import de . fuberlin . wiwiss . d2rq . sql . types . DataType . GenericType ; import de . fuberlin . wiwiss . d2rq . sql . SQLScriptLoader ; import de . fuberlin . wiwiss . d2rq . vocab . D2RQ ; public class Database extends MapObject { public static final int NO_LIMIT = - 1 ; public static final int NO_FETCH_SIZE = - 1 ; private String jdbcDSN ; private String jdbcDriver ; private String username ; private String password ; private final Map < String , GenericType > columnTypes = new HashMap < String , GenericType > ( ) ; private int limit = NO_LIMIT ; private int fetchSize = NO_FETCH_SIZE ; private String startupSQLScript = null ; private ConnectedDB connection = null ; private Properties connectionProperties = new Properties ( ) ; public Database ( Resource resource ) { super ( resource ) ; } public void setJDBCDSN ( String jdbcDSN ) { assertNotYetDefined ( this . jdbcDSN , D2RQ . jdbcDSN , D2RQException . DATABASE_DUPLICATE_JDBCDSN ) ; checkNotConnected ( ) ; this . jdbcDSN = jdbcDSN ; } public String getJDBCDSN ( ) { return this . jdbcDSN ; } public void setJDBCDriver ( String jdbcDriver ) { assertNotYetDefined ( this . jdbcDriver , D2RQ . jdbcDriver , D2RQException . DATABASE_DUPLICATE_JDBCDRIVER ) ; checkNotConnected ( ) ; this . jdbcDriver = jdbcDriver ; } public String getJDBCDriver ( ) { return jdbcDriver ; } public void setUsername ( String username ) { assertNotYetDefined ( this . username , D2RQ . username , D2RQException . DATABASE_DUPLICATE_USERNAME ) ; checkNotConnected ( ) ; this . username = username ; } public String getUsername ( ) { return username ; } public void setPassword ( String password ) { assertNotYetDefined ( this . password , D2RQ . password , D2RQException . DATABASE_DUPLICATE_PASSWORD ) ; checkNotConnected ( ) ; this . password = password ; } public String getPassword ( ) { return password ; } public void addTextColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . CHARACTER ) ; } public void addNumericColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . NUMERIC ) ; } public void addBooleanColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . BOOLEAN ) ; } public void addDateColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . DATE ) ; } public void addTimestampColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . TIMESTAMP ) ; } public void addTimeColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . TIME ) ; } public void addBinaryColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . BINARY ) ; } public void addBitColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . BIT ) ; } public void addIntervalColumn ( String column ) { checkNotConnected ( ) ; columnTypes . put ( column , GenericType . INTERVAL ) ; } public void setResultSizeLimit ( int limit ) { checkNotConnected ( ) ; this . limit = limit ; } public int getResultSizeLimit ( ) { return limit ; } public int getFetchSize ( ) { return this . fetchSize ; } public void setFetchSize ( int fetchSize ) { checkNotConnected ( ) ; this . fetchSize = fetchSize ; } public void setStartupSQLScript ( Resource script
1,204
<s> package org . oddjob . values . types ; import java . io . Serializable ; import java . util . HashMap ; import java . util . Map ; import org . apache . commons . beanutils . DynaBean ; import org . apache . commons . beanutils . DynaProperty ; import org . apache . commons . beanutils . MutableDynaClass ; public class PropertyTypeDynaClass implements MutableDynaClass , Serializable { private static final long serialVersionUID = 20070124 ; private final Map < String , DynaProperty > propertiesMap = new HashMap < String , DynaProperty > ( ) ; private final String name ; public PropertyTypeDynaClass ( String name ) { this . name = name ; } public boolean isRestricted ( ) { return false ; } public void setRestricted ( boolean restricted ) { throw new UnsupportedOperationException ( "" ) ; } public void add ( String name ) { add ( new DynaProperty ( name , String . class ) ) ; } public void add ( String name , Class type ) { if ( ! ( String . class . isAssignableFrom ( type ) ) ) { throw new IllegalArgumentException ( "" ) ; } add ( new DynaProperty ( name , type )
1,205
<s> package br . com . caelum . vraptor . dash . hibernate . stats ; import java . util . Map ; import java . util . concurrent . ConcurrentHashMap ; import br . com . caelum . vraptor . ioc . ApplicationScoped ; import br . com . caelum . vraptor . ioc . Component ; import br . com . caelum . vraptor . resource . ResourceMethod ; @ ApplicationScoped
1,206
<s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . jface . viewers . TableViewer ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . search . ui . text . AbstractTextSearchViewPage ; import org . eclipse . search . ui . text . Match ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; public class OccurrencesSearchResultPage extends AbstractTextSearchViewPage { private TextSearchTableContentProvider fContentProvider ; public OccurrencesSearchResultPage ( ) { super ( AbstractTextSearchViewPage . FLAG_LAYOUT_FLAT ) ; } protected void showMatch ( Match match , int currentOffset , int currentLength , boolean activate ) throws PartInitException { IEditorPart editor = null ; RubyElementLine element = ( RubyElementLine ) match . getElement ( ) ; IRubyElement javaElement = element . getRubyElement ( ) ; try { editor = EditorUtility . openInEditor ( javaElement , false ) ; } catch ( PartInitException e1 ) { return ; } catch ( RubyModelException e1 ) { return ; } if
1,207
<s> package com . pogofish . jadt . javadoc . javacc ; import static com . pogofish . jadt . ast . JDToken . _JDWhiteSpace ; import java . io . Reader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import com . pogofish . jadt . ast . JDToken ; import com . pogofish . jadt . comments . javacc . generated . BaseJavaDocParserImpl ; import com . pogofish . jadt . comments . javacc . generated . Token ; public class JavaDocParserImpl extends BaseJavaDocParserImpl { public JavaDocParserImpl ( Reader stream ) { super ( stream
1,208
<s> package org . oddjob ; public class FailedToStopException extends Exception { private static final long serialVersionUID = 2010071900L ; private final Object failedToStop ; public FailedToStopException ( Stateful failedToStop ) { super ( "[" + failedToStop
1,209
<s> package com . pogofish . jadt . parser ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertSame ; import static org . junit . Assert . fail ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . Reader ; import java . util . List ; import org . junit . Test ; import com . pogofish . jadt . ast . ASTConstants ; import com . pogofish . jadt . ast . DataType ; import com . pogofish . jadt . ast . Doc ; import com . pogofish . jadt . ast . Imprt ; import com . pogofish . jadt . ast . ParseResult ; import com . pogofish . jadt . errors . SyntaxError ; import com . pogofish . jadt . source . Source ; import com . pogofish . jadt . source . StringSource ; import com . pogofish . jadt . util . Util ; public class ParserTest { @ Test public void testErrorClosing ( ) { final IOException thrown = new IOException ( "oh yeah" ) ; final Source source = new Source ( ) { @ Override public String getSrcInfo ( ) { return "whatever" ; } @ Override public BufferedReader createReader ( ) { return new BufferedReader ( new Reader ( ) { @ Override public int read ( char [ ] cbuf , int off , int len ) throws IOException { throw new RuntimeException ( "" ) ; } @ Override public void close ( ) throws IOException { throw thrown ; } } ) ; } } ; final Parser parser = new StandardParser ( new ParserImplFactory ( ) { @ Override public ParserImpl create ( String srcInfo , Reader reader ) { return new BaseTestParserImpl ( ) { @ Override public Doc doc ( ) throws Exception { return Doc . _Doc ( "whatever" , ASTConstants . EMPTY_PKG , Util . < Imprt > list ( ) , Util . < DataType > list ( ) ) ; } @ Override public List < SyntaxError > errors ( ) { return Util . < SyntaxError > list ( ) ; } } ; } } ) ; try { final ParseResult parseResult = parser . parse ( source ) ; fail ( "" + parseResult ) ; } catch ( RuntimeException caught ) { assertEquals ( "" , thrown , caught . getCause ( ) ) ; } } @ Test public void testExceptionHandling ( ) { final Throwable thrown1 = new RuntimeException ( "oh yeah" ) ; try { final Parser parser = new StandardParser ( new ThrowingParserImplFactory ( thrown1 ) ) ; final ParseResult result = parser . parse ( new StringSource ( "whatever" , "whatever" ) ) ; fail ( "" + result ) ; } catch ( RuntimeException caught ) { assertSame ( "" , thrown1 , caught ) ; } final Throwable thrown2 = new Error ( "oh yeah" ) ; try { final Parser parser = new StandardParser ( new ThrowingParserImplFactory ( thrown2 ) ) ; final ParseResult result = parser . parse ( new StringSource ( "whatever" , "whatever" ) ) ; fail
1,210
<s> package org . oddjob . monitor . view ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import javax . swing . event . TableModelEvent ; import javax . swing . table . AbstractTableModel ; public class PropertyTableModel extends AbstractTableModel { private static final long serialVersionUID = 20051109 ; private List < String > keys = new ArrayList < String > ( ) ; private List < String > values = new ArrayList < String > ( ) ; private final String colNames [ ] = { "Name" , "Value" } ; public void update ( Map < String , String > props ) { keys = new ArrayList < String > ( props . keySet ( ) ) ; values
1,211
<s> package org . rubypeople . rdt . internal . ui . preferences ; import java . util . ArrayList ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . preference . ColorSelector ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . preference . PreferencePage ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . FontMetrics ; import org . eclipse . swt . graphics . GC ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Link ; import org . eclipse . swt . widgets . List ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . dialogs . PreferencesUtil ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . ui . PreferenceConstants ; class RubyEditorAppearanceConfigurationBlock extends AbstractConfigurationBlock { private final String [ ] [ ] fAppearanceColorListModel = new String [ ] [ ] { { PreferencesMessages . RubyEditorPreferencePage_matchingBracketsHighlightColor2 , PreferenceConstants . EDITOR_MATCHING_BRACKETS_COLOR , null } , { PreferencesMessages . RubyEditorPreferencePage_backgroundForCompletionProposals , PreferenceConstants . CODEASSIST_PROPOSALS_BACKGROUND , null } , { PreferencesMessages . RubyEditorPreferencePage_foregroundForCompletionProposals , PreferenceConstants . CODEASSIST_PROPOSALS_FOREGROUND , null } , { PreferencesMessages . RubyEditorPreferencePage_backgroundForMethodParameters , PreferenceConstants . CODEASSIST_PARAMETERS_BACKGROUND , null } , { PreferencesMessages . RubyEditorPreferencePage_foregroundForMethodParameters , PreferenceConstants . CODEASSIST_PARAMETERS_FOREGROUND , null } , { PreferencesMessages . RubyEditorPreferencePage_backgroundForCompletionReplacement , PreferenceConstants . CODEASSIST_REPLACEMENT_BACKGROUND , null } , { PreferencesMessages . RubyEditorPreferencePage_foregroundForCompletionReplacement , PreferenceConstants . CODEASSIST_REPLACEMENT_FOREGROUND , null } , } ; private List fAppearanceColorList ; private ColorSelector fAppearanceColorEditor ; private Button fAppearanceColorDefault ; private FontMetrics fFontMetrics ; public RubyEditorAppearanceConfigurationBlock ( PreferencePage mainPreferencePage , OverlayPreferenceStore store ) { super ( store , mainPreferencePage ) ; getPreferenceStore ( ) . addKeys ( createOverlayStoreKeys ( ) ) ; } private OverlayPreferenceStore . OverlayKey [ ] createOverlayStoreKeys ( ) { ArrayList overlayKeys = new ArrayList ( ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . EDITOR_MATCHING_BRACKETS_COLOR ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . HOVERS_ENABLED ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_MATCHING_BRACKETS ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_QUICKASSIST_LIGHTBULB ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_EVALUTE_TEMPORARY_PROBLEMS ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_SMART_HOME_END ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_PROPOSALS_BACKGROUND ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_PROPOSALS_FOREGROUND ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_PARAMETERS_BACKGROUND ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_PARAMETERS_FOREGROUND ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_REPLACEMENT_BACKGROUND ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . CODEASSIST_REPLACEMENT_FOREGROUND ) ) ; OverlayPreferenceStore . OverlayKey [ ] keys = new OverlayPreferenceStore . OverlayKey [ overlayKeys . size ( ) ] ; overlayKeys . toArray ( keys ) ; return keys ; } public Control createControl ( Composite parent ) { initializeDialogUnits ( parent ) ; Composite composite = new Composite ( parent , SWT . NONE ) ; composite . setLayout ( new GridLayout ( ) ) ; createHeader ( composite ) ; createAppearancePage ( composite ) ; return composite ; } private void createHeader ( Composite contents ) { final Shell shell = contents . getShell ( ) ; String text = PreferencesMessages . RubyEditorPreferencePage_link ; Link link = new Link ( contents , SWT . NONE ) ; link . setText ( text ) ; link . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { PreferencesUtil . createPreferenceDialogOn ( shell , "" , null , null ) ; } } ) ; link . setToolTipText ( PreferencesMessages . RubyEditorPreferencePage_link_tooltip ) ; GridData gridData = new GridData ( SWT . FILL , SWT . BEGINNING , true , false ) ; gridData . widthHint = 150 ; link . setLayoutData ( gridData ) ; addFiller ( contents ) ; } private void addFiller ( Composite composite ) { PixelConverter pixelConverter = new PixelConverter ( composite ) ; Label filler = new Label ( composite , SWT . LEFT ) ; GridData gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; gd . horizontalSpan = 2 ; gd . heightHint = pixelConverter . convertHeightInCharsToPixels ( 1 ) / 2 ; filler . setLayoutData ( gd ) ; } protected int convertWidthInCharsToPixels ( int chars ) { if ( fFontMetrics == null ) return 0 ; return Dialog . convertWidthInCharsToPixels ( fFontMetrics , chars ) ; } protected int convertHeightInCharsToPixels ( int chars ) { if ( fFontMetrics == null ) return 0 ; return Dialog . convertHeightInCharsToPixels ( fFontMetrics , chars ) ; } private Control createAppearancePage ( Composite parent ) { Composite appearanceComposite = new Composite ( parent , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; layout . numColumns = 2 ; appearanceComposite . setLayout ( layout ) ; String label ; label = PreferencesMessages . RubyEditorPreferencePage_smartHomeEnd ; addCheckBox ( appearanceComposite , label , PreferenceConstants . EDITOR_SMART_HOME_END , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_subWordNavigation ; addCheckBox ( appearanceComposite , label , PreferenceConstants . EDITOR_SUB_WORD_NAVIGATION , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_analyseAnnotationsWhileTyping ; addCheckBox ( appearanceComposite , label , PreferenceConstants . EDITOR_EVALUTE_TEMPORARY_PROBLEMS , 0 ) ; String text = PreferencesMessages . SmartTypingConfigurationBlock_annotationReporting_link ; addLink ( appearanceComposite , text , INDENT ) ; Label spacer = new Label ( appearanceComposite , SWT . LEFT ) ; GridData gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; gd . horizontalSpan = 2 ; gd . heightHint = convertHeightInCharsToPixels ( 1 ) / 2 ; spacer . setLayoutData ( gd ) ; label = PreferencesMessages . RubyEditorPreferencePage_highlightMatchingBrackets ; addCheckBox ( appearanceComposite , label , PreferenceConstants . EDITOR_MATCHING_BRACKETS , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_quickassist_lightbulb ; addCheckBox ( appearanceComposite , label , PreferenceConstants . EDITOR_QUICKASSIST_LIGHTBULB , 0 ) ; label = PreferencesMessages . RubyEditorPreferencePage_enableHovers ; addCheckBox ( appearanceComposite , label , PreferenceConstants . HOVERS_ENABLED , 0 ) ; Label l = new Label ( appearanceComposite , SWT . LEFT ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; gd . horizontalSpan = 2 ; gd . heightHint = convertHeightInCharsToPixels ( 1 ) / 2 ; l . setLayoutData ( gd ) ; l = new Label ( appearanceComposite , SWT . LEFT ) ; l . setText ( PreferencesMessages . RubyEditorPreferencePage_appearanceOptions ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; gd . horizontalSpan = 2 ; l . setLayoutData ( gd ) ; Composite editorComposite = new Composite ( appearanceComposite , SWT . NONE ) ; layout = new GridLayout ( ) ; layout . numColumns = 2 ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; editorComposite . setLayout ( layout ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL | GridData . FILL_VERTICAL ) ; gd . horizontalSpan = 2 ; editorComposite
1,212
<s> package com . asakusafw . bulkloader . collector ; import java . io . IOException ; import java . io . OutputStream ; import java . net . URI ; import java . net . URISyntaxException ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . apache . commons . io . output . CountingOutputStream ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileStatus ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . FileUtil ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . mapreduce . lib . output . FileOutputCommitter ; import com . asakusafw . bulkloader . bean . ExportTargetTableBean ; import com . asakusafw . bulkloader . bean . ExporterBean ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . FileCompType ; import com . asakusafw . bulkloader . common . FileNameUtil ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . bulkloader . transfer . FileList ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . TsvIoFactory ; import com . asakusafw . runtime . stage . temporary . TemporaryStorage ; public class ExportFileSend { static final Log LOG = new Log ( ExportFileSend . class ) ; Map < String , Integer > fileNameMap = new HashMap < String , Integer > ( ) ; public boolean sendExportFile ( ExporterBean bean , String user ) { String strCompType = ConfigurationLoader . getProperty ( Constants . PROP_KEY_EXP_FILE_COMP_TYPE ) ; FileCompType compType = FileCompType . find ( strCompType ) ; OutputStream output = getOutputStream ( ) ; try { FileList . Writer writer ; try { writer = FileList . createWriter ( output , compType == FileCompType . DEFLATED ) ; } catch ( IOException e ) { throw new BulkLoaderSystemException ( e , getClass ( ) , "" , "" ) ; } Configuration conf = new Configuration ( ) ; List < String > l = bean . getExportTargetTableList ( ) ; for ( String tableName : l ) { ExportTargetTableBean targetTable = bean . getExportTargetTable ( tableName ) ; Class < ? extends Writable > targetTableModel = targetTable . getExportTargetType ( ) . asSubclass ( Writable . class ) ; List < Path > filePath = FileNameUtil . createPaths ( conf , targetTable . getDfsFilePaths ( ) , bean . getExecutionId ( ) , user ) ; int fileCount = filePath . size ( ) ; long recordCount = 0 ; for ( int i = 0 ; i < fileCount ; i ++ ) { LOG . info ( "" , tableName , filePath . get ( i ) , compType . getSymbol ( ) , targetTableModel . toString ( ) ) ; long countInFile = send ( targetTableModel , filePath . get ( i ) . toString ( ) , writer , tableName ) ; if ( countInFile >= 0 ) { recordCount += countInFile ; } LOG . info ( "" , tableName , filePath . get ( i ) , compType . getSymbol ( ) , targetTableModel . toString ( ) ) ; } LOG . info ( "" , bean . getTargetName ( ) , bean . getBatchId ( ) , bean . getJobflowId ( ) , bean . getExecutionId ( ) , tableName , recordCount ) ; } try { writer . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return true ; } catch ( BulkLoaderSystemException e ) { LOG . log ( e ) ; return false ; } finally { try { output . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } protected < T extends Writable > long send ( Class < T > targetTableModel , String filePath , FileList
1,213
<s> package org . rubypeople . rdt . ui . actions ; import org . eclipse . core . resources . IncrementalProjectBuilder ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IViewPart ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . actions . ActionFactory ; import org . eclipse . ui . actions . ActionGroup ; import org . eclipse . ui . actions . BuildAction ; import org . eclipse . ui . ide . IDEActionFactory ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . internal . ui . actions . ActionMessages ; import org . rubypeople . rdt . ui . IContextMenuConstants ; public class BuildActionGroup extends ActionGroup { private IWorkbenchSite fSite ; private BuildAction fBuildAction ; private RefreshAction fRefreshAction ; public BuildActionGroup ( IViewPart part ) { fSite = part . getSite ( ) ; Shell shell = fSite . getShell ( ) ; ISelectionProvider provider = fSite . getSelectionProvider ( ) ; fBuildAction = new BuildAction ( shell , IncrementalProjectBuilder . INCREMENTAL_BUILD ) ; fBuildAction . setText ( ActionMessages . BuildAction_label ) ; fBuildAction . setActionDefinitionId ( "" ) ; fRefreshAction = new RefreshAction ( fSite ) ; fRefreshAction . setActionDefinitionId ( "" ) ; provider . addSelectionChangedListener ( fBuildAction ) ; provider . addSelectionChangedListener ( fRefreshAction ) ; } public IAction getRefreshAction ( ) { return fRefreshAction ; } public void fillActionBars ( IActionBars actionBar ) { super . fillActionBars ( actionBar ) ; setGlobalActionHandlers ( actionBar ) ; } public void fillContextMenu ( IMenuManager menu ) { ISelection selection = getContext ( ) . getSelection ( ) ; if ( ! ResourcesPlugin . getWorkspace ( ) . isAutoBuilding ( ) && isBuildTarget ( selection ) ) { appendToGroup ( menu , fBuildAction ) ; } appendToGroup ( menu , fRefreshAction ) ; super . fillContextMenu ( menu ) ; } public void dispose ( ) { ISelectionProvider provider = fSite . getSelectionProvider
1,214
<s> package journal . io . api ; import java . util . concurrent . locks . ReentrantLock ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . util . HashSet ; import java . util . Map . Entry ; import java . util . Set ; import java . util . concurrent . ConcurrentHashMap ; import java . util . concurrent . ConcurrentMap ; import java . util . concurrent . ScheduledExecutorService ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . locks . Lock ; import java . util . concurrent . locks . ReadWriteLock ; import java . util . concurrent . locks . ReentrantReadWriteLock ; import journal . io . api . Journal . WriteCommand ; import journal . io . util . IOHelper ; import static journal . io . util . LogHelper . * ; class DataFileAccessor { private final ConcurrentMap < Thread , ConcurrentMap < Integer , RandomAccessFile > > perThreadDataFileRafs = new ConcurrentHashMap < Thread , ConcurrentMap < Integer , RandomAccessFile > > ( ) ; private final ConcurrentMap < Thread , ConcurrentMap < Integer , Lock > > perThreadDataFileLocks = new ConcurrentHashMap < Thread , ConcurrentMap < Integer , Lock > > ( ) ; private final ReadWriteLock compactionLock = new ReentrantReadWriteLock ( ) ; private final Lock accessorLock = compactionLock . readLock ( ) ; private final Lock compactorMutex = compactionLock . writeLock ( ) ; private final Journal journal ; private volatile ScheduledExecutorService disposer ; public DataFileAccessor ( Journal journal ) { this . journal = journal ; } void updateLocation ( Location location , byte type , boolean sync ) throws IOException { Lock threadLock = getOrCreateLock ( Thread . currentThread ( ) , location . getDataFileId ( ) ) ; accessorLock . lock ( ) ; threadLock . lock ( ) ; try { journal . sync ( ) ; RandomAccessFile raf = getOrCreateRaf ( Thread . currentThread ( ) , location . getDataFileId ( ) ) ; if ( seekToLocation ( raf , location ) ) { raf . skipBytes ( Journal . RECORD_POINTER_SIZE + Journal . RECORD_LENGTH_SIZE ) ; raf . write ( type ) ; location . setType ( type ) ; if ( sync ) { IOHelper . sync ( raf . getFD ( ) ) ; } } else { throw new IOException ( "" + location ) ; } } finally { threadLock . unlock ( ) ; accessorLock . unlock ( ) ; } } byte [ ] readLocation ( Location location , boolean sync ) throws IOException { if ( location . getData ( ) != null && ! sync ) { return location . getData ( ) ; } else { Location read = readLocationDetails ( location . getDataFileId ( ) , location . getPointer ( ) ) ; if ( read != null && ! read . isDeletedRecord ( ) ) { return read . getData ( ) ; } else { throw new IOException ( "" + location ) ; } } } Location readLocationDetails ( int file , int pointer ) throws IOException { WriteCommand asyncWrite = journal . getInflightWrites ( ) . get ( new Location ( file , pointer ) ) ; if ( asyncWrite != null ) { Location location = new Location ( file , pointer ) ; location . setPointer ( asyncWrite . getLocation ( ) . getPointer ( ) ) ; location . setSize ( asyncWrite . getLocation ( ) . getSize ( ) ) ; location . setType ( asyncWrite . getLocation ( ) . getType ( ) ) ; location . setData ( asyncWrite . getData ( ) ) ; return location ; } else { Location location = new Location ( file , pointer ) ; Lock threadLock = getOrCreateLock ( Thread . currentThread ( ) , location . getDataFileId ( ) ) ; accessorLock . lock ( ) ; threadLock . lock ( ) ; try { RandomAccessFile raf = getOrCreateRaf ( Thread . currentThread ( ) , location . getDataFileId ( ) ) ; if ( seekToLocation ( raf , location ) ) { long position = raf . getFilePointer ( ) ; location . setPointer ( raf . readInt ( ) ) ; location . setSize ( raf . readInt ( ) ) ; location . setType ( raf . readByte ( ) ) ; if ( location . getSize ( ) > 0 ) { location . setData ( readLocationData ( location , raf ) ) ; raf . seek ( position ) ; return location ; } else { raf . seek ( position ) ; return null ; } } else { return null ; } } finally { threadLock . unlock ( ) ; accessorLock . unlock ( ) ; } } } Location readNextLocationDetails ( Location start , int type ) throws IOException { Location asyncLocation = new Location ( start .
1,215
<s> package org . rubypeople . rdt . internal . debug . ui ; import org . eclipse . jface . resource . CompositeImageDescriptor ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . swt . graphics . ImageData ; import org . eclipse . swt . graphics . Point ; public class RDTImageDescriptor extends CompositeImageDescriptor { public final static int IS_OUT_OF_SYNCH = 0x0001 ; private Point fSize ; private ImageDescriptor fBaseImage ; private int fFlags ; public RDTImageDescriptor ( ImageDescriptor baseImage , int flags ) { setBaseImage ( baseImage ) ; setFlags ( flags ) ; } @ Override protected void drawCompositeImage ( int width , int height ) { ImageData bg = getBaseImage ( ) . getImageData ( ) ; if ( bg == null ) { bg = DEFAULT_IMAGE_DATA ; } drawImage ( bg , 0 , 0 ) ; drawOverlays ( ) ; } @ Override protected Point getSize ( ) { if ( fSize == null ) { ImageData data = getBaseImage ( ) . getImageData ( ) ; setSize ( new Point ( data . width , data . height ) ) ; } return fSize ; } protected void setSize ( Point size ) {
1,216
<s> package net . sf . sveditor . core . hierarchy ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBModIfcInst ; import net . sf . sveditor . core . db . SVDBModIfcInstItem ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . search . SVDBFindByName ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; public class ModuleHierarchyTreeFactory { private ISVDBIndexIterator fIndexIt ; private SVDBFindByName fFinder ; private LogHandle fLog ; public ModuleHierarchyTreeFactory ( ISVDBIndexIterator index_it ) { fIndexIt = index_it ; fFinder = new SVDBFindByName ( fIndexIt ) ; fLog = LogFactory . getLogHandle ( "" ) ; } public HierarchyTreeNode build ( SVDBModIfcDecl mod ) { return build_s ( null , mod , null ) ; } private HierarchyTreeNode build_s ( HierarchyTreeNode parent , SVDBModIfcDecl mod , SVDBModIfcInstItem inst_item ) { HierarchyTreeNode ret ; if ( inst_item != null ) { ret = new HierarchyTreeNode ( parent , inst_item . getName ( ) , inst_item , mod ) ; } else { ret = new HierarchyTreeNode ( parent , mod . getName ( ) , mod ) ; } for ( ISVDBItemBase it : mod . getChildren (
1,217
<s> package org . oddjob . framework ; import java . util . LinkedHashMap ; import java . util . Map ; import org . oddjob . arooa . registry . ServiceProvider ; import org . oddjob . arooa . registry . Services ; import org . oddjob . arooa . types . IsType ; public class ServicesJob extends SimpleJob implements ServiceProvider { private final Map < String , ServiceDefinition > services = new LinkedHashMap < String , ServiceDefinition > ( ) ; @ Override protected int execute ( ) throws Throwable { return 0 ; } @ Override protected void onReset ( ) { services . clear ( ) ; } @ Override public Services getServices ( ) { return new Services ( ) { @ Override public Object getService ( String serviceName ) throws IllegalArgumentException { ServiceDefinition def = services . get ( serviceName ) ; if (
1,218
<s> package org . rubypeople . rdt . internal . ti . util ; import java . util . LinkedList ; import java . util . List ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . internal . ti . TypeInferenceHelper ; public class MethodDefinitionLocator extends NodeLocator { private MethodDefinitionLocator ( ) { } private static MethodDefinitionLocator staticInstance = new MethodDefinitionLocator ( ) ; public static MethodDefinitionLocator Instance ( ) { return staticInstance ; } private TypeInferenceHelper helper = TypeInferenceHelper . Instance ( ) ; private String typeName ;
1,219
<s> package com . asakusafw . compiler . flow . example ; import com . asakusafw . vocabulary . external . ImporterDescription ; public class InvalidTypeImporterDescription
1,220
<s> package com . asakusafw . windgate . stream ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import org . junit . Assume ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class StreamSourceDriverTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void simple ( ) throws Exception { File file = folder . newFile ( "testing" ) ; put ( file , "" ) ; StringBuilder buf = new StringBuilder ( ) ; StreamSourceDriver < StringBuilder > driver = new StreamSourceDriver < StringBuilder > ( "streaming" , "testing" , wrap ( new FileInputStreamProvider ( file ) ) , new StringBuilderSupport ( ) , buf ) ; try { driver . prepare ( ) ; assertThat ( driver . next ( ) , is ( true ) ) ; assertThat ( driver . get ( ) . toString ( ) , is ( "" ) ) ; assertThat ( driver . next ( ) , is ( false ) ) ; } finally { driver . close ( ) ; } } @ Test public void empty ( ) throws Exception { File file = folder . newFile ( "testing" ) ; StringBuilder buf = new StringBuilder ( ) ; StreamSourceDriver < StringBuilder > driver = new StreamSourceDriver < StringBuilder > ( "streaming" , "testing" , wrap ( new FileInputStreamProvider ( file ) ) , new StringBuilderSupport ( ) , buf ) ; try { driver . prepare ( ) ; assertThat ( driver . next ( ) , is ( false ) ) ; } finally { driver . close ( ) ; } } @ Test public void multiple ( ) throws Exception { File file = folder . newFile ( "testing" ) ; put ( file , "" , "" , "" ) ; StringBuilder buf = new StringBuilder ( ) ; StreamSourceDriver < StringBuilder > driver = new StreamSourceDriver < StringBuilder > ( "streaming" , "testing" , wrap ( new FileInputStreamProvider ( file ) ) , new StringBuilderSupport ( ) , buf ) ; try { driver . prepare ( ) ; assertThat ( driver . next ( ) , is ( true ) ) ; assertThat ( driver . get ( ) . toString ( ) , is ( "" ) ) ; assertThat ( driver . next ( ) , is ( true ) ) ; assertThat ( driver . get ( ) . toString ( ) , is ( "" ) ) ; assertThat ( driver . next ( ) , is ( true ) ) ; assertThat ( driver . get ( ) . toString ( ) , is ( "" ) ) ; assertThat ( driver . next ( ) , is ( false ) ) ; } finally { driver . close ( ) ; } } @ Test ( expected = IOException . class ) public void invalid_open_fail ( ) throws Exception { File file = folder . newFile ( "testing" ) ;
1,221
<s> package org . rubypeople . rdt . internal . ui . viewsupport ; import org . eclipse . jface . util . Assert ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . graphics . Image ; public class ImageDisposer implements DisposeListener { private Image [ ] fImages ; public ImageDisposer ( Image image )
1,222
<s> package org . oddjob . designer . components ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design .
1,223
<s> package com . asakusafw . bulkloader . common ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . List ; import java . util . Properties ; import org . junit . After ; import org . junit . AfterClass ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Test ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; public class BulkLoaderInitializerTest { private static String targetName = "target1" ; private static List < String > propertys_db = Arrays . asList ( new String [ ] { "" } ) ; private static List < String > propertys_hc = Arrays . asList ( new String [ ] { "" } ) ; private static List < String > propertys_er1 = Arrays . asList ( new String [ ] { "" } ) ; private static List < String > propertys_er2 = Arrays . asList
1,224
<s> package org . rubypeople . rdt . debug . core ; import org . eclipse . core . runtime
1,225
<s> package net . thucydides . showcase . simple . requirements ; import net . thucydides . core . annotations . Feature ;
1,226
<s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . text . source . IVerticalRulerInfo ; import org . eclipse . ui . texteditor . AbstractRulerActionDelegate ; import org . eclipse . ui . texteditor . ITextEditor ;
1,227
<s> package com . asakusafw . testdriver . excel ; import java . lang . annotation . Annotation ; import java . util . Collection ; import java . util . Collections ; import java . util . LinkedHashMap ; import java . util . Map ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . PropertyName ; import com . asakusafw . testdriver . core . PropertyType ; public class ArrayModelDefinition implements DataModelDefinition < Object [ ] > { private final Map < PropertyName , PropertyType > nameAndTypes ; public ArrayModelDefinition ( Map < PropertyName , PropertyType > nameAndTypes ) { if ( nameAndTypes == null ) { throw new IllegalArgumentException ( "" ) ; } this . nameAndTypes = Collections . unmodifiableMap ( new LinkedHashMap < PropertyName , PropertyType > ( nameAndTypes ) ) ; } @ Override public Class < Object [ ] > getModelClass ( ) { return Object [ ] . class ; }
1,228
<s> package net . sf . sveditor . ui . wizards ; import org . eclipse . swt . widgets . Composite ; public class NewSVModuleWizardPage extends AbstractNewSVItemFileWizardPage { public NewSVModuleWizardPage ( ) {
1,229
<s> package com . asakusafw . dmdl . java . spi ; import java . io . IOException ; import java . util . Collections ; import java . util . List ; import com . asakusafw . dmdl . java . emitter . EmitContext ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . utils . java . model . syntax . Annotation ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model .
1,230
<s> package com . asakusafw . utils . java . parser . javadoc ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Set ; public abstract class AcceptableJavadocBlockParser extends
1,231
<s> package com . asakusafw . dmdl . semantics ; import java . text . MessageFormat ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . model . AstSimpleName ; public class PropertySymbol implements Symbol < PropertyDeclaration > { private final ModelSymbol owner ; private final AstSimpleName name ; protected PropertySymbol ( ModelSymbol owner , AstSimpleName name ) { if ( owner == null ) { throw new IllegalArgumentException ( "" ) ; }
1,232
<s> package com . asakusafw . yaess . bootstrap ; import static org . hamcrest . CoreMatchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Properties ; import org . junit . Assume ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class CommandLineUtilTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void loadProperties_local ( ) throws Exception { Properties p = new Properties ( ) ; p . setProperty ( "hello" , "world!" ) ; File file = store ( p ) ; Properties loaded = CommandLineUtil . loadProperties ( file ) ; assertThat ( loaded , is ( p ) ) ; } @ Test public void parseFileList ( ) throws Exception { File a = folder . newFile ( "a.properties" ) ; File b = folder . newFile ( "c.properties" ) ; File c = folder . newFile ( "b.properties" ) ; StringBuilder buf = new StringBuilder ( ) ; buf . append ( a ) ; buf . append ( File . pathSeparatorChar ) ; buf . append ( b ) ; buf . append ( File . pathSeparatorChar ) ; buf . append ( c ) ; List < File > result = canonicalize ( CommandLineUtil . parseFileList ( buf . toString ( ) ) ) ; assertThat ( result , is ( Arrays . asList ( a , b , c ) ) ) ; } @ Test public void parseFileList_null ( ) { List < File > result = canonicalize ( CommandLineUtil . parseFileList ( null ) ) ; assertThat ( result , is ( Arrays . < File > asList ( ) ) ) ; } @ Test public void parseFileList_empty ( ) { List < File > result = canonicalize ( CommandLineUtil . parseFileList ( "" )
1,233
<s> package com . asakusafw . runtime . flow . join ; import java . io . IOException ; import java . util . List ; public interface LookUpTable < T > { List < T > get
1,234
<s> package net . sf . sveditor . core ; public class Tuple < T1 , T2 > { private T1 first ; private T2 second ; public Tuple ( T1 it1 , T2 it2 ) { first =
1,235
<s> package net . sf . sveditor . core . tests . parser ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . parser . SVParseException ; import net . sf . sveditor . core . tests . SVDBTestUtils ; import junit . framework . TestCase ; public class TestLexer extends TestCase { public void testSpaceContainingNumber ( ) throws SVParseException { SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "class c;n" + "" + "" + "" + "" + "endclassn" ; runTest ( "" , content , new String [ ] { "c" , "b" , "d" , "e" } ) ; } public void testParenContainingString ( ) throws SVParseException { SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String content = "" + " begin \\n" + "" + "" + "ttendn" + "n" + "class c;n" + "" + "" + "" + "endclassn" ; runTest ( "" , content , new String [ ] { "c" , "test" } ) ; } public void testDefinedMacroCallWithStatement ( ) throws SVParseException { SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String testname = "" ; String content = "" + "n" + "class c;n" + "" + "" + "" + "endclassn" ; runTest ( testname , content , new String [ ] { "c" ,
1,236
<s> package net . sf . sveditor . ui . editor ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IDocumentExtension4 ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ISynchronizable ; import org . eclipse . jface . text . reconciler . DirtyRegion ; import org . eclipse . jface . text . reconciler . IReconcilingStrategy ; import org . eclipse . jface . text .
1,237
<s> package com . sun . tools . hat . internal . lang . openjdk6 ; import java . util . List ; import java . util . Map ; import com . google . common . collect . ImmutableMap ; import com . sun . tools . hat . internal . lang . MapModel ; import com . sun . tools . hat . internal . lang . Models ; import com . sun . tools . hat . internal . lang . common . HashCommon ; import com . sun . tools . hat . internal . model . JavaObject ; import com . sun . tools . hat . internal . model . JavaThing ; class JavaConcHash extends MapModel { private final ImmutableMap < JavaThing , JavaThing > map ; private JavaConcHash ( ImmutableMap < JavaThing , JavaThing > map ) { this . map = map ; } public static JavaConcHash make ( JavaObject chm ) { List < JavaObject > segments
1,238
<s> package com . asakusafw . testdriver . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import org . junit . Test ; import com . asakusafw . testdriver . core . MockExporterRetriever . Desc ; import com . asakusafw . vocabulary . external . ExporterDescription ; public class SpiExporterRetrieverTest extends SpiTestRoot { private static final TestContext EMPTY = new TestContext . Empty ( ) ; @ Test public void getDescriptionClass ( ) { SpiExporterRetriever target = new SpiExporterRetriever ( getClass ( ) . getClassLoader ( ) ) ; assertThat ( target . getDescriptionClass (
1,239
<s> package com . asakusafw . compiler . flow . testing . external ; import com . asakusafw . compiler . flow . testing . model . ExJoined ; import com . asakusafw . compiler . testing . TemporaryOutputDescription ; public class ExJoinedMockExporterDescription extends TemporaryOutputDescription { @ Override public Class < ? > getModelType
1,240
<s> package org . oddjob . jmx . handlers ; import java . io . Serializable ; import java . lang . reflect . UndeclaredThrowableException ; import javax . management . InstanceNotFoundException ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanException ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . Notification ; import javax . management . NotificationListener ; import javax . management . ReflectionException ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ConfigurationHandle ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . parsing . ArooaContext ; import org . oddjob . arooa . parsing . ArooaElement ; import org . oddjob . arooa . parsing . ConfigOwnerEvent ; import org . oddjob . arooa . parsing . ConfigSessionEvent ; import org . oddjob . arooa . parsing . ConfigurationOwner ; import org . oddjob . arooa . parsing . ConfigurationOwnerSupport ; import org . oddjob . arooa . parsing . ConfigurationSession ; import org . oddjob . arooa . parsing . ConfigurationSessionSupport ; import org . oddjob . arooa . parsing . CutAndPasteSupport ; import org . oddjob . arooa . parsing . DragPoint ; import org . oddjob . arooa . parsing . DragTransaction ; import org . oddjob . arooa . parsing . OwnerStateListener ; import org . oddjob . arooa . parsing . SessionStateListener ; import org . oddjob . arooa . registry . ChangeHow ; import org . oddjob . arooa . xml . XMLArooaParser ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jmx . RemoteOperation ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . ClientInterfaceHandlerFactory ; import org . oddjob . jmx . client . ClientSideToolkit ; import org . oddjob . jmx . client . HandlerVersion ; import org . oddjob . jmx . client . SimpleHandlerResolver ; import org . oddjob . jmx . server . JMXOperationPlus ; import org . oddjob . jmx . server . ServerInterfaceHandler ; import org . oddjob . jmx . server . ServerInterfaceHandlerFactory ; import org . oddjob . jmx . server . ServerSideToolkit ; public class ComponentOwnerHandlerFactory implements ServerInterfaceHandlerFactory < ConfigurationOwner , ConfigurationOwner > { public static final HandlerVersion VERSION = new HandlerVersion ( 3 , 0 ) ; public static final String MODIFIED_NOTIF_TYPE = "" ; public static final String CHANGE_NOTIF_TYPE = "" ; private static final JMXOperationPlus < Integer > SESSION_AVAILABLE = new JMXOperationPlus < Integer > ( "" , "" , Integer . class , MBeanOperationInfo . INFO ) ; private static final JMXOperationPlus < DragPointInfo > DRAG_POINT_INFO = new JMXOperationPlus < DragPointInfo > ( "" , "" , DragPointInfo . class , MBeanOperationInfo . INFO ) . addParam ( "component" , Object . class , "" ) ; private static final JMXOperationPlus < Void > CUT = new JMXOperationPlus < Void > ( "configCut" , "" , Void . TYPE , MBeanOperationInfo . ACTION_INFO ) . addParam ( "component" , Object . class , "" ) ; private static final JMXOperationPlus < String > PASTE = new JMXOperationPlus < String > ( "configPaste" , "" , String . class , MBeanOperationInfo . ACTION ) . addParam ( "component" , Object . class , "" ) . addParam ( "index" , Integer . TYPE , "" ) . addParam ( "config" , String . class , "" ) ; private static final JMXOperationPlus < Boolean
1,241
<s> package org . oddjob . state ; public class AndStateOp implements StateOperator { public ParentState evaluate ( State ... states ) { new AssertNonDestroyed ( ) . evaluate ( states ) ; ParentState state = ParentState . READY ; if ( states . length > 0 ) { state = new ParentStateConverter ( ) . toStructuralState ( states [ 0 ] ) ; for ( int i = 1 ; i < states . length ; ++
1,242
<s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; public enum JavadocTokenKind { WHITE_SPACES , LINE_BREAK , ASTERISK , IDENTIFIER , AT , DOT , COMMA , SHARP , LEFT_BRACKET ,
1,243
<s> package net . sf . sveditor . core . parser ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBAddChildItem ; import net . sf . sveditor . core . scanner . SVKeywords ; public class SVFieldVarDeclParser extends SVParserBase { public SVFieldVarDeclParser ( ISVParser parser ) { super ( parser ) ; } public boolean try_parse ( ISVDBAddChildItem parent , boolean decl_allowed ) throws SVParseException { if ( ( fLexer . peekKeyword ( SVKeywords . fBuiltinTypes ) && ! fLexer . peekKeyword ( "void" ) ) || fLexer . isIdentifier ( ) || fLexer . peekKeyword ( "typedef" ) ) { boolean builtin_type = ( fLexer . peekKeyword ( SVKeywords . fBuiltinTypes ) && ! fLexer . peekKeyword ( "void" ) ) ; if ( ( fLexer . peekKeyword ( SVKeywords . fBuiltinTypes ) && ! fLexer . peekKeyword ( "void" ) ) || fLexer . peekKeyword ( "typedef" ) ) { if ( ! decl_allowed ) { error ( "" ) ; } parsers ( ) . blockItemDeclParser ( ) . parse ( parent , null , null ) ; return true ; } else { List < SVToken > id_list = parsers ( ) . SVParser ( ) . scopedStaticIdentifier_l ( true ) ; if ( ! builtin_type && ( fLexer . peekOperator ( ) && ! fLexer . peekOperator ( "#" ) ) ) { for ( int i = id_list . size ( ) - 1 ; i >= 0 ; i -- ) { fLexer . ungetToken ( id_list . get ( i ) ) ; } debug ( "" + fLexer . peek ( ) ) ; } else { for ( int
1,244
<s> package org . oddjob . designer . components ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . SimpleDesignProperty ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . etc . FileAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . FieldGroup ; import org . oddjob . arooa . design . screem . FieldSelection ; import org . oddjob . arooa . design . screem . Form ; import org
1,245
<s> package com . asakusafw . compiler . repository ; import java . lang . reflect . Type ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . ServiceLoader ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClassRepository ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . utils
1,246
<s> package org . rubypeople . rdt . refactoring . nodewrapper ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . jruby . ast . SymbolNode ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . core . renamemodule . ModuleSpecifierWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . VisibilityNodeWrapper . METHOD_VISIBILITY ; public class ClassNodeWrapper implements INodeWrapper { private Collection < PartialClassNodeWrapper > partialClassNodes ; public ClassNodeWrapper ( PartialClassNodeWrapper partialClassNode ) { partialClassNodes = new ArrayList < PartialClassNodeWrapper > ( ) ; addPartialClassNode ( partialClassNode ) ; } public void addPartialClassNode ( PartialClassNodeWrapper partialClassNode ) { partialClassNodes . add ( partialClassNode ) ; } public Collection < FieldNodeWrapper > getFields ( ) { ArrayList < FieldNodeWrapper > fields = new ArrayList < FieldNodeWrapper > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { fields . addAll ( partialClassNode . getFields ( ) ) ; } return fields ; } public Collection < ModuleSpecifierWrapper > getIncludes ( ) { ArrayList < ModuleSpecifierWrapper > fields = new ArrayList < ModuleSpecifierWrapper > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { fields . addAll ( partialClassNode . getIncludeCalls ( ) ) ; } return fields ; } public Collection < MethodNodeWrapper > getMethods ( ) { Collection < MethodNodeWrapper > methodNodes = new ArrayList < MethodNodeWrapper > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { methodNodes . addAll ( partialClassNode . getMethods ( ) ) ; } return methodNodes ; } public boolean hasMethod ( String name ) { for ( MethodNodeWrapper method : getMethods ( ) ) { if ( name . equals ( method . getName ( ) ) ) { return true ; } } return false ; } public PartialClassNodeWrapper getFirstPartialClassNode ( ) { return partialClassNodes . iterator ( ) . next ( ) ; } public String getName ( ) { return getFirstPartialClassNode ( ) . getClassName ( ) ; } public String getSuperClassName ( ) { return getFirstPartialClassNode ( ) . getSuperClassName ( ) ; } public MethodNodeWrapper getConstructorNode ( ) { Collection < MethodNodeWrapper > constructors = getExistingConstructors ( ) ; if ( constructors . isEmpty ( ) ) { return new MethodNodeWrapper ( NodeFactory . createDefaultConstructor ( ) , this ) ; } return constructors . toArray ( new MethodNodeWrapper [ constructors . size ( ) ] ) [ constructors . size ( ) - 1 ] ; } public Collection < MethodNodeWrapper > getExistingConstructors ( ) { Collection < MethodNodeWrapper > constructors = new ArrayList < MethodNodeWrapper > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { constructors . addAll ( partialClassNode . getExistingConstructors ( ) ) ; } return constructors ; } public boolean hasConstructor ( ) { return ! getExistingConstructors ( ) . isEmpty ( ) ; } public Collection < Node > getAttrNodes ( ) { Collection < Node > attrNodes = new ArrayList < Node > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { attrNodes . addAll ( partialClassNode . getAttrNodes ( ) ) ; } return attrNodes ; } public Collection < AttrAccessorNodeWrapper > getAccessorNodes ( ) { Collection < AttrAccessorNodeWrapper > accessorNodes = new ArrayList < AttrAccessorNodeWrapper > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { accessorNodes . addAll ( partialClassNode . getAccessorNodes ( ) ) ; } return accessorNodes ; } public Collection < PartialClassNodeWrapper > getPartialClassNodes ( ) { return partialClassNodes ; } public Collection < PartialClassNodeWrapper > getPartialClassNodesOfFile ( String file ) { ArrayList < PartialClassNodeWrapper > matchingPartialClasses = new ArrayList < PartialClassNodeWrapper > ( ) ; for ( PartialClassNodeWrapper currentClassPart : partialClassNodes ) { String fileOfClassPart = currentClassPart . getFile ( ) ; if ( fileOfClassPart . equals ( file ) ) { matchingPartialClasses . add ( currentClassPart ) ; } } return matchingPartialClasses ; } public Collection < Node > getInstFieldOccurences ( ) { Collection < Node > allFieldOccuences = new ArrayList < Node > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { allFieldOccuences . addAll ( partialClassNode . getInstFieldOccurences ( ) ) ; } return allFieldOccuences ; } public Collection < Node > getClassFieldOccurences ( ) { Collection < Node > classFieldOccuences = new ArrayList < Node > ( ) ; for ( PartialClassNodeWrapper partialClassNode : partialClassNodes ) { classFieldOccuences . addAll ( partialClassNode . getClassFieldOccurences ( ) ) ; } return classFieldOccuences ; } public Collection < MethodCallNodeWrapper > getMethodCalls ( MethodDefNode decoratedNode ) { ArrayList < MethodCallNodeWrapper > calls = new ArrayList < MethodCallNodeWrapper > ( ) ; for ( PartialClassNodeWrapper classPart : partialClassNodes ) { calls . addAll ( classPart . getMethodCalls ( decoratedNode ) ) ; } return calls ; } public Collection < MethodCallNodeWrapper > getMethodCallNodes ( ) { ArrayList < MethodCallNodeWrapper > methodCalls = new ArrayList < MethodCallNodeWrapper > ( ) ; for ( PartialClassNodeWrapper classPart : partialClassNodes ) { methodCalls . addAll ( classPart . getMethodCallNodes ( ) ) ; } return methodCalls ; } public Collection < SymbolNode > getMethodSymbols ( MethodDefNode decoratedNode ) { ArrayList < SymbolNode > symbols = new
1,247
<s> package org . oddjob . designer . elements . schedule ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . FieldGroup ; import org . oddjob . arooa . design . screem . FieldSelection ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . screem . StandardForm ; import org . oddjob . arooa . parsing . ArooaContext ; import org . oddjob . arooa . parsing . ArooaElement ; public class MonthlyScheduleDE implements DesignFactory { public DesignInstance createDesign ( ArooaElement element , ArooaContext parentContext ) { return new MonthlyScheduleDesign ( element , parentContext ) ; } } class MonthlyScheduleDesign extends ParentSchedule { private final SimpleTextAttribute onDay ; private final SimpleTextAttribute fromDay ; private final SimpleTextAttribute toDay ; private final SimpleTextAttribute inWeek ; private final SimpleTextAttribute fromWeek ; private final SimpleTextAttribute toWeek ; private final SimpleTextAttribute onDayOfWeek ; private final SimpleTextAttribute fromDayOfWeek ; private final SimpleTextAttribute toDayOfWeek ; public MonthlyScheduleDesign ( ArooaElement element , ArooaContext parentContext ) { super ( element , parentContext ) ; onDay = new SimpleTextAttribute ( "onDay" , this ) ; fromDay = new SimpleTextAttribute ( "fromDay" , this ) ; toDay = new SimpleTextAttribute ( "toDay" , this ) ; inWeek = new SimpleTextAttribute ( "inWeek" , this ) ; fromWeek = new SimpleTextAttribute ( "fromWeek" , this ) ; toWeek = new SimpleTextAttribute (
1,248
<s> package org . rubypeople . rdt . core . search ; import org . eclipse . core . runtime . CoreException ; public abstract class SearchRequestor { public abstract void acceptSearchMatch (
1,249
<s> package org . rubypeople . rdt . internal . ui . util ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . internal . corext . util . TypeInfo ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . RubyUIMessages ; import org . rubypeople . rdt . ui . RubyElementLabels ; public class TypeInfoLabelProvider extends LabelProvider { public static final int SHOW_FULLYQUALIFIED = 0x01 ; public static final int SHOW_PACKAGE_POSTFIX = 0x02 ; public static final int SHOW_PACKAGE_ONLY = 0x04 ; public static final int SHOW_ROOT_POSTFIX = 0x08 ; public static final int SHOW_TYPE_ONLY = 0x10 ; public static final int SHOW_TYPE_CONTAINER_ONLY = 0x20 ; public static final int SHOW_POST_QUALIFIED = 0x40 ; private static final Image CLASS_ICON = RubyPluginImages . get ( RubyPluginImages . IMG_OBJS_CLASS ) ; private static final Image MODULE_ICON = RubyPluginImages . get ( RubyPluginImages . IMG_OBJS_MODULE ) ; private static final
1,250
<s> package org . rubypeople . rdt . internal . testunit . ui ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . StringReader ; import org . eclipse . debug . core . ILaunchManager ; import org . eclipse . jface . action . IMenuListener ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . action . Separator ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . CTabFolder ; import org . eclipse . swt . custom . CTabItem ; import org . eclipse . swt . dnd . Clipboard ; import org . eclipse . swt . events . DisposeEvent ; import org . eclipse . swt . events . DisposeListener ; import org . eclipse . swt . events . MouseAdapter ; import org . eclipse . swt . events . MouseEvent ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Menu ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . TableItem ; import org . rubypeople . rdt . testunit . ITestRunListener ; public class FailureTab extends TestRunTab implements IMenuListener { private Table fTable ; private TestUnitView fRunnerViewPart ; private boolean fMoveSelection = false ; private final Image fErrorIcon = TestUnitView . createImage ( "" ) ; private final Image fFailureIcon = TestUnitView . createImage ( "" ) ; private final Image fFailureTabIcon = TestUnitView . createImage ( "" ) ; public FailureTab ( ) { } public void createTabControl ( CTabFolder tabFolder , Clipboard clipboard , TestUnitView runner ) { fRunnerViewPart = runner ; CTabItem failureTab = new CTabItem ( tabFolder , SWT . NONE ) ; failureTab . setText ( getName ( ) ) ; failureTab . setImage ( fFailureTabIcon ) ; Composite composite = new Composite ( tabFolder , SWT . NONE ) ; GridLayout gridLayout = new GridLayout ( ) ; gridLayout . marginHeight = 0 ; gridLayout . marginWidth = 0 ; composite . setLayout ( gridLayout ) ; GridData gridData = new GridData ( GridData . HORIZONTAL_ALIGN_FILL | GridData . VERTICAL_ALIGN_FILL | GridData . GRAB_HORIZONTAL | GridData . GRAB_VERTICAL ) ; composite . setLayoutData ( gridData ) ; fTable = new Table ( composite , SWT . NONE ) ; gridLayout = new GridLayout ( ) ; gridLayout . marginHeight = 0 ; gridLayout . marginWidth = 0 ; fTable . setLayout ( gridLayout ) ; gridData = new GridData ( GridData . HORIZONTAL_ALIGN_FILL | GridData . VERTICAL_ALIGN_FILL | GridData . GRAB_HORIZONTAL | GridData . GRAB_VERTICAL ) ; fTable . setLayoutData ( gridData ) ; failureTab . setControl ( composite ) ; failureTab . setToolTipText ( TestUnitMessages . FailureRunView_tab_tooltip ) ; initMenu ( ) ; addListeners ( ) ; } private void disposeIcons ( ) { fErrorIcon . dispose ( ) ; fFailureIcon . dispose ( ) ; fFailureTabIcon . dispose ( ) ; } private void initMenu ( ) { MenuManager menuMgr = new MenuManager ( ) ; menuMgr . setRemoveAllWhenShown ( true ) ; menuMgr . addMenuListener ( this ) ; Menu menu = menuMgr . createContextMenu ( fTable ) ; fTable . setMenu ( menu ) ; } public String getName ( ) { return TestUnitMessages . FailureRunView_tab_title ; } public String getSelectedTestId ( ) { int index = fTable . getSelectionIndex ( ) ; if ( index == - 1 ) return null ; return getTestInfo ( fTable . getItem ( index ) ) . getTestId ( ) ; } public String getAllFailedTestNames ( ) { StringBuffer trace = new StringBuffer ( ) ; String lineDelim = System . getProperty ( "" , "n" ) ; for ( int i = 0 ; i < fTable . getItemCount ( ) ; i ++ ) { TestRunInfo testInfo = getTestInfo ( fTable . getItem ( i ) ) ; trace . append ( testInfo . getTestName ( ) ) . append ( lineDelim ) ; String failureTrace = testInfo . getTrace ( ) ; if ( failureTrace != null ) { StringReader stringReader = new StringReader ( failureTrace ) ; BufferedReader bufferedReader = new BufferedReader ( stringReader ) ; String line ; try { while ( ( line = bufferedReader . readLine ( ) ) !=
1,251
<s> package org . oddjob . logging ; public class MockConsoleArchiver implements ConsoleArchiver { public void addConsoleListener ( LogListener l , Object component , long last
1,252
<s> package de . fuberlin . wiwiss . d2rq . expr ; import de . fuberlin . wiwiss . d2rq . algebra . ColumnRenamer ; public class LessThan extends BinaryOperator { public LessThan ( Expression expr1 , Expression expr2 ) { super ( expr1 , expr2 , "<" ) ; } public Expression renameAttributes ( ColumnRenamer columnRenamer ) { return new LessThan (
1,253
<s> package org . rubypeople . rdt . internal . ti ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . concurrent . CopyOnWriteArrayList ; import org . jruby . ast . AssignableNode ; import org . jruby . ast . CallNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . ClassVarAsgnNode ; import org . jruby . ast . ClassVarDeclNode ; import org . jruby . ast . ClassVarNode ; import org . jruby . ast . Colon2Node ; import org . jruby . ast . ConstNode ; import org . jruby . ast . DAsgnNode ; import org . jruby . ast . DVarNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . GlobalAsgnNode ; import org . jruby . ast . GlobalVarNode ; import org . jruby . ast . InstAsgnNode ; import org . jruby . ast . InstVarNode ; import org . jruby . ast . ListNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . ModuleNode ; import org . jruby . ast . Node ; import org . jruby . ast . ReturnNode ; import org . jruby . ast . SelfNode ; import org . jruby . ast . VCallNode ; import org . jruby . lexer . yacc . SyntaxException ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . ReturnVisitor ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import org . rubypeople . rdt . internal . ti . data . LiteralNodeTypeNames ; import org . rubypeople . rdt . internal . ti . data . TypicalMethodReturnNames ; import org . rubypeople . rdt . internal . ti . util . ClosestSpanningNodeLocator ; import org . rubypeople . rdt . internal . ti . util . INodeAcceptor ; import org . rubypeople . rdt . internal . ti . util . MethodDefinitionLocator ; import org . rubypeople . rdt . internal . ti . util . MethodInvocationLocator ; import org . rubypeople . rdt . internal . ti . util . OffsetNodeLocator ; import org . rubypeople . rdt . internal . ti . util . ScopedNodeLocator ; public class DataFlowTypeInferrer implements ITypeInferrer { private static final boolean VERBOSE = false ; private void sysout ( String string ) { if ( VERBOSE ) { System . out . println ( string ) ; } } private void prettyPrint ( Node node ) { sysout ( "" + "Node: " + node . getClass ( ) . getSimpleName ( ) + "n" + "Source:n[" + node . getPosition ( ) . getStartOffset ( ) + ".." + node . getPosition ( ) . getEndOffset ( ) + "]n" + source . substring ( node . getPosition ( ) . getStartOffset ( ) , node . getPosition ( ) . getEndOffset ( ) ) + "n" + "" ) ; } TypeInferenceHelper helper ; private String source ; private Node rootNode ; private List < Node > inferNodeStack ; public List < ITypeGuess > infer ( String source , int offset ) { if ( source == null ) return Collections . emptyList ( ) ; this . rootNode = null ; try { this . rootNode = ( new RubyParser ( ) ) . parse ( source ) . getAST ( ) ; } catch ( SyntaxException se ) { return Collections . emptyList ( ) ; } catch ( Exception e ) { RubyCore . log ( e ) ; return Collections . emptyList ( ) ; } List < ITypeGuess > guesses = new LinkedList < ITypeGuess > ( ) ; this . helper = TypeInferenceHelper . Instance ( ) ; this . source = source ; this . inferNodeStack = new LinkedList < Node > ( ) ; Node node = OffsetNodeLocator . Instance ( ) . getNodeAtOffset ( rootNode , offset ) ; if ( node == null ) { return null ; } guesses = inferNodeType ( node ) ; guesses = redistributeGuessConfidences ( guesses ) ; guesses = combineSameGuesses ( guesses ) ; return guesses ; } private List < ITypeGuess > combineSameGuesses ( List < ITypeGuess > guesses ) { Map < String , Integer > combined = new HashMap < String , Integer > ( ) ; for ( ITypeGuess typeGuess : guesses ) { Integer percent = combined . get ( typeGuess . getType ( ) ) ; if ( percent == null ) { combined . put ( typeGuess . getType ( ) , typeGuess . getConfidence ( ) ) ; } else { combined . put ( typeGuess . getType ( ) , percent + typeGuess . getConfidence ( ) ) ; } } List < ITypeGuess > combinedGuesses = new ArrayList < ITypeGuess > ( combined . size ( ) ) ; for ( String type : combined . keySet ( ) ) { combinedGuesses . add ( new BasicTypeGuess ( type , combined . get ( type ) ) ) ; } return combinedGuesses ; } private List < ITypeGuess > redistributeGuessConfidences ( List < ITypeGuess > guesses ) { int sum = 0 ; for ( ITypeGuess guess : guesses ) { if ( guess == null ) continue ; sum += guess . getConfidence ( ) ; } List < ITypeGuess > newGuesses = new ArrayList < ITypeGuess > ( guesses . size ( ) ) ; for ( ITypeGuess guess : guesses ) { if ( guess == null ) continue ; ITypeGuess newGuess = new BasicTypeGuess ( guess . getType ( ) , ( int ) ( ( ( double ) guess . getConfidence ( ) ) / ( ( double ) sum ) * 100.0 ) ) ; newGuesses . add ( newGuess ) ; } return newGuesses ; } private List < ITypeGuess > inferNodeType ( Node node ) { if ( node == null ) { return Collections . emptyList ( ) ; } sysout ( "" + node . getClass ( ) . getSimpleName ( ) ) ; List < ITypeGuess > guesses = new ArrayList < ITypeGuess > ( 1 ) ; if ( inferNodeStack . indexOf ( node ) != - 1 ) { sysout ( "" ) ; prettyPrint ( node ) ; return guesses ; } inferNodeStack . add ( 0 , node ) ; if ( isSelfReferenceNode ( node ) ) { ITypeGuess guess = getSelfReferenceNodeType ( node ) ; if ( guess != null ) guesses . add ( guess ) ; } if ( isAssignmentNode ( node ) ) { guesses . addAll ( inferNodeType ( getAssignmentNodeValueNode ( node ) ) ) ; } if ( isTypeDefinitionNode ( node ) ) { ITypeGuess guess = getTypeDefinitionNodeType ( node ) ; if ( guess != null ) guesses . add ( guess ) ; } if ( isConstantNode ( node ) ) { guesses . add ( getConstantNodeType ( node ) ) ; } if ( node instanceof LocalVarNode ) { guesses . addAll ( getLocalVarReferenceNodeTypes ( ( LocalVarNode ) node ) ) ; } if ( node instanceof DVarNode ) { guesses . addAll ( getDVarReferenceNodeTypes ( ( DVarNode ) node ) ) ; } if ( node instanceof InstVarNode ) { guesses . addAll ( getInstanceVarReferenceNodeTypes ( ( InstVarNode ) node ) ) ; } if ( node instanceof ClassVarNode ) { guesses . addAll ( getClassVarReferenceNodeTypes ( ( ClassVarNode ) node ) ) ; } if ( node instanceof GlobalVarNode ) { guesses . addAll ( getGlobalVarReferenceNodeTypes ( ( GlobalVarNode ) node ) ) ; } if ( isCallNode ( node ) ) { guesses . addAll ( getCallNodeTypes ( node ) ) ; } inferNodeStack . remove ( 0 ) ; return guesses ; } private boolean isConstantNode ( Node node ) { return ( node instanceof Colon2Node ) || ( node instanceof ConstNode ) || ( null != LiteralNodeTypeNames . get ( node . getClass ( ) . getSimpleName ( ) ) ) ; } private ITypeGuess getConstantNodeType ( Node node ) { if ( node instanceof ConstNode ) { return new BasicTypeGuess ( ( ( ConstNode ) node ) . getName ( ) , 100 ) ; } if ( node instanceof Colon2Node ) { String name = ASTUtil . getFullyQualifiedName ( ( Colon2Node ) node ) ; return new BasicTypeGuess ( name , 100 ) ; } return new BasicTypeGuess ( LiteralNodeTypeNames . get ( node . getClass ( ) . getSimpleName ( ) ) , 100 ) ; } private boolean isTypeDefinitionNode ( Node node ) { return ( node instanceof ClassNode ) || ( node instanceof ModuleNode ) ; } private ITypeGuess getTypeDefinitionNodeType ( Node node ) { String typeNodeName = helper . getTypeNodeName ( node ) ; if ( typeNodeName != null ) { return new BasicTypeGuess ( typeNodeName , 100 ) ; } RubyCore . log ( "" + node ) ; return null ; } private boolean isSelfReferenceNode ( Node node ) { return ( node instanceof SelfNode ) ; } private ITypeGuess getSelfReferenceNodeType ( Node node ) { Node enclosingTypeNode = findEnclosingTypeNode ( node ) ; return getTypeDefinitionNodeType ( enclosingTypeNode ) ; } private List < Node > findAllSendersOfMethod ( String typeName , String methodName ) { return MethodInvocationLocator . Instance ( ) . findMethodInvocations ( rootNode , typeName , methodName , new DataFlowTypeInferrer ( ) ) ; } private List < Node > findAllMethodDefinitions ( String typeName , String methodName ) { return MethodDefinitionLocator . Instance ( ) . findMethodDefinitions ( rootNode , typeName , methodName ) ; } private List < Node > findRetvalExprs ( Node methodNode ) { ReturnVisitor visitor = new ReturnVisitor ( ) ; visitor . acceptNode ( methodNode ) ; List < Node > returnNodes = visitor . getReturnValues ( ) ; List < Node > retvalExprs = new ArrayList < Node > ( returnNodes . size ( ) ) ; for ( Node returnNode : returnNodes ) { if ( returnNode instanceof ReturnNode ) { retvalExprs . add ( ( ( ReturnNode ) returnNode ) . getValueNode ( ) ) ; } else { retvalExprs . add ( returnNode ) ; } } sysout ( "Found " + retvalExprs . size ( ) + "" + helper . getMethodDefinitionNodeName ( methodNode ) ) ; return retvalExprs ; } private Node findEnclosingMethodNode ( Node node ) { Node enclosingScopeNode = ClosestSpanningNodeLocator . Instance ( ) . findClosestSpanner ( rootNode , node . getPosition ( ) . getStartOffset ( ) , new INodeAcceptor ( ) { public boolean doesAccept ( Node node ) { return ( node instanceof DefnNode ) || ( node instanceof DefsNode ) ; } } ) ; if ( enclosingScopeNode == null ) { enclosingScopeNode = rootNode ; } return enclosingScopeNode ; } private Node findEnclosingTypeNode ( Node node ) { Node enclosingTypeNode = ClosestSpanningNodeLocator . Instance ( ) . findClosestSpanner ( rootNode , node . getPosition ( ) . getStartOffset ( ) , new INodeAcceptor ( ) { public boolean doesAccept ( Node node ) { return ( node instanceof ClassNode ) || ( node instanceof ModuleNode ) ; } } ) ; if ( enclosingTypeNode == null ) { enclosingTypeNode = rootNode ; } return enclosingTypeNode ; } private List < ITypeGuess > getLocalVarReferenceNodeTypes ( LocalVarNode node ) { List < ITypeGuess > possibleTypes = new ArrayList < ITypeGuess > ( 1 ) ; Node enclosingScopeNode = findEnclosingMethodNode ( node ) ; if ( enclosingScopeNode == rootNode ) { sysout ( "" ) ; enclosingScopeNode = findEnclosingTypeNode ( node ) ; } final String localVarName = helper . getVarName ( node ) ; CopyOnWriteArrayList < Node > localAssignsIntoNode = new CopyOnWriteArrayList < Node > ( ScopedNodeLocator . Instance ( ) . findNodesInScope ( enclosingScopeNode , new INodeAcceptor ( ) { public boolean doesAccept ( Node acceptNode ) { if ( acceptNode instanceof LocalAsgnNode ) { return ( ( ( LocalAsgnNode ) acceptNode ) . getName ( ) . equals ( localVarName ) ) ; } return false ; } } ) ) ; if ( ( localAssignsIntoNode != null ) && ( localAssignsIntoNode . size ( ) > 0 ) ) { for ( Node asgnNode : localAssignsIntoNode ) { possibleTypes . addAll ( inferNodeType ( ( ( AssignableNode ) asgnNode ) . getValueNode ( ) ) ) ; } return possibleTypes ; } if ( helper . isArgumentInMethod ( localVarName , enclosingScopeNode ) ) { Node enclosingMethodNode = enclosingScopeNode ; sysout ( "" ) ; Node enclosingTypeNode = findEnclosingTypeNode ( node ) ; String enclosingTypeName = "Kernel" ; if ( enclosingTypeNode != rootNode ) { enclosingTypeName = helper . getTypeNodeName ( enclosingTypeNode ) ; } String enclosingMethodName = helper . getMethodDefinitionNodeName ( enclosingMethodNode ) ; sysout ( "" + localVarName + " in method " + enclosingMethodName ) ; ListNode argsListNode = helper . getArgsListNode ( enclosingMethodNode ) ; int paramIndex = helper . getArgIndex ( argsListNode , localVarName ) ; List < Node > sendExprs = findAllSendersOfMethod ( enclosingTypeName , enclosingMethodName ) ; sysout ( "Found " + sendExprs . size ( ) + " senders: " ) ; List < Node > argExprs = new ArrayList < Node > ( sendExprs . size ( ) ) ; for ( Node sendExpr : sendExprs ) { prettyPrint ( sendExpr ) ; argExprs . add ( helper . findNthArgExprInSendExpr ( paramIndex , sendExpr ) ) ; } sysout ( "" + argExprs . size ( ) ) ; for ( Node argExpr : argExprs ) { prettyPrint ( argExpr ) ; possibleTypes . addAll ( inferNodeType ( argExpr ) ) ; } return possibleTypes ; } sysout ( "bottom" ) ; return possibleTypes ; } private List < ITypeGuess > getDVarReferenceNodeTypes ( DVarNode node ) { List < ITypeGuess > possibleTypes = new ArrayList < ITypeGuess > ( 1 ) ; Node enclosingScopeNode = findEnclosingMethodNode ( node ) ; if ( enclosingScopeNode == rootNode ) { enclosingScopeNode = findEnclosingTypeNode ( node ) ; } final String varName = node . getName ( ) ; List < Node > dynAsgnNodes = ScopedNodeLocator . Instance ( ) . findNodesInScope ( enclosingScopeNode , new INodeAcceptor ( ) { public boolean doesAccept ( Node acceptNode ) { if ( acceptNode instanceof DAsgnNode ) { return ( ( ( DAsgnNode ) acceptNode ) . getName ( ) . equals ( varName ) ) ; } return false ; } } ) ; if ( dynAsgnNodes != null ) { for ( Node dynAsgnNode : dynAsgnNodes ) { possibleTypes . addAll ( inferNodeType ( ( ( DAsgnNode ) dynAsgnNode ) . getValueNode ( ) ) ) ; } } return possibleTypes ; } private List < ITypeGuess > getInstanceVarReferenceNodeTypes ( InstVarNode node ) { List < ITypeGuess > possibleTypes = new ArrayList < ITypeGuess > ( 1 ) ; Node enclosingTypeNode = findEnclosingTypeNode ( node ) ; final String instanceVarName = helper . getVarName ( node ) ; List < Node > instAsgnNodes = ScopedNodeLocator . Instance ( ) . findNodesInScope ( enclosingTypeNode , new INodeAcceptor ( ) { public boolean doesAccept ( Node acceptNode ) { if ( acceptNode instanceof InstAsgnNode ) { return ( ( ( InstAsgnNode ) acceptNode ) . getName ( ) . equals ( instanceVarName ) ) ; } return false ; } } ) ; if ( instAsgnNodes != null ) { for ( Node instAsgnNode : instAsgnNodes ) { possibleTypes . addAll ( inferNodeType ( ( ( InstAsgnNode ) instAsgnNode ) . getValueNode ( ) ) ) ; } } return possibleTypes ; } private List < ITypeGuess > getClassVarReferenceNodeTypes ( ClassVarNode node ) { List < ITypeGuess > possibleTypes = new ArrayList < ITypeGuess > ( 1 ) ; Node enclosingTypeNode = findEnclosingTypeNode ( node ) ; final String classVarName = helper . getVarName ( node ) ; prettyPrint ( enclosingTypeNode ) ; List < Node > classAsgnNodes = ScopedNodeLocator . Instance ( ) . findNodesInScope ( enclosingTypeNode , new INodeAcceptor ( ) { public boolean doesAccept ( Node
1,254
<s> package com . asakusafw . compiler . flow . join . operator ; import java . lang . annotation . Documented ; import java . lang . annotation .
1,255
<s> package com . aptana . rdt . internal . core . gems ; import java . util . Collections ; import java . util . Set ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . core . gems . Gem ; import com . aptana . rdt . core . gems . Version ; public class HybridGemParser implements IGemParser { private IGemParser [ ] parsers ; public HybridGemParser ( Version version ) { if ( version != null && version . isLessThan ( "1.2.0" ) ) { parsers = new IGemParser [ ] { new LegacyGemParser ( true ) , new GemOnePointTwoParser ( true ) } ; } else { parsers = new IGemParser [ ] { new GemOnePointTwoParser ( true ) , new LegacyGemParser ( true ) } ; } } public Set < Gem > parse ( String string ) { for ( int i = 0 ; i < parsers . length ; i ++ ) { try { Set < Gem > gems = parsers [ i ]
1,256
<s> package org . rubypeople . rdt . internal . debug . ui . actions ; import java . lang . reflect . InvocationTargetException ; import java . text . MessageFormat ; import java . util . Iterator ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . debug . core . DebugException ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . model . ISourceLocator ; import org . eclipse . debug . core . model . IStackFrame ; import org . eclipse . debug . core . model . IThread ; import org . eclipse . debug . core . model . IValue ; import org . eclipse . debug . ui . DebugUITools ; import org . eclipse . debug . ui . IDebugModelPresentation ; import org . eclipse . debug . ui . IDebugUIConstants ; import org . eclipse . debug . ui . IDebugView ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . graphics . GC ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Display ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorActionDelegate ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IObjectActionDelegate ; import org . eclipse . ui . IPartListener ; import org . eclipse . ui . IViewActionDelegate ; import org . eclipse . ui . IViewPart ; import org . eclipse . ui . IWorkbench ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . IWorkbenchWindowActionDelegate ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . debug . core . RdtDebugCorePlugin ; import org . rubypeople . rdt . debug . core . model . IEvaluationResult ; import org . rubypeople . rdt . debug . core . model . IRubyStackFrame ; import org . rubypeople . rdt . debug . core . model . IRubyValue ; import org . rubypeople . rdt . debug . core . model . IRubyVariable ; import org . rubypeople . rdt . debug . ui . RdtDebugUiConstants ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiPlugin ; import org . rubypeople . rdt . internal . debug . ui . display . IDataDisplay ; import org . rubypeople . rdt . internal . debug . ui . display . RubyInspectExpression ; import org . rubypeople . rdt . internal . ui . text . RubyWordFinder ; public abstract class EvaluateAction implements IWorkbenchWindowActionDelegate , IObjectActionDelegate , IEditorActionDelegate , IPartListener , IViewActionDelegate { private IAction fAction ; private IWorkbenchPart fTargetPart ; private IWorkbenchWindow fWindow ; private Object fSelection ; private IRegion fRegion ; private boolean fEvaluating ; private IWorkbenchPart fNewTargetPart = null ; private IDebugModelPresentation fPresentation ; public EvaluateAction ( ) { super ( ) ; } protected IRubyValue getObjectContext ( ) { IWorkbenchPage page = RdtDebugUiPlugin . getActivePage ( ) ; if ( page == null ) return null ; IWorkbenchPart activePart = page . getActivePart ( ) ; if ( activePart == null ) return null ; IDebugView a = ( IDebugView ) activePart . getAdapter ( IDebugView . class ) ; if ( a == null || a . getViewer ( ) == null ) return null ; ISelection s = a . getViewer ( ) . getSelection ( ) ; if ( ! ( s instanceof IStructuredSelection ) ) return null ; IStructuredSelection structuredSelection = ( IStructuredSelection ) s ; if ( structuredSelection . size ( ) != 1 ) return null ; Object selection = structuredSelection . getFirstElement ( ) ; if ( selection instanceof IRubyVariable ) { IRubyVariable var = ( IRubyVariable ) selection ; try { if ( ! var . getName ( ) . equals ( "this" ) ) { IValue value = var . getValue ( ) ; if ( value instanceof IRubyValue ) { return ( IRubyValue ) value ; } } } catch ( DebugException e ) { RdtDebugUiPlugin . log ( e ) ; } } else if ( selection instanceof RubyInspectExpression ) { IValue value = ( ( RubyInspectExpression ) selection ) . getValue ( ) ; if ( value instanceof IRubyValue ) { return ( IRubyValue ) value ; } } return null ; } protected IRubyStackFrame getStackFrameContext ( ) { try { IWorkbenchPart part = getTargetPart ( ) ; if ( part == null ) { return RdtDebugUiPlugin . getEvaluationContextManager ( ) . getEvaluationContext ( getWindow ( ) ) ; } return RdtDebugUiPlugin . getEvaluationContextManager ( ) . getEvaluationContext ( part ) ; } catch ( Throwable e ) { RdtDebugUiPlugin . log ( e ) ; return null ; } } public void evaluationComplete ( final IEvaluationResult result ) { if ( RdtDebugUiPlugin . getDefault ( ) == null ) { return ; } final IValue value = result . getValue ( ) ; if ( result . hasErrors ( ) || value != null ) { final Display display = RdtDebugUiPlugin . getStandardDisplay ( ) ; if ( display . isDisposed ( ) ) { return ; } displayResult ( result ) ; } } protected void evaluationCleanup ( ) { setEvaluating ( false ) ; setTargetPart ( fNewTargetPart ) ; } abstract protected void displayResult ( IEvaluationResult result ) ; protected void run ( ) { final IRubyValue object = getObjectContext ( ) ; final IRubyStackFrame stackFrame = getStackFrameContext ( ) ; if ( stackFrame == null ) { reportError ( ActionMessages . Evaluate_error_message_stack_frame_context ) ; return ; } IThread thread = ( IThread ) stackFrame . getThread ( ) ; setNewTargetPart ( getTargetPart ( ) ) ; IRunnableWithProgress runnable = new IRunnableWithProgress ( ) { public void run ( IProgressMonitor monitor ) throws InvocationTargetException , InterruptedException { if ( stackFrame . isSuspended ( ) ) { Object selection = getSelectedObject ( ) ; if ( ! ( selection instanceof String ) ) { return ; } String expression = ( String ) selection ; setEvaluating ( true ) ; IEvaluationResult result = stackFrame . evaluate ( expression ) ; evaluationComplete ( result ) ; return ; } throw new InvocationTargetException ( null , ActionMessages . EvaluateAction_Thread_not_suspended___unable_to_perform_evaluation__1 ) ; } } ; IWorkbench workbench = RdtDebugUiPlugin . getDefault ( ) . getWorkbench ( ) ; try { workbench . getProgressService ( ) . busyCursorWhile ( runnable ) ; } catch ( InvocationTargetException e ) { evaluationCleanup ( ) ; String message = e . getMessage ( ) ; if ( message == null ) { message = e . getClass ( ) . getName ( ) ; if ( e . getCause ( ) != null ) { message = e . getCause ( ) . getClass ( ) . getName ( ) ; if ( e . getCause ( ) . getMessage ( ) != null ) { message = e . getCause ( ) . getMessage ( ) ; } } } reportError ( message ) ; } catch ( InterruptedException e ) { } } protected void update ( ) { IAction action = getAction ( ) ; if ( action != null ) { resolveSelectedObject ( ) ; } } protected void resolveSelectedObject ( ) { Object selectedObject = null ; fRegion = null ; ISelection selection = getTargetSelection ( ) ; if ( selection instanceof ITextSelection ) { ITextSelection ts = ( ITextSelection ) selection ; String text = ts . getText ( ) ; if ( textHasContent ( text ) ) { selectedObject = text ; fRegion = new Region ( ts . getOffset ( ) , ts . getLength ( ) ) ; } else if ( getTargetPart ( ) instanceof IEditorPart ) { IEditorPart editor = ( IEditorPart ) getTargetPart ( ) ; if ( editor instanceof ITextEditor ) { selectedObject = resolveSelectedObjectUsingToken ( selectedObject , ts , editor ) ; } } } else if ( selection instanceof IStructuredSelection ) { if ( ! selection . isEmpty ( ) ) { if ( getTargetPart ( ) . getSite ( ) . getId ( ) . equals ( IDebugUIConstants . ID_DEBUG_VIEW ) ) { IEditorPart editor = getTargetPart ( ) . getSite ( ) . getPage ( ) . getActiveEditor ( ) ; setTargetPart ( editor ) ; selection = getTargetSelection ( ) ; if ( selection instanceof ITextSelection ) { ITextSelection ts = ( ITextSelection ) selection ; String text = ts . getText ( ) ; if ( textHasContent ( text ) ) { selectedObject = text ; } else if ( editor instanceof ITextEditor ) { selectedObject = resolveSelectedObjectUsingToken ( selectedObject , ts , editor ) ; } } } else { IStructuredSelection ss = ( IStructuredSelection ) selection ; Iterator elements = ss . iterator ( ) ; while ( elements . hasNext ( ) ) { if ( ! ( elements . next ( ) instanceof IRubyVariable ) ) { setSelectedObject ( null ) ; return ; } } selectedObject = ss ; } } } setSelectedObject ( selectedObject ) ; } private Object resolveSelectedObjectUsingToken ( Object selectedObject , ITextSelection ts , IEditorPart editor ) { ITextEditor textEditor = ( ITextEditor ) editor ; IDocument doc = textEditor . getDocumentProvider ( ) . getDocument ( editor . getEditorInput ( ) ) ; fRegion = RubyWordFinder . findWord ( doc , ts . getOffset ( ) ) ; if ( fRegion != null ) { try { selectedObject = doc . get ( fRegion . getOffset ( ) , fRegion . getLength ( ) ) ; } catch ( BadLocationException e ) { } } return selectedObject ; } protected ISelection getTargetSelection ( ) { IWorkbenchPart part = getTargetPart ( ) ; if ( part != null ) { ISelectionProvider provider = part . getSite ( ) . getSelectionProvider ( ) ; if ( provider != null ) { return provider . getSelection ( ) ; } } return null ; } protected boolean compareToEditorInput ( IStackFrame stackFrame ) { ILaunch launch = stackFrame .
1,257
<s> package org . rubypeople . rdt . refactoring . tests . core . renameclass ; import java . io . FileNotFoundException ; import java . io . IOException ; import junit . framework . TestCase ; import org . jruby . ast . ClassNode ; import org . rubypeople . rdt . refactoring . core . renameclass . ClassFinder ; import org . rubypeople . rdt . refactoring . documentprovider . DocumentWithIncluding ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . tests . MultiFileTestData ; public class TC_ClassFinder extends TestCase { public void testFindAll1 ( ) throws FileNotFoundException , IOException { IDocumentProvider doc = getDoc ( "" ) ; ClassNode [ ] classNodes = new ClassFinder ( doc , "TestClass" , "" ) . findParts ( ) . toArray ( new ClassNode [
1,258
<s> package org . rubypeople . rdt . internal . ui . search ; import java . util . HashSet ; import java . util . Iterator ; import java . util . Set ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Platform ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class SearchParticipantsExtensionPoint { private Set fActiveParticipants = null ; private static SearchParticipantsExtensionPoint fgInstance ; public boolean hasAnyParticipants ( ) { return Platform . getExtensionRegistry ( ) . getConfigurationElementsFor ( RubySearchPage . PARTICIPANT_EXTENSION_POINT ) . length > 0 ; } private synchronized Set getAllParticipants ( ) { if ( fActiveParticipants != null ) return fActiveParticipants ; IConfigurationElement [ ] allParticipants = Platform . getExtensionRegistry ( ) . getConfigurationElementsFor ( RubySearchPage . PARTICIPANT_EXTENSION_POINT ) ; fActiveParticipants = new HashSet ( allParticipants . length ) ; for ( int i = 0 ; i < allParticipants . length ;
1,259
<s> package org . springframework . social . google . api . tasks ; import org . springframework . social . google . api . ApiEntity ; public class TaskList extends ApiEntity { private String title ; public TaskList ( ) { } public TaskList ( String id , String title ) { super ( id ) ; this . title = title ; } public TaskList ( String
1,260
<s> package org . oddjob . state ; import org . oddjob . Resetable ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . Structural ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . arooa . deploy . annotations . ArooaComponent ; import org . oddjob . framework . StructuralJob ; public class IfJob extends StructuralJob < Object > implements Runnable , Stateful , Resetable , Structural , Stoppable { private static final long serialVersionUID = 20050806 ; private StateCondition state = StateConditions . COMPLETE ; private volatile boolean then ; public StateCondition getState ( ) { return state ; } @ ArooaAttribute public void setState ( StateCondition state ) { this . state = state ; } @ ArooaComponent public void setJobs ( int index , Runnable job ) { if ( job == null ) { childHelper . removeChildAt ( index ) ; } else { childHelper . insertChild ( index , job ) ; } } @ Override protected StateOperator getStateOp ( ) { return new StateOperator ( ) { public ParentState evaluate ( State ... states ) { if ( states . length < 1 ) { return ParentState . READY ; } then = state . test ( states [ 0 ] ) ; if ( then ) { if ( states . length > 1 ) { return new ParentStateConverter ( ) . toStructuralState ( states [ 1 ] ) ; } } else { if ( states . length > 2
1,261
<s> package com . asakusafw . utils . java . parser . javadoc ; import static com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocElementKind . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . List ; import java . util . regex . Pattern ; import org . junit . Test ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocBlock ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocFragment ; public class DefaultJavadocBlockParserTest extends JavadocTestRoot { @ Test public void testDefaultJavadocBlockParser ( ) { DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser ( ) ; assertEquals ( 0 , parser . getBlockParsers ( ) . size ( ) ) ; } @ Test public void testDefaultJavadocBlockParserInlines ( ) { MockJavadocBlockParser m1 = new MockJavadocBlockParser ( ) ; MockJavadocBlockParser m2 = new MockJavadocBlockParser ( ) ; MockJavadocBlockParser m3 = new MockJavadocBlockParser ( ) ; DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser ( Arrays . asList ( m1 , m2 , m3 ) ) ; List < ? extends JavadocBlockParser > parsers = parser . getBlockParsers ( ) ; assertEquals ( 3 , parsers . size ( ) ) ; assertSame ( m1 , parsers . get ( 0 ) ) ; assertSame ( m2 , parsers . get ( 1 ) ) ; assertSame ( m3 , parsers . get ( 2 ) ) ; } @ Test public void testCanAccept ( ) { DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser ( ) ; assertTrue ( parser . canAccept ( null ) ) ; assertTrue ( parser . canAccept ( "" ) ) ; assertTrue ( parser . canAccept ( "param" ) ) ; assertTrue ( parser . canAccept ( "code" ) ) ; } @ Test public void testParse ( ) throws Exception { MockJavadocBlockParser i1 = new MockJavadocBlockParser ( ) ; i1 . setIdentifier ( "i1" ) ; i1 . setAcceptable ( Pattern . compile ( "a" ) ) ; DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser ( Arrays . asList ( i1 ) ) ; { IrDocBlock block = parser . parse ( null , string ( "" ) ) ; assertNull ( block . getTag ( ) ) ; List < ? extends IrDocFragment > fragments = block . getFragments ( ) ; assertKinds ( fragments , TEXT ) ; } { IrDocBlock block = parser . parse ( null , string ( "{@a sample}" ) ) ; assertNull ( block . getTag ( ) ) ;
1,262
<s> package com . asakusafw . compiler . flow . processor ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . List ; import org . junit . Test ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . processor . flow . SplitFlowTrivial ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . compiler
1,263
<s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . DocMethod ; import com . asakusafw . utils . java . model . syntax . DocMethodParameter ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class DocMethodImpl extends ModelRoot implements DocMethod { private Type type ; private SimpleName name ; private List < ? extends DocMethodParameter > formalParameters ; @ Override public Type getType ( ) { return this
1,264
<s> package com . asakusafw . testdriver . file ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Set ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . apache . hadoop . conf . Configurable ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . apache . hadoop . mapreduce . lib . output . FileOutputFormat ; import org . apache . hadoop . util . ReflectionUtils ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . testdriver . core . BaseImporterPreparator ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . ImporterPreparator ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . hadoop . ConfigurationFactory ; import com . asakusafw . vocabulary . external . FileImporterDescription ; @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public class FileImporterPreparator extends BaseImporterPreparator < FileImporterDescription > { static final Logger LOG = LoggerFactory . getLogger ( FileImporterPreparator . class ) ; private final ConfigurationFactory configurations ; public FileImporterPreparator ( ) { this ( ConfigurationFactory . getDefault ( ) ) ; } public FileImporterPreparator ( ConfigurationFactory configurations ) { if ( configurations == null ) { throw new IllegalArgumentException ( "" ) ; } this . configurations = configurations ; } @ Override public void truncate ( FileImporterDescription description , TestContext context ) throws IOException { LOG . info ( "" , description ) ; VariableTable variables = createVariables ( context ) ; Configuration config = configurations . newInstance ( ) ; FileSystem fs = FileSystem . get ( config ) ; for ( String path : description . getPaths ( ) ) { String resolved = variables . parse ( path , false ) ; Path target = fs . makeQualified ( new Path ( resolved ) ) ; LOG . debug ( "" , target ) ; boolean succeed = fs . delete ( target , true ) ; LOG . debug ( "" , succeed , target ) ; } } @ Override public < V > ModelOutput < V > createOutput ( DataModelDefinition < V > definition , FileImporterDescription description , TestContext context ) throws IOException { LOG . info ( "" , description ) ; checkType ( definition , description ) ; Set < String > path = description . getPaths ( ) ; if ( path . isEmpty ( ) ) { return new ModelOutput < V > ( ) { @ Override public void close ( ) throws IOException { return ; } @ Override public void write ( V model ) throws IOException { return ; } } ; } VariableTable variables = createVariables ( context ) ; String destination = path . iterator ( ) . next ( ) . replace ( '*' , '_' ) ; String resolved = variables . parse ( destination , false ) ; Configuration conf = configurations . newInstance ( ) ; FileOutputFormat output =
1,265
<s> package com . asakusafw . windgate . hadoopfs . temporary ; import java . io . IOException ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . windgate . core . resource . DrainDriver ; public class ModelOutputDrainDriver < T > implements DrainDriver < T > { static final Logger LOG = LoggerFactory . getLogger ( ModelOutputDrainDriver . class ) ; private final ModelOutput < T > output ; public ModelOutputDrainDriver ( ModelOutput < T > output ) { if ( output == null ) { throw new IllegalArgumentException ( "" ) ; } this . output = output ; } @ Override public void
1,266
<s> package com . asakusafw . testdriver . rule ; public class BothAreNull implements ValuePredicate
1,267
<s> package org . oddjob . monitor . actions ; public class ActionProviderBean implements ActionProvider { private ExplorerAction [ ] actions ; public void setExplorerActions ( ExplorerAction [ ] actions
1,268
<s> package org . oddjob . sql ; import java . math . BigDecimal ; import java . sql . ResultSet ; import java . sql . ResultSetMetaData ; import java . sql . SQLException ; import java . sql . Statement ; import java . util . List ; import junit . framework . AssertionFailedError ; import junit . framework . TestCase ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaClass ; import org . oddjob . arooa . reflect . BeanOverview ; import org . oddjob . arooa . reflect . PropertyAccessor ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . types . ArooaObject ; import org . oddjob . arooa . types . ValueType ; import org . oddjob . beanbus . BadBeanException ; import org . oddjob . beanbus . CrashBusException ; public class ParameterisedExecutorText extends TestCase { public void testHSQLDataTypes ( ) throws SQLException , ClassNotFoundException , ArooaConversionException { ConnectionType ct = new ConnectionType ( ) ; ct . setDriver ( "" ) ; ct . setUrl ( "" ) ; ct . setUsername ( "sa" ) ; ct . setPassword ( "" ) ; Statement stmt = ct . toValue ( ) . createStatement ( ) ; String create = "" + "" + "" + "" + "" + "" + "" ; stmt . execute ( create ) ; String insert = "" ; stmt . execute ( insert ) ; String select = "" ; ResultSet rs = stmt . executeQuery ( select ) ; ResultSetMetaData md = rs . getMetaData ( ) ; int c = md . getColumnCount ( ) ; rs . next ( ) ; try { for ( int i = 1 ; i <= c ; ++ i ) { assertEquals ( md . getColumnName ( i
1,269
<s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . mapping . ResourceMapping ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IAdapterFactory ; import org . eclipse . search . ui . ISearchPageScoreComputer ; import org . eclipse . ui . IContainmentAdapter ; import org . eclipse . ui . IContributorResourceAdapter ; import org . eclipse . ui . IPersistableElement ; import org . eclipse . ui . ide . IContributorResourceAdapter2 ; import org . eclipse . ui . model . IWorkbenchAdapter ; import org . eclipse . ui . views . properties . FilePropertySource ; import org . eclipse . ui . views . properties . IPropertySource ; import org . eclipse . ui . views . properties . ResourcePropertySource ; import org . eclipse . ui . views . tasklist . ITaskListResourceAdapter ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . internal . corext . util . RubyElementResourceMapping ; import org . rubypeople . rdt . internal . ui . rubyeditor . IRubyScriptEditorInput ; import org . rubypeople . rdt . internal . ui . search . RubySearchPageScoreComputer ; import org . rubypeople . rdt . internal . ui . search . SearchUtil ; public class RubyElementAdapterFactory implements IAdapterFactory , IContributorResourceAdapter , IContributorResourceAdapter2 { private static Class [ ] PROPERTIES = new Class [ ] { IPropertySource . class , IResource . class , IWorkbenchAdapter . class , IResourceLocator . class , IPersistableElement . class , IContributorResourceAdapter . class , IContributorResourceAdapter2 . class , ITaskListResourceAdapter . class , IContainmentAdapter . class } ; private Object fSearchPageScoreComputer ; private static IResourceLocator fgResourceLocator ; private static RubyWorkbenchAdapter fgRubyWorkbenchAdapter ; private static ITaskListResourceAdapter fgTaskListAdapter ; private static RubyElementContainmentAdapter fgRubyElementContainmentAdapter ; public Class [ ] getAdapterList ( ) { updateLazyLoadedAdapters ( ) ; return PROPERTIES ; } public Object getAdapter ( Object element , Class key ) { updateLazyLoadedAdapters ( ) ; IRubyElement java = getRubyElement ( element ) ; if ( IPropertySource . class . equals ( key ) ) { return getProperties ( java ) ; } if ( IResource . class . equals ( key ) ) { return getResource ( java ) ; } if ( fSearchPageScoreComputer != null && ISearchPageScoreComputer . class . equals ( key ) ) { return fSearchPageScoreComputer ; } if ( IWorkbenchAdapter . class . equals ( key ) ) { return getRubyWorkbenchAdapter ( ) ; } if ( IResourceLocator . class . equals ( key ) ) { return getResourceLocator ( ) ; } if ( IPersistableElement . class . equals ( key ) ) { return new PersistableRubyElementFactory ( java ) ; } if ( IContributorResourceAdapter . class . equals ( key ) ) { return this ; } if (
1,270
<s> package net . sf . sveditor . core . fileset ; import java . util . ArrayList ; import java . util . List ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import java . util . regex . PatternSyntaxException ; import net . sf . sveditor . core . SVFileUtils ; import net . sf . sveditor . core . log . LogHandle ; public abstract class AbstractSVFileMatcher { protected static Pattern fNormalizePathPattern ; protected boolean fPatternsValid ; protected List < FilePattern > fIncludePatterns ; protected List < FilePattern > fExcludePatterns ; protected List < SVFileSet > fFileSets ; protected LogHandle fLog ; private class FilePattern { public Pattern fDirMatchPattern ; public Pattern fFileMatchPattern ; } static { fNormalizePathPattern = Pattern . compile ( "\\\\" ) ; } public AbstractSVFileMatcher ( ) { fIncludePatterns = new ArrayList < FilePattern > ( ) ; fExcludePatterns = new ArrayList < FilePattern > ( ) ; fFileSets = new ArrayList < SVFileSet > ( ) ; fPatternsValid = false ; } public void addFileSet ( SVFileSet fs ) { fFileSets . add ( fs ) ; fPatternsValid = false ; } public abstract List < String > findIncludedPaths ( ) ; protected boolean include_dir ( String path ) { path = fNormalizePathPattern . matcher ( path ) . replaceAll ( "/" ) ; if ( ! fPatternsValid ) { update_patterns ( ) ; fPatternsValid = true ; } boolean include = ( fIncludePatterns . size ( ) == 0 ) ; for ( FilePattern p : fIncludePatterns ) { Matcher m = p . fDirMatchPattern . matcher ( path ) ; if ( m . matches ( ) ) { include = true ; break ; } } if ( include ) { boolean exclude = false ; for ( FilePattern p : fExcludePatterns ) { Matcher m = p . fDirMatchPattern . matcher ( path ) ; if ( m . matches ( ) ) { exclude = true ; break ; } } fLog . debug ( "Dir \"" + path + "\" " + ( ( exclude ) ? "not" : "" ) + " included" ) ; return ! exclude ; } else { fLog . debug ( "Dir \"" + path + "" ) ; return false ; } } protected boolean include_file ( String path ) { path = fNormalizePathPattern .
1,271
<s> package com . aptana . rdt . internal . core . parser . warnings ; import java . util . List ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . parser . warnings . AbstractRubyLintVisitorTestCase ; import com . aptana . rdt . IProblem ; import com . aptana . rdt . internal . parser . warnings . DynamicVariableAliasesLocal ; public class DynamicVariableAliasesLocalTest extends AbstractRubyLintVisitorTestCase { @ Override protected RubyLintVisitor createVisitor ( String src ) { return new DynamicVariableAliasesLocal ( src ) { @ Override protected String getSeverity ( ) { return RubyCore . WARNING ; } } ; } public void testDynamicVarMatchesLocalVarNameInScope ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . DynamicVariableAliasesLocal , problems . get ( 0 ) . getID ( ) ) ; assertEquals ( 34 , problems . get ( 0 ) . getSourceStart ( ) ) ; assertEquals ( 39 , problems . get ( 0 ) . getSourceEnd ( ) ) ; } public void testNoFalsePositiveForNewDynamicVarName ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 0 , problems . size ( ) ) ; } public void testOneDynamicVarInListOfVarsMatchesLocalVarNameInScope ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . DynamicVariableAliasesLocal , problems . get ( 0 )
1,272
<s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBAssociativeArrayElemAssignExpr extends SVDBExpr { public SVDBExpr fKey ; public SVDBExpr fValue ; public SVDBAssociativeArrayElemAssignExpr ( ) { super ( SVDBItemType
1,273
<s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . jface . action . Action ; import org . eclipse
1,274
<s> package net . sf . sveditor . core . db . refs ; import net . sf . sveditor . core . db . SVDBLocation ; public class SVDBFileRefCollector extends AbstractSVDBFileRefFinder { private SVDBRefCacheEntry fReferences ;
1,275
<s> package org . rubypeople . rdt . internal . ui . text ; import java . text . CharacterIterator ; import org . eclipse . jface . text . Assert ; public class SequenceCharacterIterator implements CharacterIterator { private int fIndex = - 1 ; private final CharSequence fSequence ; private final int fFirst ; private final int fLast ; private void invariant ( ) { Assert . isTrue ( fIndex >= fFirst ) ; Assert . isTrue ( fIndex <= fLast ) ; } public SequenceCharacterIterator ( CharSequence sequence ) { this ( sequence , 0 ) ; } public SequenceCharacterIterator ( CharSequence sequence , int first ) throws IllegalArgumentException { this ( sequence
1,276
<s> package com . asakusafw . compiler . windgate . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . windgate . testing . model . Simple ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class SimpleOutput implements ModelOutput < Simple > { private final RecordEmitter emitter ; public SimpleOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException
1,277
<s> package net . sf . sveditor . ui . pref ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Map . Entry ; import java . util . Set ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . XMLTransformUtils ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . preference . ListEditor ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . eclipse . swt . widgets . List ; import org . eclipse . swt . widgets . Text ; public class TemplatePropertiesEditor extends ListEditor { private Text fPreview ; private Button fModify ; private List fList ; private Map < String , String > fParamValMap ; public TemplatePropertiesEditor ( String name , Composite parent ) { super ( name , "" , parent ) ; fParamValMap = new HashMap < String , String > ( ) ; } @ Override protected String createList ( String [ ] items ) { Map < String , String > content = new HashMap < String , String > ( ) ; for ( String item : items ) { content . put ( item , fParamValMap . get ( item ) ) ; } String str = "" ; try { str = XMLTransformUtils . map2Xml ( content , "parameters" , "parameter" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return str ; } @ Override protected String [ ] parseString ( String stringList ) { Map < String , String > content = null ; fParamValMap . clear ( ) ; if ( ! stringList . trim ( ) . equals ( "" ) ) { try { content = XMLTransformUtils . xml2Map ( new StringInputStream ( stringList ) , "parameters" , "parameter" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } if ( content != null ) { Set < String > keys = content . keySet ( ) ; for ( Entry < String , String > e : content . entrySet ( ) ) { fParamValMap . put ( e . getKey ( ) , e . getValue ( ) ) ; } return keys . toArray ( new String [ keys . size ( ) ] ) ; } else { return new String [ 0 ] ; } } @ Override protected void doLoad ( ) { super . doLoad ( ) ; if ( fList . getSelectionIndex ( ) == - 1 && fList . getItemCount ( ) > 0 ) { fList . select ( 0 ) ; listSelected ( ) ; } } @ Override protected void doFillIntoGrid ( Composite parent , int numColumns ) { super . doFillIntoGrid ( parent , numColumns ) ; GridData gd ; Group g = new Group ( parent , SWT . NONE ) ; g . setText ( "Preview" ) ; gd = new GridData ( SWT . FILL , SWT . FILL , true , true ) ; gd . horizontalSpan = numColumns - 1 ; g . setLayoutData ( gd ) ; g . setLayout ( new GridLayout ( ) ) ; fPreview = new Text ( g , SWT . READ_ONLY + SWT . MULTI + SWT . BORDER ) ; fPreview . setFont ( JFaceResources . getTextFont ( ) ) ; gd = new GridData ( SWT . FILL , SWT . FILL , true , true ) ; fPreview . setLayoutData ( gd ) ; fModify = new Button ( parent , SWT . PUSH ) ; fModify . setText ( "Modify..." ) ; fModify . setLayoutData ( new GridData ( SWT . FILL , SWT . CENTER , false , false ) ) ; fModify . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { modifyPressed ( ) ; } } ) ; fList = getListControl ( parent ) ; fList . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { listSelected ( ) ; } } ) ; } private void listSelected ( ) { String val = fParamValMap . get ( fList . getItem ( fList . getSelectionIndex ( ) ) ) ;
1,278
<s> package org . rubypeople . rdt . internal . core ; import java . text . NumberFormat ; import java . util . HashMap ; import java . util . Map ; import org . rubypeople . rdt . core . IRubyElement ; public class RubyModelCache { public static final int CACHE_RATIO = 20 ; protected RubyModelInfo modelInfo ; protected HashMap projectCache ; protected ElementCache folderCache ; protected ElementCache rootCache ; protected ElementCache openableCache ; protected Map childrenCache ; public static final int DEFAULT_PROJECT_SIZE = 5 ; public static final int DEFAULT_ROOT_SIZE = 50 ; public static final int DEFAULT_FOLDER_SIZE = 500 ; public static final int DEFAULT_OPENABLE_SIZE = 500 ; public static final int DEFAULT_CHILDREN_SIZE = 500 * 20 ; protected double memoryRatio = - 1 ; public RubyModelCache ( ) { double ratio = getMemoryRatio ( ) ; this . rootCache = new ElementCache ( ( int ) ( DEFAULT_ROOT_SIZE * ratio ) ) ; this . projectCache = new HashMap ( DEFAULT_PROJECT_SIZE ) ; this . openableCache = new ElementCache ( ( int ) ( DEFAULT_OPENABLE_SIZE * ratio ) ) ; this . folderCache = new ElementCache ( ( int ) ( DEFAULT_FOLDER_SIZE * ratio ) ) ; this . childrenCache = new HashMap ( ( int ) ( DEFAULT_CHILDREN_SIZE * ratio ) ) ; } protected double getMemoryRatio ( ) { if ( this . memoryRatio == - 1 ) { long maxMemory = Runtime . getRuntime ( ) . maxMemory ( ) ; this . memoryRatio = maxMemory == Long . MAX_VALUE ? 4d : ( ( double ) maxMemory ) / ( 64 * 0x100000 ) ; } return this . memoryRatio ; } public Object getInfo ( IRubyElement element ) { switch ( element . getElementType ( ) ) { case IRubyElement . RUBY_MODEL : return this . modelInfo ; case IRubyElement . RUBY_PROJECT : return this . projectCache . get ( element ) ; case IRubyElement . SOURCE_FOLDER_ROOT : return this . rootCache . get ( element ) ; case IRubyElement . SOURCE_FOLDER : return this . folderCache . get ( element ) ; case IRubyElement . SCRIPT : return this . openableCache . get ( element ) ; default : return this . childrenCache . get ( element ) ; } } protected Object peekAtInfo ( IRubyElement element ) { switch ( element . getElementType ( ) ) { case IRubyElement . RUBY_MODEL : return this . modelInfo ; case IRubyElement . RUBY_PROJECT : return this . projectCache . get ( element ) ; case IRubyElement . SOURCE_FOLDER_ROOT : return this . rootCache . peek ( element ) ; case IRubyElement . SOURCE_FOLDER : return this . folderCache . peek ( element ) ; case IRubyElement . SCRIPT : return this . openableCache . peek ( element ) ; default : return this . childrenCache . get ( element ) ; } } protected void putInfo ( IRubyElement element , Object info ) { switch ( element . getElementType ( ) ) { case IRubyElement . RUBY_MODEL : this . modelInfo = ( RubyModelInfo ) info ; break ; case IRubyElement . RUBY_PROJECT : this . projectCache . put ( element , info ) ; this . rootCache . ensureSpaceLimit ( ( ( RubyElementInfo ) info ) . children . length , element ) ; break ; case IRubyElement . SOURCE_FOLDER_ROOT : this . rootCache . put ( element , info ) ; this . folderCache . ensureSpaceLimit
1,279
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . ReturnStatement ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class ReturnStatementImpl extends ModelRoot implements ReturnStatement { private Expression expression ;
1,280
<s> package org . rubypeople . rdt . refactoring . core . movemethod ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . editprovider . ReplaceEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ArgsNodeWrapper ; import org
1,281
<s> package net . sf . sveditor . ui . wizards ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Text ; public class NewSVClassWizardPage extends AbstractNewSVItemFileWizardPage { public static final String SUPER_CLASS =
1,282
<s> package com . asakusafw . testdriver . excel . legacy ; import java . util . HashMap ; import java . util . Map ; public enum RowMatchingCondition { EXACT ( "-UNK-" ) , PARTIAL ( "-UNK-" ) , NONE ( "-UNK-" ) ; private String japaneseName ; private RowMatchingCondition ( String japaneseName ) { this . japaneseName = japaneseName ; } public String getJapaneseName ( ) { return japaneseName ; } private static Map < String , RowMatchingCondition > japaneseNameMap = new HashMap < String , RowMatchingCondition > ( ) ; static { for ( RowMatchingCondition conditon : RowMatchingCondition . values ( ) ) { String key = conditon . getJapaneseName ( ) ; if ( japaneseNameMap . containsKey ( key )
1,283
<s> package com . asakusafw . compiler . operator ; import java . util . List ; import javax . lang . model . element . ExecutableElement ; import javax . lang . model . element . TypeElement ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Lists ; public class OperatorClass { private TypeElement element ; private List
1,284
<s> package com . asakusafw . compiler . common ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . Arrays ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . compiler . batch . ResourceRepository . Cursor ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . runtime . configuration . FrameworkDeployer ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; public class ZipRepositoryTest { @ Rule public FrameworkDeployer framework = new FrameworkDeployer ( false ) ; @ Test public void single ( ) throws Exception { ZipRepository repository = new ZipRepository ( open ( "single.zip" ) ) ; Cursor cur = repository . createCursor ( ) ; Map < String , List < String > > entries = drain ( cur ) ; Map < String , List < String > > expected = Maps . create ( ) ; expected . put ( "hello.txt" , Arrays . asList ( "" ) ) ; assertThat ( entries , is ( expected ) ) ; } @ Test public void multiple ( ) throws Exception { ZipRepository repository = new ZipRepository ( open ( "multiple.zip" ) ) ; Cursor cur = repository . createCursor ( ) ; Map < String , List < String > > entries = drain ( cur ) ; Map < String , List < String > > expected = Maps . create ( ) ; expected . put ( "a.txt" , Arrays . asList ( "aaa" ) ) ; expected . put ( "b.txt" , Arrays . asList ( "bbb" ) ) ; expected . put ( "c.txt" , Arrays . asList ( "ccc" ) ) ; assertThat ( entries , is ( expected ) ) ; } @ Test public void structured ( ) throws Exception { ZipRepository repository = new ZipRepository ( open ( "" ) ) ; Cursor cur = repository . createCursor ( ) ; Map < String , List < String > > entries = drain ( cur ) ; Map < String , List < String > > expected = Maps . create ( ) ; expected . put ( "a.txt" , Arrays . asList ( "aaa" ) ) ; expected . put ( "a/b.txt" ,
1,285
<s> package fi . koku . services . utility . authorizationinfo . v1 . impl ; import java . util . ArrayList ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import fi . koku . KoKuFaultException ; import fi . koku . services . utility . authorization . v1 . AuthorizationInfoServicePortType ; import fi . koku . services . utility . authorization . v1 . GroupQueryCriteriaType ; import fi . koku . services . utility . authorization . v1 . GroupType ; import fi . koku . services . utility . authorization . v1 . GroupsType ; import fi . koku . services . utility . authorization . v1 . MemberPicsType ; import fi . koku . services . utility . authorization . v1 . ServiceFault ; import fi . koku . services . utility . authorizationinfo . v1 . AuthorizationInfoService ; import fi . koku . services . utility . authorizationinfo . v1 . model . Group ; import fi . koku . services . utility . authorizationinfo . v1 . model . OrgUnit ; import fi . koku . services . utility . authorizationinfo . v1 . model . Registry ; import fi . koku . services . utility . authorizationinfo . v1 . model . Role ; import fi . koku . services . utility . authorizationinfo . v1 . model . User ; public class AuthorizationInfoServiceWSImpl implements AuthorizationInfoService { private Logger logger = LoggerFactory . getLogger ( AuthorizationInfoServiceWSImpl . class ) ; private AuthorizationInfoServicePortType authzService ; public AuthorizationInfoServiceWSImpl ( AuthorizationInfoServicePortType ep ) { this . authzService = ep ; } @ Override public List < Registry > getUsersAuthorizedRegistries ( String uid ) { List < Registry > res = getGroups ( null , "registry" , uid , new GroupTypeMapper < Registry > ( ) { @ Override public Registry mapToSpecializedGroup ( GroupType grp ) { return new Registry ( grp . getId ( )
1,286
<s> package org . rubypeople . rdt . refactoring . tests . core . overridemethod ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople .
1,287
<s> package com . asakusafw . compiler . flow . testing . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . flow . testing . io . ExSummarizedInput ; import com . asakusafw . compiler . flow . testing . io . ExSummarizedOutput ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . model . Key ; import com . asakusafw . vocabulary . model . Summarized ; @ DataModelKind ( "DMDL" ) @ ModelInputLocation ( ExSummarizedInput . class ) @ ModelOutputLocation ( ExSummarizedOutput . class ) @ Summarized ( term = @ Summarized . Term ( source = Ex1 . class , foldings = { @ Summarized . Folding ( aggregator = Summarized . Aggregator . ANY , source = "string" , destination = "string" ) , @ Summarized . Folding ( aggregator = Summarized . Aggregator . SUM
1,288
<s> package org . rubypeople . rdt . internal . ui . preferences ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jface . text . Assert ; import org . eclipse . jface . viewers . ComboViewer ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredContentProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . StackLayout ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . FillLayout ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Combo ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Label ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyUIMessages ; import org . rubypeople . rdt . internal . ui . text . folding . RubyFoldingStructureProviderDescriptor ; import org . rubypeople . rdt . internal . ui . text . folding . RubyFoldingStructureProviderRegistry ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . folding . IRubyFoldingPreferenceBlock ; class FoldingConfigurationBlock implements IPreferenceConfigurationBlock { private static class ErrorPreferences implements IRubyFoldingPreferenceBlock { private String fMessage ; protected ErrorPreferences ( String message ) { fMessage = message ; } public Control createControl ( Composite composite ) { Composite inner = new Composite ( composite , SWT . NONE ) ; inner . setLayout ( new FillLayout ( SWT . VERTICAL ) ) ; Label label = new Label ( inner , SWT . CENTER ) ; label . setText ( fMessage ) ; return inner ; } public void initialize ( ) { } public void performOk ( ) { } public void performDefaults ( ) { } public void dispose ( ) { } } private final OverlayPreferenceStore fStore ; private Combo fProviderCombo ; private Button fFoldingCheckbox ; private ComboViewer fProviderViewer ; private Map fProviderDescriptors ; private Composite fGroup ; private Map fProviderPreferences ; private Map fProviderControls ; private StackLayout fStackLayout ; public FoldingConfigurationBlock ( OverlayPreferenceStore store ) { Assert . isNotNull ( store ) ; fStore = store ; fStore . addKeys ( createOverlayStoreKeys ( ) ) ; fProviderDescriptors = createListModel ( ) ; fProviderPreferences = new HashMap ( ) ; fProviderControls = new HashMap ( ) ; } private Map createListModel ( ) { RubyFoldingStructureProviderRegistry reg = RubyPlugin . getDefault ( ) . getFoldingStructureProviderRegistry ( ) ; reg . reloadExtensions ( ) ; RubyFoldingStructureProviderDescriptor [ ] descs = reg . getFoldingProviderDescriptors ( ) ; Map map = new HashMap ( ) ; for ( int i = 0 ; i < descs . length ; i ++ ) { map . put ( descs [ i ] . getId ( ) , descs [ i ] ) ; } return map ; } private OverlayPreferenceStore . OverlayKey [ ] createOverlayStoreKeys ( ) { ArrayList overlayKeys = new ArrayList ( ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , PreferenceConstants . EDITOR_FOLDING_ENABLED ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , PreferenceConstants . EDITOR_FOLDING_PROVIDER ) ) ; OverlayPreferenceStore . OverlayKey [ ] keys = new OverlayPreferenceStore . OverlayKey [ overlayKeys . size ( ) ] ; overlayKeys . toArray ( keys ) ; return keys ; } public Control createControl ( Composite parent ) { Composite composite = new Composite ( parent , SWT . NULL ) ; GridData gd = new GridData ( GridData . HORIZONTAL_ALIGN_CENTER | GridData . VERTICAL_ALIGN_FILL ) ; composite . setLayoutData ( gd ) ; GridLayout layout = new GridLayout ( ) ; layout . numColumns = 2 ; PixelConverter pc = new PixelConverter ( composite ) ; layout . verticalSpacing = pc . convertHeightInCharsToPixels ( 1 ) / 2 ; composite . setLayout ( layout ) ; fFoldingCheckbox = new Button ( composite , SWT . CHECK ) ; fFoldingCheckbox . setText ( PreferencesMessages . FoldingConfigurationBlock_enable ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_BEGINNING | GridData . VERTICAL_ALIGN_BEGINNING ) ; fFoldingCheckbox . setLayoutData ( gd ) ; fFoldingCheckbox . addSelectionListener ( new SelectionListener ( ) { public void widgetSelected ( SelectionEvent e ) { boolean enabled = fFoldingCheckbox . getSelection ( ) ; fStore . setValue ( PreferenceConstants . EDITOR_FOLDING_ENABLED , enabled ) ; updateCheckboxDependencies ( ) ; } public void widgetDefaultSelected ( SelectionEvent e ) { } } ) ; Label label = new Label ( composite , SWT . CENTER ) ; gd = new GridData ( GridData . FILL_HORIZONTAL | GridData . VERTICAL_ALIGN_BEGINNING ) ; label . setLayoutData ( gd ) ; Composite comboComp = new Composite ( composite , SWT . NONE ) ; gd = new GridData ( GridData . FILL_HORIZONTAL | GridData . VERTICAL_ALIGN_BEGINNING ) ; GridLayout gridLayout = new GridLayout ( 2 , false ) ; gridLayout . marginWidth = 0 ; comboComp . setLayout ( gridLayout ) ; Label comboLabel = new Label ( comboComp , SWT . CENTER ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_BEGINNING | GridData . VERTICAL_ALIGN_CENTER ) ; comboLabel . setLayoutData ( gd ) ; comboLabel . setText ( PreferencesMessages . FoldingConfigurationBlock_combo_caption ) ; label = new Label ( composite , SWT . CENTER ) ; gd = new GridData ( GridData . FILL_HORIZONTAL | GridData . VERTICAL_ALIGN_BEGINNING ) ; label . setLayoutData ( gd ) ; fProviderCombo = new Combo ( comboComp , SWT . READ_ONLY | SWT . DROP_DOWN ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_END | GridData . VERTICAL_ALIGN_CENTER ) ; fProviderCombo . setLayoutData ( gd ) ; fProviderViewer = new ComboViewer ( fProviderCombo ) ; fProviderViewer . setContentProvider ( new IStructuredContentProvider ( ) { public void dispose ( ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } public Object [ ] getElements ( Object inputElement ) { return fProviderDescriptors . values ( ) . toArray ( ) ; } } ) ; fProviderViewer . setLabelProvider ( new LabelProvider ( ) { public Image getImage ( Object element ) { return null ; } public String getText ( Object element ) { return ( ( RubyFoldingStructureProviderDescriptor ) element ) . getName ( ) ; } } ) ; fProviderViewer . addSelectionChangedListener ( new ISelectionChangedListener ( ) { public void selectionChanged ( SelectionChangedEvent event ) { IStructuredSelection sel = ( IStructuredSelection ) event . getSelection ( ) ; if ( ! sel . isEmpty ( ) ) { fStore . setValue ( PreferenceConstants . EDITOR_FOLDING_PROVIDER , ( ( RubyFoldingStructureProviderDescriptor ) sel . getFirstElement ( ) ) . getId ( ) ) ; updateListDependencies ( ) ; } } } ) ; fProviderViewer . setInput ( fProviderDescriptors ) ; fProviderViewer . refresh ( ) ; Composite groupComp = new Composite ( composite , SWT . NONE ) ; gd = new GridData ( GridData . FILL_BOTH ) ; gd . horizontalSpan = 2 ; groupComp . setLayoutData
1,289
<s> package net . sf . sveditor . doc . dev ; import java . io . FileInputStream ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . util . Properties ; import javax . xml . parsers . DocumentBuilder ; import javax . xml . parsers . DocumentBuilderFactory ; import javax . xml . parsers . ParserConfigurationException ; import javax . xml . transform . OutputKeys ; import javax . xml . transform . TransformerConfigurationException ; import javax . xml . transform . TransformerException ; import javax . xml . transform . dom . DOMSource ; import javax . xml . transform . sax . SAXTransformerFactory ; import javax . xml . transform . sax . TransformerHandler ; import javax . xml . transform . stream . StreamResult ; import org . apache . tools . ant . BuildException ; import org . apache . tools . ant . taskdefs . MatchingTask ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; import org . xml . sax . ErrorHandler ; import org . xml . sax . SAXException ; import org . xml . sax . SAXParseException ; public class AssembleTocTask extends MatchingTask { private String [ ] fFiles ; private String fOutput = "toc.xml" ; private String fLabel = "" ; public void setOutput ( String output ) { fOutput = output ; } public void setLabel ( String label ) { fLabel = label ; } public void setFiles ( String files ) { fFiles = files
1,290
<s> package net . sf . sveditor . core . tests . index ; import java . io . File ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; import net . sf . sveditor . core . db . index . SVDBIndexCollection ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import net . sf . sveditor . core . db . project . SVDBProjectManager ; import net . sf . sveditor . core . db . project . SVProjectFileWrapper ; import net . sf . sveditor . core . db . search . SVDBFindDefaultNameMatcher ; import net . sf . sveditor . core . tests . CoreReleaseTests ; import net . sf . sveditor . core . tests . utils . TestUtils ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IProjectDescription ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . NullProgressMonitor ; public class TestCrossIndexReferences extends TestCase { private File fTmpDir ; @ Override protected void setUp ( ) throws Exception { fTmpDir = TestUtils . createTempDir ( ) ; CoreReleaseTests . clearErrors ( ) ; } @ Override protected void tearDown ( ) throws Exception { assertEquals ( 0 , CoreReleaseTests . getErrors ( ) . size ( ) ) ; } public void testBasicArgFileIndexCrossRef ( ) throws CoreException { String testname = "" ; SVDBProjectManager pmgr = SVCorePlugin . getDefault ( ) . getProjMgr ( ) ; IProject p1 = TestUtils . setupIndexWSProject ( null , fTmpDir , "p1" , "" ) ; IProject p2 = TestUtils . setupIndexWSProject ( null , fTmpDir , "p2" , "" ) ; IProjectDescription p2_desc = p2 . getDescription ( ) ; p2_desc . setReferencedProjects ( new IProject [ ] { p1 } ) ; p2 . setDescription ( p2_desc , new NullProgressMonitor ( ) ) ; SVDBProjectData p1_pdata = pmgr . getProjectData ( p1 ) ; SVProjectFileWrapper p1_fwrapper = p1_pdata . getProjectFileWrapper ( ) ; SVDBProjectData p2_pdata = pmgr . getProjectData ( p2 ) ; SVProjectFileWrapper p2_fwrapper = p2_pdata . getProjectFileWrapper ( ) ; p1_fwrapper . addArgFilePath ( "" ) ; p2_fwrapper . addArgFilePath ( "" ) ; p1_pdata . setProjectFileWrapper ( p1_fwrapper ) ; p2_pdata . setProjectFileWrapper ( p2_fwrapper ) ; SVDBIndexCollection p1_index = p1_pdata . getProjectIndexMgr ( ) ; SVDBIndexCollection p2_index = p2_pdata . getProjectIndexMgr ( ) ; List < SVDBDeclCacheItem > result = p2_index . findGlobalScopeDecl ( new NullProgressMonitor ( ) , "p1_c" , SVDBFindDefaultNameMatcher . getDefault ( ) ) ; assertEquals ( 1 , result . size ( ) ) ; SVDBDeclCacheItem p1_c = result . get ( 0 ) ; assertEquals ( "p1_c" , p1_c . getName ( ) ) ; assertEquals (
1,291
<s> package com . mcbans . firestar . mcbans ; import com . mcbans . firestar . mcbans . bukkitListeners . PlayerListener ; import com . mcbans . firestar . mcbans . callBacks . BanSync ; import com . mcbans . firestar . mcbans . callBacks . MainCallBack ; import com . mcbans . firestar . mcbans . callBacks . serverChoose ; import com . mcbans . firestar . mcbans . commands . CommandHandler ; import com . mcbans . firestar . mcbans . log . ActionLog ; import com . mcbans . firestar . mcbans . log . LogLevels ; import com . mcbans . firestar . mcbans . log . Logger ; import de . diddiz . LogBlock . LogBlock ; import fr . neatmonster . nocheatplus . NoCheatPlus ; import org . bukkit . command . Command ; import org . bukkit . command . CommandSender ; import org . bukkit . entity . Player ; import org . bukkit . plugin . Plugin ; import org . bukkit . plugin . PluginManager ; import org . bukkit . plugin . java . JavaPlugin ; import java . util . HashMap ; public class BukkitInterface extends JavaPlugin { private CommandHandler commandHandle ; private PlayerListener bukkitPlayer = new PlayerListener ( this ) ; public int taskID = 0 ; public HashMap < String , Integer > connectionData = new HashMap < String , Integer > ( ) ; public HashMap < String , Long > resetTime = new HashMap < String , Long > ( ) ; public Settings Settings ; public Language Language = null ; public Thread callbackThread = null ; public Thread syncBan = null ; public boolean syncRunning = false ; public long lastID = 0 ; public ActionLog actionLog = null ; public LogBlock logblock = null ; public long lastCallBack = 0 ; public long lastSync = 0 ; public NoCheatPlus noCheatPlus = null ; public boolean notSelectedServer = true ; public String apiServers = "" ; public String apiServer = "" ; private String apiKey = "" ; public BukkitPermissions Permissions = null ; public Logger logger = new Logger ( this ) ; public void onDisable ( ) { if ( callbackThread != null ) { if ( callbackThread . isAlive ( ) ) { callbackThread . interrupt ( ) ; } } if ( syncBan != null ) { if ( syncBan . isAlive ( ) ) { syncBan . interrupt ( ) ; } } log ( LogLevels . INFO , "" ) ; } public void onEnable ( ) { PluginManager pm = getServer ( ) . getPluginManager ( ) ; pm . registerEvents ( bukkitPlayer , this ) ; if ( ! this . getServer ( ) . getOnlineMode ( ) ) { logger . log ( LogLevels . FATAL , "" ) ; pm . disablePlugin ( pluginInterface ( "mcbans" ) ) ; return ; } Settings = new Settings ( ) ; if ( Settings . exists ) { pm . disablePlugin ( pluginInterface ( "mcbans" ) ) ; return ; } this . apiKey = Settings . getString ( "apiKey" ) ; String language ; language = Settings . getString ( "language" ) ; log ( LogLevels . INFO , "" + language ) ; Language = new Language ( this ) ; if ( Settings . getBoolean ( "logEnable" ) ) { log ( LogLevels . INFO , "" ) ; actionLog = new ActionLog ( this , Settings . getString ( "logFile" ) ) ; actionLog . write ( "" ) ; } else { log ( LogLevels . INFO , "" ) ; } Permissions
1,292
<s> package org . rubypeople . rdt . internal . ui . workingsets ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . ActionContributionItem ; import org . eclipse . jface . action . IContributionItem ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . util . Assert ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IWorkbenchPartSite ; import org . eclipse . ui . actions . ActionGroup ; public class WorkingSetShowActionGroup extends ActionGroup implements IWorkingSetActionGroup { private List fContributions = new ArrayList ( ) ; private ConfigureWorkingSetAction fConfigureWorkingSetAction ; private WorkingSetModel fWorkingSetModel ; private final IWorkbenchPartSite fSite ; public WorkingSetShowActionGroup ( IWorkbenchPartSite site ) { Assert . isNotNull ( site ) ; fSite = site ; } public void setWorkingSetMode ( WorkingSetModel model ) { Assert . isNotNull ( model ) ; fWorkingSetModel = model ; if ( fConfigureWorkingSetAction != null ) fConfigureWorkingSetAction . setWorkingSetModel ( fWorkingSetModel ) ; } public void fillActionBars ( IActionBars actionBars ) { super . fillActionBars ( actionBars ) ; IMenuManager menuManager = actionBars . getMenuManager
1,293
<s> package com . sun . tools . hat . internal . model ; import com . sun . tools . hat . internal . util . Misc ; public class Root { private final long id ; private final long refererId ; private int index = - 1 ; private final int type ; private final String description ; private JavaHeapObject referer = null ; private StackTrace stackTrace = null ; public final static int INVALID_TYPE = 0 ; public final static int UNKNOWN = 1 ; public final static int SYSTEM_CLASS = 2 ; public final static int NATIVE_LOCAL = 3 ; public final static int NATIVE_STATIC = 4 ; public final static int THREAD_BLOCK = 5 ; public final static int BUSY_MONITOR = 6 ; public final static int JAVA_LOCAL = 7 ; public final static int NATIVE_STACK = 8 ; public final static int JAVA_STATIC = 9 ; public Root ( long id , long refererId , int type , String description ) { this ( id , refererId , type , description , null ) ; } public Root ( long id , long refererId , int type , String description , StackTrace stackTrace ) { this . id = id ; this . refererId = refererId ; this . type = type ; this . description = description ; this . stackTrace = stackTrace ; } public long getId ( ) { return id ; } public String getIdString ( ) { return Misc . toHex ( id ) ; } public String getDescription ( ) { if ( "" . equals ( description ) ) { return getTypeName ( ) + " Reference" ; } else { return description ; } } public int getType ( ) { return type ; } public String getTypeName ( ) { switch ( type )
1,294
<s> package org . rubypeople . rdt . refactoring . editprovider ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . IScopingNode ; import org . jruby . ast . Node ; public class ScopingNodeRenameEditProvider { private final Collection < ? extends IScopingNode > nodes ; private final String newName ; public ScopingNodeRenameEditProvider ( Collection < ? extends IScopingNode > nodes , String newName ) { this . nodes = nodes ; this . newName = newName ; } public Collection < FileEditProvider > getEditProviders ( ) { Collection < FileEditProvider >
1,295
<s> package org . springframework . samples . petclinic ; import java . util . Collection ; import java . util . Date ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertTrue ; import org . joda . time . LocalDate ; import org . junit . Test ; import org . springframework . beans . factory . annotation . Autowired ; import org . springframework . samples . petclinic . util . EntityUtils ; import org . springframework . test . context . ContextConfiguration ; import org . springframework . test . context . junit4 . AbstractTransactionalJUnit4SpringContextTests ; @ ContextConfiguration public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4SpringContextTests { @ Autowired protected Clinic clinic ; @ Test public void getVets ( ) { Collection < Vet > vets = this . clinic . getVets ( ) ; assertEquals ( "" , super . countRowsInTable ( "vets" ) , vets . size ( ) ) ; Vet v1 = EntityUtils . getById ( vets , Vet . class , 2 ) ; assertEquals ( "Leary" , v1 . getLastName ( ) ) ; assertEquals ( 1 , v1 . getNrOfSpecialties ( ) ) ; assertEquals ( "radiology" , ( v1 . getSpecialties ( ) . get ( 0 ) ) . getName ( ) ) ; Vet v2 = EntityUtils . getById ( vets , Vet . class , 3 ) ; assertEquals ( "Douglas" , v2 . getLastName ( ) ) ; assertEquals ( 2 , v2 . getNrOfSpecialties ( ) ) ; assertEquals ( "dentistry" , ( v2 . getSpecialties ( ) . get ( 0 ) ) . getName ( ) ) ; assertEquals ( "surgery" , ( v2 . getSpecialties ( ) . get ( 1 ) ) . getName ( ) ) ; } @ Test public void getPetTypes ( ) { Collection < PetType > petTypes = this . clinic . getPetTypes ( ) ; assertEquals ( "" , super . countRowsInTable ( "types" ) , petTypes . size ( ) ) ; PetType t1 = EntityUtils . getById ( petTypes , PetType . class , 1 ) ; assertEquals ( "cat" , t1 . getName ( ) ) ; PetType t4 = EntityUtils . getById ( petTypes , PetType . class , 4 ) ; assertEquals ( "snake" , t4 . getName ( ) ) ; } @ Test public void findOwners ( ) { Collection < Owner > owners = this . clinic . findOwners ( "Davis" ) ; assertEquals ( 2 , owners . size ( ) ) ; owners = this . clinic . findOwners ( "Daviss" ) ; assertEquals ( 0 , owners . size ( ) ) ; } @ Test public void loadOwner ( ) { Owner o1 = this . clinic . loadOwner ( 1 ) ; assertTrue ( o1 . getLastName ( ) . startsWith ( "Franklin" ) ) ; Owner o10 = this . clinic . loadOwner ( 10 ) ; assertEquals ( "Carlos" , o10 . getFirstName ( ) ) ; o1 . getPets ( ) ; } @ Test public void insertOwner ( ) { Collection < Owner > owners = this . clinic . findOwners ( "Schultz" ) ; int found = owners . size ( ) ; Owner owner = new Owner ( ) ; owner . setLastName ( "Schultz" ) ; this . clinic . storeOwner ( owner ) ; owners = this . clinic . findOwners ( "Schultz" ) ; assertEquals ( "" , found + 1 , owners . size ( ) ) ; } @ Test public void updateOwner ( ) throws Exception { Owner o1 = this . clinic . loadOwner ( 1 ) ; String old = o1 . getLastName ( ) ; o1 . setLastName ( old + "X" ) ; this . clinic . storeOwner ( o1 ) ; o1 = this . clinic . loadOwner ( 1 ) ; assertEquals ( old + "X" , o1 . getLastName ( ) ) ; } @ Test public void loadPet ( ) { Collection < PetType > types = this . clinic . getPetTypes ( ) ; Pet p7 = this . clinic . loadPet ( 7 ) ; assertTrue ( p7 . getName ( ) . startsWith ( "Samantha" ) ) ; assertEquals ( EntityUtils . getById ( types , PetType . class , 1 ) . getId ( ) , p7 . getType ( ) . getId ( ) ) ; assertEquals ( "Jean" , p7 . getOwner ( ) . getFirstName ( ) ) ; Pet p6 = this . clinic . loadPet ( 6 ) ; assertEquals ( "George" , p6 . getName ( ) ) ; assertEquals ( EntityUtils . getById ( types , PetType . class , 4 ) . getId ( ) , p6 . getType ( ) . getId ( ) ) ; assertEquals ( "Peter" , p6 . getOwner ( ) . getFirstName ( ) ) ; } @ Test public void insertPet ( ) { Owner o6 = this . clinic . loadOwner ( 6 ) ; int found = o6 . getPets ( ) . size ( ) ; Pet pet = new Pet ( ) ;
1,296
<s> package org . rubypeople . rdt . internal . ui . packageview ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . rubypeople . rdt . internal . ui .
1,297
<s> package de . fuberlin . wiwiss . d2rq . algebra ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Set ; import junit . framework . TestCase ; import com . hp . hpl . jena . graph . Node ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . nodes . FixedNodeMaker ; import de . fuberlin . wiwiss . d2rq . nodes . TypedNodeMaker ; import de . fuberlin . wiwiss . d2rq . values . Column ; import de . fuberlin . wiwiss . d2rq . values . Pattern ; public class TripleRelationTest extends
1,298
<s> package com . asakusafw . compiler . flow . processor . operator ; import com . asakusafw . compiler . flow . processor . ExtractFlowProcessor ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . vocabulary . operator . Extract ; public abstract class ExtractFlow { @ Extract public void op1 ( Ex1 a1 , Result < Ex1 > r1 ) {
1,299
<s> package com . asakusafw . yaess . paralleljob ; import java . text . MessageFormat ; import java . util . ResourceBundle ; import com . asakusafw . yaess . core . YaessLogger ; public class YaessParallelJobLogger extends YaessLogger { private static final ResourceBundle BUNDLE = ResourceBundle . getBundle ( "" ) ; public YaessParallelJobLogger ( Class < ? > target ) { super ( target ,