Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: 82c464941ce996f6da13f04dd63faaff0d46e9bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*******************************************************************************
 * Copyright (c) 2004, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets;

import org.eclipse.jst.ws.internal.ui.WSUIPluginMessages;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;


public class PreferencesSelectionWidget extends SimpleWidgetDataContributor
{    
  private ResourceContext context_;
  
  /*CONTEXT_ID PWPR0003 for the Overwrite Files check box of the Project Page*/
  private String INFOPOP_PWPR_CHECKBOX_OVERWRITE_FILES = "PWPR0003";
  private Button overwriteFilesCheckbox_;
  
  /*CONTEXT_ID PWPR0004 for the Create Folders check box of the Project Page*/
  private String INFOPOP_PWPR_CHECKBOX_CREATE_FOLDERS = "PWPR0004";
  private Button createFoldersCheckbox_;
  
  /*CONTEXT_ID PWPR0015 for the Check Out Files check box of the Project Page*/
  private String INFOPOP_PWPR_CHECKBOX_CHECKOUT_FILES = "PWPR0015";  
  private Button checkoutFilesCheckbox_;
  
  /* (non-Javadoc)
   * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#addControls(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Listener)
   */
  public WidgetDataEvents addControls( Composite parent, Listener statusListener)
  {
    String       conPluginId = "org.eclipse.jst.ws.consumption.ui";
  	UIUtils      utils       = new UIUtils( conPluginId );
  	
    Composite resourcesGroup = utils.createComposite( parent, 1 );
    
    overwriteFilesCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_OVERWRITE_FILES,
    		WSUIPluginMessages.TOOLTIP_PPRM_CHECKBOX_OVERWRITE_FILES, 
                                                    INFOPOP_PWPR_CHECKBOX_OVERWRITE_FILES );
                                                 
    createFoldersCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_CREATE_FOLDERS,
    		WSUIPluginMessages.TOOLTIP_PPRM_CHECKBOX_CREATE_FOLDERS , 
                                                   INFOPOP_PWPR_CHECKBOX_CREATE_FOLDERS );
                                                      
    checkoutFilesCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_CHECKOUT_FILES,
    		WSUIPluginMessages.TOOLTIP_PPRM_CHECKBOX_CHECK_OUT, 
                                                   INFOPOP_PWPR_CHECKBOX_CHECKOUT_FILES );
    
    return this;
  }

  public void setResourceContext( ResourceContext context )
  { 
    overwriteFilesCheckbox_.setSelection( context.isOverwriteFilesEnabled() );
    createFoldersCheckbox_.setSelection( context.isCreateFoldersEnabled() );
    checkoutFilesCheckbox_.setSelection( context.isCheckoutFilesEnabled() ); 
    
    context_ = context;
  }
  
  public ResourceContext getResourceContext() 
  {    
    context_.setOverwriteFilesEnabled( overwriteFilesCheckbox_.getSelection() );
    context_.setCreateFoldersEnabled( createFoldersCheckbox_.getSelection() );
    context_.setCheckoutFilesEnabled( checkoutFilesCheckbox_.getSelection() );
    
    return context_;
  }
}

Back to the top