[openrtm-commit:02459] r681 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder: nl ui/editors ui/wizard
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 19日 (日) 14:35:26 JST
Author: ga
Date: 2017-02-19 14:35:26 +0900 (Sun, 19 Feb 2017)
New Revision: 681
Removed:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizard.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizardPage.java
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/nl/messages.properties
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/BasicEditorFormPage.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/IMessageConstants.java
Log:
Remove "Packaging" button in Basic Tab. #3961
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/nl/messages.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/nl/messages.properties 2017-02-19 04:59:13 UTC (rev 680)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/nl/messages.properties 2017-02-19 05:35:26 UTC (rev 681)
@@ -3,12 +3,12 @@
IMessageConstants.BASIC_SECTION=Basic
IMessageConstants.BASIC_COMPONENT_TITLE=RT-Component Basic Profile
IMessageConstants.BASIC_PROJECT_TITLE=Output Project
-IMessageConstants.BASIC_GENERATE_TITLE=Code Generation and Packaging
+IMessageConstants.BASIC_GENERATE_TITLE=Code Generation
IMessageConstants.BASIC_EXPORT_IMPORT_TITLE=Import/Export Profile information
IMessageConstants.BASIC_COMPONENT_EXPL=This section defines RT-Component Basic information.
IMessageConstants.BASIC_PROJECT_EXPL=Specifies the directory that outputs RTC Project.
-IMessageConstants.BASIC_GENERATE_EXPL=Generates code and Packaging.
+IMessageConstants.BASIC_GENERATE_EXPL=Generates code.
IMessageConstants.BASIC_EXPORT_IMPORT_EXPL=Imports/Exports Profile information
IMessageConstants.BASIC_HINT_MODULENAME_TITLE=Module name :
@@ -68,9 +68,6 @@
IMessageConstants.BASIC_HINT_PROJECT_DESC_P5=\uff65Input a project name directly.
IMessageConstants.BASIC_HINT_GENERATE_TITLE=Code Generation :
IMessageConstants.BASIC_HINT_GENERATE_DESC=Generates RTC skeleton code based on its configuration.
-IMessageConstants.BASIC_HINT_PACKAGE_TITLE=Packaging :
-IMessageConstants.BASIC_HINT_PACKAGE_DESC_P1=Archives RTC source code and
-IMessageConstants.BASIC_HINT_PACKAGE_DESC_P2=the execution binary code etc in various forms.
IMessageConstants.BASIC_HINT_IMPORT_TITLE=Import :
IMessageConstants.BASIC_HINT_IMPORT_DESC=Loads the saved contents in RtcProfile format.
IMessageConstants.BASIC_HINT_EXPORT_TITLE=Packaging and Export :
@@ -92,7 +89,6 @@
IMessageConstants.BASIC_BTN_REF=Browse...
IMessageConstants.BASIC_BTN_GENERATE=Code Generation
-IMessageConstants.BASIC_BTN_PACKAGING=Packaging
IMessageConstants.BASIC_BTN_IMPORT=Import
IMessageConstants.BASIC_BTN_EXPORT=Export
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/BasicEditorFormPage.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/BasicEditorFormPage.java 2017-02-19 04:59:13 UTC (rev 680)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/BasicEditorFormPage.java 2017-02-19 05:35:26 UTC (rev 681)
@@ -20,7 +20,6 @@
import jp.go.aist.rtm.rtcbuilder.manager.GenerateManager;
import jp.go.aist.rtm.rtcbuilder.ui.Perspective.LanguageProperty;
import jp.go.aist.rtm.rtcbuilder.ui.preference.ComponentPreferenceManager;
-import jp.go.aist.rtm.rtcbuilder.ui.wizard.RtcExportWizard;
import jp.go.aist.rtm.rtcbuilder.util.FileUtil;
import jp.go.aist.rtm.rtcbuilder.util.StringUtil;
@@ -37,7 +36,6 @@
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -296,7 +294,6 @@
createHintSpace(toolkit, composite);
//
createHintLabel(IMessageConstants.BASIC_HINT_GENERATE_TITLE, IMessageConstants.BASIC_HINT_GENERATE_DESC, toolkit, composite);
- createHintLabel(IMessageConstants.BASIC_HINT_PACKAGE_TITLE, IMessageConstants.BASIC_HINT_PACKAGE_DESC, toolkit, composite);
//
createHintSpace(toolkit, composite);
//
@@ -307,22 +304,9 @@
private void createGenerateSection(FormToolkit toolkit, ScrolledForm form) {
generateSection = createSectionBaseWithLabel(toolkit, form,
IMessageConstants.BASIC_GENERATE_TITLE, IMessageConstants.BASIC_GENERATE_EXPL, 2);
- //
createGenerateButton(toolkit);
- createPackageButton(toolkit);
}
- private void createPackageButton(FormToolkit toolkit) {
- packageButton = toolkit.createButton(generateSection, IMessageConstants.BASIC_BTN_PACKAGING, SWT.NONE);
- packageButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- WizardDialog dialog = new WizardDialog(getSite().getShell(), new RtcExportWizard());
- dialog.open();
- }
- });
- }
-
private void createGenerateButton(FormToolkit toolkit) {
generateButton = toolkit.createButton(generateSection, IMessageConstants.BASIC_BTN_GENERATE, SWT.NONE);
generateButton.addSelectionListener(new SelectionAdapter() {
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/IMessageConstants.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/IMessageConstants.java 2017-02-19 04:59:13 UTC (rev 680)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/editors/IMessageConstants.java 2017-02-19 05:35:26 UTC (rev 681)
@@ -89,10 +89,6 @@
public static final String BASIC_HINT_PROJECT_DESC = StringUtil.connectMessageWithSepalator( new String[]{BASIC_HINT_PROJECT_DESC_P1, BASIC_HINT_PROJECT_DESC_P2, BASIC_HINT_PROJECT_DESC_P3, BASIC_HINT_PROJECT_DESC_P4, BASIC_HINT_PROJECT_DESC_P5});
public static final String BASIC_HINT_GENERATE_TITLE = Messages.getString("IMessageConstants.BASIC_HINT_GENERATE_TITLE"); //$NON-NLS-1$
public static final String BASIC_HINT_GENERATE_DESC = Messages.getString("IMessageConstants.BASIC_HINT_GENERATE_DESC"); //$NON-NLS-1$
- public static final String BASIC_HINT_PACKAGE_TITLE = Messages.getString("IMessageConstants.BASIC_HINT_PACKAGE_TITLE"); //$NON-NLS-1$
- public static final String BASIC_HINT_PACKAGE_DESC_P1 = Messages.getString("IMessageConstants.BASIC_HINT_PACKAGE_DESC_P1"); //$NON-NLS-1$
- public static final String BASIC_HINT_PACKAGE_DESC_P2 = Messages.getString("IMessageConstants.BASIC_HINT_PACKAGE_DESC_P2"); //$NON-NLS-1$
- public static final String BASIC_HINT_PACKAGE_DESC = StringUtil.connectMessageWithSepalator( new String[]{BASIC_HINT_PACKAGE_DESC_P1, BASIC_HINT_PACKAGE_DESC_P2});
public static final String BASIC_HINT_IMPORT_TITLE = Messages.getString("IMessageConstants.BASIC_HINT_IMPORT_TITLE"); //$NON-NLS-1$
public static final String BASIC_HINT_IMPORT_DESC = Messages.getString("IMessageConstants.BASIC_HINT_IMPORT_DESC"); //$NON-NLS-1$
public static final String BASIC_HINT_EXPORT_TITLE = Messages.getString("IMessageConstants.BASIC_HINT_EXPORT_TITLE"); //$NON-NLS-1$
@@ -114,7 +110,6 @@
public static final String BASIC_BTN_REF = Messages.getString("IMessageConstants.BASIC_BTN_REF"); //$NON-NLS-1$
public static final String BASIC_BTN_GENERATE = Messages.getString("IMessageConstants.BASIC_BTN_GENERATE"); //$NON-NLS-1$
- public static final String BASIC_BTN_PACKAGING = Messages.getString("IMessageConstants.BASIC_BTN_PACKAGING"); //$NON-NLS-1$
public static final String BASIC_BTN_IMPORT = Messages.getString("IMessageConstants.BASIC_BTN_IMPORT"); //$NON-NLS-1$
public static final String BASIC_BTN_EXPORT = Messages.getString("IMessageConstants.BASIC_BTN_EXPORT"); //$NON-NLS-1$
Deleted: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizard.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizard.java 2017-02-19 04:59:13 UTC (rev 680)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizard.java 2017-02-19 05:35:26 UTC (rev 681)
@@ -1,64 +0,0 @@
-package jp.go.aist.rtm.rtcbuilder.ui.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class RtcExportWizard extends Wizard implements IExportWizard {
- private IStructuredSelection selection;
-
- private RtcExportWizardPage mainPage;
-
- /**
- * Creates a wizard for exporting workspace resources to a zip file.
- */
- @SuppressWarnings("deprecation")
- public RtcExportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("RtcExportWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("RtcExportWizard");//$NON-NLS-1$
- }
- setDialogSettings(section);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- super.addPages();
- mainPage = new RtcExportWizardPage(selection);
- addPage(mainPage);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
- @SuppressWarnings("unchecked")
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.selection = currentSelection;
- List selectedResources = IDE.computeSelectedResources(currentSelection);
- if (!selectedResources.isEmpty()) {
- this.selection = new StructuredSelection(selectedResources);
- }
- setWindowTitle(IWizardMessageConstants.EXPORT_TITLE);
- setNeedsProgressMonitor(true);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- return mainPage.finish();
- }
-}
Deleted: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizardPage.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizardPage.java 2017-02-19 04:59:13 UTC (rev 680)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/ui/wizard/RtcExportWizardPage.java 2017-02-19 05:35:26 UTC (rev 681)
@@ -1,605 +0,0 @@
-package jp.go.aist.rtm.rtcbuilder.ui.wizard;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import jp.go.aist.rtm.rtcbuilder.ui.preference.ExportPreferenceManager;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.dialogs.WizardExportResourcesPage;
-import org.eclipse.ui.internal.wizards.datatransfer.ArchiveFileExportOperation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
- at SuppressWarnings("restriction")
-public class RtcExportWizardPage extends WizardExportResourcesPage {
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(RtcExportWizardPage.class);
-
- private final static String STORE_DESTINATION_NAMES_ID = "RtcExportWizardPage.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$
- private final static String STORE_CREATE_STRUCTURE_ID = "RtcExportWizardPage.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$
- private final static String STORE_COMPRESS_CONTENTS_ID = "RtcExportWizardPage.STORE_COMPRESS_CONTENTS_ID"; //$NON-NLS-1$
-
- private Combo destinationNameField;
- private Button destinationBrowseButton;
- //
- private Button sourceArchiveButton;
- private Button binaryArchiveButton;
- private Button sourcebinaryArchiveButton;
- //
- private Button compressContentsCheckbox;
- private Button zipFormatButton;
-// private Button bzipFormatButton;
- private Button targzFormatButton;
- //
- private Button createDirectoryStructureButton;
- private Button createSelectionOnlyButton;
- //
- private org.eclipse.swt.widgets.List targetProjectList;
- private IResource[] targetProjects;
- //
- private ArrayList<String> sourceExt = new ArrayList<String>();
- private ArrayList<String> sourceFile = new ArrayList<String>();
- private ArrayList<String> binaryExt = new ArrayList<String>();
- private ArrayList<String> binaryFile = new ArrayList<String>();
- private ArrayList<String> sourcebinaryExt = new ArrayList<String>();
- private ArrayList<String> sourcebinaryFile = new ArrayList<String>();
-
- /**
- * Create an instance of this class.
- *
- * @param name java.lang.String
- */
- protected RtcExportWizardPage(String name, IStructuredSelection selection) {
- super(name, selection);
- }
-
- /**
- * Create an instance of this class
- * @param selection the selection
- */
- public RtcExportWizardPage(IStructuredSelection selection) {
- this("RtcExportPage1", selection); //$NON-NLS-1$
- setTitle(IWizardMessageConstants.EXPORT_PAGE_TITLE);
- setDescription(IWizardMessageConstants.EXPORT_PAGE_DESCRIPTION);
- //
- sourceExt = ExportPreferenceManager.getInstance().getExportSourceExt();
- sourceFile = ExportPreferenceManager.getInstance().getExportSourceFile();
- ////
- binaryExt = ExportPreferenceManager.getInstance().getExportBinaryExt();
- binaryFile = ExportPreferenceManager.getInstance().getExportBinaryFile();
- ////
- sourcebinaryExt = ExportPreferenceManager.getInstance().getExportSourceBinaryExt();
- sourcebinaryFile = ExportPreferenceManager.getInstance().getExportSourceBinaryFile();
- }
-
- /** (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setFont(parent.getFont());
-
- createTargetProjectGroup(composite);
- createDestinationGroup(composite);
- createKindGroup(composite);
- createOptionsGroup(composite);
-
- restoreWidgetValues();
-
- setControl(composite);
- setPageComplete(false);
- }
-
- protected void createOptionsGroup(Composite parent) {
- Group optionsGroup = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL));
- optionsGroup.setText(IWizardMessageConstants.EXPORT_PAGE_GRP_OPTION);
- optionsGroup.setFont(parent.getFont());
-
- Font font = optionsGroup.getFont();
- optionsGroup.setLayout(new GridLayout(2, true));
-
- Composite left = new Composite(optionsGroup, SWT.NONE);
- left.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
- left.setLayout(new GridLayout(1, true));
-
- createFileFormatOptions(left, font);
-
- // compress... checkbox
- compressContentsCheckbox = new Button(left, SWT.CHECK
- | SWT.LEFT);
- compressContentsCheckbox.setText(IWizardMessageConstants.EXPORT_PAGE_CHK_COMPRESS);
- compressContentsCheckbox.setFont(font);
-
- Composite right = new Composite(optionsGroup, SWT.NONE);
- right.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
- right.setLayout(new GridLayout(1, true));
-
- createDirectoryStructureOptions(right, font);
-
- // initial setup
- createDirectoryStructureButton.setSelection(true);
- createSelectionOnlyButton.setSelection(false);
- compressContentsCheckbox.setSelection(true);
- }
-
- protected void createDirectoryStructureOptions(Composite optionsGroup, Font font) {
- createDirectoryStructureButton = new Button(optionsGroup, SWT.RADIO
- | SWT.LEFT);
- createDirectoryStructureButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_CREATE_DIR);
- createDirectoryStructureButton.setSelection(false);
- createDirectoryStructureButton.setFont(font);
-
- createSelectionOnlyButton = new Button(optionsGroup, SWT.RADIO
- | SWT.LEFT);
- createSelectionOnlyButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_CREATE_DIR_ONLY);
- createSelectionOnlyButton.setSelection(true);
- createSelectionOnlyButton.setFont(font);
- }
-
- protected void createFileFormatOptions(Composite optionsGroup, Font font) {
- zipFormatButton = new Button(optionsGroup, SWT.RADIO | SWT.LEFT);
- zipFormatButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_ZIP);
- zipFormatButton.setSelection(true);
- zipFormatButton.setFont(font);
-
-// bzipFormatButton = new Button(optionsGroup, SWT.RADIO | SWT.LEFT);
-// bzipFormatButton.setText("BZIPフォーマットで保管");
-// bzipFormatButton.setSelection(false);
-// bzipFormatButton.setFont(font);
-
- targzFormatButton = new Button(optionsGroup, SWT.RADIO | SWT.LEFT);
- targzFormatButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_TAR);
- targzFormatButton.setSelection(false);
- targzFormatButton.setFont(font);
- }
-
- protected void createKindGroup(Composite parent) {
- Group kindGroup = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- kindGroup.setLayout(layout);
- kindGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL));
- kindGroup.setText(IWizardMessageConstants.EXPORT_PAGE_GRP_ARC);
- kindGroup.setFont(parent.getFont());
-
- Font font = kindGroup.getFont();
- kindGroup.setLayout(new GridLayout(3, true));
-
- sourceArchiveButton = new Button(kindGroup, SWT.RADIO | SWT.LEFT);
- sourceArchiveButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_SRC);
- sourceArchiveButton.setSelection(true);
- sourceArchiveButton.setFont(font);
-
- binaryArchiveButton = new Button(kindGroup, SWT.RADIO | SWT.LEFT);
- binaryArchiveButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_BIN);
- binaryArchiveButton.setSelection(false);
- binaryArchiveButton.setFont(font);
-
- sourcebinaryArchiveButton = new Button(kindGroup, SWT.RADIO | SWT.LEFT);
- sourcebinaryArchiveButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_SRC_BIN);
- sourcebinaryArchiveButton.setSelection(false);
- sourcebinaryArchiveButton.setFont(font);
- }
-
- protected void createDestinationGroup(Composite parent) {
-
- Font font = parent.getFont();
- // destination specification group
- Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- destinationSelectionGroup.setLayout(layout);
- destinationSelectionGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- destinationSelectionGroup.setFont(font);
-
- Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
- destinationLabel.setText(IWizardMessageConstants.EXPORT_PAGE_LBL_DEST);
- destinationLabel.setFont(font);
-
- // destination name entry field
- destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
- | SWT.BORDER);
- destinationNameField.addListener(SWT.Modify, this);
- destinationNameField.addListener(SWT.Selection, this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- destinationNameField.setLayoutData(data);
- destinationNameField.setFont(font);
- destinationNameField.addKeyListener(new KeyListener() {
- public void keyReleased(KeyEvent e) {
- doValidate();
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- // destination browse button
- destinationBrowseButton = new Button(destinationSelectionGroup,
- SWT.PUSH);
- destinationBrowseButton.setText(IWizardMessageConstants.EXPORT_PAGE_BTN_DEST);
- destinationBrowseButton.addListener(SWT.Selection, this);
- destinationBrowseButton.setFont(font);
- setButtonLayoutData(destinationBrowseButton);
-
- new Label(parent, SWT.NONE); // vertical spacer
- }
-
- protected void createTargetProjectGroup(Composite parent) {
-
- Font font = parent.getFont();
- // destination specification group
- Composite targetProjectSelectionGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- targetProjectSelectionGroup.setLayout(layout);
- targetProjectSelectionGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- targetProjectSelectionGroup.setFont(font);
-
- Label targetProjectLabel = new Label(targetProjectSelectionGroup, SWT.NONE);
- targetProjectLabel.setText(IWizardMessageConstants.EXPORT_PAGE_LBL_PJ);
- targetProjectLabel.setFont(font);
-
- targetProjectList = new org.eclipse.swt.widgets.List(targetProjectSelectionGroup, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 80;
- targetProjectList.setLayoutData(gd);
- targetProjectList.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- doValidate();
- }
- });
- try {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- targetProjects = root.members();
- for(int intIdx=0; intIdx<targetProjects.length; intIdx++) {
- targetProjectList.add(targetProjects[intIdx].getName());
- }
- } catch (CoreException e) {
- LOGGER.error("Fail to get resources", e);
- }
- }
-
- private void doValidate() {
- if( destinationNameField.getText() != null && !destinationNameField.getText().equals("") &&
- targetProjectList.getSelectionIndex() >= 0) {
- setPageComplete(true);
- } else {
- setPageComplete(false);
- }
- }
-
- public void handleEvent(Event event) {
- Widget source = event.widget;
-
- if (source == destinationBrowseButton) {
- handleDestinationBrowseButtonPressed();
- }
- }
-
- protected void handleDestinationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(getContainer().getShell(),
- SWT.SAVE);
- dialog.setText(IWizardMessageConstants.EXPORT_PAGE_DIR_DLG_TITLE);
- String selectedDirectoryName = dialog.open();
-
- if (selectedDirectoryName != null) {
- setErrorMessage(null);
- destinationNameField.setText(selectedDirectoryName);
- doValidate();
- }
- }
-
- @SuppressWarnings({ "unchecked" })
- public boolean finish() {
- List resourcesToExport = getTargetResources();
-
- if (!ensureTargetIsValid()) {
- return false;
- }
-
-// //Save dirty editors if possible but do not stop if not all are saved
- saveDirtyEditors();
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- return executeExportOperation(new ArchiveFileExportOperation(null,
- resourcesToExport, getDestinationValue()));
- }
-
- protected boolean executeExportOperation(ArchiveFileExportOperation op) {
- op.setCreateLeadupStructure(createDirectoryStructureButton
- .getSelection());
- op.setUseCompression(compressContentsCheckbox.getSelection());
- op.setUseTarFormat(targzFormatButton.getSelection());
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- IWizardMessageConstants.EXPORT_PAGE_MSG_EXPORT_PROBLEM,
- null, // no special message
- status);
- return false;
- }
- MessageDialog.openInformation(getContainer().getShell(), IWizardMessageConstants.EXPORT_PAGE_DLG_TITLE, IWizardMessageConstants.EXPORT_PAGE_MSG_FINISH);
-
- return true;
- }
-
- @SuppressWarnings("unchecked")
- private List getTargetResources() {
- List resourceList = new ArrayList();
- ArrayList<String> targetExt = new ArrayList<String>();
- ArrayList<String> targetFile = new ArrayList<String>();
-
- if( sourceArchiveButton.getSelection() ) {
- targetExt = sourceExt;
- targetFile = sourceFile;
- } else if( binaryArchiveButton.getSelection()) {
- targetExt = binaryExt;
- targetFile = binaryFile;
- } else if( sourcebinaryArchiveButton.getSelection()) {
- targetExt = sourcebinaryExt;
- targetFile = sourcebinaryFile;
- }
- //
- try {
- IProject targetProject = (IProject)targetProjects[targetProjectList.getSelectionIndex()];
- IResource[] targets = targetProject.members();
- searchTarget(resourceList, targetExt, targetFile, targets);
- } catch (CoreException e) {
- LOGGER.error("Fail to get resources", e);
- }
- return resourceList;
- }
-
- @SuppressWarnings("unchecked")
- private void searchTarget(List resourceList, ArrayList<String> targetExt, ArrayList<String> targetFile,
- IResource[] sourceRes) {
-
- for(int intIdx=0;intIdx<sourceRes.length;intIdx++) {
- if( sourceRes[intIdx].getType() == IResource.FILE ) {
- if( targetExt.contains(sourceRes[intIdx].getFileExtension()) ) {
- resourceList.add(sourceRes[intIdx]);
- }
- for( String filename : targetFile ) {
- if( sourceRes[intIdx].getName().startsWith(filename) ) {
- resourceList.add(sourceRes[intIdx]);
- break;
- }
- }
- } else if( sourceRes[intIdx].getType() == IResource.FOLDER ) {
- try {
- IResource[] resources = ((IFolder)sourceRes[intIdx]).members();
- searchTarget(resourceList, targetExt, targetFile, resources);
- } catch (CoreException e) {
- LOGGER.error("Fail to search resources.", e);
- }
- }
- }
- }
-
- private boolean ensureTargetIsValid() {
- String targetPath = getDestinationValue();
-
- if (!ensureTargetDirectoryIsValid(targetPath)) {
- return false;
- }
-
- if (!ensureTargetFileIsValid(new File(targetPath))) {
- return false;
- }
-
- return true;
- }
-
- private String getDestinationValue() {
- String idealSuffix = getOutputSuffix();
- String destinationText = destinationNameField.getText().trim();
-
- // only append a suffix if the destination doesn't already have a . in
- // its last path segment.
- // Also prevent the user from selecting a directory. Allowing this will
- // create a ".zip" file in the directory
- if (destinationText.length() != 0
- && !destinationText.endsWith(File.separator)) {
- int dotIndex = destinationText.lastIndexOf('.');
- if (dotIndex != -1) {
- // the last path seperator index
- int pathSepIndex = destinationText.lastIndexOf(File.separator);
- if (pathSepIndex != -1 && dotIndex < pathSepIndex) {
- destinationText += File.separator + targetProjects[targetProjectList.getSelectionIndex()].getName() + idealSuffix;
- }
- } else {
- destinationText += File.separator + targetProjects[targetProjectList.getSelectionIndex()].getName() + idealSuffix;
- }
- }
-
- File check = new File(destinationText);
- if(!check.isAbsolute()) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- destinationText = root.getLocation() + File.separator + destinationText;
- }
-
- return destinationText;
- }
-
- private String getOutputSuffix() {
- if(zipFormatButton.getSelection()) {
- return ".zip"; //$NON-NLS-1$
-// } else if(bzipFormatButton.getSelection()) {
-// return ".bz2"; //$NON-NLS-1$
- } else if(compressContentsCheckbox.getSelection()) {
- return ".tar.gz"; //$NON-NLS-1$
- } else {
- return ".tar"; //$NON-NLS-1$
- }
- }
-
- private boolean ensureTargetFileIsValid(File targetFile) {
- if (targetFile.exists() && targetFile.isDirectory()) {
- displayErrorDialog(IWizardMessageConstants.EXPORT_PAGE_MSG_FILE_ERR);
- destinationNameField.setFocus();
- return false;
- }
-
- if (targetFile.exists()) {
- if (targetFile.canWrite()) {
- if (!queryYesNoQuestion(IWizardMessageConstants.EXPORT_PAGE_MSG_WRITE_YN)) {
- return false;
- }
- } else {
- displayErrorDialog(IWizardMessageConstants.EXPORT_PAGE_MSG_CANNOT_WRITE_ERR);
- destinationNameField.setFocus();
- return false;
- }
- }
-
- return true;
- }
-
- private boolean ensureTargetDirectoryIsValid(String fullPathname) {
- int separatorIndex = fullPathname.lastIndexOf(File.separator);
-
- if (separatorIndex == -1) {
- return true;
- }
-
- return ensureTargetIsValid(new File(fullPathname.substring(0,
- separatorIndex)));
- }
-
- private boolean ensureTargetIsValid(File targetDirectory) {
- if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
- displayErrorDialog(IWizardMessageConstants.EXPORT_PAGE_MSG_EXISTS_ERR);
- destinationNameField.setFocus();
- return false;
- }
-
- return ensureDirectoryExists(targetDirectory);
- }
-
- private boolean ensureDirectoryExists(File directory) {
- if (!directory.exists()) {
- if (!queryYesNoQuestion(IWizardMessageConstants.EXPORT_PAGE_MSG_CREATE_YN)) {
- return false;
- }
-
- if (!directory.mkdirs()) {
- displayErrorDialog(IWizardMessageConstants.EXPORT_PAGE_MSG_CANNOT_CREATE_ERR);
- destinationNameField.setFocus();
- return false;
- }
- }
- return true;
- }
-
- protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings
- .getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null) {
- directoryNames = new String[0];
- }
-
- directoryNames = addToHistory(directoryNames, destinationNameField.getText().trim());
- settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
-
- settings.put(STORE_CREATE_STRUCTURE_ID,
- createDirectoryStructureButton.getSelection());
-
- settings.put(STORE_COMPRESS_CONTENTS_ID, compressContentsCheckbox
- .getSelection());
- }
- }
-
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings
- .getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null || directoryNames.length == 0) {
- return;
- }
-
- // destination
- setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++) {
- addDestinationItem(directoryNames[i]);
- }
-
- boolean setStructure = settings
- .getBoolean(STORE_CREATE_STRUCTURE_ID);
-
- createDirectoryStructureButton.setSelection(setStructure);
- createSelectionOnlyButton.setSelection(!setStructure);
-
- compressContentsCheckbox.setSelection(settings
- .getBoolean(STORE_COMPRESS_CONTENTS_ID));
- }
- }
-
- protected void addDestinationItem(String value) {
- destinationNameField.add(value);
- }
- protected void setDestinationValue(String value) {
- destinationNameField.setText(value);
- }
-}
openrtm-commit メーリングリストの案内