1 package net.sourceforge.phpdt.externaltools.variable;
 
   3 /**********************************************************************
 
   4  Copyright (c) 2002 IBM Corp. and others. All rights reserved.
 
   5  This file is made available under the terms of the Common Public License v1.0
 
   6  which accompanies this distribution, and is available at
 
   7  http://www.eclipse.org/legal/cpl-v10.html
 
  10  **********************************************************************/
 
  12 import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages;
 
  14 import org.eclipse.core.resources.IResource;
 
  15 import org.eclipse.jface.dialogs.IMessageProvider;
 
  16 import org.eclipse.jface.viewers.IStructuredSelection;
 
  17 import org.eclipse.swt.SWT;
 
  18 import org.eclipse.swt.layout.GridData;
 
  19 import org.eclipse.swt.widgets.Label;
 
  22  * Visual component to edit the resource type variable value for the file
 
  23  * location. Variable is limited to a specific <code>IFile</code> resource.
 
  25  * This class is not intended to be extended by clients.
 
  28 public class SpecificFileResourceComponent extends ResourceComponent {
 
  33         public SpecificFileResourceComponent() {
 
  38          * (non-Javadoc) Method declared on ResourceComponent.
 
  40         protected void createSelectedResourceOption() {
 
  41                 // Do not present this option...
 
  45          * (non-Javadoc) Method declared on ResourceComponent.
 
  47         protected void createSpecificResourceOption() {
 
  48                 Label label = new Label(mainGroup, SWT.NONE);
 
  49                 GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
 
  50                 label.setLayoutData(data);
 
  51                 label.setFont(mainGroup.getFont());
 
  52                 label.setText(ExternalToolsModelMessages
 
  53                                 .getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$
 
  57          * (non-Javadoc) Method declared on ResourceComponent.
 
  59         protected boolean validateResourceListSelection() {
 
  60                 if (resourceList == null)
 
  63                 IStructuredSelection sel = (IStructuredSelection) resourceList
 
  65                 IResource resource = (IResource) sel.getFirstElement();
 
  66                 if (resource == null || resource.getType() != IResource.FILE) {
 
  69                                                         ExternalToolsModelMessages
 
  70                                                                         .getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$