sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.util/src/com/nokia/carbide/cpp/pi/util/SourceLookupFileChooserDialog.java
changeset 12 ae255c9aa552
parent 2 b9ab3b238396
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
    41 import com.nokia.carbide.cpp.ui.CarbideUIPlugin;
    41 import com.nokia.carbide.cpp.ui.CarbideUIPlugin;
    42 import com.nokia.carbide.cpp.ui.ICarbideSharedImages;
    42 import com.nokia.carbide.cpp.ui.ICarbideSharedImages;
    43 
    43 
    44 public class SourceLookupFileChooserDialog extends TitleAreaDialog {
    44 public class SourceLookupFileChooserDialog extends TitleAreaDialog {
    45 
    45 
    46 	IASTFileLocation[] locations = null;
    46 	private IASTFileLocation[] locations = null;
    47 	IASTFileLocation selectedLocation = null;
    47 	private IASTFileLocation selectedLocation = null;
    48 	
    48 	
    49 	// control
    49 	// control
    50 	private Composite composite = null;
    50 	private Composite composite = null;
    51 	private Table table = null;
    51 	private Table table = null;
    52 
    52 
    53 	protected SourceLookupFileChooserDialog(Shell arg0, IASTFileLocation[] locs) {
    53 	protected SourceLookupFileChooserDialog(final Shell arg0, final IASTFileLocation[] locs) {
    54 		super(arg0);
    54 		super(arg0);
    55 		locations = locs;
    55 		locations = locs;
    56 	}
    56 	}
    57 	
    57 	
    58 	public Control createDialogArea(Composite parent) {
    58 	public Control createDialogArea(final Composite parent) {
    59 		// use image from support plugin
    59 		// use image from support plugin
    60 		setDefaultImage(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_CARBIDE_C_ICON_16_16).createImage());
    60 		setDefaultImage(CarbideUIPlugin.getSharedImages().getImageDescriptor(ICarbideSharedImages.IMG_CARBIDE_C_ICON_16_16).createImage());
    61 		getShell().setText(Messages.getString("SourceLookupFileChooserDialog.text")); //$NON-NLS-1$
    61 		getShell().setText(Messages.getString("SourceLookupFileChooserDialog.text")); //$NON-NLS-1$
    62 		setTitle(Messages.getString("SourceLookupFileChooserDialog.title")); //$NON-NLS-1$
    62 		setTitle(Messages.getString("SourceLookupFileChooserDialog.title")); //$NON-NLS-1$
    63 		setMessage(Messages.getString("SourceLookupFileChooserDialog.message")); //$NON-NLS-1$
    63 		setMessage(Messages.getString("SourceLookupFileChooserDialog.message")); //$NON-NLS-1$
    69 		composite.setLayout(gridLayout);
    69 		composite.setLayout(gridLayout);
    70 				
    70 				
    71 	    table = new Table(composite, SWT.SINGLE);
    71 	    table = new Table(composite, SWT.SINGLE);
    72 	    table.addSelectionListener(new SelectionListener() {
    72 	    table.addSelectionListener(new SelectionListener() {
    73 
    73 
    74 			public void widgetDefaultSelected(SelectionEvent arg0) {
    74 			public void widgetDefaultSelected(final SelectionEvent arg0) {
    75 			}
    75 			}
    76 
    76 
    77 			public void widgetSelected(SelectionEvent arg0) {
    77 			public void widgetSelected(final SelectionEvent arg0) {
    78 				selectedLocation = (IASTFileLocation)table.getSelection()[0].getData();
    78 				selectedLocation = (IASTFileLocation)table.getSelection()[0].getData();
    79 			}
    79 			}
    80 	    	
    80 	    	
    81 	    });
    81 	    });
    82 	    table.addMouseListener(new MouseListener(){
    82 	    table.addMouseListener(new MouseListener(){
    83 	    	// allow double click instead of OK
    83 	    	// allow double click instead of OK
    84 			public void mouseDoubleClick(MouseEvent arg0) {
    84 			public void mouseDoubleClick(final MouseEvent arg0) {
    85 				selectedLocation = (IASTFileLocation)table.getSelection()[0].getData();
    85 				selectedLocation = (IASTFileLocation)table.getSelection()[0].getData();
    86 				okPressed();
    86 				okPressed();
    87 			}
    87 			}
    88 
    88 
    89 			public void mouseDown(MouseEvent arg0) {
    89 			public void mouseDown(final MouseEvent arg0) {
    90 			}
    90 			}
    91 
    91 
    92 			public void mouseUp(MouseEvent arg0) {
    92 			public void mouseUp(final MouseEvent arg0) {
    93 			}
    93 			}
    94 	    	
    94 	    	
    95 	    });
    95 	    });
    96 	    
    96 	    
    97 	    for(IASTFileLocation location : locations) {
    97 	    for(IASTFileLocation location : locations) {