[213776]: [xslt] URIResolver - cleaned up find bug errors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213776
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLDebugPluginImages.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLDebugPluginImages.java
index afc145b..e9c6537 100755
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLDebugPluginImages.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLDebugPluginImages.java
@@ -17,10 +17,10 @@
public class XSLDebugPluginImages {
/**
- * Path to the XSLT Processor Images used for launch configurations
+ * Path to the XSLT Processor Images used for launch configurations
*/
public static final String IMG_PROCESSOR_TAB = "icons/xslt_processor.gif"; //$NON-NLS-1$
-
+
/**
* Path to the XSLT Output Images used for launch configurations
*/
@@ -30,5 +30,5 @@
* Path to the XSLT Launch Images used for launch configurations
*/
public static final String IMG_MAIN_TAB = "icons/xslt_launch.gif"; //$NON-NLS-1$
-
+
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLPluginImageHelper.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLPluginImageHelper.java
index 86843b5..74396a4 100755
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLPluginImageHelper.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/debug/internal/util/XSLPluginImageHelper.java
@@ -20,7 +20,6 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.wst.xsl.internal.debug.ui.XSLDebugUIPlugin;
-
/**
* Helper class to handle images provided by this plug-in.
*
@@ -50,8 +49,8 @@
private final String PLUGINID = XSLDebugUIPlugin.PLUGIN_ID;
/**
- * Creates an image from the given resource and adds the image to the
- * image registry.
+ * Creates an image from the given resource and adds the image to the image
+ * registry.
*
* @param resource
* @return Image
@@ -73,9 +72,9 @@
/**
* Creates an image descriptor from the given imageFilePath and adds the
- * image descriptor to the image descriptor registry. If an image
- * descriptor could not be created, the default "missing" image descriptor
- * is returned but not added to the image descriptor registry.
+ * image descriptor to the image descriptor registry. If an image descriptor
+ * could not be created, the default "missing" image descriptor is returned
+ * but not added to the image descriptor registry.
*
* @param imageFilePath
* @return ImageDescriptor image descriptor for imageFilePath or default
@@ -83,11 +82,11 @@
*/
@SuppressWarnings("unchecked")
private ImageDescriptor createImageDescriptor(String imageFilePath) {
- ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath);
+ ImageDescriptor imageDescriptor = AbstractUIPlugin
+ .imageDescriptorFromPlugin(PLUGINID, imageFilePath);
if (imageDescriptor != null) {
getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
- }
- else {
+ } else {
imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
}
@@ -95,14 +94,14 @@
}
/**
- * Retrieves the image associated with resource from the image registry.
- * If the image cannot be retrieved, attempt to find and load the image at
- * the location specified in resource.
+ * Retrieves the image associated with resource from the image registry. If
+ * the image cannot be retrieved, attempt to find and load the image at the
+ * location specified in resource.
*
* @param resource
* the image to retrieve
- * @return Image the image associated with resource or null if one could
- * not be found
+ * @return Image the image associated with resource or null if one could not
+ * be found
*/
public Image getImage(String resource) {
Image image = getImageRegistry().get(resource);
@@ -115,15 +114,14 @@
/**
* Retrieves the image descriptor associated with resource from the image
- * descriptor registry. If the image descriptor cannot be retrieved,
- * attempt to find and load the image descriptor at the location specified
- * in resource.
+ * descriptor registry. If the image descriptor cannot be retrieved, attempt
+ * to find and load the image descriptor at the location specified in
+ * resource.
*
* @param resource
* the image descriptor to retrieve
* @return ImageDescriptor the image descriptor assocated with resource or
- * the default "missing" image descriptor if one could not be
- * found
+ * the default "missing" image descriptor if one could not be found
*/
public ImageDescriptor getImageDescriptor(String resource) {
ImageDescriptor imageDescriptor = null;
@@ -131,8 +129,7 @@
if (o == null) {
// create a descriptor
imageDescriptor = createImageDescriptor(resource);
- }
- else {
+ } else {
imageDescriptor = (ImageDescriptor) o;
}
return imageDescriptor;
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/AbstractTableBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/AbstractTableBlock.java
index 53bc5c1..72085a5 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/AbstractTableBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/AbstractTableBlock.java
@@ -16,14 +16,13 @@
/**
* An <code>AbstractLaunchConfigurationTab</code> specialised for blocks that
- * contain a table. This abstract class conveniently saves and restores the table's
- * column settings.
+ * contain a table. This abstract class conveniently saves and restores the
+ * table's column settings.
*
* @author Doug Satchwell
* @since 1.0
*/
-public abstract class AbstractTableBlock extends AbstractLaunchConfigurationTab
-{
+public abstract class AbstractTableBlock extends AbstractLaunchConfigurationTab {
private int fSortColumn;
protected abstract Table getTable();
@@ -32,8 +31,7 @@
protected abstract String getQualifier();
- protected void setSortColumn(int column)
- {
+ protected void setSortColumn(int column) {
fSortColumn = column;
}
@@ -41,12 +39,12 @@
* Persist table settings into the give dialog store, prefixed with the
* given key.
*/
- public void saveColumnSettings()
- {
+ public void saveColumnSettings() {
int columnCount = getTable().getColumnCount();
- for (int i = 0; i < columnCount; i++)
- {
- getDialogSettings().put(getQualifier() + ".columnWidth" + i, getTable().getColumn(i).getWidth()); //$NON-NLS-1$
+ for (int i = 0; i < columnCount; i++) {
+ getDialogSettings()
+ .put(
+ getQualifier() + ".columnWidth" + i, getTable().getColumn(i).getWidth()); //$NON-NLS-1$
}
getDialogSettings().put(getQualifier() + ".sortColumn", fSortColumn); //$NON-NLS-1$
}
@@ -54,34 +52,25 @@
/**
* Restore table settings from the given dialog store using the given key.
*/
- public void restoreColumnSettings()
- {
+ public void restoreColumnSettings() {
getTable().layout(true);
restoreColumnWidths(getDialogSettings(), getQualifier());
int col = 0;
- try
- {
+ try {
col = getDialogSettings().getInt(getQualifier() + ".sortColumn"); //$NON-NLS-1$
- }
- catch (NumberFormatException e)
- {
+ } catch (NumberFormatException e) {
col = 1;
}
setSortColumn(col);
}
- private void restoreColumnWidths(IDialogSettings settings, String qualifier)
- {
+ private void restoreColumnWidths(IDialogSettings settings, String qualifier) {
int columnCount = getTable().getColumnCount();
- for (int i = 0; i < columnCount; i++)
- {
+ for (int i = 0; i < columnCount; i++) {
int width = -1;
- try
- {
+ try {
width = settings.getInt(qualifier + ".columnWidth" + i); //$NON-NLS-1$
- }
- catch (NumberFormatException e)
- {
+ } catch (NumberFormatException e) {
}
if (width > 0)
@@ -90,8 +79,7 @@
}
@Override
- public void dispose()
- {
+ public void dispose() {
if (getTable() != null && !getTable().isDisposed())
saveColumnSettings();
super.dispose();
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/Messages.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/Messages.java
index 6b24e42..653a397 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/Messages.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/Messages.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.wst.xsl.internal.debug.ui;
-
import org.eclipse.osgi.util.NLS;
/**
@@ -126,9 +125,9 @@
public static String InputFileBlock_FILE_SYSTEM_BUTTON;
public static String InputFileBlock_WORKSPACE_BUTTON;
-
+
public static String InputFileBlock_OPENFILES_BUTTON;
-
+
public static String InputFileBlock_OPENFILES_DIALOG;
public static String InputFileBlock_Name;
@@ -237,15 +236,13 @@
public static String OutputFOFileBlock_WORKSPACE_DIALOG_TITLE;
public static String OutputFOFileBlock_Exception_occurred_saving_configuration;
-
+
public static String ResourceSelectionBlock_0;
- public static String XSLLaunchShortcut_0;
+ public static String XSLLaunchShortcut_0;
public static String XSLLaunchShortcut_1;
public static String XSLLaunchShortcut_2;
public static String XSLLaunchShortcut_6;
public static String XSLSelectExisting;
-
-
private Messages() {
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/ResourceSelectionBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/ResourceSelectionBlock.java
index 5783a61..1b56860 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/ResourceSelectionBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/ResourceSelectionBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Chase Technology Ltd - http://www.chasetechnology.co.uk
+ * Copyright (c) 2007, 2010 Chase Technology Ltd - http://www.chasetechnology.co.uk
* 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
@@ -9,14 +9,11 @@
* Doug Satchwell (Chase Technology Ltd) - initial API and implementation
* Stuart Harper - bug 264788 - added "open files" selector
* David Carver (STAR) - bug 264788 - pulled up getFileExtensions from InputFileBlock
+ * David Carver (Intalio) - clean up find bugs
*******************************************************************************/
package org.eclipse.wst.xsl.internal.debug.ui;
import java.io.File;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -25,11 +22,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -53,7 +46,6 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
@@ -65,16 +57,15 @@
import org.eclipse.ui.views.navigator.ResourceComparator;
import org.eclipse.wst.xsl.core.internal.util.XMLContentType;
-
/**
- * A block that shows a text box with buttons for browsing workspace or the filesystem
- * in order to populate the text box with a file path.
+ * A block that shows a text box with buttons for browsing workspace or the
+ * filesystem in order to populate the text box with a file path.
*
* @author Doug Satchwell
* @since 1.0
*/
-public abstract class ResourceSelectionBlock extends AbstractLaunchConfigurationTab
-{
+public abstract class ResourceSelectionBlock extends
+ AbstractLaunchConfigurationTab {
protected static final int ERROR_DIRECTORY_NOT_SPECIFIED = 1;
protected static final int ERROR_DIRECTORY_DOES_NOT_EXIST = 2;
protected static final int GROUP_NAME = 3;
@@ -104,59 +95,46 @@
protected String defaultResource;
protected String resource;
protected String fileLabel = Messages.ResourceSelectionBlock_0;
-
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
-
- private final ISelectionStatusValidator validator = new ISelectionStatusValidator()
- {
- public IStatus validate(Object[] selection)
- {
- if (selection.length == 0)
- {
- return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ private final ISelectionStatusValidator validator = new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection) {
+ if (selection.length == 0) {
+ return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0,
+ "", null); //$NON-NLS-1$
}
- for (int i = 0; i < selection.length; i++)
- {
- if (resourceType == IResource.FOLDER && !(selection[i] instanceof IContainer))
- return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- else if (resourceType == IResource.FILE && !(selection[i] instanceof IFile))
- return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ for (int i = 0; i < selection.length; i++) {
+ if (resourceType == IResource.FOLDER
+ && !(selection[i] instanceof IContainer))
+ return new Status(IStatus.ERROR,
+ XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ else if (resourceType == IResource.FILE
+ && !(selection[i] instanceof IFile))
+ return new Status(IStatus.ERROR,
+ XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
}
- return new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, 0,
+ "", null); //$NON-NLS-1$
}
};
- class WidgetListener extends SelectionAdapter implements ModifyListener
- {
- public void modifyText(ModifyEvent e)
- {
+ class WidgetListener extends SelectionAdapter implements ModifyListener {
+ public void modifyText(ModifyEvent e) {
textModified();
updateLaunchConfigurationDialog();
}
@Override
- public void widgetSelected(SelectionEvent e)
- {
+ public void widgetSelected(SelectionEvent e) {
Object source = e.getSource();
- if (source == fWorkspaceButton)
- {
+ if (source == fWorkspaceButton) {
handleWorkspaceResourceBrowseButtonSelected();
- }
- else if (source == fFileSystemButton)
- {
+ } else if (source == fFileSystemButton) {
handleExternalResourceBrowseButtonSelected();
- }
- else if (source == fVariablesButton)
- {
+ } else if (source == fVariablesButton) {
handleResourceVariablesButtonSelected();
- }
- else if (source == useDefaultCheckButton)
- {
+ } else if (source == useDefaultCheckButton) {
updateResourceText(useDefaultCheckButton.getSelection());
- }
- else if (source == fOpenFilesButton)
- {
+ } else if (source == fOpenFilesButton) {
handleOpenFilesResourceBrowseButtonSelected();
}
}
@@ -165,54 +143,67 @@
/**
* Same as <code>new ResourceSelectionBlock(true)</code>
*/
- public ResourceSelectionBlock()
- {
+ public ResourceSelectionBlock() {
this(true);
}
/**
- * Same as <code>new ResourceSelectionBlock(IResource.FOLDER,showDefault)</code>
+ * Same as
+ * <code>new ResourceSelectionBlock(IResource.FOLDER,showDefault)</code>
*
- * @param showDefault true if this should have a 'Show Default' button
+ * @param showDefault
+ * true if this should have a 'Show Default' button
*/
- public ResourceSelectionBlock(boolean showDefault)
- {
+ public ResourceSelectionBlock(boolean showDefault) {
this(IResource.FOLDER, showDefault);
}
/**
- * Same as <code>new ResourceSelectionBlock(resourceType,showDefault,true)</code>
+ * Same as
+ * <code>new ResourceSelectionBlock(resourceType,showDefault,true)</code>
*
- * @param resourceType the type of resource to select - IResource.FOLDER or IResource.FILE
- * @param showDefault true if this should have a 'Show Default' button
+ * @param resourceType
+ * the type of resource to select - IResource.FOLDER or
+ * IResource.FILE
+ * @param showDefault
+ * true if this should have a 'Show Default' button
*/
- public ResourceSelectionBlock(int resourceType, boolean showDefault)
- {
+ public ResourceSelectionBlock(int resourceType, boolean showDefault) {
this(resourceType, showDefault, true);
}
/**
- * Same as <code>new ResourceSelectionBlock(resourceType,showDefault,required,true)</code>
+ * Same as
+ * <code>new ResourceSelectionBlock(resourceType,showDefault,required,true)</code>
*
- * @param resourceType the type of resource to select - IResource.FOLDER or IResource.FILE
- * @param showDefault true if this should have a 'Show Default' button
- * @param required true if a blank text box is invalid
+ * @param resourceType
+ * the type of resource to select - IResource.FOLDER or
+ * IResource.FILE
+ * @param showDefault
+ * true if this should have a 'Show Default' button
+ * @param required
+ * true if a blank text box is invalid
*/
- public ResourceSelectionBlock(int resourceType, boolean showDefault, boolean required)
- {
+ public ResourceSelectionBlock(int resourceType, boolean showDefault,
+ boolean required) {
this(resourceType, showDefault, required, true);
}
/**
* Create a new instance of this.
*
- * @param resourceType the type of resource to select - IResource.FOLDER or IResource.FILE
- * @param showDefault true if this should have a 'Show Default' button
- * @param required true if a blank text box is invalid
- * @param mustExist true of the selected resource must already exist
+ * @param resourceType
+ * the type of resource to select - IResource.FOLDER or
+ * IResource.FILE
+ * @param showDefault
+ * true if this should have a 'Show Default' button
+ * @param required
+ * true if a blank text box is invalid
+ * @param mustExist
+ * true of the selected resource must already exist
*/
- public ResourceSelectionBlock(int resourceType, boolean showDefault, boolean required, boolean mustExist)
- {
+ public ResourceSelectionBlock(int resourceType, boolean showDefault,
+ boolean required, boolean mustExist) {
super();
this.showDefault = showDefault;
this.resourceType = resourceType;
@@ -220,15 +211,13 @@
this.mustExist = mustExist;
}
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
Composite group = createContainer(parent);
setControl(group);
createContents(group);
}
- protected Composite createContainer(Composite parent)
- {
+ protected Composite createContainer(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setText(getMessage(GROUP_NAME));
// TODO PlatformUI.getWorkbench().getHelpSystem().setHelp...
@@ -242,17 +231,15 @@
return group;
}
- protected void createContents(Composite parent)
- {
+ protected void createContents(Composite parent) {
createCheckboxAndText(parent);
createButtons(parent);
}
- protected void createCheckboxAndText(Composite parent)
- {
- if (showDefault)
- {
- useDefaultCheckButton = createCheckButton(parent, getMessage(USE_DEFAULT_RADIO));
+ protected void createCheckboxAndText(Composite parent) {
+ if (showDefault) {
+ useDefaultCheckButton = createCheckButton(parent,
+ getMessage(USE_DEFAULT_RADIO));
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 2;
useDefaultCheckButton.setLayoutData(gd);
@@ -272,8 +259,7 @@
gd.horizontalSpan = 2;
specificFileComp.setLayoutData(gd);
- if (showDefault)
- {
+ if (showDefault) {
Label label = new Label(specificFileComp, SWT.NONE);
label.setText(fileLabel);
}
@@ -286,8 +272,7 @@
resourceText.addModifyListener(widgetListener);
}
- protected void createButtons(Composite parent)
- {
+ protected void createButtons(Composite parent) {
// filler
new Label(parent, SWT.NONE);
@@ -301,27 +286,28 @@
buttonComp.setLayoutData(gd);
buttonComp.setFont(parent.getFont());
- fWorkspaceButton = createPushButton(buttonComp, getMessage(WORKSPACE_BUTTON), null);
+ fWorkspaceButton = createPushButton(buttonComp,
+ getMessage(WORKSPACE_BUTTON), null);
fWorkspaceButton.addSelectionListener(widgetListener);
- fFileSystemButton = createPushButton(buttonComp, getMessage(FILE_SYSTEM_BUTTON), null);
+ fFileSystemButton = createPushButton(buttonComp,
+ getMessage(FILE_SYSTEM_BUTTON), null);
fFileSystemButton.addSelectionListener(widgetListener);
- fVariablesButton = createPushButton(buttonComp, getMessage(VARIABLES_BUTTON), null);
+ fVariablesButton = createPushButton(buttonComp,
+ getMessage(VARIABLES_BUTTON), null);
fVariablesButton.addSelectionListener(widgetListener);
-
- fOpenFilesButton = createPushButton(buttonComp, getMessage(OPENFILES_BUTTON), null);
+
+ fOpenFilesButton = createPushButton(buttonComp,
+ getMessage(OPENFILES_BUTTON), null);
fOpenFilesButton.addSelectionListener(widgetListener);
}
- protected void updateResourceText(boolean useDefault)
- {
- if (useDefault)
- {
- resourceText.setText(defaultResource == null ? "" : defaultResource); //$NON-NLS-1$
- }
- else
- {
+ protected void updateResourceText(boolean useDefault) {
+ if (useDefault) {
+ resourceText
+ .setText(defaultResource == null ? "" : defaultResource); //$NON-NLS-1$
+ } else {
resourceText.setText(resource == null ? "" : resource); //$NON-NLS-1$
}
resourceText.setEnabled(!useDefault);
@@ -331,45 +317,36 @@
}
@Override
- public void dispose()
- {
+ public void dispose() {
}
- protected void handleExternalResourceBrowseButtonSelected()
- {
+ protected void handleExternalResourceBrowseButtonSelected() {
String currentWorkingDir = getText();
String selected = null;
- if (resourceType == IResource.FOLDER)
- {
+ if (resourceType == IResource.FOLDER) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setMessage(getMessage(DIRECTORY_DIALOG_MESSAGE));
if (!currentWorkingDir.trim().equals("")) //$NON-NLS-1$
{
File path = new File(currentWorkingDir);
- if (path.exists())
- {
+ if (path.exists()) {
dialog.setFilterPath(currentWorkingDir);
}
}
selected = dialog.open();
- }
- else
- {
+ } else {
FileDialog dialog = new FileDialog(getShell());
if (!currentWorkingDir.trim().equals("")) //$NON-NLS-1$
{
File path = new File(currentWorkingDir);
- if (path.exists())
- {
+ if (path.exists()) {
dialog.setFilterPath(currentWorkingDir);
}
}
String[] fileExtensions = getFileExtensions();
- if (fileExtensions != null)
- {
+ if (fileExtensions != null) {
String[] filterExtensions = new String[fileExtensions.length];
- for (int i = 0; i < fileExtensions.length; i++)
- {
+ for (int i = 0; i < fileExtensions.length; i++) {
String ext = fileExtensions[i];
filterExtensions[i] = "*." + ext; //$NON-NLS-1$
}
@@ -377,54 +354,57 @@
}
selected = dialog.open();
}
- if (selected != null)
- {
+ if (selected != null) {
resourceText.setText(selected);
}
}
- protected String[] getFileExtensions()
- {
+ protected String[] getFileExtensions() {
return new XMLContentType().getFileExtensions();
}
-
- protected void handleOpenFilesResourceBrowseButtonSelected()
- {
+
+ protected void handleOpenFilesResourceBrowseButtonSelected() {
String path = openFileListResourceDialog();
if (path != null)
- setText("${workspace_loc:" + path + "}"); //$NON-NLS-1$ //$NON-NLS-2$
+ setText("${workspace_loc:" + path + "}"); //$NON-NLS-1$ //$NON-NLS-2$
}
+
/**
- * Opens a dialog displaying a list of all XML files in the editor and allows the user to select one of them.
+ * Opens a dialog displaying a list of all XML files in the editor and
+ * allows the user to select one of them.
+ *
* @return The path to the selected XML file or null if none was chosen.
*/
- protected String openFileListResourceDialog(){
- IEditorReference[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
-
- WorkbenchContentProvider w = new WorkbenchContentProvider();
+ protected String openFileListResourceDialog() {
+ IEditorReference[] editors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+
String[] paths = filterOpenEditorsByFileExtension(editors);
-
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider());
+
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(
+ getShell(), new LabelProvider());
dialog.setTitle(getMessage(OPENFILES_DIALOG_TITLE));
dialog.setElements(paths);
dialog.open();
-
- return (String)dialog.getFirstResult();
-
+
+ return (String) dialog.getFirstResult();
+
}
private String[] filterOpenEditorsByFileExtension(IEditorReference[] editors) {
- String [] paths = new String[editors.length];
- String [] fileExts = getFileExtensions();
-
- for(int i =0; i<editors.length; i++){
+ String[] paths = new String[editors.length];
+ String[] fileExts = getFileExtensions();
+
+ for (int i = 0; i < editors.length; i++) {
IEditorReference currentEditor = editors[i];
IEditorPart editorPart = currentEditor.getEditor(true);
- IFile file = (IFile) editorPart.getEditorInput().getAdapter(IFile.class);
+ IFile file = (IFile) editorPart.getEditorInput().getAdapter(
+ IFile.class);
if (file != null) {
IPath path = file.getFullPath();
- paths[i] = getEditorPath(path, fileExts);
+ paths[i] = getEditorPath(path, fileExts);
}
}
return paths;
@@ -434,37 +414,35 @@
if (fileExts == null || fileExts.length == 0) {
return filePath.toOSString();
}
-
+
String path = null;
for (int cnt = 0; cnt < fileExts.length; cnt++) {
if (filePath.getFileExtension().equals(fileExts[cnt])) {
path = filePath.toOSString();
break;
}
- }
+ }
return path;
}
-
-
- protected void handleWorkspaceResourceBrowseButtonSelected()
- {
+
+ protected void handleWorkspaceResourceBrowseButtonSelected() {
IPath path = openWorkspaceResourceDialog();
if (path != null)
- setText("${workspace_loc:" + path.toString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
+ setText("${workspace_loc:" + path.toString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
}
- protected IPath openWorkspaceResourceDialog()
- {
+ protected IPath openWorkspaceResourceDialog() {
IResource currentResource = getResource();
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
+ getShell(), new WorkbenchLabelProvider(),
+ new WorkbenchContentProvider());
dialog.setTitle(getMessage(WORKSPACE_DIALOG_TITLE));
dialog.setMessage(getMessage(WORKSPACE_DIALOG_MESSAGE));
dialog.setValidator(validator);
- dialog.addFilter(new ViewerFilter()
- {
+ dialog.addFilter(new ViewerFilter() {
@Override
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
if (element instanceof IContainer)
return true;
if (resourceType != IResource.FILE)
@@ -474,10 +452,8 @@
if (extensions == null)
return true;
String fileExt = file.getFileExtension();
- if (fileExt != null)
- {
- for (String ext : extensions)
- {
+ if (fileExt != null) {
+ for (String ext : extensions) {
if (fileExt.equalsIgnoreCase(ext))
return true;
}
@@ -493,8 +469,7 @@
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
dialog.setAllowMultiple(false);
- if (dialog.open() == Window.OK)
- {
+ if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
if (elements.length > 0)
return ((IResource) elements[0]).getFullPath();
@@ -502,123 +477,98 @@
return null;
}
- protected ViewerFilter getResourceFilter()
- {
+ protected ViewerFilter getResourceFilter() {
return null;
}
/**
* Returns the selected workspace container,or <code>null</code>
*/
- protected IResource getResource()
- {
+ protected IResource getResource() {
String path = getText();
- if (path.length() > 0)
- {
+ if (path.length() > 0) {
IResource res = null;
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- try
- {
- if (path.startsWith("${workspace_loc:")) //$NON-NLS-1$
+ try {
+ if (path.startsWith("${workspace_loc:")) //$NON-NLS-1$
{
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ IStringVariableManager manager = VariablesPlugin
+ .getDefault().getStringVariableManager();
path = manager.performStringSubstitution(path, false);
}
File f = new File(path);
- if (resourceType == IResource.FOLDER)
- {
- IContainer[] containers = root.findContainersForLocationURI(f.toURI());
- if (containers.length > 0)
- {
+ if (resourceType == IResource.FOLDER) {
+ IContainer[] containers = root
+ .findContainersForLocationURI(f.toURI());
+ if (containers.length > 0) {
res = containers[0];
}
- }
- else if (resourceType == IResource.FILE)
- {
+ } else if (resourceType == IResource.FILE) {
IFile[] files = root.findFilesForLocationURI(f.toURI());
- if (files.length > 0)
- {
+ if (files.length > 0) {
res = files[0];
}
}
return res;
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
return null;
}
- protected void handleResourceVariablesButtonSelected()
- {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ protected void handleResourceVariablesButtonSelected() {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
+ getShell());
dialog.open();
String variableText = dialog.getVariableExpression();
- if (variableText != null)
- {
+ if (variableText != null) {
resourceText.insert(variableText);
}
}
@Override
- public boolean isValid(ILaunchConfiguration config)
- {
+ public boolean isValid(ILaunchConfiguration config) {
setErrorMessage(null);
setMessage(null);
// if variables are present, we cannot resolve the directory
String workingDirPath = getText();
if (workingDirPath.indexOf("${") >= 0) //$NON-NLS-1$
{
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
- try
- {
+ IStringVariableManager manager = VariablesPlugin.getDefault()
+ .getStringVariableManager();
+ try {
manager.validateStringVariables(workingDirPath);
- if (mustExist)
- {
- String path = manager.performStringSubstitution(workingDirPath);
+ if (mustExist) {
+ String path = manager
+ .performStringSubstitution(workingDirPath);
validateResource(path);
}
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
setErrorMessage(e.getMessage());
return false;
}
- }
- else if (mustExist && workingDirPath.length() > 0)
- {
+ } else if (mustExist && workingDirPath.length() > 0) {
return validateResource(workingDirPath);
- }
- else if (required && workingDirPath.length() == 0)
- {
+ } else if (required && workingDirPath.length() == 0) {
setErrorMessage(getMessage(ERROR_DIRECTORY_NOT_SPECIFIED));
}
return true;
}
- protected boolean validateResource(String workingDirPath)
- {
- if (resourceType == IResource.FOLDER)
- {
+ protected boolean validateResource(String workingDirPath) {
+ if (resourceType == IResource.FOLDER) {
IContainer container = (IContainer) getResource();
- if (container == null)
- {
+ if (container == null) {
File dir = new File(workingDirPath);
- if (dir.isDirectory())
- {
+ if (dir.isDirectory()) {
return true;
}
- }
- else
+ } else
return true;
- }
- else if (resourceType == IResource.FILE)
- {
+ } else if (resourceType == IResource.FILE) {
File file = new File(workingDirPath);
- if (file.isFile())
- {
+ if (file.isFile()) {
return true;
}
}
@@ -628,27 +578,22 @@
protected abstract String getMessage(int type);
- protected void textModified()
- {
+ protected void textModified() {
}
- protected String getText()
- {
+ protected String getText() {
return resourceText.getText().trim();
}
- protected void setText(String text)
- {
+ protected void setText(String text) {
resourceText.setText(text);
}
- protected void setLaunchConfiguration(ILaunchConfiguration config)
- {
+ protected void setLaunchConfiguration(ILaunchConfiguration config) {
fLaunchConfiguration = config;
}
- protected ILaunchConfiguration getLaunchConfiguration()
- {
+ protected ILaunchConfiguration getLaunchConfiguration() {
return fLaunchConfiguration;
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIConstants.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIConstants.java
index c983bae..b3ae795 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIConstants.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIConstants.java
@@ -16,23 +16,29 @@
* @author Doug Satchwell
* @since 1.0
*/
-public class XSLDebugUIConstants
-{
+public class XSLDebugUIConstants {
private static final String PREFIX = XSLDebugUIPlugin.PLUGIN_ID + '.';
/**
- * Constant used to store column setting preferences for the <code>InstalledProcessorsBlock</code>
+ * Constant used to store column setting preferences for the
+ * <code>InstalledProcessorsBlock</code>
*/
- public static final String PROCESSOR_DETAILS_DIALOG = PREFIX + "PROCESSOR_DETAILS_DIALOG"; //$NON-NLS-1$
+ public static final String PROCESSOR_DETAILS_DIALOG = PREFIX
+ + "PROCESSOR_DETAILS_DIALOG"; //$NON-NLS-1$
/**
- * Constant used to store column setting preferences for the <code>ParametersBlock</code>
+ * Constant used to store column setting preferences for the
+ * <code>ParametersBlock</code>
*/
- public static final String MAIN_PARAMATERS_BLOCK = PREFIX + "MAIN_PARAMATERS_BLOCK"; //$NON-NLS-1$
+ public static final String MAIN_PARAMATERS_BLOCK = PREFIX
+ + "MAIN_PARAMATERS_BLOCK"; //$NON-NLS-1$
/**
- * Constant used to store column setting preferences for the <code>TransformsBlock</code>
+ * Constant used to store column setting preferences for the
+ * <code>TransformsBlock</code>
*/
- public static final String MAIN_TRANSFORMS_BLOCK = PREFIX + "MAIN_TRANSFORMS_BLOCK"; //$NON-NLS-1$
+ public static final String MAIN_TRANSFORMS_BLOCK = PREFIX
+ + "MAIN_TRANSFORMS_BLOCK"; //$NON-NLS-1$
/**
- * Constant used to store column setting preferences for the <code>OutputBlock</code>
+ * Constant used to store column setting preferences for the
+ * <code>OutputBlock</code>
*/
public static final String OUTPUT_BLOCK = PREFIX + "OUTPUT_BLOCK"; //$NON-NLS-1$
/**
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUILaunchListener.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUILaunchListener.java
index 1283fd4..f360a59 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUILaunchListener.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUILaunchListener.java
@@ -33,118 +33,104 @@
import org.eclipse.wst.xsl.launching.config.BaseLaunchHelper;
/**
- * A listener to XSL launches. When an XSL launch is terminated, this performs the UI parts of the
- * XSL launching - such as open the editor on the output file, and format it.
+ * A listener to XSL launches. When an XSL launch is terminated, this performs
+ * the UI parts of the XSL launching - such as open the editor on the output
+ * file, and format it.
*
* @author Doug Satchwell
* @since 1.0
*/
-public class XSLDebugUILaunchListener implements ILaunchesListener2
-{
+public class XSLDebugUILaunchListener implements ILaunchesListener2 {
public static final String XSL_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.wst.xsl.launching.launchConfigurationType"; //$NON-NLS-1$
/**
* Starts the launch listening
*/
- public void start()
- {
+ public void start() {
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
-
+
/**
* Stops the launch listening
*/
- public void stop()
- {
+ public void stop() {
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
}
-
- public void launchesTerminated(ILaunch[] launches)
- {
- for (ILaunch launch : launches)
- {
+
+ public void launchesTerminated(ILaunch[] launches) {
+ for (ILaunch launch : launches) {
ILaunchConfigurationType configType = null;
- try
- {
+ try {
configType = launch.getLaunchConfiguration().getType();
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
// do nothing
}
- if (configType != null && XSL_LAUNCH_CONFIGURATION_TYPE.equals(configType.getIdentifier()))
- {
- try
- {
- BaseLaunchHelper launchHelper = new BaseLaunchHelper(launch.getLaunchConfiguration());
+ if (configType != null
+ && XSL_LAUNCH_CONFIGURATION_TYPE.equals(configType
+ .getIdentifier())) {
+ try {
+ BaseLaunchHelper launchHelper = new BaseLaunchHelper(launch
+ .getLaunchConfiguration());
File file = launchHelper.getTarget();
- IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getAbsolutePath()));
- if (ifile != null)
- {// refresh this workspace file..
- try
- {
- ifile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
- }
- catch (CoreException e)
- {
+ IFile ifile = ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(
+ new Path(file.getAbsolutePath()));
+ if (ifile != null) {// refresh this workspace file..
+ try {
+ ifile.refreshLocal(IResource.DEPTH_ZERO,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
openFileIfRequired(launchHelper);
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
}
}
- public void launchesAdded(ILaunch[] launches)
- {
+ public void launchesAdded(ILaunch[] launches) {
// do nothing
}
- public void launchesChanged(ILaunch[] launches)
- {
+ public void launchesChanged(ILaunch[] launches) {
// do nothing
}
- public void launchesRemoved(ILaunch[] launches)
- {
+ public void launchesRemoved(ILaunch[] launches) {
// do nothing
}
-
- private void openFileIfRequired(final BaseLaunchHelper launchHelper)
- {
- if (launchHelper.getOpenFileOnCompletion())
- {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
+
+ private void openFileIfRequired(final BaseLaunchHelper launchHelper) {
+ if (launchHelper.getOpenFileOnCompletion()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ try {
// Open editor on new file.
- IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow dw = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
File file = launchHelper.getTarget();
Path path = new Path(file.getAbsolutePath());
- IFileStore filestore = EFS.getLocalFileSystem().getStore(path);
- IDE.openEditorOnFileStore(dw.getActivePage(), filestore);
-
- if (launchHelper.getFormatFileOnCompletion())
- {
+ IFileStore filestore = EFS.getLocalFileSystem()
+ .getStore(path);
+ IDE
+ .openEditorOnFileStore(dw.getActivePage(),
+ filestore);
+
+ if (launchHelper.getFormatFileOnCompletion()) {
// format the editor contents
- IHandlerService p = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- p.executeCommand("org.eclipse.wst.sse.ui.format.document", null); //$NON-NLS-1$
+ IHandlerService p = (IHandlerService) PlatformUI
+ .getWorkbench().getService(
+ IHandlerService.class);
+ p
+ .executeCommand(
+ "org.eclipse.wst.sse.ui.format.document", null); //$NON-NLS-1$
}
- }
- catch (PartInitException e)
- {
+ } catch (PartInitException e) {
XSLDebugUIPlugin.log(e);
- }
- catch (CommandException e)
- {
+ } catch (CommandException e) {
XSLDebugUIPlugin.log(e);
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIPlugin.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIPlugin.java
index 5cf1503..b6ef366 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIPlugin.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLDebugUIPlugin.java
@@ -34,8 +34,7 @@
* @author Doug Satchwell
* @since 1.0
*/
-public class XSLDebugUIPlugin extends AbstractUIPlugin
-{
+public class XSLDebugUIPlugin extends AbstractUIPlugin {
/**
* The id of this.
*/
@@ -43,27 +42,24 @@
// The shared instance
private static XSLDebugUIPlugin plugin;
-
+
private XSLDebugUILaunchListener launchListener = new XSLDebugUILaunchListener();
/**
* Create a new instance of this.
*/
- public XSLDebugUIPlugin()
- {
+ public XSLDebugUIPlugin() {
plugin = this;
}
@Override
- public void start(BundleContext context) throws Exception
- {
+ public void start(BundleContext context) throws Exception {
super.start(context);
launchListener.start();
}
@Override
- public void stop(BundleContext context) throws Exception
- {
+ public void stop(BundleContext context) throws Exception {
plugin = null;
launchListener.stop();
super.stop(context);
@@ -74,46 +70,45 @@
*
* @return the singleton
*/
- public static XSLDebugUIPlugin getDefault()
- {
+ public static XSLDebugUIPlugin getDefault() {
return plugin;
}
/**
* Get an ImageDescriptor from a path in this bundle.
*
- * @param path the path to the image
+ * @param path
+ * the path to the image
* @return the ImageDescriptor
*/
- public static ImageDescriptor getImageDescriptor(String path)
- {
+ public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
/**
* Convenience method for opening a given preference page.
*
- * @param id the id of the preference page
- * @param page the preference page to show
+ * @param id
+ * the id of the preference page
+ * @param page
+ * the preference page to show
*/
- public static void showPreferencePage(String id, IPreferencePage page)
- {
+ public static void showPreferencePage(String id, IPreferencePage page) {
final IPreferenceNode targetNode = new PreferenceNode(id, page);
PreferenceManager manager = new PreferenceManager();
manager.addToRoot(targetNode);
- final PreferenceDialog dialog = new PreferenceDialog(XSLDebugUIPlugin.getActiveWorkbenchShell(), manager);
- final boolean[] result = new boolean[]
- { false };
- BusyIndicator.showWhile(XSLDebugUIPlugin.getStandardDisplay(), new Runnable()
- {
- public void run()
- {
- dialog.create();
- dialog.setMessage(targetNode.getLabelText());
- result[0] = (dialog.open() == Window.OK);
- }
- });
+ final PreferenceDialog dialog = new PreferenceDialog(XSLDebugUIPlugin
+ .getActiveWorkbenchShell(), manager);
+ final boolean[] result = new boolean[] { false };
+ BusyIndicator.showWhile(XSLDebugUIPlugin.getStandardDisplay(),
+ new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ result[0] = (dialog.open() == Window.OK);
+ }
+ });
}
/**
@@ -121,8 +116,7 @@
*
* @return the current or default Display
*/
- public static Display getStandardDisplay()
- {
+ public static Display getStandardDisplay() {
Display display;
display = Display.getCurrent();
if (display == null)
@@ -135,8 +129,7 @@
*
* @return the active workbench window
*/
- public static IWorkbenchWindow getActiveWorkbenchWindow()
- {
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow();
}
@@ -145,11 +138,9 @@
*
* @return the active workbench shell
*/
- public static Shell getActiveWorkbenchShell()
- {
+ public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null)
- {
+ if (window != null) {
return window.getShell();
}
return null;
@@ -160,11 +151,9 @@
*
* @return the active page
*/
- public static IWorkbenchPage getActivePage()
- {
+ public static IWorkbenchPage getActivePage() {
IWorkbenchWindow w = getActiveWorkbenchWindow();
- if (w != null)
- {
+ if (w != null) {
return w.getActivePage();
}
return null;
@@ -173,20 +162,21 @@
/**
* Log the given exception by creating a new Status.
*
- * @param e the exception to log
+ * @param e
+ * the exception to log
*/
- public static void log(Exception e)
- {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, "", e)); //$NON-NLS-1$
+ public static void log(Exception e) {
+ getDefault().getLog().log(
+ new Status(IStatus.ERROR, PLUGIN_ID, 0, "", e)); //$NON-NLS-1$
}
/**
* Log the given core exception.
*
- * @param e the exception to log
+ * @param e
+ * the exception to log
*/
- public static void log(CoreException e)
- {
+ public static void log(CoreException e) {
getDefault().getLog().log(e.getStatus());
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchConfigurationTab.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchConfigurationTab.java
index beeabcf..6ff469d 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchConfigurationTab.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchConfigurationTab.java
@@ -20,23 +20,22 @@
import org.eclipse.swt.widgets.Composite;
/**
- * The base class for XSL launch configuration tabs which allows a number of 'blocks' to be added.
- * Each block must itself fully implement <code>ILaunchConfigurationTab</code>.
+ * The base class for XSL launch configuration tabs which allows a number of
+ * 'blocks' to be added. Each block must itself fully implement
+ * <code>ILaunchConfigurationTab</code>.
*
* @author Doug Satchwell
* @since 1.0
*/
-public abstract class XSLLaunchConfigurationTab extends AbstractLaunchConfigurationTab
-{
+public abstract class XSLLaunchConfigurationTab extends
+ AbstractLaunchConfigurationTab {
private ILaunchConfigurationTab[] blocks;
- protected void setBlocks(ILaunchConfigurationTab[] blocks)
- {
+ protected void setBlocks(ILaunchConfigurationTab[] blocks) {
this.blocks = blocks;
}
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setFont(parent.getFont());
// TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
@@ -46,60 +45,53 @@
setControl(comp);
}
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
for (ILaunchConfigurationTab element : blocks)
element.setDefaults(configuration);
}
- public void initializeFrom(ILaunchConfiguration configuration)
- {
+ public void initializeFrom(ILaunchConfiguration configuration) {
for (ILaunchConfigurationTab element : blocks)
element.initializeFrom(configuration);
}
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
for (ILaunchConfigurationTab element : blocks)
element.performApply(configuration);
}
@Override
- public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog)
- {
+ public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) {
super.setLaunchConfigurationDialog(dialog);
for (ILaunchConfigurationTab element : blocks)
element.setLaunchConfigurationDialog(dialog);
}
@Override
- public void dispose()
- {
+ public void dispose() {
for (ILaunchConfigurationTab element : blocks)
element.dispose();
}
@Override
- public void activated(ILaunchConfigurationWorkingCopy workingCopy)
- {
+ public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
// don't call initializeFrom
// super.activated(workingCopy);
for (ILaunchConfigurationTab element : blocks)
element.activated(workingCopy);
}
-
-// @Override
-// protected boolean isDirty()
-// {
-// for (ILaunchConfigurationTab element : blocks)
-// if (((XSLLaunchConfigurationTab)element).isDirty())
-// return true;
-// return super.isDirty();
-// }
+
+ // @Override
+ // protected boolean isDirty()
+ // {
+ // for (ILaunchConfigurationTab element : blocks)
+ // if (((XSLLaunchConfigurationTab)element).isDirty())
+ // return true;
+ // return super.isDirty();
+ // }
@Override
- public boolean isValid(ILaunchConfiguration configuration)
- {
+ public boolean isValid(ILaunchConfiguration configuration) {
boolean valid = true;
for (ILaunchConfigurationTab element : blocks)
valid &= element.isValid(configuration);
@@ -107,13 +99,10 @@
}
@Override
- public String getErrorMessage()
- {
+ public String getErrorMessage() {
String m = super.getErrorMessage();
- if (m == null)
- {
- for (ILaunchConfigurationTab element : blocks)
- {
+ if (m == null) {
+ for (ILaunchConfigurationTab element : blocks) {
m = element.getErrorMessage();
if (m != null)
break;
@@ -123,13 +112,10 @@
}
@Override
- public String getMessage()
- {
+ public String getMessage() {
String m = super.getMessage();
- if (m == null)
- {
- for (ILaunchConfigurationTab element : blocks)
- {
+ if (m == null) {
+ for (ILaunchConfigurationTab element : blocks) {
m = element.getMessage();
if (m != null)
break;
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchShortcut.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchShortcut.java
index b392c34..3c0dd50 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchShortcut.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLLaunchShortcut.java
@@ -53,68 +53,67 @@
/**
* <table border=1>
- * <th>
- * <tr>
- * <td>XML Files</td>
- * <td>XSL Files</td>
- * <td>Action</td>
- * </tr>
- * </th>
- * <tbody>
- * <tr>
- * <td>1</td>
- * <td>0</td>
- * <td>Launch assuming embedded stylesheet instruction</td>
- * </tr>
- * <tr>
- * <td>0</td>
- * <td>>=1</td>
- * <td>Open dialog - prompt for input file</td>
- * </tr>
- * <tr>
- * <td>1</td>
- * <td>>=1</td>
- * <td>Launch</td>
- * </tr>
- * </tbody>
+ * <th>
+ * <tr>
+ * <td>XML Files</td>
+ * <td>XSL Files</td>
+ * <td>Action</td>
+ * </tr>
+ * </th>
+ * <tbody>
+ * <tr>
+ * <td>1</td>
+ * <td>0</td>
+ * <td>Launch assuming embedded stylesheet instruction</td>
+ * </tr>
+ * <tr>
+ * <td>0</td>
+ * <td>>=1</td>
+ * <td>Open dialog - prompt for input file</td>
+ * </tr>
+ * <tr>
+ * <td>1</td>
+ * <td>>=1</td>
+ * <td>Launch</td>
+ * </tr>
+ * </tbody>
* </table>
*
- * <p>The launch shortcut should not appear in the menu for any other combination of files</p>
- * <p>In all cases, a check must be performed to find any existing launch configuration that uses the selected files.</p>
+ * <p>
+ * The launch shortcut should not appear in the menu for any other combination
+ * of files
+ * </p>
+ * <p>
+ * In all cases, a check must be performed to find any existing launch
+ * configuration that uses the selected files.
+ * </p>
*
* @author Doug
* @since 1.0
*/
-public class XSLLaunchShortcut implements ILaunchShortcut
-{
+public class XSLLaunchShortcut implements ILaunchShortcut {
private IFile xmlFile;
private IPath xmlFilePath;
private IFile[] xslFiles;
-
- public void launch(ISelection selection, String mode)
- {
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection ssel = (IStructuredSelection)selection;
- searchAndLaunch(ssel.toArray(),mode);
+
+ public void launch(ISelection selection, String mode) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ searchAndLaunch(ssel.toArray(), mode);
}
}
- public void launch(IEditorPart editor, String mode)
- {
- IEditorInput input = editor.getEditorInput();
- if (input != null)
- {
+ public void launch(IEditorPart editor, String mode) {
+ IEditorInput input = editor.getEditorInput();
+ if (input != null) {
IFile file = (IFile) input.getAdapter(IFile.class);
if (file != null)
- searchAndLaunch(new Object[]{ file }, mode);
- }
+ searchAndLaunch(new Object[] { file }, mode);
+ }
}
-
- private void searchAndLaunch(Object[] objects, String mode)
- {
- if (fillFiles(objects))
- {
+
+ private void searchAndLaunch(Object[] objects, String mode) {
+ if (fillFiles(objects)) {
// ensure we have an input file
if (xmlFile == null)
promptForInput();
@@ -123,70 +122,66 @@
}
}
- private void promptForInput()
- {
+ private void promptForInput() {
// prompt for input xml file
- StatusDialog dialog = new StatusDialog(getShell()){
+ StatusDialog dialog = new StatusDialog(getShell()) {
private InputFileBlock inputFileBlock = new InputFileBlock(null);
-
+
@Override
- protected Control createDialogArea(Composite parent)
- {
- Composite comp = (Composite)super.createDialogArea(parent);
+ protected Control createDialogArea(Composite parent) {
+ Composite comp = (Composite) super.createDialogArea(parent);
comp.setFont(parent.getFont());
GridLayout layout = new GridLayout(1, false);
comp.setLayout(layout);
-
- Label label = new Label(comp,SWT.NONE);
+
+ Label label = new Label(comp, SWT.NONE);
label.setFont(comp.getFont());
GridData gd = new GridData();
gd.horizontalIndent = 5;
gd.verticalIndent = 5;
gd.widthHint = 380;
label.setLayoutData(gd);
- label.setText(Messages.XSLLaunchShortcut_0);
-
+ label.setText(Messages.XSLLaunchShortcut_0);
+
inputFileBlock.createControl(comp);
return comp;
}
-
+
@Override
- protected void okPressed()
- {
+ protected void okPressed() {
IResource res = inputFileBlock.getResource();
if (res == null)
xmlFilePath = new Path(inputFileBlock.getText());
- else if (ResourcesPlugin.getWorkspace().getRoot().exists(res.getFullPath()) && res.getType() == IResource.FILE)
- xmlFile = (IFile)res;
+ else if (ResourcesPlugin.getWorkspace().getRoot().exists(
+ res.getFullPath())
+ && res.getType() == IResource.FILE)
+ xmlFile = (IFile) res;
super.okPressed();
}
-
+
};
dialog.setHelpAvailable(false);
dialog.setStatusLineAboveButtons(true);
- dialog.setTitle(Messages.XSLLaunchShortcut_1);
+ dialog.setTitle(Messages.XSLLaunchShortcut_1);
dialog.open();
}
- private boolean fillFiles(Object[] selections)
- {
+ private boolean fillFiles(Object[] selections) {
xmlFile = null;
xmlFilePath = null;
List<IFile> xslFileList = new ArrayList<IFile>();
- for (Object object : selections)
- {
- IResource resource = (IResource)object;
- if (resource.getType() == IResource.FILE)
- {
- IFile file = (IFile)resource;
- if (XSLCore.isXMLFile(file))
- {
+ for (Object object : selections) {
+ IResource resource = (IResource) object;
+ if (resource.getType() == IResource.FILE) {
+ IFile file = (IFile) resource;
+ if (XSLCore.isXMLFile(file)) {
if (XSLCore.isXSLFile(file))
xslFileList.add(file);
- else if (xmlFile==null)
+ else if (xmlFile == null)
xmlFile = file;
else
- return false; // no action if we have more than than 1 xml file
+ return false; // no action if we have more than than 1
+ // xml file
}
}
}
@@ -194,64 +189,58 @@
return true;
}
- private void launch(String mode)
- {
- if (xmlFile!=null)
+ private void launch(String mode) {
+ if (xmlFile != null)
xmlFilePath = xmlFile.getLocation();
ILaunchConfiguration config = null;
- try
- {
+ try {
config = findOrCreateLaunchConfiguration();
- if (config!=null)
+ if (config != null)
DebugUITools.launch(config, mode);
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
- protected ILaunchManager getLaunchManager()
- {
+ protected ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}
- protected ILaunchConfigurationType getConfigurationType()
- {
- return getLaunchManager().getLaunchConfigurationType(XSLLaunchConfigurationConstants.ID_LAUNCH_CONFIG_TYPE);
+ protected ILaunchConfigurationType getConfigurationType() {
+ return getLaunchManager().getLaunchConfigurationType(
+ XSLLaunchConfigurationConstants.ID_LAUNCH_CONFIG_TYPE);
}
- private ILaunchConfiguration findOrCreateLaunchConfiguration() throws CoreException
- {
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(getConfigurationType());
- List<ILaunchConfiguration> candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
- for (ILaunchConfiguration config : configs)
- {
- String inputFile = config.getAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, (String) null);
- try
- {
- inputFile = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(inputFile);
- }
- catch (CoreException e)
- {
+ private ILaunchConfiguration findOrCreateLaunchConfiguration()
+ throws CoreException {
+ ILaunchConfiguration[] configs = getLaunchManager()
+ .getLaunchConfigurations(getConfigurationType());
+ List<ILaunchConfiguration> candidateConfigs = new ArrayList<ILaunchConfiguration>(
+ configs.length);
+ for (ILaunchConfiguration config : configs) {
+ String inputFile = config.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE,
+ (String) null);
+ try {
+ inputFile = VariablesPlugin.getDefault()
+ .getStringVariableManager().performStringSubstitution(
+ inputFile);
+ } catch (CoreException e) {
// just ignore this one
continue;
}
Path path = new Path(inputFile);
// the source xml file must be the same
- if (path.equals(xmlFilePath))
- {
+ if (path.equals(xmlFilePath)) {
BaseLaunchHelper lh = new BaseLaunchHelper(config);
// all the selected stylesheets must be in the pipeline
boolean found = false;
- for (IFile stylesheet : xslFiles)
- {
+ for (IFile stylesheet : xslFiles) {
found = false;
- for (Iterator<LaunchTransform> iter = lh.getPipeline().getTransformDefs().iterator(); iter.hasNext();)
- {
+ for (Iterator<LaunchTransform> iter = lh.getPipeline()
+ .getTransformDefs().iterator(); iter.hasNext();) {
LaunchTransform lt = iter.next();
- if (lt.getLocation().equals(stylesheet.getLocation()))
- {
+ if (lt.getLocation().equals(stylesheet.getLocation())) {
found = true;
break;
}
@@ -276,57 +265,68 @@
return config;
}
- private ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configList)
- {
- IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
- ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+ private ILaunchConfiguration chooseConfiguration(
+ List<ILaunchConfiguration> configList) {
+ IDebugModelPresentation labelProvider = DebugUITools
+ .newDebugModelPresentation();
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(
+ getShell(), labelProvider);
dialog.setElements(configList.toArray());
- dialog.setTitle(Messages.XSLLaunchShortcut_2);
+ dialog.setTitle(Messages.XSLLaunchShortcut_2);
dialog.setMessage(Messages.XSLSelectExisting);
dialog.setMultipleSelection(false);
int result = dialog.open();
labelProvider.dispose();
- if (result == Window.OK)
- {
+ if (result == Window.OK) {
return (ILaunchConfiguration) dialog.getFirstResult();
}
return null;
}
- private ILaunchConfiguration createConfiguration()
- {
+ private ILaunchConfiguration createConfiguration() {
ILaunchConfiguration config = null;
- try
- {
+ try {
ILaunchConfigurationType configType = getConfigurationType();
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(xmlFilePath.lastSegment()));
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
+ getLaunchManager()
+ .generateUniqueLaunchConfigurationNameFrom(
+ xmlFilePath.lastSegment()));
if (xmlFile != null)
- wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, "${workspace_loc:" + xmlFile.getFullPath().toPortableString()+"}"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc
+ .setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE,
+ "${workspace_loc:" + xmlFile.getFullPath().toPortableString() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
else
- wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, xmlFilePath.toPortableString());
+ wc.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE,
+ xmlFilePath.toPortableString());
- wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE, true);
- wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, true);
+ wc
+ .setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE,
+ true);
+ wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_OPEN_FILE,
+ true);
LaunchPipeline pipeline = new LaunchPipeline();
- for (IFile element : xslFiles)
- {
- pipeline.addTransformDef(new LaunchTransform(element.getFullPath().toPortableString(), LaunchTransform.RESOURCE_TYPE));
+ for (IFile element : xslFiles) {
+ pipeline.addTransformDef(new LaunchTransform(element
+ .getFullPath().toPortableString(),
+ LaunchTransform.RESOURCE_TYPE));
}
- wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_PIPELINE, pipeline.toXML());
- if (xmlFile!=null)
- wc.setMappedResources(new IResource[]{ xmlFile.getProject() });
+ wc.setAttribute(XSLLaunchConfigurationConstants.ATTR_PIPELINE,
+ pipeline.toXML());
+ if (xmlFile != null)
+ wc.setMappedResources(new IResource[] { xmlFile.getProject() });
config = wc.doSave();
- }
- catch (CoreException exception)
- {
- MessageDialog.openError(getShell(), Messages.XSLLaunchShortcut_6, exception.getStatus().getMessage());
+ } catch (CoreException exception) {
+ MessageDialog.openError(getShell(), Messages.XSLLaunchShortcut_6,
+ exception.getStatus().getMessage());
}
return config;
}
- protected Shell getShell()
- {
+ protected Shell getShell() {
return XSLDebugUIPlugin.getActiveWorkbenchShell();
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLTTabGroup.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLTTabGroup.java
index 42ba093..2098467 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLTTabGroup.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/XSLTTabGroup.java
@@ -19,40 +19,39 @@
import org.eclipse.wst.xsl.internal.debug.ui.tabs.output.OutputTab;
/**
- *The tab group for the XSL tabs.
+ * The tab group for the XSL tabs.
*
* @author Doug Satchwell
* @since 1.0
*/
-public class XSLTTabGroup extends AbstractLaunchConfigurationTabGroup
-{
+public class XSLTTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
* Create a new instance of this.
*/
- public XSLTTabGroup()
- {
+ public XSLTTabGroup() {
}
- public void createTabs(ILaunchConfigurationDialog dialog, String mode)
- {
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
XSLMainTab main = new XSLMainTab();
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { main, new OutputTab(main) };
- tabs = addTabs(tabs, new ILaunchConfigurationTab[] { new SourceLookupTab(), new CommonTab() });
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { main,
+ new OutputTab(main) };
+ tabs = addTabs(tabs, new ILaunchConfigurationTab[] {
+ new SourceLookupTab(), new CommonTab() });
setTabs(tabs);
}
- private ILaunchConfigurationTab[] addTabs(ILaunchConfigurationTab[] tabs1, ILaunchConfigurationTab[] tabs2)
- {
- ILaunchConfigurationTab[] newTabs = new ILaunchConfigurationTab[tabs1.length + tabs2.length];
+ private ILaunchConfigurationTab[] addTabs(ILaunchConfigurationTab[] tabs1,
+ ILaunchConfigurationTab[] tabs2) {
+ ILaunchConfigurationTab[] newTabs = new ILaunchConfigurationTab[tabs1.length
+ + tabs2.length];
System.arraycopy(tabs1, 0, newTabs, 0, tabs1.length);
System.arraycopy(tabs2, 0, newTabs, tabs1.length, tabs2.length);
return newTabs;
}
@Override
- public void setTabs(ILaunchConfigurationTab[] tabs)
- {
+ public void setTabs(ILaunchConfigurationTab[] tabs) {
// TODO Auto-generated method stub
super.setTabs(tabs);
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractParameterAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractParameterAction.java
index dab1427..30b2d54 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractParameterAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractParameterAction.java
@@ -23,14 +23,12 @@
*
* @author Doug Satchwell
*/
-public abstract class AbstractParameterAction extends SelectionListenerAction
-{
+public abstract class AbstractParameterAction extends SelectionListenerAction {
private ParameterViewer viewer;
private Button button;
private Shell shell;
- protected AbstractParameterAction(String text, ParameterViewer viewer)
- {
+ protected AbstractParameterAction(String text, ParameterViewer viewer) {
super(text);
setViewer(viewer);
}
@@ -38,40 +36,35 @@
/**
* Set the viewer.
*
- * @param viewer the parametere viewer
+ * @param viewer
+ * the parametere viewer
*/
- public void setViewer(ParameterViewer viewer)
- {
- if (this.viewer != null)
- {
+ public void setViewer(ParameterViewer viewer) {
+ if (this.viewer != null) {
this.viewer.getViewer().removeSelectionChangedListener(this);
}
this.viewer = viewer;
- if (viewer != null)
- {
+ if (viewer != null) {
viewer.getViewer().addSelectionChangedListener(this);
update();
}
}
- protected ParameterViewer getViewer()
- {
+ protected ParameterViewer getViewer() {
return viewer;
}
/**
* Set the button associated with the action.
*
- * @param button the button
+ * @param button
+ * the button
*/
- public void setButton(Button button)
- {
+ public void setButton(Button button) {
this.button = button;
- button.addSelectionListener(new SelectionAdapter()
- {
+ button.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected(SelectionEvent evt)
- {
+ public void widgetSelected(SelectionEvent evt) {
run();
}
});
@@ -79,24 +72,20 @@
}
@Override
- public void setEnabled(boolean enabled)
- {
+ public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- if (button != null)
- {
+ if (button != null) {
button.setEnabled(enabled);
}
}
- protected void update()
- {
- selectionChanged((IStructuredSelection) getViewer().getViewer().getSelection());
+ protected void update() {
+ selectionChanged((IStructuredSelection) getViewer().getViewer()
+ .getSelection());
}
- protected Shell getShell()
- {
- if (shell == null)
- {
+ protected Shell getShell() {
+ if (shell == null) {
shell = getViewer().getShell();
}
return shell;
@@ -105,21 +94,19 @@
/**
* Set the shell that will be used for opening a dialog.
*
- * @param shell the shell to use
+ * @param shell
+ * the shell to use
*/
- public void setShell(Shell shell)
- {
+ public void setShell(Shell shell) {
this.shell = shell;
}
@Override
- protected boolean updateSelection(IStructuredSelection selection)
- {
+ protected boolean updateSelection(IStructuredSelection selection) {
return getViewer().updateSelection(getActionType(), selection);
}
- protected int getActionType()
- {
+ protected int getActionType() {
return AbstractStylesheetAction.DEFAULT;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractStylesheetAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractStylesheetAction.java
index 39ac666..5117722 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractStylesheetAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AbstractStylesheetAction.java
@@ -28,8 +28,7 @@
*
* @author Doug Satchwell
*/
-public abstract class AbstractStylesheetAction extends SelectionListenerAction
-{
+public abstract class AbstractStylesheetAction extends SelectionListenerAction {
/**
* The default action type.
*/
@@ -51,8 +50,7 @@
private Button button;
private Shell shell;
- protected AbstractStylesheetAction(String text, StylesheetViewer viewer)
- {
+ protected AbstractStylesheetAction(String text, StylesheetViewer viewer) {
super(text);
setViewer(viewer);
}
@@ -60,50 +58,45 @@
/**
* Add an array of LaunchTransform's to the viewer.
*
- * @param res launch transforms to add
+ * @param res
+ * launch transforms to add
*/
- public void addTransforms(LaunchTransform[] res)
- {
+ public void addTransforms(LaunchTransform[] res) {
viewer.addTransforms(res);
}
/**
* Set the viewer associated with this action.
*
- * @param viewer the viewer
+ * @param viewer
+ * the viewer
*/
- public void setViewer(StylesheetViewer viewer)
- {
- if (this.viewer != null)
- {
+ public void setViewer(StylesheetViewer viewer) {
+ if (this.viewer != null) {
this.viewer.getViewer().removeSelectionChangedListener(this);
}
this.viewer = viewer;
- if (viewer != null)
- {
+ if (viewer != null) {
viewer.getViewer().addSelectionChangedListener(this);
update();
}
}
- protected StylesheetViewer getViewer()
- {
+ protected StylesheetViewer getViewer() {
return viewer;
}
/**
* Set the button associated with this action.
*
- * @param button the button
+ * @param button
+ * the button
*/
- public void setButton(Button button)
- {
+ public void setButton(Button button) {
this.button = button;
- button.addSelectionListener(new SelectionAdapter()
- {
+ button.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected(SelectionEvent evt)
- {
+ public void widgetSelected(SelectionEvent evt) {
run();
}
});
@@ -111,24 +104,20 @@
}
@Override
- public void setEnabled(boolean enabled)
- {
+ public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- if (button != null)
- {
+ if (button != null) {
button.setEnabled(enabled);
}
}
- protected void update()
- {
- selectionChanged((IStructuredSelection) getViewer().getViewer().getSelection());
+ protected void update() {
+ selectionChanged((IStructuredSelection) getViewer().getViewer()
+ .getSelection());
}
- protected Shell getShell()
- {
- if (shell == null)
- {
+ protected Shell getShell() {
+ if (shell == null) {
shell = getViewer().getShell();
}
return shell;
@@ -137,32 +126,29 @@
/**
* Set the shell to be used for opening a dialog.
*
- * @param shell the shell to use
+ * @param shell
+ * the shell to use
*/
- public void setShell(Shell shell)
- {
+ public void setShell(Shell shell) {
this.shell = shell;
}
@Override
- protected boolean updateSelection(IStructuredSelection selection)
- {
+ protected boolean updateSelection(IStructuredSelection selection) {
return getViewer().updateSelection(getActionType(), selection);
}
- protected int getActionType()
- {
+ protected int getActionType() {
return DEFAULT;
}
- protected List<?> getOrderedSelection()
- {
- List<?> selection = ((IStructuredSelection) getViewer().getViewer().getSelection()).toList();
+ protected List<?> getOrderedSelection() {
+ List<?> selection = ((IStructuredSelection) getViewer().getViewer()
+ .getSelection()).toList();
return selection;
}
- protected List<LaunchTransform> getEntriesAsList()
- {
+ protected List<LaunchTransform> getEntriesAsList() {
// IStylesheetEntry[] entries = getViewer().getEntries();
// List list = new ArrayList(entries.length);
// for (int i = 0; i < entries.length; i++) {
@@ -172,26 +158,21 @@
return lp.getTransformDefs();
}
- protected void setEntries(List<?> list)
- {
+ protected void setEntries(List<?> list) {
getViewer().setEntries(list.toArray(new LaunchTransform[list.size()]));
// // update all selection listeners
// getViewer().setSelection(getViewer().getSelection());
}
- protected boolean isIndexSelected(IStructuredSelection selection, int index)
- {
- if (selection.isEmpty())
- {
+ protected boolean isIndexSelected(IStructuredSelection selection, int index) {
+ if (selection.isEmpty()) {
return false;
}
Iterator<?> entries = selection.iterator();
List<?> list = getEntriesAsList();
- while (entries.hasNext())
- {
+ while (entries.hasNext()) {
Object next = entries.next();
- if (list.indexOf(next) == index)
- {
+ if (list.indexOf(next) == index) {
return true;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddExternalFileAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddExternalFileAction.java
index 35e1bbd..1b7aa95 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddExternalFileAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddExternalFileAction.java
@@ -23,58 +23,59 @@
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
import org.eclipse.wst.xsl.core.XSLCore;
-
/**
- * An action that opens a dialog to allow the user to select a file from the file system.
+ * An action that opens a dialog to allow the user to select a file from the
+ * file system.
*
* @author Doug Satchwell
*/
-public class AddExternalFileAction extends OpenDialogAction
-{
+public class AddExternalFileAction extends OpenDialogAction {
/**
* Create a new instance of this.
*
- * @param viewer the stylesheet viewer
- * @param dialogSettingsPrefix a prefix to use for saving dialog preferences
+ * @param viewer
+ * the stylesheet viewer
+ * @param dialogSettingsPrefix
+ * a prefix to use for saving dialog preferences
*/
- public AddExternalFileAction(StylesheetViewer viewer, String dialogSettingsPrefix)
- {
+ public AddExternalFileAction(StylesheetViewer viewer,
+ String dialogSettingsPrefix) {
super(Messages.AddExternalFileAction_Text, viewer, dialogSettingsPrefix);
}
@Override
- public void run()
- {
+ public void run() {
String lastUsedPath = getDialogSetting(LAST_PATH_SETTING);
- if (lastUsedPath == null)
- {
+ if (lastUsedPath == null) {
lastUsedPath = ""; //$NON-NLS-1$
}
FileDialog dialog = new FileDialog(getShell(), SWT.MULTI);
dialog.setText(Messages.AddExternalFileAction_Selection_3);
dialog.setFilterPath(lastUsedPath);
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- IContentType contentType = contentTypeManager.getContentType(XSLCore.XSL_CONTENT_TYPE);
- String[] xslContentTypes = contentType.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
-
+ IContentTypeManager contentTypeManager = Platform
+ .getContentTypeManager();
+ IContentType contentType = contentTypeManager
+ .getContentType(XSLCore.XSL_CONTENT_TYPE);
+ String[] xslContentTypes = contentType
+ .getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+
// add *. to front
- for (int i = 0; i < xslContentTypes.length; i++)
- {
+ for (int i = 0; i < xslContentTypes.length; i++) {
String string = xslContentTypes[i];
- xslContentTypes[i] = "*."+string; //$NON-NLS-1$
+ xslContentTypes[i] = "*." + string; //$NON-NLS-1$
}
dialog.setFilterExtensions(xslContentTypes);
String res = dialog.open();
- if (res == null)
- {
+ if (res == null) {
return;
}
IPath filterPath = new Path(dialog.getFilterPath());
LaunchTransform[] lts = new LaunchTransform[1];
IPath path = new Path(res).makeAbsolute();
- lts[0] = new LaunchTransform(path.toPortableString(), LaunchTransform.EXTERNAL_TYPE);
+ lts[0] = new LaunchTransform(path.toPortableString(),
+ LaunchTransform.EXTERNAL_TYPE);
setDialogSetting(LAST_PATH_SETTING, filterPath.toOSString());
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddParameterAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddParameterAction.java
index 1440b10..7f7b563 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddParameterAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddParameterAction.java
@@ -17,34 +17,33 @@
import org.eclipse.wst.xsl.launching.config.LaunchAttribute;
/**
- * An action that opens a dialog to allow the user to add a parameter to a transform.
+ * An action that opens a dialog to allow the user to add a parameter to a
+ * transform.
*
* @author Doug Satchwell
*/
-public class AddParameterAction extends AbstractParameterAction
-{
+public class AddParameterAction extends AbstractParameterAction {
/**
* Create a new instance of this.
*
- * @param viewer teh viewer
+ * @param viewer
+ * teh viewer
*/
- public AddParameterAction(ParameterViewer viewer)
- {
+ public AddParameterAction(ParameterViewer viewer) {
super(Messages.AddParameterAction, viewer);
}
@Override
- public void run()
- {
- MultipleInputDialog dialog = new MultipleInputDialog(getShell(), Messages.AddParameterAction_Dialog);
+ public void run() {
+ MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
+ Messages.AddParameterAction_Dialog);
String namelabel = Messages.AddParameterAction_Dialog_Name;
dialog.addTextField(namelabel, null, false);
String variableslabel = Messages.AddParameterAction_Dialog_Value;
dialog.addVariablesField(variableslabel, null, false);
dialog.open();
- if (dialog.getReturnCode() == Window.OK)
- {
+ if (dialog.getReturnCode() == Window.OK) {
String name = dialog.getStringValue(namelabel);
String value = dialog.getStringValue(variableslabel);
LaunchAttribute parameter = null;
@@ -57,8 +56,7 @@
}
@Override
- public void setEnabled(boolean enabled)
- {
+ public void setEnabled(boolean enabled) {
// do nothing
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddWorkspaceFileAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddWorkspaceFileAction.java
index cc0e483..04259f1 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddWorkspaceFileAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/AddWorkspaceFileAction.java
@@ -33,65 +33,61 @@
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
/**
- * An action that opens a dialog to allow the user to select a file in the workspace.
+ * An action that opens a dialog to allow the user to select a file in the
+ * workspace.
*
* @author Doug Satchwell
*/
-public class AddWorkspaceFileAction extends AbstractStylesheetAction
-{
- private final ISelectionStatusValidator validator = new ISelectionStatusValidator()
- {
- public IStatus validate(Object[] selection)
- {
- if (selection.length == 0)
- {
- return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+public class AddWorkspaceFileAction extends AbstractStylesheetAction {
+ private final ISelectionStatusValidator validator = new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection) {
+ if (selection.length == 0) {
+ return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0,
+ "", null); //$NON-NLS-1$
}
- for (int i = 0; i < selection.length; i++)
- {
- if (!(selection[i] instanceof IFile))
- {
- return new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ for (int i = 0; i < selection.length; i++) {
+ if (!(selection[i] instanceof IFile)) {
+ return new Status(IStatus.ERROR,
+ XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
}
}
- return new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, 0,
+ "", null); //$NON-NLS-1$
}
};
/**
* Create a new instance of this.
*
- * @param viewer the viewer
+ * @param viewer
+ * the viewer
*/
- public AddWorkspaceFileAction(StylesheetViewer viewer)
- {
+ public AddWorkspaceFileAction(StylesheetViewer viewer) {
super(Messages.AddWorkspaceFileAction_Text, viewer);
}
@Override
- public void run()
- {
+ public void run() {
// ViewerFilter filter= new StylesheetFilter(getSelectedJars());
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), lp, cp);
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
+ getShell(), lp, cp);
dialog.setValidator(validator);
dialog.setTitle(Messages.AddWorkspaceFileAction_DialogTitle);
dialog.setMessage(Messages.AddWorkspaceFileAction_DialogMessage);
- dialog.addFilter(new ViewerFilter()
- {
+ dialog.addFilter(new ViewerFilter() {
@Override
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
if (!(element instanceof IResource))
return false;
- IResource resource = (IResource)element;
- if (resource.getType() == IResource.FILE)
- {
- if (!XSLCore.isXSLFile((IFile)resource))
+ IResource resource = (IResource) element;
+ if (resource.getType() == IResource.FILE) {
+ if (!XSLCore.isXSLFile((IFile) resource))
return false;
}
return true;
@@ -100,22 +96,20 @@
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- if (dialog.open() == Window.OK)
- {
+ if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
LaunchTransform[] res = new LaunchTransform[elements.length];
- for (int i = 0; i < res.length; i++)
- {
+ for (int i = 0; i < res.length; i++) {
IResource elem = (IResource) elements[i];
- res[i] = new LaunchTransform(elem.getFullPath().toPortableString(), LaunchTransform.RESOURCE_TYPE);
+ res[i] = new LaunchTransform(elem.getFullPath()
+ .toPortableString(), LaunchTransform.RESOURCE_TYPE);
}
addTransforms(res);
}
}
@Override
- protected int getActionType()
- {
+ protected int getActionType() {
return ADD;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/ControlAccessibleListener.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/ControlAccessibleListener.java
index 71caaf6..33e6fcd 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/ControlAccessibleListener.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/ControlAccessibleListener.java
@@ -19,36 +19,34 @@
*
* @author Doug Satchwell
*/
-public class ControlAccessibleListener extends AccessibleAdapter
-{
+public class ControlAccessibleListener extends AccessibleAdapter {
private final String controlName;
- private ControlAccessibleListener(String name)
- {
+ private ControlAccessibleListener(String name) {
controlName = name;
}
@Override
- public void getName(AccessibleEvent e)
- {
+ public void getName(AccessibleEvent e) {
e.result = controlName;
}
/**
* Helper for adding an instance of this to the given control.
*
- * @param comp the control to add this to
- * @param name the name for this
+ * @param comp
+ * the control to add this to
+ * @param name
+ * the name for this
*/
- public static void addListener(Control comp, String name)
- {
+ public static void addListener(Control comp, String name) {
// strip mnemonic
String[] strs = name.split("&"); //$NON-NLS-1$
StringBuffer stripped = new StringBuffer();
- for (String element : strs)
- {
+ for (String element : strs) {
stripped.append(element);
}
- comp.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
+ comp.getAccessible().addAccessibleListener(
+ new ControlAccessibleListener(stripped.toString()));
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveDownAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveDownAction.java
index 683636e..f6a0c13 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveDownAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveDownAction.java
@@ -18,43 +18,38 @@
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
/**
- * The action for moving a stylesheet further down in the transformation pipeline.
+ * The action for moving a stylesheet further down in the transformation
+ * pipeline.
*
* @author Doug Satchwell
*/
-public class MoveDownAction extends AbstractStylesheetAction
-{
+public class MoveDownAction extends AbstractStylesheetAction {
/**
* Create a new instance of this.
*
* @param viewer
*/
- public MoveDownAction(StylesheetViewer viewer)
- {
+ public MoveDownAction(StylesheetViewer viewer) {
super(Messages.MoveDownAction_Text, viewer);
}
@Override
- public void run()
- {
+ public void run() {
List<?> targets = getOrderedSelection();
- if (targets.isEmpty())
- {
+ if (targets.isEmpty()) {
return;
}
List<LaunchTransform> list = getEntriesAsList();
int bottom = list.size() - 1;
int index = 0;
- for (int i = targets.size() - 1; i >= 0; i--)
- {
+ for (int i = targets.size() - 1; i >= 0; i--) {
Object target = targets.get(i);
index = list.indexOf(target);
- if (index < bottom)
- {
+ if (index < bottom) {
bottom = index + 1;
Object temp = list.get(bottom);
- list.set(bottom, (LaunchTransform)target);
- list.set(index, (LaunchTransform)temp);
+ list.set(bottom, (LaunchTransform) target);
+ list.set(index, (LaunchTransform) temp);
}
bottom = index;
}
@@ -62,18 +57,16 @@
}
@Override
- protected boolean updateSelection(IStructuredSelection selection)
- {
- if (selection.isEmpty())
- {
+ protected boolean updateSelection(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
return false;
}
- return getViewer().updateSelection(getActionType(), selection) && !isIndexSelected(selection, getEntriesAsList().size() - 1);
+ return getViewer().updateSelection(getActionType(), selection)
+ && !isIndexSelected(selection, getEntriesAsList().size() - 1);
}
@Override
- protected int getActionType()
- {
+ protected int getActionType() {
return MOVE;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveUpAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveUpAction.java
index 9646d52..c613daa 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveUpAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MoveUpAction.java
@@ -24,40 +24,34 @@
*
* @author Doug Satchwell
*/
-public class MoveUpAction extends AbstractStylesheetAction
-{
+public class MoveUpAction extends AbstractStylesheetAction {
/**
* Create a new instance of this.
*
* @param viewer
*/
- public MoveUpAction(StylesheetViewer viewer)
- {
+ public MoveUpAction(StylesheetViewer viewer) {
super(Messages.MoveUpAction_Text, viewer);
}
@Override
- public void run()
- {
+ public void run() {
List<?> targets = getOrderedSelection();
- if (targets.isEmpty())
- {
+ if (targets.isEmpty()) {
return;
}
int top = 0;
int index = 0;
List<LaunchTransform> list = getEntriesAsList();
Iterator<?> entries = targets.iterator();
- while (entries.hasNext())
- {
+ while (entries.hasNext()) {
Object target = entries.next();
index = list.indexOf(target);
- if (index > top)
- {
+ if (index > top) {
top = index - 1;
Object temp = list.get(top);
- list.set(top, (LaunchTransform)target);
- list.set(index, (LaunchTransform)temp);
+ list.set(top, (LaunchTransform) target);
+ list.set(index, (LaunchTransform) temp);
}
top = index;
}
@@ -65,18 +59,16 @@
}
@Override
- protected boolean updateSelection(IStructuredSelection selection)
- {
- if (selection.isEmpty())
- {
+ protected boolean updateSelection(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
return false;
}
- return getViewer().updateSelection(getActionType(), selection) && !isIndexSelected(selection, 0);
+ return getViewer().updateSelection(getActionType(), selection)
+ && !isIndexSelected(selection, 0);
}
@Override
- protected int getActionType()
- {
+ protected int getActionType() {
return MOVE;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MultipleInputDialog.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MultipleInputDialog.java
index 692b1b3..95d4709 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MultipleInputDialog.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/MultipleInputDialog.java
@@ -44,8 +44,7 @@
*
* @author Doug Satchwell
*/
-public class MultipleInputDialog extends Dialog
-{
+public class MultipleInputDialog extends Dialog {
protected static final String FIELD_NAME = "FIELD_NAME"; //$NON-NLS-1$
protected static final int TEXT = 100;
protected static final int BROWSE = 101;
@@ -65,38 +64,35 @@
/**
* Create a new instance of this.
*
- * @param shell the shell to open the dialog on
- * @param title the title for the dialog
+ * @param shell
+ * the shell to open the dialog on
+ * @param title
+ * the title for the dialog
*/
- public MultipleInputDialog(final Shell shell, final String title)
- {
+ public MultipleInputDialog(final Shell shell, final String title) {
super(shell);
this.title = title;
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@Override
- protected void configureShell(Shell shell)
- {
+ protected void configureShell(Shell shell) {
super.configureShell(shell);
- if (title != null)
- {
+ if (title != null) {
shell.setText(title);
}
}
@Override
- protected Control createButtonBar(Composite parent)
- {
+ protected Control createButtonBar(Composite parent) {
Control bar = super.createButtonBar(parent);
validateFields();
return bar;
}
@Override
- protected Control createDialogArea(Composite parent)
- {
+ protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
// ((GridData) parent.getLayoutData()).heightHint = 400;
// ((GridData) parent.getLayoutData()).widthHint = 400;
@@ -112,24 +108,24 @@
panel.setLayout(layout);
panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- for (Iterator<FieldSummary> i = fieldList.iterator(); i.hasNext();)
- {
+ for (Iterator<FieldSummary> i = fieldList.iterator(); i.hasNext();) {
FieldSummary field = i.next();
- switch (field.type)
- {
- case TEXT:
- createTextField(field.name, field.initialValue, field.allowsEmpty);
- break;
- // case BROWSE:
- // createBrowseField(field.name, field.initialValue,
- // field.allowsEmpty);
- // break;
- case VARIABLE:
- createVariablesField(field.name, field.initialValue, field.allowsEmpty);
- break;
- case COMBO:
- createComboField(field.name, field.initialIndex, field.items);
- break;
+ switch (field.type) {
+ case TEXT:
+ createTextField(field.name, field.initialValue,
+ field.allowsEmpty);
+ break;
+ // case BROWSE:
+ // createBrowseField(field.name, field.initialValue,
+ // field.allowsEmpty);
+ // break;
+ case VARIABLE:
+ createVariablesField(field.name, field.initialValue,
+ field.allowsEmpty);
+ break;
+ case COMBO:
+ createComboField(field.name, field.initialIndex, field.items);
+ break;
}
}
@@ -142,53 +138,67 @@
/**
* Add a label, text box and button for browsing the for a file.
*
- * @param labelText the label
- * @param initialValue the initial value
- * @param allowsEmpty true if the text box can be empty
+ * @param labelText
+ * the label
+ * @param initialValue
+ * the initial value
+ * @param allowsEmpty
+ * true if the text box can be empty
*/
- public void addBrowseField(String labelText, String initialValue, boolean allowsEmpty)
- {
- fieldList.add(new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty));
+ public void addBrowseField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(BROWSE, labelText, initialValue,
+ allowsEmpty));
}
/**
* Add a label and a text box.
*
- * @param labelText the label
- * @param initialValue the initial value
- * @param allowsEmpty true if the text box can be empty
+ * @param labelText
+ * the label
+ * @param initialValue
+ * the initial value
+ * @param allowsEmpty
+ * true if the text box can be empty
*/
- public void addTextField(String labelText, String initialValue, boolean allowsEmpty)
- {
- fieldList.add(new FieldSummary(TEXT, labelText, initialValue, allowsEmpty));
+ public void addTextField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(TEXT, labelText, initialValue,
+ allowsEmpty));
}
/**
* Add a label, a text box and a button for selecting variables.
*
- * @param labelText the label
- * @param initialValue the initial value
- * @param allowsEmpty true if the text box can be empty
+ * @param labelText
+ * the label
+ * @param initialValue
+ * the initial value
+ * @param allowsEmpty
+ * true if the text box can be empty
*/
- public void addVariablesField(String labelText, String initialValue, boolean allowsEmpty)
- {
- fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue, allowsEmpty));
+ public void addVariablesField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue,
+ allowsEmpty));
}
/**
* Add a label and a combo.
*
- * @param labelText the label
- * @param initialIndex the initial selection index
- * @param items the array of items for the combo
+ * @param labelText
+ * the label
+ * @param initialIndex
+ * the initial selection index
+ * @param items
+ * the array of items for the combo
*/
- public void addComboField(String labelText, int initialIndex, String[] items)
- {
+ public void addComboField(String labelText, int initialIndex, String[] items) {
fieldList.add(new FieldSummary(COMBO, labelText, items, initialIndex));
}
- protected void createTextField(String labelText, String initialValue, boolean allowEmpty)
- {
+ protected void createTextField(String labelText, String initialValue,
+ boolean allowEmpty) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
@@ -200,25 +210,19 @@
// make sure rows are the same height on both panels.
label.setSize(label.getSize().x, text.getSize().y);
- if (initialValue != null)
- {
+ if (initialValue != null) {
text.setText(initialValue);
}
- if (!allowEmpty)
- {
- validators.add(new Validator()
- {
+ if (!allowEmpty) {
+ validators.add(new Validator() {
@Override
- public boolean validate()
- {
+ public boolean validate() {
return !text.getText().equals(""); //$NON-NLS-1$
}
});
- text.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
validateFields();
}
});
@@ -227,8 +231,8 @@
controlList.add(text);
}
- protected void createVariablesField(String labelText, String initialValue, boolean allowEmpty)
- {
+ protected void createVariablesField(String labelText, String initialValue,
+ boolean allowEmpty) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
@@ -249,44 +253,36 @@
// make sure rows are the same height on both panels.
label.setSize(label.getSize().x, text.getSize().y);
- if (initialValue != null)
- {
+ if (initialValue != null) {
text.setText(initialValue);
}
- if (!allowEmpty)
- {
- validators.add(new Validator()
- {
+ if (!allowEmpty) {
+ validators.add(new Validator() {
@Override
- public boolean validate()
- {
+ public boolean validate() {
return !text.getText().equals(""); //$NON-NLS-1$
}
});
- text.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
validateFields();
}
});
}
- Button button = createButton(comp, IDialogConstants.IGNORE_ID, Messages.VariablesFieldButton_Text, false);
- button.addSelectionListener(new SelectionAdapter()
- {
+ Button button = createButton(comp, IDialogConstants.IGNORE_ID,
+ Messages.VariablesFieldButton_Text, false);
+ button.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected(SelectionEvent e)
- {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ public void widgetSelected(SelectionEvent e) {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
+ getShell());
int code = dialog.open();
- if (code == IDialogConstants.OK_ID)
- {
+ if (code == IDialogConstants.OK_ID) {
String variable = dialog.getVariableExpression();
- if (variable != null)
- {
+ if (variable != null) {
text.insert(variable);
}
}
@@ -297,8 +293,8 @@
}
- protected void createComboField(String labelText, int initialValue, String[] items)
- {
+ protected void createComboField(String labelText, int initialValue,
+ String[] items) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
@@ -310,7 +306,8 @@
comp.setLayout(layout);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- final Combo combo = new Combo(comp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ final Combo combo = new Combo(comp, SWT.SINGLE | SWT.BORDER
+ | SWT.READ_ONLY);
// GridData data = new GridData(GridData.FILL_HORIZONTAL);
// data.widthHint = 200;
// combo.setLayoutData(data);
@@ -327,19 +324,16 @@
}
@Override
- protected void okPressed()
- {
- for (Iterator<Scrollable> i = controlList.iterator(); i.hasNext();)
- {
+ protected void okPressed() {
+ for (Iterator<Scrollable> i = controlList.iterator(); i.hasNext();) {
Control control = i.next();
- if (control instanceof Text)
- {
- valueMap.put(control.getData(FIELD_NAME), ((Text) control).getText());
- }
- else if (control instanceof Combo)
- {
+ if (control instanceof Text) {
+ valueMap.put(control.getData(FIELD_NAME), ((Text) control)
+ .getText());
+ } else if (control instanceof Combo) {
Combo combo = (Combo) control;
- valueMap.put(control.getData(FIELD_NAME), new Integer(combo.getSelectionIndex()));
+ valueMap.put(control.getData(FIELD_NAME), Integer.valueOf(combo
+ .getSelectionIndex()));
}
}
controlList = null;
@@ -347,34 +341,27 @@
}
@Override
- public int open()
- {
+ public int open() {
applyDialogFont(panel);
return super.open();
}
- protected Object getValue(String key)
- {
+ protected Object getValue(String key) {
return valueMap.get(key);
}
- protected String getStringValue(String key)
- {
+ protected String getStringValue(String key) {
return (String) getValue(key);
}
- protected int getIntValue(String key)
- {
+ protected int getIntValue(String key) {
return ((Integer) getValue(key)).intValue();
}
- protected void validateFields()
- {
- for (Iterator<Validator> i = validators.iterator(); i.hasNext();)
- {
+ protected void validateFields() {
+ for (Iterator<Validator> i = validators.iterator(); i.hasNext();) {
Validator validator = i.next();
- if (!validator.validate())
- {
+ if (!validator.validate()) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
return;
}
@@ -382,25 +369,23 @@
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
- private String getDialogSettingsSectionName()
- {
+ private String getDialogSettingsSectionName() {
return XSLDebugUIPlugin.PLUGIN_ID + ".MULTIPLE_INPUT_DIALOG"; //$NON-NLS-1$
}
@Override
- protected IDialogSettings getDialogBoundsSettings()
- {
- IDialogSettings settings = XSLDebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
- if (section == null)
- {
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = XSLDebugUIPlugin.getDefault()
+ .getDialogSettings();
+ IDialogSettings section = settings
+ .getSection(getDialogSettingsSectionName());
+ if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
}
return section;
}
- protected class FieldSummary
- {
+ protected static class FieldSummary {
int initialIndex;
int type;
String name;
@@ -408,26 +393,24 @@
boolean allowsEmpty;
String[] items;
- public FieldSummary(int type, String name, String initialValue, boolean allowsEmpty)
- {
+ public FieldSummary(int type, String name, String initialValue,
+ boolean allowsEmpty) {
this.type = type;
this.name = name;
this.initialValue = initialValue;
this.allowsEmpty = allowsEmpty;
}
- public FieldSummary(int type, String name, String[] items, int initialIndex)
- {
+ public FieldSummary(int type, String name, String[] items,
+ int initialIndex) {
this.type = type;
this.name = name;
this.items = items;
}
}
- protected class Validator
- {
- boolean validate()
- {
+ protected class Validator {
+ boolean validate() {
return true;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/OpenDialogAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/OpenDialogAction.java
index 3c269b0..09baf4f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/OpenDialogAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/OpenDialogAction.java
@@ -19,48 +19,48 @@
*
* @author Doug Satchwell
*/
-public class OpenDialogAction extends AbstractStylesheetAction
-{
+public class OpenDialogAction extends AbstractStylesheetAction {
protected static final String LAST_PATH_SETTING = "LAST_PATH_SETTING"; //$NON-NLS-1$
private String fPrefix = null;
/**
* Create a new instance of this
*
- * @param label the dialog title
- * @param viewer a viewer that this dialog is associated with
- * @param dialogSettingsPrefix the prefix to use for saving dialog preferences
+ * @param label
+ * the dialog title
+ * @param viewer
+ * a viewer that this dialog is associated with
+ * @param dialogSettingsPrefix
+ * the prefix to use for saving dialog preferences
*/
- public OpenDialogAction(String label, StylesheetViewer viewer, String dialogSettingsPrefix)
- {
+ public OpenDialogAction(String label, StylesheetViewer viewer,
+ String dialogSettingsPrefix) {
super(label, viewer);
fPrefix = dialogSettingsPrefix;
}
- protected String getDialogSettingsPrefix()
- {
+ protected String getDialogSettingsPrefix() {
return fPrefix;
}
- protected String getDialogSetting(String settingName)
- {
- return getDialogSettings().get(getDialogSettingsPrefix() + "." + settingName); //$NON-NLS-1$
+ protected String getDialogSetting(String settingName) {
+ return getDialogSettings().get(
+ getDialogSettingsPrefix() + "." + settingName); //$NON-NLS-1$
}
- protected void setDialogSetting(String settingName, String value)
- {
- getDialogSettings().put(getDialogSettingsPrefix() + "." + settingName, value); //$NON-NLS-1$
+ protected void setDialogSetting(String settingName, String value) {
+ getDialogSettings().put(
+ getDialogSettingsPrefix() + "." + settingName, value); //$NON-NLS-1$
}
- protected IDialogSettings getDialogSettings()
- {
- IDialogSettings settings = XSLDebugUIPlugin.getDefault().getDialogSettings();
+ protected IDialogSettings getDialogSettings() {
+ IDialogSettings settings = XSLDebugUIPlugin.getDefault()
+ .getDialogSettings();
return settings;
}
@Override
- protected int getActionType()
- {
+ protected int getActionType() {
return ADD;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveAction.java
index 11809ce..3f0d05f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveAction.java
@@ -21,39 +21,37 @@
*
* @author Doug Satchwell
*/
-public class RemoveAction extends AbstractStylesheetAction
-{
+public class RemoveAction extends AbstractStylesheetAction {
/**
* Create a new instance of this.
*
- * @param viewer the viewer that will have its selection removed
+ * @param viewer
+ * the viewer that will have its selection removed
*/
- public RemoveAction(StylesheetViewer viewer)
- {
+ public RemoveAction(StylesheetViewer viewer) {
super(Messages.RemoveAction_Text, viewer);
}
@SuppressWarnings("unchecked")
@Override
- public void run()
- {
- IStructuredSelection selection = (IStructuredSelection) getViewer().getViewer().getSelection();
- getViewer().removeEntries((LaunchTransform[]) selection.toList().toArray(new LaunchTransform[0]));
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection) getViewer()
+ .getViewer().getSelection();
+ getViewer().removeEntries(
+ (LaunchTransform[]) selection.toList().toArray(
+ new LaunchTransform[0]));
}
@Override
- protected boolean updateSelection(IStructuredSelection selection)
- {
- if (selection.isEmpty())
- {
+ protected boolean updateSelection(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
return false;
}
return getViewer().updateSelection(getActionType(), selection);
}
@Override
- protected int getActionType()
- {
+ protected int getActionType() {
return MOVE;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveParameterAction.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveParameterAction.java
index 430dadc..9595161 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveParameterAction.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/actions/RemoveParameterAction.java
@@ -23,28 +23,24 @@
*
* @author Doug Satchwell
*/
-public class RemoveParameterAction extends AbstractParameterAction
-{
+public class RemoveParameterAction extends AbstractParameterAction {
/**
* Create a new instance of this.
*
- * @param viewer the viewer that will have its selection removed
+ * @param viewer
+ * the viewer that will have its selection removed
*/
- public RemoveParameterAction(ParameterViewer viewer)
- {
+ public RemoveParameterAction(ParameterViewer viewer) {
super(Messages.RemoveParameterAction, viewer);
}
@Override
- public void run()
- {
+ public void run() {
IStructuredSelection sel = getStructuredSelection();
- if (sel.size() > 0)
- {
+ if (sel.size() > 0) {
LaunchAttribute[] entries = new LaunchAttribute[sel.size()];
int i = 0;
- for (Iterator<?> iter = sel.iterator(); iter.hasNext(); i++)
- {
+ for (Iterator<?> iter = sel.iterator(); iter.hasNext(); i++) {
LaunchAttribute att = (LaunchAttribute) iter.next();
entries[i] = att;
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/breakpoint/XSLBreakpointProvider.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/breakpoint/XSLBreakpointProvider.java
index 14cbe5b..c95a34a 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/breakpoint/XSLBreakpointProvider.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/breakpoint/XSLBreakpointProvider.java
@@ -41,120 +41,114 @@
*
* @author Doug Satchwell
*/
-public class XSLBreakpointProvider implements IBreakpointProvider, IExecutableExtension
-{
- public IStatus addBreakpoint(IDocument document, IEditorInput input, int editorLineNumber, int offset) throws CoreException
- {
+public class XSLBreakpointProvider implements IBreakpointProvider,
+ IExecutableExtension {
+ public IStatus addBreakpoint(IDocument document, IEditorInput input,
+ int editorLineNumber, int offset) throws CoreException {
// check if there is a valid position to set breakpoint
int pos = getValidPosition(document, editorLineNumber);
IStatus status = null;
- if (pos >= 0)
- {
+ if (pos >= 0) {
IResource res = getResourceFromInput(input);
- if (res != null)
- {
+ if (res != null) {
boolean add = true;
- if (add)
- {
- IBreakpoint point = new XSLLineBreakpoint(res, editorLineNumber, pos, pos);
- if (point == null)
- {
- status = new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR, Messages.XSLBreakpointProvider_0, null);
- }
- else
- {
+ if (add) {
+ IBreakpoint point = new XSLLineBreakpoint(res,
+ editorLineNumber, pos, pos);
+ if (point == null) {
+ status = new Status(IStatus.ERROR,
+ XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR,
+ Messages.XSLBreakpointProvider_0, null);
+ } else {
// DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(point);
}
}
- }
- else if (input instanceof IStorageEditorInput)
- {
+ } else if (input instanceof IStorageEditorInput) {
res = ResourcesPlugin.getWorkspace().getRoot();
String id = input.getName();
- if (input instanceof IStorageEditorInput && ((IStorageEditorInput) input).getStorage() != null && ((IStorageEditorInput) input).getStorage().getFullPath() != null)
- {
- id = ((IStorageEditorInput) input).getStorage().getFullPath().toString();
+ if (input instanceof IStorageEditorInput
+ && ((IStorageEditorInput) input).getStorage() != null
+ && ((IStorageEditorInput) input).getStorage()
+ .getFullPath() != null) {
+ id = ((IStorageEditorInput) input).getStorage()
+ .getFullPath().toString();
}
Map<String, String> attributes = new HashMap<String, String>();
- attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, id);
- IBreakpoint point = new XSLLineBreakpoint(res, editorLineNumber, pos, pos);
- if (point == null)
- {
- status = new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR, Messages.XSLBreakpointProvider_0, null);
+ attributes
+ .put(
+ StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY,
+ id);
+ IBreakpoint point = new XSLLineBreakpoint(res,
+ editorLineNumber, pos, pos);
+ if (point == null) {
+ status = new Status(IStatus.ERROR,
+ XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR,
+ Messages.XSLBreakpointProvider_0, null);
}
}
}
- if (status == null)
- {
- status = new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, IStatus.OK, "JSPUIMessages.OK", null); //$NON-NLS-1$
+ if (status == null) {
+ status = new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID,
+ IStatus.OK, "JSPUIMessages.OK", null); //$NON-NLS-1$
}
return status;
}
- public IResource getResource(IEditorInput input)
- {
+ public IResource getResource(IEditorInput input) {
return getResourceFromInput(input);
}
- private IResource getResourceFromInput(IEditorInput input)
- {
+ private IResource getResourceFromInput(IEditorInput input) {
IResource resource = (IResource) input.getAdapter(IFile.class);
- if (resource == null)
- {
+ if (resource == null) {
resource = (IResource) input.getAdapter(IResource.class);
}
return resource;
}
- private int getValidPosition(IDocument idoc, int editorLineNumber)
- {
+ private int getValidPosition(IDocument idoc, int editorLineNumber) {
int result = -1;
- if (idoc != null)
- {
+ if (idoc != null) {
int startOffset = 0;
int endOffset = 0;
- try
- {
+ try {
IRegion line = idoc.getLineInformation(editorLineNumber - 1);
startOffset = line.getOffset();
- endOffset = Math.max(line.getOffset(), line.getOffset() + line.getLength());
+ endOffset = Math.max(line.getOffset(), line.getOffset()
+ + line.getLength());
- String lineText = idoc.get(startOffset, endOffset - startOffset).trim();
+ String lineText = idoc
+ .get(startOffset, endOffset - startOffset).trim();
// blank lines or PI's cannot have breakpoints
if (lineText.trim().equals("") || lineText.startsWith("<?")) //$NON-NLS-1$ //$NON-NLS-2$
{
result = -1;
- }
- else
- {
+ } else {
// get all partitions for current line
ITypedRegion[] partitions = null;
- partitions = idoc.computePartitioning(startOffset, endOffset - startOffset);
+ partitions = idoc.computePartitioning(startOffset,
+ endOffset - startOffset);
- for (int i = 0; i < partitions.length; ++i)
- {
+ for (int i = 0; i < partitions.length; ++i) {
// String type = partitions[i].getType();
result = partitions[i].getOffset();
}
}
- }
- catch (BadLocationException e)
- {
+ } catch (BadLocationException e) {
result = -1;
}
}
return result;
}
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException
- {
+ public void setInitializationData(IConfigurationElement config,
+ String propertyName, Object data) throws CoreException {
// not used
}
- public void setSourceEditingTextTools(ISourceEditingTextTools tools)
- {
+ public void setSourceEditingTextTools(ISourceEditingTextTools tools) {
// not used
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLBreakpointAdapterFactory.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLBreakpointAdapterFactory.java
index db68b8f..9764f0a 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLBreakpointAdapterFactory.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLBreakpointAdapterFactory.java
@@ -20,19 +20,14 @@
/**
* Creates a toggle breakpoint adapter
*/
-public class XSLBreakpointAdapterFactory implements IAdapterFactory
-{
- @SuppressWarnings("unchecked")
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- if (adaptableObject instanceof ITextEditor)
- {
+public class XSLBreakpointAdapterFactory implements IAdapterFactory {
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ITextEditor) {
ITextEditor editorPart = (ITextEditor) adaptableObject;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
- if (resource != null && resource instanceof IFile)
- {
- if (XSLCore.isXSLFile((IFile)resource))
- {
+ IResource resource = (IResource) editorPart.getEditorInput()
+ .getAdapter(IResource.class);
+ if (resource != null && resource instanceof IFile) {
+ if (XSLCore.isXSLFile((IFile) resource)) {
return new XSLLineBreakpointAdapter();
}
}
@@ -40,10 +35,7 @@
return null;
}
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList()
- {
- return new Class[]
- { IToggleBreakpointsTarget.class };
+ public Class[] getAdapterList() {
+ return new Class[] { IToggleBreakpointsTarget.class };
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLLineBreakpointAdapter.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLLineBreakpointAdapter.java
index 870045d..2feeeaa 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLLineBreakpointAdapter.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLLineBreakpointAdapter.java
@@ -30,23 +30,21 @@
*
* @author Doug Satchwell
*/
-public class XSLLineBreakpointAdapter implements IToggleBreakpointsTarget
-{
- public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException
- {
+public class XSLLineBreakpointAdapter implements IToggleBreakpointsTarget {
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
ITextEditor textEditor = getEditor(part);
- if (textEditor != null)
- {
- IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
+ if (textEditor != null) {
+ IResource resource = (IResource) textEditor.getEditorInput()
+ .getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
- for (IBreakpoint breakpoint : breakpoints)
- {
- if (resource.equals(breakpoint.getMarker().getResource()))
- {
- if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1))
- {
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault()
+ .getBreakpointManager().getBreakpoints(
+ IXSLConstants.ID_XSL_DEBUG_MODEL);
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (resource.equals(breakpoint.getMarker().getResource())) {
+ if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
// remove
breakpoint.delete();
return;
@@ -54,13 +52,15 @@
}
}
// create line breakpoint (doc line numbers start at 0)
- XSLLineBreakpoint lineBreakpoint = new XSLLineBreakpoint(resource, lineNumber + 1, 1, 1);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
+ XSLLineBreakpoint lineBreakpoint = new XSLLineBreakpoint(resource,
+ lineNumber + 1, 1, 1);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(
+ lineBreakpoint);
}
}
- public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
- {
+ public boolean canToggleLineBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
return getEditor(part) != null;
}
@@ -68,16 +68,13 @@
* Returns the editor being used to edit a XSL file, associated with the
* given part, or <code>null</code> if none.
*/
- private ITextEditor getEditor(IWorkbenchPart part)
- {
- if (part instanceof ITextEditor)
- {
+ private ITextEditor getEditor(IWorkbenchPart part) {
+ if (part instanceof ITextEditor) {
ITextEditor editorPart = (ITextEditor) part;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
- if (resource != null && resource.getType() == IResource.FILE)
- {
- if (XSLCore.isXSLFile((IFile)resource))
- {
+ IResource resource = (IResource) editorPart.getEditorInput()
+ .getAdapter(IResource.class);
+ if (resource != null && resource.getType() == IResource.FILE) {
+ if (XSLCore.isXSLFile((IFile) resource)) {
return editorPart;
}
}
@@ -85,21 +82,21 @@
return null;
}
- public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException
- {
+ public void toggleMethodBreakpoints(IWorkbenchPart part,
+ ISelection selection) throws CoreException {
}
- public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection)
- {
+ public boolean canToggleMethodBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
return false;
}
- public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException
- {
+ public void toggleWatchpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
}
- public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection)
- {
+ public boolean canToggleWatchpoints(IWorkbenchPart part,
+ ISelection selection) {
return false;
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLModelPresentation.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLModelPresentation.java
index 3b72474..a7838de 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLModelPresentation.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/model/XSLModelPresentation.java
@@ -29,28 +29,25 @@
import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
/**
- * An <code>IDebugModelPresentation</code> for XSL debugging.
+ * An <code>IDebugModelPresentation</code> for XSL debugging.
*
* @author Doug Satchwell
*/
-public class XSLModelPresentation extends LabelProvider implements IDebugModelPresentation
-{
+public class XSLModelPresentation extends LabelProvider implements
+ IDebugModelPresentation {
private Image localImg;
- public void setAttribute(String attribute, Object value)
- {
+ public void setAttribute(String attribute, Object value) {
}
@Override
- public Image getImage(Object element)
- {
- if (element instanceof XSLVariable)
- {
+ public Image getImage(Object element) {
+ if (element instanceof XSLVariable) {
XSLVariable var = (XSLVariable) element;
- if (var.getScope().equals(XSLVariable.LOCAL_SCOPE))
- {
+ if (var.getScope().equals(XSLVariable.LOCAL_SCOPE)) {
if (localImg == null)
- localImg = XSLDebugUIPlugin.getImageDescriptor("/icons/localvariable_obj.gif").createImage(); //$NON-NLS-1$
+ localImg = XSLDebugUIPlugin.getImageDescriptor(
+ "/icons/localvariable_obj.gif").createImage(); //$NON-NLS-1$
return localImg;
}
}
@@ -59,28 +56,36 @@
if (nodeVar.getNode() != null) {
Node node = nodeVar.getNode();
if (node.getNodeType() == Node.ELEMENT_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ELEMENT);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ELEMENT);
}
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE);
}
if (node.getNodeType() == Node.COMMENT_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_COMMENT);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_COMMENT);
}
if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_PROCESSINGINSTRUCTION);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_PROCESSINGINSTRUCTION);
}
if (node.getNodeType() == Node.CDATA_SECTION_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_CDATASECTION);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_CDATASECTION);
}
if (node.getNodeType() == Node.ENTITY_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ENTITY);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ENTITY);
}
if (node.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ENTITY_REFERENCE);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ENTITY_REFERENCE);
}
if (node.getNodeType() == Node.TEXT_NODE) {
- localImg = SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_TXTEXT);
+ localImg = SharedXMLEditorPluginImageHelper
+ .getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_TXTEXT);
}
return localImg;
}
@@ -89,49 +94,39 @@
}
@Override
- public String getText(Object element)
- {
+ public String getText(Object element) {
return null;
}
@Override
- public void dispose()
- {
+ public void dispose() {
if (localImg != null)
localImg.dispose();
super.dispose();
}
- public void computeDetail(IValue value, IValueDetailListener listener)
- {
+ public void computeDetail(IValue value, IValueDetailListener listener) {
String detail = ""; //$NON-NLS-1$
- try
- {
+ try {
detail = value.getValueString();
- }
- catch (DebugException e)
- {
+ } catch (DebugException e) {
}
listener.detailComputed(value, detail);
}
- public IEditorInput getEditorInput(Object element)
- {
- if (element instanceof IFile)
- {
+ public IEditorInput getEditorInput(Object element) {
+ if (element instanceof IFile) {
return new FileEditorInput((IFile) element);
}
- if (element instanceof ILineBreakpoint)
- {
- return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
+ if (element instanceof ILineBreakpoint) {
+ return new FileEditorInput((IFile) ((ILineBreakpoint) element)
+ .getMarker().getResource());
}
return null;
}
- public String getEditorId(IEditorInput input, Object element)
- {
- if (element instanceof IFile || element instanceof ILineBreakpoint)
- {
+ public String getEditorId(IEditorInput input, Object element) {
+ if (element instanceof IFile || element instanceof ILineBreakpoint) {
return XSLDebugUIConstants.XSL_EDITOR_ID;
}
return null;
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IParametersChangedListener.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IParametersChangedListener.java
index 13d8a71..9a3afe5 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IParametersChangedListener.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IParametersChangedListener.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.wst.xsl.internal.debug.ui.tabs.main;
-public interface IParametersChangedListener
-{
+public interface IParametersChangedListener {
void parametersChanged(ParameterViewer viewer);
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IStylesheetEntriesChangedListener.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IStylesheetEntriesChangedListener.java
index b1fe798..dd02a0f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IStylesheetEntriesChangedListener.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/IStylesheetEntriesChangedListener.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.wst.xsl.internal.debug.ui.tabs.main;
-public interface IStylesheetEntriesChangedListener
-{
+public interface IStylesheetEntriesChangedListener {
void entriesChanged(StylesheetViewer viewer);
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/InputFileBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/InputFileBlock.java
index 59bd3a9..53c2f5f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/InputFileBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/InputFileBlock.java
@@ -16,7 +16,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -26,114 +25,104 @@
import org.eclipse.wst.xsl.internal.debug.ui.XSLDebugUIPlugin;
import org.eclipse.wst.xsl.launching.XSLLaunchConfigurationConstants;
-
-public class InputFileBlock extends ResourceSelectionBlock
-{
+public class InputFileBlock extends ResourceSelectionBlock {
private final IFile defaultFile;
- public InputFileBlock(IFile defaultFile)
- {
+ public InputFileBlock(IFile defaultFile) {
super(IResource.FILE, false);
this.defaultFile = defaultFile;
}
-
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
String path = ""; //$NON-NLS-1$
if (defaultFile != null)
- path = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", defaultFile.getFullPath().toPortableString()); //$NON-NLS-1$
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, path);
+ path = VariablesPlugin
+ .getDefault()
+ .getStringVariableManager()
+ .generateVariableExpression(
+ "workspace_loc", defaultFile.getFullPath().toPortableString()); //$NON-NLS-1$
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, path);
}
- public void initializeFrom(ILaunchConfiguration configuration)
- {
+ public void initializeFrom(ILaunchConfiguration configuration) {
setLaunchConfiguration(configuration);
- try
- {
- String wd = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, (String) null);
- if (wd != null)
- {
+ try {
+ String wd = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE,
+ (String) null);
+ if (wd != null) {
setText(wd);
}
- }
- catch (CoreException e)
- {
- setErrorMessage(Messages.InputFileBlock_Exception_occurred_reading_configuration + e.getStatus().getMessage());
+ } catch (CoreException e) {
+ setErrorMessage(Messages.InputFileBlock_Exception_occurred_reading_configuration
+ + e.getStatus().getMessage());
XSLDebugUIPlugin.log(e);
}
}
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, getText());
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, getText());
}
- public String getName()
- {
+ public String getName() {
return Messages.InputFileBlock_Name;
}
-
+
@Override
- protected void textModified()
- {
+ protected void textModified() {
IPath path = null;
String workingDirPath = getText();
if (workingDirPath.indexOf("${") >= 0) //$NON-NLS-1$
{
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
- try
- {
+ IStringVariableManager manager = VariablesPlugin.getDefault()
+ .getStringVariableManager();
+ try {
manager.validateStringVariables(workingDirPath);
- path = new Path(manager.performStringSubstitution(workingDirPath));
+ path = new Path(manager
+ .performStringSubstitution(workingDirPath));
+ } catch (CoreException e) {
}
- catch (CoreException e)
- {
- }
- }
- else if (workingDirPath.length() > 0)
- {
+ } else if (workingDirPath.length() > 0) {
path = new Path(workingDirPath);
}
}
@Override
- protected String getMessage(int type)
- {
- switch (type)
- {
- case ERROR_DIRECTORY_NOT_SPECIFIED:
- return Messages.InputFileBlock_DIRECTORY_NOT_SPECIFIED;
- case ERROR_DIRECTORY_DOES_NOT_EXIST:
- return Messages.InputFileBlock_DIRECTORY_DOES_NOT_EXIST;
- case GROUP_NAME:
- return Messages.InputFileBlock_GROUP_NAME;
- case USE_DEFAULT_RADIO:
- return Messages.InputFileBlock_DEFAULT_RADIO;
- case USE_OTHER_RADIO:
- return Messages.InputFileBlock_OTHER_RADIO;
- case DIRECTORY_DIALOG_MESSAGE:
- return Messages.InputFileBlock_DIALOG_MESSAGE;
- case WORKSPACE_DIALOG_MESSAGE:
- return Messages.InputFileBlock_WORKSPACE_DIALOG_MESSAGE;
- case VARIABLES_BUTTON:
- return Messages.InputFileBlock_VARIABLES_BUTTON;
- case FILE_SYSTEM_BUTTON:
- return Messages.InputFileBlock_FILE_SYSTEM_BUTTON;
- case WORKSPACE_BUTTON:
- return Messages.InputFileBlock_WORKSPACE_BUTTON;
- case WORKSPACE_DIALOG_TITLE:
- return Messages.InputFileBlock_WORKSPACE_DIALOG_TITLE;
- case OPENFILES_BUTTON:
- return Messages.InputFileBlock_OPENFILES_BUTTON;
- case OPENFILES_DIALOG_TITLE:
- return Messages.InputFileBlock_OPENFILES_DIALOG;
+ protected String getMessage(int type) {
+ switch (type) {
+ case ERROR_DIRECTORY_NOT_SPECIFIED:
+ return Messages.InputFileBlock_DIRECTORY_NOT_SPECIFIED;
+ case ERROR_DIRECTORY_DOES_NOT_EXIST:
+ return Messages.InputFileBlock_DIRECTORY_DOES_NOT_EXIST;
+ case GROUP_NAME:
+ return Messages.InputFileBlock_GROUP_NAME;
+ case USE_DEFAULT_RADIO:
+ return Messages.InputFileBlock_DEFAULT_RADIO;
+ case USE_OTHER_RADIO:
+ return Messages.InputFileBlock_OTHER_RADIO;
+ case DIRECTORY_DIALOG_MESSAGE:
+ return Messages.InputFileBlock_DIALOG_MESSAGE;
+ case WORKSPACE_DIALOG_MESSAGE:
+ return Messages.InputFileBlock_WORKSPACE_DIALOG_MESSAGE;
+ case VARIABLES_BUTTON:
+ return Messages.InputFileBlock_VARIABLES_BUTTON;
+ case FILE_SYSTEM_BUTTON:
+ return Messages.InputFileBlock_FILE_SYSTEM_BUTTON;
+ case WORKSPACE_BUTTON:
+ return Messages.InputFileBlock_WORKSPACE_BUTTON;
+ case WORKSPACE_DIALOG_TITLE:
+ return Messages.InputFileBlock_WORKSPACE_DIALOG_TITLE;
+ case OPENFILES_BUTTON:
+ return Messages.InputFileBlock_OPENFILES_BUTTON;
+ case OPENFILES_DIALOG_TITLE:
+ return Messages.InputFileBlock_OPENFILES_DIALOG;
}
return "" + type; //$NON-NLS-1$
}
@Override
- protected void updateResourceText(boolean useDefault)
- {
+ protected void updateResourceText(boolean useDefault) {
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParameterViewer.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParameterViewer.java
index 7927c85..8156234 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParameterViewer.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParameterViewer.java
@@ -18,88 +18,75 @@
import org.eclipse.wst.xsl.internal.debug.ui.actions.AbstractStylesheetAction;
import org.eclipse.wst.xsl.launching.config.LaunchAttribute;
-public class ParameterViewer
-{
+public class ParameterViewer {
private final TableViewer viewer;
private final ListenerList fListeners = new ListenerList();
- public ParameterViewer(Table table)
- {
+ public ParameterViewer(Table table) {
viewer = new TableViewer(table);
}
-
- public TableViewer getViewer()
- {
+
+ public TableViewer getViewer() {
return viewer;
}
- private ParametersContentProvider getParametersContentProvider()
- {
+ private ParametersContentProvider getParametersContentProvider() {
return (ParametersContentProvider) viewer.getContentProvider();
}
- public Shell getShell()
- {
+ public Shell getShell() {
return viewer.getControl().getShell();
}
- public boolean isEnabled()
- {
+ public boolean isEnabled() {
return true;
}
- public boolean updateSelection(int actionType, IStructuredSelection selection)
- {
- switch (actionType)
- {
- case AbstractStylesheetAction.ADD:
- return true;
- case AbstractStylesheetAction.REMOVE:
- case AbstractStylesheetAction.MOVE:
- default:
- break;
+ public boolean updateSelection(int actionType,
+ IStructuredSelection selection) {
+ switch (actionType) {
+ case AbstractStylesheetAction.ADD:
+ return true;
+ case AbstractStylesheetAction.REMOVE:
+ case AbstractStylesheetAction.MOVE:
+ default:
+ break;
}
return selection.size() > 0;
}
- public IStructuredSelection getSelectedEntries()
- {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ public IStructuredSelection getSelectedEntries() {
+ IStructuredSelection selection = (IStructuredSelection) viewer
+ .getSelection();
return selection;
}
- public void addParameter(LaunchAttribute parameter)
- {
+ public void addParameter(LaunchAttribute parameter) {
getParametersContentProvider().addParameter(parameter);
notifyChanged();
}
- public void removeEntries(LaunchAttribute[] entries)
- {
+ public void removeEntries(LaunchAttribute[] entries) {
getParametersContentProvider().removeParameters(entries);
notifyChanged();
}
- public LaunchAttribute[] getParameters()
- {
+ public LaunchAttribute[] getParameters() {
return getParametersContentProvider().getParameters();
}
- public void addParametersChangedListener(IParametersChangedListener listener)
- {
+ public void addParametersChangedListener(IParametersChangedListener listener) {
fListeners.add(listener);
}
- public void removeParametersChangedListener(IParametersChangedListener listener)
- {
+ public void removeParametersChangedListener(
+ IParametersChangedListener listener) {
fListeners.remove(listener);
}
- private void notifyChanged()
- {
+ private void notifyChanged() {
Object[] listeners = fListeners.getListeners();
- for (Object element : listeners)
- {
+ for (Object element : listeners) {
((IParametersChangedListener) element).parametersChanged(this);
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersBlock.java
index 0846e48..d312920 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersBlock.java
@@ -41,19 +41,18 @@
import org.eclipse.wst.xsl.launching.config.LaunchAttribute;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class ParametersBlock extends AbstractTableBlock
-{
+public class ParametersBlock extends AbstractTableBlock {
private ParameterViewer parametersViewer;
private Button addParameterButton;
private Button removeParameterButton;
private final TransformsBlock transformsBlock;
- private final ISelectionChangedListener selectionListener = new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection stylesheetSelection = (IStructuredSelection) event.getSelection();
+ private final ISelectionChangedListener selectionListener = new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection stylesheetSelection = (IStructuredSelection) event
+ .getSelection();
if (stylesheetSelection.size() == 1)
- setTransform((LaunchTransform) stylesheetSelection.getFirstElement());
+ setTransform((LaunchTransform) stylesheetSelection
+ .getFirstElement());
else
setTransform(null);
updateEnabled();
@@ -61,29 +60,28 @@
};
private Table fTable;
- public ParametersBlock(TransformsBlock transformsBlock)
- {
+ public ParametersBlock(TransformsBlock transformsBlock) {
super();
this.transformsBlock = transformsBlock;
}
- protected void setTransform(LaunchTransform transform)
- {
+ protected void setTransform(LaunchTransform transform) {
parametersViewer.getViewer().setInput(transform);
}
- protected void updateEnabled()
- {
- IStructuredSelection stylesheetSelection = (IStructuredSelection) transformsBlock.getStylesheetViewer().getSelection();
+ protected void updateEnabled() {
+ IStructuredSelection stylesheetSelection = (IStructuredSelection) transformsBlock
+ .getStylesheetViewer().getSelection();
boolean enabled = stylesheetSelection.size() == 1;
parametersViewer.getViewer().getTable().setEnabled(enabled);
addParameterButton.setEnabled(enabled);
- IStructuredSelection parametersSelection = (IStructuredSelection) parametersViewer.getViewer().getSelection();
- removeParameterButton.setEnabled(enabled && !parametersSelection.isEmpty());
+ IStructuredSelection parametersSelection = (IStructuredSelection) parametersViewer
+ .getViewer().getSelection();
+ removeParameterButton.setEnabled(enabled
+ && !parametersSelection.isEmpty());
}
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
Font font = parent.getFont();
Group group = new Group(parent, SWT.NONE);
@@ -110,56 +108,54 @@
TableColumn column1 = new TableColumn(fTable, SWT.NONE);
column1.setWidth(150);
column1.setResizable(true);
- column1.setText(Messages.ParametersBlock_0);
+ column1.setText(Messages.ParametersBlock_0);
TableColumn column3 = new TableColumn(fTable, SWT.NONE);
column3.setWidth(250);
column3.setResizable(true);
- column3.setText(Messages.ParametersBlock_2);
+ column3.setText(Messages.ParametersBlock_2);
parametersViewer = new ParameterViewer(fTable);
- parametersViewer.getViewer().setLabelProvider(new ParametersLabelProvider());
- parametersViewer.getViewer().setContentProvider(new ParametersContentProvider());
- parametersViewer.addParametersChangedListener(new IParametersChangedListener()
- {
+ parametersViewer.getViewer().setLabelProvider(
+ new ParametersLabelProvider());
+ parametersViewer.getViewer().setContentProvider(
+ new ParametersContentProvider());
+ parametersViewer
+ .addParametersChangedListener(new IParametersChangedListener() {
- public void parametersChanged(ParameterViewer viewer)
- {
- updateLaunchConfigurationDialog();
- }
- });
- parametersViewer.getViewer().getTable().addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- RemoveParameterAction ra = new RemoveParameterAction(parametersViewer);
- ra.run();
- updateLaunchConfigurationDialog();
- }
- }
- });
+ public void parametersChanged(ParameterViewer viewer) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ parametersViewer.getViewer().getTable().addKeyListener(
+ new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ RemoveParameterAction ra = new RemoveParameterAction(
+ parametersViewer);
+ ra.run();
+ updateLaunchConfigurationDialog();
+ }
+ }
+ });
- parametersViewer.getViewer().setColumnProperties(new String[]
- { "name", "value" }); //$NON-NLS-1$ //$NON-NLS-2$
+ parametersViewer.getViewer().setColumnProperties(
+ new String[] { "name", "value" }); //$NON-NLS-1$ //$NON-NLS-2$
TextCellEditor textEditor = new TextCellEditor(fTable);
- CellEditor[] editors = new CellEditor[]
- { null, textEditor };
+ CellEditor[] editors = new CellEditor[] { null, textEditor };
parametersViewer.getViewer().setCellEditors(editors);
- parametersViewer.getViewer().setCellModifier(new ICellModifier()
- {
- public boolean canModify(Object element, String property)
- {
+ parametersViewer.getViewer().setCellModifier(new ICellModifier() {
+ public boolean canModify(Object element, String property) {
return "value".equals(property); //$NON-NLS-1$
}
- public Object getValue(Object element, String property)
- {
+ public Object getValue(Object element, String property) {
LaunchAttribute att = (LaunchAttribute) element;
return att.value == null ? "" : att.value; //$NON-NLS-1$
}
- public void modify(Object element, String property, Object value)
- {
+ public void modify(Object element, String property, Object value) {
Item item = (Item) element;
LaunchAttribute att = (LaunchAttribute) item.getData();
att.value = (String) value;
@@ -173,70 +169,67 @@
parameterButtonCompLayout.marginHeight = 0;
parameterButtonCompLayout.marginWidth = 0;
parameterButtonComp.setLayout(parameterButtonCompLayout);
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
parameterButtonComp.setLayoutData(gd);
parameterButtonComp.setFont(font);
- addParameterButton = createButton(parameterButtonComp, new AddParameterAction(parametersViewer));
- removeParameterButton = createButton(parameterButtonComp, new RemoveParameterAction(parametersViewer));
+ addParameterButton = createButton(parameterButtonComp,
+ new AddParameterAction(parametersViewer));
+ removeParameterButton = createButton(parameterButtonComp,
+ new RemoveParameterAction(parametersViewer));
- transformsBlock.getStylesheetViewer().addSelectionChangedListener(selectionListener);
+ transformsBlock.getStylesheetViewer().addSelectionChangedListener(
+ selectionListener);
restoreColumnSettings();
}
- protected Button createButton(Composite pathButtonComp, AbstractParameterAction action)
- {
+ protected Button createButton(Composite pathButtonComp,
+ AbstractParameterAction action) {
Button button = createPushButton(pathButtonComp, action.getText(), null);
action.setButton(button);
return button;
}
@Override
- protected Table getTable()
- {
+ protected Table getTable() {
return fTable;
}
@Override
- protected IDialogSettings getDialogSettings()
- {
+ protected IDialogSettings getDialogSettings() {
return XSLDebugUIPlugin.getDefault().getDialogSettings();
}
@Override
- protected String getQualifier()
- {
+ protected String getQualifier() {
return XSLDebugUIConstants.MAIN_PARAMATERS_BLOCK;
}
- public String getName()
- {
- return Messages.ParametersBlock_9;
+ public String getName() {
+ return Messages.ParametersBlock_9;
}
- public void initializeFrom(ILaunchConfiguration configuration)
- {
+ public void initializeFrom(ILaunchConfiguration configuration) {
// handled by the Tab
updateEnabled();
}
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
// handled by the Tab
}
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// handled by the Tab
}
@Override
- public void dispose()
- {
+ public void dispose() {
if (transformsBlock.getStylesheetViewer() != null)
- transformsBlock.getStylesheetViewer().removeSelectionChangedListener(selectionListener);
+ transformsBlock.getStylesheetViewer()
+ .removeSelectionChangedListener(selectionListener);
super.dispose();
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersContentProvider.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersContentProvider.java
index 2298719..6f2a322 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersContentProvider.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersContentProvider.java
@@ -21,47 +21,38 @@
import org.eclipse.wst.xsl.launching.config.LaunchAttribute;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class ParametersContentProvider implements IStructuredContentProvider
-{
+public class ParametersContentProvider implements IStructuredContentProvider {
private LaunchTransform stylesheetEntry;
private TableViewer parameterViewer;
- public Object[] getElements(Object inputElement)
- {
+ public Object[] getElements(Object inputElement) {
if (stylesheetEntry == null)
return new Object[0];
return stylesheetEntry.getParameters().toArray();
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
stylesheetEntry = (LaunchTransform) newInput;
parameterViewer = (TableViewer) viewer;
}
- public void dispose()
- {
+ public void dispose() {
}
- public LaunchAttribute[] getParameters()
- {
+ public LaunchAttribute[] getParameters() {
return stylesheetEntry.getParameters().toArray(new LaunchAttribute[0]);
}
- public void removeParameters(LaunchAttribute[] entries)
- {
- for (LaunchAttribute parameter : entries)
- {
+ public void removeParameters(LaunchAttribute[] entries) {
+ for (LaunchAttribute parameter : entries) {
stylesheetEntry.getParameters().remove(parameter);
}
TableItem[] items = parameterViewer.getTable().getItems();
List<LaunchAttribute> entryList = Arrays.asList(entries);
Object sel = null;
- for (int i = items.length - 1; i >= 0; i--)
- {
+ for (int i = items.length - 1; i >= 0; i--) {
TableItem item = items[i];
- if (!entryList.contains(item.getData()))
- {
+ if (!entryList.contains(item.getData())) {
sel = item.getData();
break;
}
@@ -72,8 +63,7 @@
parameterViewer.setSelection(new StructuredSelection(sel), true);
}
- public void addParameter(LaunchAttribute parameter)
- {
+ public void addParameter(LaunchAttribute parameter) {
stylesheetEntry.getParameters().add(parameter);
parameterViewer.add(parameter);
parameterViewer.setSelection(new StructuredSelection(parameter), true);
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersLabelProvider.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersLabelProvider.java
index e5da79f..0a781e6 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersLabelProvider.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/ParametersLabelProvider.java
@@ -15,40 +15,32 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xsl.launching.config.LaunchAttribute;
-public class ParametersLabelProvider implements ITableLabelProvider
-{
- public String getColumnText(Object element, int columnIndex)
- {
+public class ParametersLabelProvider implements ITableLabelProvider {
+ public String getColumnText(Object element, int columnIndex) {
LaunchAttribute p = (LaunchAttribute) element;
- switch (columnIndex)
- {
- case 0:
- return p.uri;
- case 1:
- return p.value;
+ switch (columnIndex) {
+ case 0:
+ return p.uri;
+ case 1:
+ return p.value;
}
return "!"; //$NON-NLS-1$
}
- public Image getColumnImage(Object element, int columnIndex)
- {
+ public Image getColumnImage(Object element, int columnIndex) {
return null;
}
- public void addListener(ILabelProviderListener listener)
- {
+ public void addListener(ILabelProviderListener listener) {
}
- public void dispose()
- {
+ public void dispose() {
}
- public boolean isLabelProperty(Object element, String property)
- {
+ public boolean isLabelProperty(Object element, String property) {
return false;
}
- public void removeListener(ILabelProviderListener listener)
- {
+ public void removeListener(ILabelProviderListener listener) {
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetContentProvider.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetContentProvider.java
index 17c34ad..fd8c467 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetContentProvider.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetContentProvider.java
@@ -20,40 +20,33 @@
import org.eclipse.wst.xsl.launching.config.LaunchPipeline;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class StylesheetContentProvider implements IStructuredContentProvider
-{
+public class StylesheetContentProvider implements IStructuredContentProvider {
private TableViewer tableViewer;
private LaunchPipeline pipeline;
- public StylesheetContentProvider()
- {
+ public StylesheetContentProvider() {
}
- public Object[] getElements(Object inputElement)
- {
+ public Object[] getElements(Object inputElement) {
return pipeline.getTransformDefs().toArray(new LaunchTransform[0]);
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
tableViewer = (TableViewer) viewer;
pipeline = (LaunchPipeline) newInput;
}
- public void dispose()
- {
+ public void dispose() {
}
- public void setEntries(LaunchTransform[] transforms)
- {
- pipeline.setTransformDefs(new ArrayList<LaunchTransform>(Arrays.asList(transforms)));
+ public void setEntries(LaunchTransform[] transforms) {
+ pipeline.setTransformDefs(new ArrayList<LaunchTransform>(Arrays
+ .asList(transforms)));
tableViewer.refresh();
}
- public void addEntries(LaunchTransform[] res, Object beforeElement)
- {
- for (LaunchTransform transform : res)
- {
+ public void addEntries(LaunchTransform[] res, Object beforeElement) {
+ for (LaunchTransform transform : res) {
pipeline.addTransformDef(transform);
}
tableViewer.add(res);
@@ -61,10 +54,8 @@
tableViewer.setSelection(new StructuredSelection(res[0]), true);
}
- public void removeEntries(LaunchTransform[] res)
- {
- for (LaunchTransform transform : res)
- {
+ public void removeEntries(LaunchTransform[] res) {
+ for (LaunchTransform transform : res) {
pipeline.removeTransformDef(transform);
}
tableViewer.refresh();
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetLabelProvider.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetLabelProvider.java
index 1e43f28..1f01746 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetLabelProvider.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetLabelProvider.java
@@ -21,63 +21,53 @@
import org.eclipse.wst.xsl.internal.debug.ui.XSLDebugUIPlugin;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class StylesheetLabelProvider extends LabelProvider
-{
- private Image image = XSLDebugUIPlugin.getImageDescriptor("icons/xslt_launch.gif").createImage(); //$NON-NLS-1$
-
+public class StylesheetLabelProvider extends LabelProvider {
+ private Image image = XSLDebugUIPlugin.getImageDescriptor(
+ "icons/xslt_launch.gif").createImage(); //$NON-NLS-1$
+
@Override
- public Image getImage(Object element)
- {
+ public Image getImage(Object element) {
return image;
}
@Override
- public String getText(Object element)
- {
+ public String getText(Object element) {
LaunchTransform lt = (LaunchTransform) element;
int index = lt.getPipeline().getTransformDefs().indexOf(lt);
IPath path;
- try
- {
+ try {
path = lt.getPath();
- }
- catch (CoreException e)
- {
- return MessageFormat.format(Messages.StylesheetEntryLabelProvider_Invalid_path, new Object[]
- { "null" }); //$NON-NLS-1$
+ } catch (CoreException e) {
+ return MessageFormat.format(
+ Messages.StylesheetEntryLabelProvider_Invalid_path,
+ new Object[] { "null" }); //$NON-NLS-1$
}
- if (path == null)
- {
- return MessageFormat.format(Messages.StylesheetEntryLabelProvider_Invalid_path, new Object[]
- { "null" }); //$NON-NLS-1$
- }
- else if (!path.isAbsolute() || !path.isValidPath(path.toString()))
- {
- return MessageFormat.format(Messages.StylesheetEntryLabelProvider_Invalid_path, new Object[]
- { path.toString() });
+ if (path == null) {
+ return MessageFormat.format(
+ Messages.StylesheetEntryLabelProvider_Invalid_path,
+ new Object[] { "null" }); //$NON-NLS-1$
+ } else if (!path.isAbsolute() || !path.isValidPath(path.toString())) {
+ return MessageFormat.format(
+ Messages.StylesheetEntryLabelProvider_Invalid_path,
+ new Object[] { path.toString() });
}
String[] segments = path.segments();
StringBuffer displayPath = new StringBuffer();
- if (segments.length > 0)
- {
+ if (segments.length > 0) {
displayPath.append(segments[segments.length - 1]);
displayPath.append(" - "); //$NON-NLS-1$
String device = path.getDevice();
- if (device != null)
- {
+ if (device != null) {
displayPath.append(device);
}
displayPath.append(File.separator);
- for (int i = 0; i < segments.length - 1; i++)
- {
+ for (int i = 0; i < segments.length - 1; i++) {
displayPath.append(segments[i]).append(File.separator);
}
- }
- else
- {
+ } else {
displayPath.append(path.toString());
}
return (index + 1) + ") " + displayPath.toString(); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetViewer.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetViewer.java
index 1d7b8a5..934b3ed 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetViewer.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/StylesheetViewer.java
@@ -18,68 +18,60 @@
import org.eclipse.wst.xsl.internal.debug.ui.actions.AbstractStylesheetAction;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class StylesheetViewer
-{
+public class StylesheetViewer {
private TableViewer viewer;
private final ListenerList listenerList = new ListenerList();
- public StylesheetViewer(Composite parent)
- {
+ public StylesheetViewer(Composite parent) {
viewer = new TableViewer(parent);
}
-
- public TableViewer getViewer(){
+
+ public TableViewer getViewer() {
return viewer;
}
- private StylesheetContentProvider getStylesheetContentProvider()
- {
+ private StylesheetContentProvider getStylesheetContentProvider() {
return (StylesheetContentProvider) viewer.getContentProvider();
}
- public void setEntries(LaunchTransform[] transforms)
- {
+ public void setEntries(LaunchTransform[] transforms) {
getStylesheetContentProvider().setEntries(transforms);
notifyChanged();
}
- public LaunchTransform[] getEntries()
- {
- return (LaunchTransform[]) getStylesheetContentProvider().getElements(null);
+ public LaunchTransform[] getEntries() {
+ return (LaunchTransform[]) getStylesheetContentProvider().getElements(
+ null);
}
- public Shell getShell()
- {
+ public Shell getShell() {
return viewer.getControl().getShell();
}
- public boolean isEnabled()
- {
+ public boolean isEnabled() {
return true;
}
- public boolean updateSelection(int actionType, IStructuredSelection selection)
- {
- switch (actionType)
- {
- case AbstractStylesheetAction.ADD:
- return true;
- case AbstractStylesheetAction.REMOVE:
- case AbstractStylesheetAction.MOVE:
- default:
- break;
+ public boolean updateSelection(int actionType,
+ IStructuredSelection selection) {
+ switch (actionType) {
+ case AbstractStylesheetAction.ADD:
+ return true;
+ case AbstractStylesheetAction.REMOVE:
+ case AbstractStylesheetAction.MOVE:
+ default:
+ break;
}
return selection.size() > 0;
}
- public IStructuredSelection getSelectedEntries()
- {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ public IStructuredSelection getSelectedEntries() {
+ IStructuredSelection selection = (IStructuredSelection) viewer
+ .getSelection();
return selection;
}
- public void addTransforms(LaunchTransform[] res)
- {
+ public void addTransforms(LaunchTransform[] res) {
IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
Object beforeElement = sel.getFirstElement();
if (getEntries().length > 1 && beforeElement == null)
@@ -88,27 +80,24 @@
notifyChanged();
}
- public void removeEntries(LaunchTransform[] entries)
- {
+ public void removeEntries(LaunchTransform[] entries) {
getStylesheetContentProvider().removeEntries(entries);
notifyChanged();
}
- public void addEntriesChangedListener(IStylesheetEntriesChangedListener listener)
- {
+ public void addEntriesChangedListener(
+ IStylesheetEntriesChangedListener listener) {
listenerList.add(listener);
}
- public void removeEntriesChangedListener(IStylesheetEntriesChangedListener listener)
- {
+ public void removeEntriesChangedListener(
+ IStylesheetEntriesChangedListener listener) {
listenerList.remove(listener);
}
- private void notifyChanged()
- {
+ private void notifyChanged() {
Object[] listeners = listenerList.getListeners();
- for (Object element : listeners)
- {
+ for (Object element : listeners) {
((IStylesheetEntriesChangedListener) element).entriesChanged(this);
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/TransformsBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/TransformsBlock.java
index c608c22..552576f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/TransformsBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/TransformsBlock.java
@@ -38,19 +38,17 @@
import org.eclipse.wst.xsl.internal.debug.ui.actions.RemoveAction;
import org.eclipse.wst.xsl.launching.config.LaunchPipeline;
-public class TransformsBlock extends AbstractTableBlock implements IStylesheetEntriesChangedListener
-{
- protected static final String DIALOG_SETTINGS_PREFIX = "TransformsBlock"; //$NON-NLS-1$
+public class TransformsBlock extends AbstractTableBlock implements
+ IStylesheetEntriesChangedListener {
+ protected static final String DIALOG_SETTINGS_PREFIX = "TransformsBlock"; //$NON-NLS-1$
private StylesheetViewer stylesheetViewer;
private LaunchPipeline pipeline;
- public TransformsBlock()
- {
+ public TransformsBlock() {
super();
}
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
Font font = parent.getFont();
Group group = new Group(parent, SWT.NONE);
@@ -69,18 +67,21 @@
stylesheetViewer.getViewer().getTable().setLayoutData(gd);
stylesheetViewer.addEntriesChangedListener(this);
stylesheetViewer.getViewer().getControl().setFont(font);
- stylesheetViewer.getViewer().setLabelProvider(new StylesheetLabelProvider());
- stylesheetViewer.getViewer().setContentProvider(new StylesheetContentProvider());
- stylesheetViewer.getViewer().getTable().addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- RemoveAction ra = new RemoveAction(stylesheetViewer);
- ra.run();
- updateLaunchConfigurationDialog();
- }
- }
- });
+ stylesheetViewer.getViewer().setLabelProvider(
+ new StylesheetLabelProvider());
+ stylesheetViewer.getViewer().setContentProvider(
+ new StylesheetContentProvider());
+ stylesheetViewer.getViewer().getTable().addKeyListener(
+ new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0) {
+ RemoveAction ra = new RemoveAction(stylesheetViewer);
+ ra.run();
+ updateLaunchConfigurationDialog();
+ }
+ }
+ });
Composite upDownButtonComp = new Composite(group, SWT.NONE);
GridLayout upDownButtonLayout = new GridLayout();
@@ -91,33 +92,37 @@
upDownButtonComp.setLayoutData(gd);
upDownButtonComp.setFont(font);
- createArrowButton(upDownButtonComp, new MoveUpAction(stylesheetViewer), SWT.UP);
+ createArrowButton(upDownButtonComp, new MoveUpAction(stylesheetViewer),
+ SWT.UP);
Label spacer = new Label(upDownButtonComp, SWT.NONE);
gd = new GridData(SWT.NONE, SWT.FILL, false, true);
spacer.setLayoutData(gd);
- createArrowButton(upDownButtonComp, new MoveDownAction(stylesheetViewer), SWT.DOWN);
+ createArrowButton(upDownButtonComp,
+ new MoveDownAction(stylesheetViewer), SWT.DOWN);
Composite pathButtonComp = new Composite(group, SWT.NONE);
GridLayout pathButtonLayout = new GridLayout();
pathButtonLayout.marginHeight = 0;
pathButtonLayout.marginWidth = 0;
pathButtonComp.setLayout(pathButtonLayout);
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.HORIZONTAL_ALIGN_FILL);
pathButtonComp.setLayoutData(gd);
pathButtonComp.setFont(font);
- createButton(pathButtonComp, new AddWorkspaceFileAction(stylesheetViewer));
- createButton(pathButtonComp, new AddExternalFileAction(stylesheetViewer, DIALOG_SETTINGS_PREFIX));
+ createButton(pathButtonComp, new AddWorkspaceFileAction(
+ stylesheetViewer));
+ createButton(pathButtonComp, new AddExternalFileAction(
+ stylesheetViewer, DIALOG_SETTINGS_PREFIX));
createButton(pathButtonComp, new RemoveAction(stylesheetViewer));
}
- public Viewer getStylesheetViewer()
- {
+ public Viewer getStylesheetViewer() {
return stylesheetViewer == null ? null : stylesheetViewer.getViewer();
}
- protected Button createArrowButton(Composite pathButtonComp, AbstractStylesheetAction action, int updown)
- {
+ protected Button createArrowButton(Composite pathButtonComp,
+ AbstractStylesheetAction action, int updown) {
Button b = new Button(pathButtonComp, SWT.ARROW | updown);
GridData gd = new GridData();
b.setLayoutData(gd);
@@ -125,51 +130,45 @@
return b;
}
- protected Button createButton(Composite pathButtonComp, AbstractStylesheetAction action)
- {
+ protected Button createButton(Composite pathButtonComp,
+ AbstractStylesheetAction action) {
Button button = createPushButton(pathButtonComp, action.getText(), null);
action.setButton(button);
return button;
}
- public String getName()
- {
+ public String getName() {
return Messages.TransformsBlock_Name;
}
- public void setPipeline(LaunchPipeline pipeline)
- {
+ public void setPipeline(LaunchPipeline pipeline) {
this.pipeline = pipeline;
}
- public void initializeFrom(ILaunchConfiguration configuration)
- {
+ public void initializeFrom(ILaunchConfiguration configuration) {
stylesheetViewer.getViewer().setInput(pipeline);
- if (pipeline.getTransformDefs().size() > 0)
- {
- stylesheetViewer.getViewer().setSelection(new StructuredSelection(pipeline.getTransformDefs().get(0)));
+ if (pipeline.getTransformDefs().size() > 0) {
+ stylesheetViewer.getViewer()
+ .setSelection(
+ new StructuredSelection(pipeline.getTransformDefs()
+ .get(0)));
}
}
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
}
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}
- public void entriesChanged(StylesheetViewer viewer)
- {
+ public void entriesChanged(StylesheetViewer viewer) {
setDirty(true);
updateLaunchConfigurationDialog();
}
@Override
- protected void setSortColumn(int column)
- {
- switch (column)
- {
+ protected void setSortColumn(int column) {
+ switch (column) {
// case 1:
// sortByName();
// break;
@@ -181,26 +180,23 @@
}
@Override
- protected Table getTable()
- {
- return stylesheetViewer == null ? null : stylesheetViewer.getViewer().getTable();
+ protected Table getTable() {
+ return stylesheetViewer == null ? null : stylesheetViewer.getViewer()
+ .getTable();
}
@Override
- protected IDialogSettings getDialogSettings()
- {
+ protected IDialogSettings getDialogSettings() {
return XSLDebugUIPlugin.getDefault().getDialogSettings();
}
@Override
- protected String getQualifier()
- {
+ protected String getQualifier() {
return XSLDebugUIConstants.MAIN_TRANSFORMS_BLOCK;
}
@Override
- public void dispose()
- {
+ public void dispose() {
if (stylesheetViewer != null)
stylesheetViewer.removeEntriesChangedListener(this);
super.dispose();
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/XSLMainTab.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/XSLMainTab.java
index 5c353d4..a9db14f 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/XSLMainTab.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/main/XSLMainTab.java
@@ -40,8 +40,7 @@
import org.eclipse.wst.xsl.launching.config.LaunchPipeline;
import org.eclipse.wst.xsl.launching.config.LaunchTransform;
-public class XSLMainTab extends XSLLaunchConfigurationTab
-{
+public class XSLMainTab extends XSLLaunchConfigurationTab {
private final InputFileBlock inputFileBlock;
private final TransformsBlock transformsBlock;
private final ParametersBlock parametersBlock;
@@ -50,8 +49,7 @@
// private RenderBlock renderBlock;
// private OutputBlock outputBlock;
- public XSLMainTab()
- {
+ public XSLMainTab() {
IResource[] resourceContext = getContext();
IFile inputFile = getXMLInput(resourceContext);
@@ -61,13 +59,12 @@
// renderBlock = new RenderBlock();
// outputBlock = new OutputBlock();
- setBlocks(new ILaunchConfigurationTab[]
- { inputFileBlock, transformsBlock, parametersBlock }); // ,renderBlock,outputBlock});
+ setBlocks(new ILaunchConfigurationTab[] { inputFileBlock,
+ transformsBlock, parametersBlock }); // ,renderBlock,outputBlock});
}
@Override
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
super.createControl(parent);
Composite comp = (Composite) getControl();
GridLayout layout = new GridLayout(1, false);
@@ -81,14 +78,13 @@
}
@Override
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
LaunchPipeline lp = new LaunchPipeline();
IResource[] resourceContext = getContext();
IFile[] stylesheets = getXSLStylesheets(resourceContext);
- for (IFile file : stylesheets)
- {
- LaunchTransform lt = new LaunchTransform(file.getFullPath().toPortableString(), LaunchTransform.RESOURCE_TYPE);
+ for (IFile file : stylesheets) {
+ LaunchTransform lt = new LaunchTransform(file.getFullPath()
+ .toPortableString(), LaunchTransform.RESOURCE_TYPE);
lp.addTransformDef(lt);
}
savePipeline(configuration, lp);
@@ -96,24 +92,20 @@
}
@Override
- public void initializeFrom(ILaunchConfiguration configuration)
- {
+ public void initializeFrom(ILaunchConfiguration configuration) {
pipeline = null;
- try
- {
- String s = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_PIPELINE, (String) null);
- if (s != null && s.length() > 0)
- {
- ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes());
+ try {
+ String s = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_PIPELINE,
+ (String) null);
+ if (s != null && s.length() > 0) {
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(s
+ .getBytes());
pipeline = LaunchPipeline.fromXML(inputStream);
- }
- else
- {
+ } else {
pipeline = new LaunchPipeline();
}
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
transformsBlock.setPipeline(pipeline);
@@ -121,31 +113,27 @@
}
@Override
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
super.performApply(configuration);
savePipeline(configuration, pipeline);
}
- private void savePipeline(ILaunchConfigurationWorkingCopy configuration, LaunchPipeline pipeline)
- {
- try
- {
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_PIPELINE, pipeline.toXML());
- }
- catch (CoreException e)
- {
+ private void savePipeline(ILaunchConfigurationWorkingCopy configuration,
+ LaunchPipeline pipeline) {
+ try {
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_PIPELINE, pipeline
+ .toXML());
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
- public String getName()
- {
+ public String getName() {
return Messages.XSLMainTab_TabName;
}
- private static IResource[] getContext()
- {
+ private static IResource[] getContext() {
// IProject[] projects =
// ResourcesPlugin.getWorkspace().getRoot().getProjects();
@@ -165,15 +153,13 @@
IWorkbenchPage page = XSLDebugUIPlugin.getActivePage();
List<Object> resources = new ArrayList<Object>();
- if (page != null)
- {
+ if (page != null) {
// use selections to find the project
ISelection selection = page.getSelection();
- if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection)
- {
+ if (selection != null && !selection.isEmpty()
+ && selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
- for (Iterator<?> iter = ss.iterator(); iter.hasNext();)
- {
+ for (Iterator<?> iter = ss.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IResource)
resources.add(element);
@@ -182,42 +168,39 @@
}
// use current editor to find the project
IEditorPart part = page.getActiveEditor();
- if (part != null)
- {
+ if (part != null) {
IEditorInput input = part.getEditorInput();
IFile file = (IFile) input.getAdapter(IFile.class);
if (file != null)
- return new IResource[]
- { file };
+ return new IResource[] { file };
}
}
return new IResource[0];
}
- private IFile getXMLInput(IResource[] context)
- {
- for (IResource resource : context)
- {
- if (resource instanceof IFile && ("xml".equalsIgnoreCase(resource.getFileExtension()) || "xhtml".equalsIgnoreCase(resource.getFileExtension()))) //$NON-NLS-1$ //$NON-NLS-2$
+ private IFile getXMLInput(IResource[] context) {
+ for (IResource resource : context) {
+ if (resource instanceof IFile
+ && ("xml".equalsIgnoreCase(resource.getFileExtension()) || "xhtml".equalsIgnoreCase(resource.getFileExtension()))) //$NON-NLS-1$ //$NON-NLS-2$
return (IFile) resource;
}
return null;
}
- private IFile[] getXSLStylesheets(IResource[] context)
- {
+ private IFile[] getXSLStylesheets(IResource[] context) {
List<IResource> stylesheets = new ArrayList<IResource>();
- for (IResource resource : context)
- {
- if (resource instanceof IFile && XSLCore.isXSLFile((IFile)resource))
+ for (IResource resource : context) {
+ if (resource instanceof IFile
+ && XSLCore.isXSLFile((IFile) resource))
stylesheets.add(resource);
}
return stylesheets.toArray(new IFile[0]);
}
-
+
@Override
public Image getImage() {
- return XSLPluginImageHelper.getInstance().getImage(XSLDebugPluginImages.IMG_MAIN_TAB);
+ return XSLPluginImageHelper.getInstance().getImage(
+ XSLDebugPluginImages.IMG_MAIN_TAB);
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputFileBlock.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputFileBlock.java
index 154d3f9..ff99b65 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputFileBlock.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputFileBlock.java
@@ -33,8 +33,7 @@
import org.eclipse.wst.xsl.launching.XSLLaunchConfigurationConstants;
import org.eclipse.wst.xsl.launching.XSLTRuntime;
-public class OutputFileBlock extends ResourceSelectionBlock
-{
+public class OutputFileBlock extends ResourceSelectionBlock {
private Button openFileCheckButton;
private Button formatFileCheckButton;
private String inputFilename;
@@ -42,48 +41,44 @@
private String defaultOutputFileName;
private String outputFileName;
- public OutputFileBlock()
- {
+ public OutputFileBlock() {
super(IResource.FOLDER, true, true, false);
}
@Override
- protected String getMessage(int type)
- {
- switch (type)
- {
- case ERROR_DIRECTORY_NOT_SPECIFIED:
- return Messages.OutputFOFileBlock_DIRECTORY_NOT_SPECIFIED;
- case ERROR_DIRECTORY_DOES_NOT_EXIST:
- return Messages.OutputFOFileBlock_DIRECTORY_DOES_NOT_EXIST;
- case GROUP_NAME:
- return getName();
- case USE_DEFAULT_RADIO:
- return Messages.OutputFileBlock_0;
- case USE_OTHER_RADIO:
- return Messages.OutputFOFileBlock_OTHER_RADIO;
- case DIRECTORY_DIALOG_MESSAGE:
- return Messages.OutputFOFileBlock_DIALOG_MESSAGE;
- case WORKSPACE_DIALOG_MESSAGE:
- return Messages.OutputFOFileBlock_WORKSPACE_DIALOG_MESSAGE;
- case VARIABLES_BUTTON:
- return Messages.OutputFOFileBlock_VARIABLES_BUTTON;
- case FILE_SYSTEM_BUTTON:
- return Messages.OutputFOFileBlock_FILE_SYSTEM_BUTTON;
- case WORKSPACE_BUTTON:
- return Messages.OutputFOFileBlock_WORKSPACE_BUTTON;
- case WORKSPACE_DIALOG_TITLE:
- return Messages.OutputFOFileBlock_WORKSPACE_DIALOG_TITLE;
+ protected String getMessage(int type) {
+ switch (type) {
+ case ERROR_DIRECTORY_NOT_SPECIFIED:
+ return Messages.OutputFOFileBlock_DIRECTORY_NOT_SPECIFIED;
+ case ERROR_DIRECTORY_DOES_NOT_EXIST:
+ return Messages.OutputFOFileBlock_DIRECTORY_DOES_NOT_EXIST;
+ case GROUP_NAME:
+ return getName();
+ case USE_DEFAULT_RADIO:
+ return Messages.OutputFileBlock_0;
+ case USE_OTHER_RADIO:
+ return Messages.OutputFOFileBlock_OTHER_RADIO;
+ case DIRECTORY_DIALOG_MESSAGE:
+ return Messages.OutputFOFileBlock_DIALOG_MESSAGE;
+ case WORKSPACE_DIALOG_MESSAGE:
+ return Messages.OutputFOFileBlock_WORKSPACE_DIALOG_MESSAGE;
+ case VARIABLES_BUTTON:
+ return Messages.OutputFOFileBlock_VARIABLES_BUTTON;
+ case FILE_SYSTEM_BUTTON:
+ return Messages.OutputFOFileBlock_FILE_SYSTEM_BUTTON;
+ case WORKSPACE_BUTTON:
+ return Messages.OutputFOFileBlock_WORKSPACE_BUTTON;
+ case WORKSPACE_DIALOG_TITLE:
+ return Messages.OutputFOFileBlock_WORKSPACE_DIALOG_TITLE;
}
return "" + type; //$NON-NLS-1$
}
@Override
- protected void createCheckboxAndText(Composite parent)
- {
- if (showDefault)
- {
- useDefaultCheckButton = createCheckButton(parent, getMessage(USE_DEFAULT_RADIO));
+ protected void createCheckboxAndText(Composite parent) {
+ if (showDefault) {
+ useDefaultCheckButton = createCheckButton(parent,
+ getMessage(USE_DEFAULT_RADIO));
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 2;
useDefaultCheckButton.setLayoutData(gd);
@@ -113,8 +108,7 @@
fileNameText.setFont(parent.getFont());
fileNameText.addModifyListener(widgetListener);
- if (showDefault)
- {
+ if (showDefault) {
label = new Label(specificFileComp, SWT.NONE);
label.setText(Messages.OutputFileBlock_7);
}
@@ -128,53 +122,46 @@
}
@Override
- protected void createButtons(Composite parent)
- {
- Composite checkComposite = new Composite(parent,SWT.NONE);
- checkComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ protected void createButtons(Composite parent) {
+ Composite checkComposite = new Composite(parent, SWT.NONE);
+ checkComposite.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING));
GridLayout gl = new GridLayout();
gl.marginWidth = 0;
checkComposite.setLayout(gl);
-
- openFileCheckButton = createCheckButton(checkComposite, Messages.OutputFileBlock_8);
+
+ openFileCheckButton = createCheckButton(checkComposite,
+ Messages.OutputFileBlock_8);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 1;
openFileCheckButton.setLayoutData(gd);
- openFileCheckButton.addSelectionListener(new SelectionListener()
- {
+ openFileCheckButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e)
- {
+ public void widgetDefaultSelected(SelectionEvent e) {
}
- public void widgetSelected(SelectionEvent e)
- {
- if (openFileCheckButton.getSelection())
- {
+ public void widgetSelected(SelectionEvent e) {
+ if (openFileCheckButton.getSelection()) {
formatFileCheckButton.setEnabled(true);
updateLaunchConfigurationDialog();
- }
- else
- {
+ } else {
formatFileCheckButton.setEnabled(false);
formatFileCheckButton.setSelection(false);
}
}
});
- formatFileCheckButton = createCheckButton(checkComposite, Messages.OutputFileBlock_2);
+ formatFileCheckButton = createCheckButton(checkComposite,
+ Messages.OutputFileBlock_2);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalSpan = 1;
formatFileCheckButton.setLayoutData(gd);
- formatFileCheckButton.addSelectionListener(new SelectionListener()
- {
+ formatFileCheckButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e)
- {
+ public void widgetDefaultSelected(SelectionEvent e) {
}
- public void widgetSelected(SelectionEvent e)
- {
+ public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
@@ -184,114 +171,134 @@
layout.marginHeight = 0;
layout.marginWidth = 0;
buttonComp.setLayout(layout);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END
+ | GridData.VERTICAL_ALIGN_BEGINNING);
gd.horizontalSpan = 1;
buttonComp.setLayoutData(gd);
buttonComp.setFont(parent.getFont());
- fWorkspaceButton = createPushButton(buttonComp, getMessage(WORKSPACE_BUTTON), null);
+ fWorkspaceButton = createPushButton(buttonComp,
+ getMessage(WORKSPACE_BUTTON), null);
fWorkspaceButton.addSelectionListener(widgetListener);
- fFileSystemButton = createPushButton(buttonComp, getMessage(FILE_SYSTEM_BUTTON), null);
+ fFileSystemButton = createPushButton(buttonComp,
+ getMessage(FILE_SYSTEM_BUTTON), null);
fFileSystemButton.addSelectionListener(widgetListener);
- fVariablesButton = createPushButton(buttonComp, getMessage(VARIABLES_BUTTON), null);
+ fVariablesButton = createPushButton(buttonComp,
+ getMessage(VARIABLES_BUTTON), null);
fVariablesButton.addSelectionListener(widgetListener);
}
- public String getName()
- {
+ public String getName() {
return Messages.OutputFileBlock_9;
}
- public void initializeFrom(ILaunchConfiguration configuration)
- {
- try
- {
- inputFilename = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, ""); //$NON-NLS-1$
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ try {
+ inputFilename = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, ""); //$NON-NLS-1$
updateDefaultOutputFile();
- boolean useDefault = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE, true);
+ boolean useDefault = configuration
+ .getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE,
+ true);
useDefaultCheckButton.setSelection(useDefault);
- outputFileName = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME, defaultOutputFileName);
- resource = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER, defaultResource);
+ outputFileName = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME,
+ defaultOutputFileName);
+ resource = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER,
+ defaultResource);
updateResourceText(useDefault);
- boolean openFileOnCompletion = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, true);
+ boolean openFileOnCompletion = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, true);
openFileCheckButton.setSelection(openFileOnCompletion);
-
- boolean formatFileOnCompletion = configuration.getAttribute(XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE, false);
+
+ boolean formatFileOnCompletion = configuration.getAttribute(
+ XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE, false);
formatFileCheckButton.setSelection(formatFileOnCompletion);
- }
- catch (CoreException e)
- {
+ } catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
- public void performApply(ILaunchConfigurationWorkingCopy configuration)
- {
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
boolean useDefault = useDefaultCheckButton.getSelection();
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE, useDefault);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE,
+ useDefault);
String outputFile = resourceText.getText();
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER, outputFile);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER, outputFile);
String outputFileName = fileNameText.getText();
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME, outputFileName);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME,
+ outputFileName);
boolean openFileOnCompletion = openFileCheckButton.getSelection();
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, openFileOnCompletion);
-
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OPEN_FILE,
+ openFileOnCompletion);
+
boolean formatFileOnCompletion = formatFileCheckButton.getSelection();
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE, formatFileOnCompletion);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE,
+ formatFileOnCompletion);
}
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
- {
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE, true);
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER, (String)null);
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME, (String)null);
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, true);
- configuration.setAttribute(XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE, false);
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_USE_DEFAULT_OUTPUT_FILE,
+ true);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FOLDER,
+ (String) null);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OUTPUT_FILENAME,
+ (String) null);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_OPEN_FILE, true);
+ configuration.setAttribute(
+ XSLLaunchConfigurationConstants.ATTR_FORMAT_FILE, false);
}
-
+
@Override
- protected void updateResourceText(boolean useDefault)
- {
+ protected void updateResourceText(boolean useDefault) {
fileNameText.setEnabled(!useDefault);
if (useDefault)
- fileNameText.setText(defaultOutputFileName == null ? "" : defaultOutputFileName); //$NON-NLS-1$
+ fileNameText
+ .setText(defaultOutputFileName == null ? "" : defaultOutputFileName); //$NON-NLS-1$
else
- fileNameText.setText(outputFileName == null ? defaultOutputFileName : outputFileName);
+ fileNameText.setText(outputFileName == null ? defaultOutputFileName
+ : outputFileName);
super.updateResourceText(useDefault);
}
- private void updateDefaultOutputFile()
- {
- try
- {
- IPath path = XSLTRuntime.defaultOutputFileForInputFile(inputFilename);
+ private void updateDefaultOutputFile() {
+ try {
+ IPath path = XSLTRuntime
+ .defaultOutputFileForInputFile(inputFilename);
// determine whether this path exists in the workspace
- IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
- if (files.length > 0)
- {// inside workspace
+ IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
+ .findFilesForLocation(path);
+ if (files.length > 0) {// inside workspace
IPath p = new Path(files[0].getProject().getName());
p.append(files[0].getParent().getProjectRelativePath());
- defaultResource = "${workspace_loc:/"+p.toString()+"}"; //$NON-NLS-1$//$NON-NLS-2$
- }
- else
- {// outside workspace
+ defaultResource = "${workspace_loc:/" + p.toString() + "}"; //$NON-NLS-1$//$NON-NLS-2$
+ } else {// outside workspace
IPath p = path.removeLastSegments(1);
defaultResource = p.toOSString();
}
defaultOutputFileName = path.lastSegment();
- }
- catch (CoreException e)
- {
- // do nothing
+ } catch (CoreException e) {
+ // do nothing
}
}
}
diff --git a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputTab.java b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputTab.java
index 16edd4d..d56b890 100644
--- a/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputTab.java
+++ b/bundles/org.eclipse.wst.xsl.debug.ui/src/org/eclipse/wst/xsl/internal/debug/ui/tabs/output/OutputTab.java
@@ -25,63 +25,59 @@
import org.eclipse.wst.xsl.internal.debug.ui.tabs.main.XSLMainTab;
import org.eclipse.wst.xsl.launching.XSLLaunchConfigurationConstants;
-public class OutputTab extends XSLLaunchConfigurationTab
-{
+public class OutputTab extends XSLLaunchConfigurationTab {
private final OutputFileBlock outputFileBlock;
private final WorkingDirectoryBlock workingDirectoryBlock;
- public OutputTab(XSLMainTab main)
- {
+ public OutputTab(XSLMainTab main) {
outputFileBlock = new OutputFileBlock();
- workingDirectoryBlock = new WorkingDirectoryBlock(XSLLaunchConfigurationConstants.ATTR_WORKING_DIR){
+ workingDirectoryBlock = new WorkingDirectoryBlock(
+ XSLLaunchConfigurationConstants.ATTR_WORKING_DIR) {
@Override
- protected IProject getProject(ILaunchConfiguration configuration) throws CoreException
- {
+ protected IProject getProject(ILaunchConfiguration configuration)
+ throws CoreException {
// TODO Auto-generated method stub
return null;
}
};
- setBlocks(new ILaunchConfigurationTab[]{ outputFileBlock,workingDirectoryBlock });
+ setBlocks(new ILaunchConfigurationTab[] { outputFileBlock,
+ workingDirectoryBlock });
}
@Override
- public void createControl(Composite parent)
- {
+ public void createControl(Composite parent) {
super.createControl(parent);
Composite comp = (Composite) getControl();
GridLayout layout = new GridLayout(1, false);
comp.setLayout(layout);
outputFileBlock.createControl(comp);
-
+
workingDirectoryBlock.createControl(comp);
-
-
-// Group group = new Group(comp, SWT.NULL);
-// group.setText(Messages.OutputTab_0);
-// GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
-// group.setLayoutData(gd);
-// layout = new GridLayout(2, false);
-// group.setLayout(layout);
+ // Group group = new Group(comp, SWT.NULL);
+ // group.setText(Messages.OutputTab_0);
+ // GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ // group.setLayoutData(gd);
+ // layout = new GridLayout(2, false);
+ // group.setLayout(layout);
-// outputBlock.createControl(group);
+ // outputBlock.createControl(group);
}
-
+
@Override
- public String getId()
- {
+ public String getId() {
return "org.eclipse.wst.xsl.internal.debug.ui.tabs.output"; //$NON-NLS-1$
}
- public String getName()
- {
+ public String getName() {
return Messages.OutputTab_1;
}
-
+
@Override
public Image getImage() {
- return XSLPluginImageHelper.getInstance().getImage(XSLDebugPluginImages.IMG_OUTPUT_TAB);
+ return XSLPluginImageHelper.getInstance().getImage(
+ XSLDebugPluginImages.IMG_OUTPUT_TAB);
}
}