| /******************************************************************************* |
| * Copyright (c) 2010 Oracle. 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: |
| * Oracle - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.jpt.ui.internal.libprov; |
| |
| import static org.eclipse.jpt.core.internal.libprov.TempWtpUserLibraryProviderInstallOperationConfig.*; |
| import org.eclipse.jpt.core.internal.libprov.TempWtpUserLibraryProviderInstallOperationConfig; |
| import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; |
| import org.eclipse.jst.common.project.facet.ui.libprov.user.UserLibraryProviderInstallPanel; |
| import org.eclipse.osgi.util.NLS; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.events.DisposeEvent; |
| import org.eclipse.swt.events.DisposeListener; |
| import org.eclipse.swt.events.SelectionAdapter; |
| import org.eclipse.swt.events.SelectionEvent; |
| import org.eclipse.swt.widgets.Button; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Control; |
| |
| /** |
| * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> |
| */ |
| |
| public class TempWtpUserLibraryProviderInstallPanel |
| |
| extends UserLibraryProviderInstallPanel |
| |
| { |
| @Override |
| protected Control createControlNextToManageHyperlink( final Composite composite ) |
| { |
| final TempWtpUserLibraryProviderInstallOperationConfig cfg |
| = (TempWtpUserLibraryProviderInstallOperationConfig) getOperationConfig(); |
| |
| final Button copyOnPublishCheckBox = new Button( composite, SWT.CHECK ); |
| copyOnPublishCheckBox.setText( Resources.copyLibraries ); |
| copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() ); |
| copyOnPublishCheckBox.setEnabled( cfg.isIncludeWithApplicationSettingEnabled() ); |
| |
| copyOnPublishCheckBox.addSelectionListener |
| ( |
| new SelectionAdapter() |
| { |
| @Override |
| public void widgetSelected( final SelectionEvent event ) |
| { |
| cfg.setIncludeWithApplicationEnabled( copyOnPublishCheckBox.getSelection() ); |
| } |
| } |
| ); |
| |
| final IPropertyChangeListener listener = new IPropertyChangeListener() |
| { |
| public void propertyChanged( final String property, |
| final Object oldValue, |
| final Object newValue ) |
| { |
| if( PROP_INCLUDE_WITH_APPLICATION_ENABLED.equals( property )) |
| { |
| copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() ); |
| } |
| else if( PROP_INCLUDE_WITH_APPLICATION_SETTING_ENABLED.equals( property ) ) |
| { |
| copyOnPublishCheckBox.setEnabled( cfg.isIncludeWithApplicationSettingEnabled() ); |
| } |
| } |
| }; |
| |
| cfg.addListener( listener, PROP_INCLUDE_WITH_APPLICATION_ENABLED, PROP_INCLUDE_WITH_APPLICATION_SETTING_ENABLED ); |
| |
| copyOnPublishCheckBox.addDisposeListener |
| ( |
| new DisposeListener() |
| { |
| public void widgetDisposed( final DisposeEvent event ) |
| { |
| cfg.removeListener( listener ); |
| } |
| } |
| ); |
| |
| return copyOnPublishCheckBox; |
| } |
| |
| private static final class Resources |
| |
| extends NLS |
| |
| { |
| public static String copyLibraries; |
| |
| static |
| { |
| initializeMessages( TempWtpUserLibraryProviderInstallPanel.class.getName(), |
| Resources.class ); |
| } |
| } |
| } |