diff options
Diffstat (limited to 'org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal')
108 files changed, 1117 insertions, 1117 deletions
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java index d3d813542..f0c0f114b 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -83,7 +83,7 @@ public class ActionRunner { clonedParams[i] = value == null ? ICheatSheetResource.EMPTY_STRING : value; } } - } + } ((ICheatSheetAction) action).run(clonedParams, csm); } else { try { @@ -97,7 +97,7 @@ public class ActionRunner { action.removePropertyChangeListener(propertyChangeListener); if (status.isOK() && listenerFired[0]) { - if (!listenerResult[0]) { + if (!listenerResult[0]) { status =new Status(IStatus.WARNING, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, Messages.ACTION_FAILED, null); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetEvaluationContext.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetEvaluationContext.java index 725afe88a..58880cb03 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetEvaluationContext.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetEvaluationContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,9 +22,9 @@ public final class CheatSheetEvaluationContext { private static final String VARIABLE_PLATFORM = "platform"; //$NON-NLS-1$ private static final String VARIABLE_WORKBENCH = "workbench"; //$NON-NLS-1$ - + private static EvaluationContext context; - + /* * Returns the evaluation context to use in cheat sheets. */ @@ -36,7 +36,7 @@ public final class CheatSheetEvaluationContext { } return context; } - + /* * Not meant to be instantiated. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java index 884db9f1c..d2c07bed2 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetHistory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,9 +29,9 @@ import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetRegistryReader; public class CheatSheetHistory { private static final int DEFAULT_DEPTH = 5; - + private ArrayList history; - private CheatSheetRegistryReader reg; + private CheatSheetRegistryReader reg; private ListenerList listeners = new ListenerList(); public CheatSheetHistory(CheatSheetRegistryReader reg) { @@ -41,12 +41,12 @@ public class CheatSheetHistory { public void addListener(IPropertyListener l) { listeners.add(l); - } - + } + public void removeListener(IPropertyListener l) { listeners.remove(l); - } - + } + private void fireChange() { Object[] array = listeners.getListeners(); for (int i = 0; i < array.length; i++) { @@ -54,18 +54,18 @@ public class CheatSheetHistory { element.propertyChanged(this, 0); } } - + public IStatus restoreState(IMemento memento) { IMemento [] children = memento.getChildren("element"); //$NON-NLS-1$ for (int i = 0; i < children.length && i < DEFAULT_DEPTH; i++) { CheatSheetElement element = reg.findCheatSheet(children[i].getID()); - if (element != null) + if (element != null) history.add(element); } return new Status(IStatus.OK,ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID,0,ICheatSheetResource.EMPTY_STRING,null); } - + public IStatus saveState(IMemento memento) { Iterator iter = history.iterator(); while (iter.hasNext()) { @@ -79,31 +79,31 @@ public class CheatSheetHistory { public void add(String id) { CheatSheetElement element = reg.findCheatSheet(id); - if (element != null) + if (element != null) add(element); } - + public void add(CheatSheetElement element) { // Avoid duplicates if (history.contains(element)) return; - // If the shortcut list will be too long, remove oldest ones + // If the shortcut list will be too long, remove oldest ones int size = history.size(); int preferredSize = DEFAULT_DEPTH; while (size >= preferredSize) { size--; history.remove(size); } - + // Insert at top as most recent history.add(0, element); fireChange(); } - + public void refreshFromRegistry() { boolean change = false; - + Iterator iter = history.iterator(); while (iter.hasNext()) { CheatSheetElement element = (CheatSheetElement)iter.next(); @@ -112,7 +112,7 @@ public class CheatSheetHistory { change = true; } } - + if (change) fireChange(); } @@ -120,7 +120,7 @@ public class CheatSheetHistory { /** * Copy the requested number of items from the history into * the destination list at the given index. - * + * * @param dest destination list to contain the items * @param destStart index in destination list to start copying items at * @param count number of items to copy from history @@ -130,11 +130,11 @@ public class CheatSheetHistory { int itemCount = count; if (itemCount > history.size()) itemCount = history.size(); - + for (int i = 0; i < itemCount; i++) dest.add(destStart + i, history.get(i)); - + return itemCount; - } + } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetPlugin.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetPlugin.java index c9546d711..c1fc408ae 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetPlugin.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetPlugin.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2002, 2008 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -56,19 +56,19 @@ public class CheatSheetPlugin extends AbstractUIPlugin { //private ResourceBundle resourceBundle; private CheatSheetHistory history = null; private DocumentBuilder documentBuilder = null; - + private static final String HISTORY_FILENAME = "history.xml"; //$NON-NLS-1$ private static final String MEMENTO_TAG_CHEATSHEET = "cheatsheet"; //$NON-NLS-1$ private static final String MEMENTO_TAG_VERSION = "version"; //$NON-NLS-1$ private static final String VERSION_STRING[] = { "0.0", "3.0.0" }; //$NON-NLS-1$ //$NON-NLS-2$ - private static final String MEMENTO_TAG_CHEATSHEET_HISTORY = "cheatsheetHistory"; //$NON-NLS-1$ + private static final String MEMENTO_TAG_CHEATSHEET_HISTORY = "cheatsheetHistory"; //$NON-NLS-1$ - public static final IPath ICONS_PATH = new Path("$nl$/icons/"); //$NON-NLS-1$ + public static final IPath ICONS_PATH = new Path("$nl$/icons/"); //$NON-NLS-1$ public static final String T_OBJ = "obj16/"; //$NON-NLS-1$ public static final String T_ELCL = "elcl16/"; //$NON-NLS-1$ public static final String T_DLCL = "dlcl16/"; //$NON-NLS-1$ public static final String T_VIEW = "view16/"; //$NON-NLS-1$ - + /** * The constructor. */ @@ -84,7 +84,7 @@ public class CheatSheetPlugin extends AbstractUIPlugin { } /** - * Returns the image in Cheat Sheet's image registry with the given key, + * Returns the image in Cheat Sheet's image registry with the given key, * or <code>null</code> if none. * Convenience method equivalent to * <pre> @@ -145,13 +145,13 @@ public class CheatSheetPlugin extends AbstractUIPlugin { message, ex); CheatSheetPlugin.getPlugin().getLog().log(errorStatus); } - + @Override protected void initializeImageRegistry(ImageRegistry reg) { IPath path = ICONS_PATH.append(T_OBJ).append("cheatsheet_obj.gif");//$NON-NLS-1$ ImageDescriptor imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); - reg.put(ICheatSheetResource.CHEATSHEET_OBJ, imageDescriptor); - + reg.put(ICheatSheetResource.CHEATSHEET_OBJ, imageDescriptor); + path = ICONS_PATH.append(T_OBJ).append("skip_status.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.CHEATSHEET_ITEM_SKIP, imageDescriptor); @@ -187,25 +187,25 @@ public class CheatSheetPlugin extends AbstractUIPlugin { path = ICONS_PATH.append(T_ELCL).append("restart_task.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_RESTART, imageDescriptor); - + path = ICONS_PATH.append(T_ELCL).append("return_to_start.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.CHEATSHEET_RETURN, imageDescriptor); - + path = ICONS_PATH.append(T_OBJ).append("error.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.ERROR, imageDescriptor); - + // Images used by composites path = ICONS_PATH.append(T_OBJ).append("composite_obj.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.COMPOSITE_OBJ, imageDescriptor); - + path = ICONS_PATH.append(T_OBJ).append("information.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.INFORMATION, imageDescriptor); - + path = ICONS_PATH.append(T_OBJ).append("warning.gif");//$NON-NLS-1$ imageDescriptor = createImageDescriptor(getPlugin().getBundle(), path); reg.put(ICheatSheetResource.WARNING, imageDescriptor); @@ -242,7 +242,7 @@ public class CheatSheetPlugin extends AbstractUIPlugin { SafeRunner.run(new SafeRunnable() { @Override public void run() { - IMemento memento; + IMemento memento; memento = readMemento(HISTORY_FILENAME); if (memento != null) { IMemento childMem = memento.getChild(MEMENTO_TAG_CHEATSHEET_HISTORY); @@ -259,10 +259,10 @@ public class CheatSheetPlugin extends AbstractUIPlugin { } }); } - + /** * Read a memento from the state directory for the cheatsheets plugin - * @param filename A simple filename + * @param filename A simple filename * @return A memento read from the state directory or null if the memento could not be read */ public XMLMemento readMemento(String filename) { @@ -277,7 +277,7 @@ public class CheatSheetPlugin extends AbstractUIPlugin { reader = new InputStreamReader(input, "utf-8"); //$NON-NLS-1$ memento = XMLMemento.createReadRoot(reader); - + } catch (FileNotFoundException e) { memento = null; // Do nothing, the file will not exist the first time the workbench in used. @@ -328,7 +328,7 @@ public class CheatSheetPlugin extends AbstractUIPlugin { } }); } - + /** * Save the memento to a file in this plugins state area * @param memento The memento to save @@ -367,20 +367,20 @@ public class CheatSheetPlugin extends AbstractUIPlugin { super.start(context); plugin = this; - + // allow the MRU history to be lazily initialized by getCheatSheetHistory } @Override public void stop(BundleContext context) throws Exception { super.stop(context); - + // save the MRU history if necessary // if we never restored history, let existing memento stand if (history != null) { saveCheatSheetHistory(); } - + CheatSheetRegistryReader.getInstance().stop(); } @@ -394,5 +394,5 @@ public class CheatSheetPlugin extends AbstractUIPlugin { } return null; } - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetStopWatch.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetStopWatch.java index b8cee635b..844c91e6b 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetStopWatch.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatSheetStopWatch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,17 +21,17 @@ public class CheatSheetStopWatch { private Map table; private CheatSheetStopWatch() { - + } - + public static CheatSheetStopWatch getInstance() { if(stopWatch == null) { stopWatch = new CheatSheetStopWatch(); } - + return stopWatch; } - + public void start(String key) { Entry entry = getEntry(key); @@ -41,20 +41,20 @@ public class CheatSheetStopWatch { } else { resetEntry(entry); } - + entry.start = System.currentTimeMillis(); } - + public void stop(String key) { Entry entry = getEntry(key); entry.stop = System.currentTimeMillis(); } - + public long totalElapsedTime(String key) { Entry entry = getEntry(key); return entry.stop - entry.start; } - + public void lapTime(String key) { Entry entry = getEntry(key); if(entry.currentLap == -1) { @@ -71,7 +71,7 @@ public class CheatSheetStopWatch { } /** - * Contains the data for an entry in the stopwatch. + * Contains the data for an entry in the stopwatch. */ private static class Entry { protected long start = -1; @@ -79,7 +79,7 @@ public class CheatSheetStopWatch { protected long currentLap = -1; protected long previousLap = -1; } - + private Entry getEntry(String key) { return (Entry) getTable().get(key); } @@ -112,7 +112,7 @@ public class CheatSheetStopWatch { } return false; } - + public static void startStopWatch(String key) { if(isTracing()) { getInstance().start(key); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java index c156afbe9..d9ed47b25 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,14 +27,14 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML { private static final String INTRO_DESC = "cheatsheet/intro/description"; //$NON-NLS-1$ private static final String ITEM_DESC = "cheatsheet/item/description"; //$NON-NLS-1$ - + private static final String CCS_DESC = "compositeCheatsheet/taskGroup/intro"; //$NON-NLS-1$ /** * Returns all the documents that this participant knows about. This method * is only used for participants that handle documents outside of the help * system's TOC. - * + * * @return a set of hrefs for documents managed by this participant. */ @Override @@ -42,8 +42,8 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML { HashSet set = new HashSet(); IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor( - ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID + '.' - + CheatSheetRegistryReader.CHEAT_SHEET_CONTENT); + ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID + '.' + + CheatSheetRegistryReader.CHEAT_SHEET_CONTENT); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; if (!element.getName().equals(CheatSheetRegistryReader.TAG_CHEATSHEET)) @@ -69,12 +69,12 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML { public Set getContributingPlugins() { IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor( - ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID + '.' + ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID + '.' + CheatSheetRegistryReader.CHEAT_SHEET_CONTENT); HashSet set = new HashSet(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; - if (element.getName().equals(CheatSheetRegistryReader.TAG_CHEATSHEET)) { + if (element.getName().equals(CheatSheetRegistryReader.TAG_CHEATSHEET)) { set.add(element.getContributor().getName()); } } @@ -94,9 +94,9 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML { data.addText(attributes.getValue(IParserTags.TITLE)); } else if (name.equals(IParserTags.SUBITEM)) { data.addText(attributes.getValue(IParserTags.LABEL)); - } else if (name.equals(ICompositeCheatsheetTags.TASK ) + } else if (name.equals(ICompositeCheatsheetTags.TASK ) || name.equals(ICompositeCheatsheetTags.TASK_GROUP)) { - data.addText(attributes.getValue(ICompositeCheatsheetTags.NAME)); + data.addText(attributes.getValue(ICompositeCheatsheetTags.NAME)); } } @@ -131,7 +131,7 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML { openAction.run(); return true; } - + private static boolean isExtensionValid(String fileName, String id, String pluginId) { if (fileName.indexOf('\\') != -1) { CheatSheetPlugin.logError("Error in cheat sheet extension id " + id + " from plug-in " + pluginId + ": path should not contain back-slashes (\\): " + fileName + ". This cheat sheet will not be indexed for searching.", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java index e662fabaf..4d38158eb 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,9 +30,9 @@ import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager; */ public class CommandRunner { - + private ICommandService getCommandService() { - IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbench wb = PlatformUI.getWorkbench(); if (wb != null) { Object serviceObject = wb.getAdapter(ICommandService.class); if (serviceObject != null) { @@ -42,9 +42,9 @@ public class CommandRunner { } return null; } - + private IHandlerService getHandlerService() { - IWorkbench wb = PlatformUI.getWorkbench(); + IWorkbench wb = PlatformUI.getWorkbench(); if (wb != null) { Object serviceObject = wb.getAdapter(IHandlerService.class); if (serviceObject != null) { @@ -54,11 +54,11 @@ public class CommandRunner { } return null; } - + /** - * Attempt to execute a command + * Attempt to execute a command * @param command a CheatSheetCommand created by the parser - * @param csm + * @param csm * @return OK_STATUS if the command completes withour error, otherwise * an error status */ @@ -67,20 +67,20 @@ public class CommandRunner { IHandlerService handlerService = getHandlerService(); if (commandService == null || handlerService == null) { return new Status - (IStatus.ERROR, + (IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, 0, Messages.ERROR_COMMAND_SERVICE_UNAVAILABLE, null); } ParameterizedCommand selectedCommand; - Object result; + Object result; String rawSerialization = command.getSerialization(); try { String substitutedSerialization = csm.performVariableSubstitution(rawSerialization); selectedCommand = commandService.deserialize(substitutedSerialization); result = handlerService.executeCommand(selectedCommand, null); - + String returnsAttribute = command.getReturns(); if ((returnsAttribute != null) && (result != null)) { ParameterType returnType = selectedCommand.getCommand().getReturnType(); @@ -94,22 +94,22 @@ public class CommandRunner { } } } - + } catch (NotDefinedException e) { String message = NLS.bind(Messages.ERROR_COMMAND_ID_NOT_FOUND, (new Object[] {rawSerialization})); - return new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); + return new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); } catch (CommandException e) { return commandFailureStatus(e); } catch (Exception e) { return commandFailureStatus(e); } - + return Status.OK_STATUS; } - + private IStatus commandFailureStatus(Exception exception) { return new Status - (IStatus.ERROR, + (IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, 0, Messages.ERROR_COMMAND_ERROR_STATUS, exception); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ICheatSheetResource.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ICheatSheetResource.java index e6fa88fa9..4d068c26a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ICheatSheetResource.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ICheatSheetResource.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,14 +28,14 @@ public interface ICheatSheetResource { public static final String MEMENTO_ID = "id"; //$NON-NLS-1$ public static final String MEMENTO_NAME = "name"; //$NON-NLS-1$ public static final String MEMENTO_URL = "url"; //$NON-NLS-1$ - + public static final String TRIGGER_POINT_ID = "org.eclipse.ui.cheatsheetSelectionDialog"; //$NON-NLS-1$ // // Constants used to retrieve images from the cheatsheet image registry. // - public static final String CHEATSHEET_OBJ = "CHEATSHEET_OBJ";//$NON-NLS-1$ + public static final String CHEATSHEET_OBJ = "CHEATSHEET_OBJ";//$NON-NLS-1$ public static final String COMPOSITE_OBJ = "COMPOSITE_OBJ";//$NON-NLS-1$ public static final String CHEATSHEET_ITEM_SKIP = "CHEATSHEET_ITEM_SKIP"; //$NON-NLS-1$ public static final String CHEATSHEET_ITEM_COMPLETE = "CHEATSHEET_ITEM_COMPLETE"; //$NON-NLS-1$ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java index 19bea88a0..e90bc8897 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/Messages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,7 +15,7 @@ import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.ui.internal.cheatsheets.Messages";//$NON-NLS-1$ - + private Messages() { // Do not instantiate } @@ -147,7 +147,7 @@ public final class Messages extends NLS { public static String COMPOSITE_RESET_TASK_DIALOG_MESSAGE; public static String COMPOSITE_PAGE_END_REVIEW; public static String CHEATSHEET_TASK_NO_ID; - + static { NLS.initializeMessages(BUNDLE_NAME, Messages.class); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetCategoryBasedSelectionAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetCategoryBasedSelectionAction.java index 166221dee..e78cb0ead 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetCategoryBasedSelectionAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetCategoryBasedSelectionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,11 +20,11 @@ import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetRegistryReader; /** * Action to programmatically open the CheatSheet selection dialog. - * + * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> - * + * */ public class CheatSheetCategoryBasedSelectionAction extends Action { @@ -64,7 +64,7 @@ public class CheatSheetCategoryBasedSelectionAction extends Action { notifyResult(false); return; } - + notifyResult(true); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetHelpMenuAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetHelpMenuAction.java index 7e056b82d..4ea6f6c29 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetHelpMenuAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetHelpMenuAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenu.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenu.java index e797b4b20..1d49f2aa2 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenu.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,10 +28,10 @@ import org.eclipse.ui.internal.cheatsheets.registry.*; import org.eclipse.ui.internal.cheatsheets.views.CheatSheetView; /** - * A menu for cheatsheet selection. + * A menu for cheatsheet selection. * <p> * A <code>CheatSheetMenu</code> is used to populate a menu with - * cheatsheet items. If the user selects one of these items + * cheatsheet items. If the user selects one of these items * an action is performed to launch the selected cheatsheet. * </p><p> * The visible cheatsheet items within the menu are dynamic and reflect the @@ -45,7 +45,7 @@ public class CheatSheetMenu extends ContributionItem { private static CheatSheetRegistryReader reg; private boolean showActive = false; - + private IMenuContributor menuContributor; private Comparator comparator = new Comparator() { @@ -63,7 +63,7 @@ public class CheatSheetMenu extends ContributionItem { }; /** - * Constructs a new instance of <code>CheatSheetMenu</code>. + * Constructs a new instance of <code>CheatSheetMenu</code>. */ public CheatSheetMenu() { super("LaunchCheatSheetMenu"); //$NON-NLS-1$ @@ -82,7 +82,7 @@ public class CheatSheetMenu extends ContributionItem { MenuItem mi = new MenuItem(menu, bCheck ? SWT.RADIO : SWT.PUSH, index); mi.setText(element.getLabel(null)); String key; - if (element.isComposite()) { + if (element.isComposite()) { key = ICheatSheetResource.COMPOSITE_OBJ; } else { key = ICheatSheetResource.CHEATSHEET_OBJ; @@ -144,7 +144,7 @@ public class CheatSheetMenu extends ContributionItem { /** * Method getActiveCheatSheetID returns the id of the active * cheatsheet or null. - * + * * @return String */ private String getActiveCheatSheetID() { @@ -167,7 +167,7 @@ public class CheatSheetMenu extends ContributionItem { /** * Method getActiveWorkbenchPage returns the active * workbench page or null. - * + * * @return IWorkbenchPage */ private IWorkbenchPage getActiveWorkbenchPage() { @@ -183,12 +183,12 @@ public class CheatSheetMenu extends ContributionItem { * in the menu. * <p> * By default, the list contains the most recently used cheatsheets - * and then random cheatsheets until there are 5 present in the list. + * and then random cheatsheets until there are 5 present in the list. * </p><p> * Care should be taken to keep this list to a minimum (7 +/- 2 items * is a good guideline to follow). * </p> - * + * * @return an <code>ArrayList<code> of cheatsheet items <code>CheatSheetElement</code> */ protected ArrayList getCheatSheetItems() { @@ -217,7 +217,7 @@ public class CheatSheetMenu extends ContributionItem { /** * Method addCheatSheets fills a list with cheatsheet elements until there * are no more empty slots. - * + * * @param list - the list to file * @param cheatSheetsCollection - the collection to get the elements from * @param emptySlots - number of empty slots remaining @@ -307,7 +307,7 @@ public class CheatSheetMenu extends ContributionItem { /** * Sets the menuContributor - * @param menuContributor an object which may add contributions to + * @param menuContributor an object which may add contributions to * the menu. */ public void setMenuContributor(IMenuContributor menuContributor) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenuAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenuAction.java index aa0171d4e..494c8e2c3 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenuAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/CheatSheetMenuAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin; /** * This is the action used to contribute the CheatSheets menu to the workbench's - * help menu. + * help menu. */ public class CheatSheetMenuAction implements IWorkbenchWindowPulldownDelegate2, IPropertyListener { /** @@ -48,7 +48,7 @@ public class CheatSheetMenuAction implements IWorkbenchWindowPulldownDelegate2, /** * Fills the drop-down menu with cheat sheets history - * + * * @param menu the menu to fill */ protected void fillMenu(Menu menu) { @@ -94,7 +94,7 @@ public class CheatSheetMenuAction implements IWorkbenchWindowPulldownDelegate2, } }); } - + @Override public void propertyChanged(Object source, int propId) { fRecreateMenu = true; @@ -110,7 +110,7 @@ public class CheatSheetMenuAction implements IWorkbenchWindowPulldownDelegate2, /** * Sets this action's drop-down menu, disposing the previous menu. - * + * * @param menu the new menu */ private void setMenu(Menu menu) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/OpenPerspective.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/OpenPerspective.java index feae23f12..1ee5f4be4 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/OpenPerspective.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/actions/OpenPerspective.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,11 +19,11 @@ import org.eclipse.ui.internal.cheatsheets.*; /** * Action to programmatically open a perspective from a cheat sheet. * The perspective id must be passed to the action via param1. - * + * * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> - * + * */ public class OpenPerspective extends Action implements ICheatSheetAction { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/AbstractOverlayIcon.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/AbstractOverlayIcon.java index 3a9f13a55..a2b12f59d 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/AbstractOverlayIcon.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/AbstractOverlayIcon.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java index 860e3a681..9b5be453e 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,41 +38,41 @@ public class ConfirmRestartDialog extends Dialog { public String getColumnText(Object obj, int index) { return treeLabelProvider.getText(obj); } - + @Override public Image getColumnImage(Object obj, int index) { return treeLabelProvider.getImage(obj); } - + @Override public Image getImage(Object obj) { return PlatformUI.getWorkbench(). getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); } - + } public class TaskContentProvider implements IStructuredContentProvider { - + Object[] input; - + @Override public void inputChanged(Viewer v, Object oldInput, Object newInput) { input = (Object[])newInput; } - + @Override public void dispose() { - } - + } + @Override public Object[] getElements(Object parent) { return input; } } - + private AbstractTask[] tasks; - + private TreeLabelProvider treeLabelProvider; protected ConfirmRestartDialog(Shell parentShell, AbstractTask[] restartTasks, @@ -81,7 +81,7 @@ public class ConfirmRestartDialog extends Dialog { this.tasks = restartTasks; this.treeLabelProvider = treeLabelProvider; } - + @Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); @@ -100,7 +100,7 @@ public class ConfirmRestartDialog extends Dialog { viewer.getControl().setLayoutData(taskData); return composite; } - + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/OverlayIcon.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/OverlayIcon.java index 0eeda3f27..6c2f3e112 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/OverlayIcon.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/OverlayIcon.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java index 5596ce2dc..c455981e9 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -33,10 +33,10 @@ public class ResetTaskAction extends Action { this.task = (AbstractTask) task; this.setText(Messages.COMPOSITE_MENU_RESET); IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("return_to_start.gif");//$NON-NLS-1$ - ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); + ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); this.setImageDescriptor(restartImage); } - + @Override public void run() { AbstractTask[] restartTasks = TaskStateUtilities.getRestartTasks(task); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java index c906e655c..f7f6448a6 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,22 +29,22 @@ public class RestartAllAction extends Action { this.model = model; this.setText(Messages.RESTART_ALL_MENU); IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("restart_all.gif");//$NON-NLS-1$ - ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); + ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); this.setImageDescriptor(restartImage); } - + @Override public void run() { if (confirmRestart()) { ((CompositeCheatSheetModel)model).resetAllTasks(null); } } - + public static boolean confirmRestart() { return MessageDialog.openConfirm( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), - Messages.COMPOSITE_RESTART_DIALOG_TITLE, - Messages.COMPOSITE_RESTART_CONFIRM_MESSAGE); + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + Messages.COMPOSITE_RESTART_DIALOG_TITLE, + Messages.COMPOSITE_RESTART_CONFIRM_MESSAGE); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java index aa5beec92..784e1895f 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -28,10 +28,10 @@ public class SkipAction extends Action { this.task = (AbstractTask) task; this.setText(Messages.COMPOSITE_MENU_SKIP); IPath ePath = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append(SKIP_CCS_TASK_GIF); - ImageDescriptor skipImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), ePath); + ImageDescriptor skipImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), ePath); this.setImageDescriptor(skipImage); } - + @Override public void run() { task.setState(ICompositeCheatSheetTask.SKIPPED); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/StartAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/StartAction.java index c4e86b836..e3d73f7fa 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/StartAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/StartAction.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,10 +27,10 @@ public class StartAction extends Action { this.task = (AbstractTask) task; this.setText(Messages.COMPOSITE_MENU_START); IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append(START_CCS_TASK_GIF); - ImageDescriptor startImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); + ImageDescriptor startImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); this.setImageDescriptor(startImage); } - + @Override public void run() { task.setState(ICompositeCheatSheetTask.IN_PROGRESS); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeContentProvider.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeContentProvider.java index 00de93990..1a7d2f98d 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeContentProvider.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java index ef2e5c689..4a05ec943 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,7 +27,7 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask; import org.eclipse.ui.internal.provisional.cheatsheets.TaskExplorer; public class TreeExplorerMenu { - + private TaskExplorer explorer; public TreeExplorerMenu(TaskExplorer explorer) { @@ -50,21 +50,21 @@ public class TreeExplorerMenu { if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection)selection; if (structuredSelection.size() == 1) { - selectedTask = (ICompositeCheatSheetTask)(structuredSelection).getFirstElement(); + selectedTask = (ICompositeCheatSheetTask)(structuredSelection).getFirstElement(); } } if (selectedTask == null) return; - + // Start StartAction startAction = new StartAction(selectedTask); startAction.setEnabled(TaskStateUtilities.isStartEnabled(selectedTask)); manager.add(startAction); - + // Skip SkipAction skipAction = new SkipAction(selectedTask); skipAction.setEnabled(TaskStateUtilities.isSkipEnabled(selectedTask)); manager.add(skipAction); - + // Restart Action restartAction; if (selectedTask.getParent() == null) { @@ -73,7 +73,7 @@ public class TreeExplorerMenu { restartAction = new ResetTaskAction(selectedTask); restartAction.setEnabled(selectedTask.getState() != ICompositeCheatSheetTask.NOT_STARTED); } - manager.add(restartAction); + manager.add(restartAction); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java index f5be72b57..8fbc51b97 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,32 +35,32 @@ public class TreeLabelProvider extends LabelProvider { private static int BLOCKED = -1; private Image defaultImage = null; // Image for tasks with null kind - + /* * A set of related images */ private class ImageSet { // Use a map rather than array so the nuber of icons is not hard coded Map images = new HashMap(); - + public void put(int index, Image image) { images.put(Integer.toString(index), image); } - + public Image getImage(int index) { return (Image)images.get(Integer.toString(index)); } - + void dispose() { for (Iterator iter = images.values().iterator(); iter.hasNext(); ) { Image nextImage = (Image)iter.next(); nextImage.dispose(); - } + } } } - + private Map imageMap = null; // each entry is an ImageSet - + public TreeLabelProvider() { imageMap = new HashMap(); } @@ -83,7 +83,7 @@ public class TreeLabelProvider extends LabelProvider { public Image getImage(Object obj) { if (obj instanceof ICompositeCheatSheetTask) { ICompositeCheatSheetTask task = (ICompositeCheatSheetTask) obj; - return lookupImage(task.getKind(), task.getState(), TaskStateUtilities.isBlocked(task)); + return lookupImage(task.getKind(), task.getState(), TaskStateUtilities.isBlocked(task)); } return super.getImage(obj); } @@ -112,26 +112,26 @@ public class TreeLabelProvider extends LabelProvider { if (desc == null) { desc = TaskEditorManager.getInstance().getImageDescriptor(kind); } - if (desc != null) { + if (desc != null) { Image baseImage = desc.createImage(); images.put(ICompositeCheatSheetTask.NOT_STARTED, baseImage); - - createImageWithOverlay(ICompositeCheatSheetTask.IN_PROGRESS, + + createImageWithOverlay(ICompositeCheatSheetTask.IN_PROGRESS, "$nl$/icons/ovr16/task_in_progress.gif", //$NON-NLS-1$ - images, + images, desc); - createImageWithOverlay(ICompositeCheatSheetTask.SKIPPED, + createImageWithOverlay(ICompositeCheatSheetTask.SKIPPED, "$nl$/icons/ovr16/task_skipped.gif", //$NON-NLS-1$ - images, + images, desc); - createDisabledImage(kind, BLOCKED, - images, + createDisabledImage(kind, BLOCKED, + images, baseImage); - createImageWithOverlay(ICompositeCheatSheetTask.COMPLETED, + createImageWithOverlay(ICompositeCheatSheetTask.COMPLETED, "$nl$/icons/ovr16/task_complete.gif", //$NON-NLS-1$ - images, + images, desc); - + } return images; } @@ -150,7 +150,7 @@ public class TreeLabelProvider extends LabelProvider { return null; } String iconPath = "$nl$/icons/"; //$NON-NLS-1$ - if (isEnabled) { + if (isEnabled) { iconPath += CheatSheetPlugin.T_OBJ; } else { iconPath += CheatSheetPlugin.T_DLCL; @@ -160,17 +160,17 @@ public class TreeLabelProvider extends LabelProvider { } private void createImageWithOverlay(int state, String imagePath, ImageSet images, ImageDescriptor baseDescriptor) { - ImageDescriptor descriptor = createImageDescriptor(imagePath); + ImageDescriptor descriptor = createImageDescriptor(imagePath); OverlayIcon icon = new OverlayIcon(baseDescriptor, new ImageDescriptor[][] { {}, { descriptor } }); images.put(state, icon.createImage()); } - + private void createDisabledImage(String kind, int state, ImageSet images, Image baseImage) { // The four images for task_set, task_sequence, task_choice and cheatsheet_task can be found - // in icons/dlcl16. + // in icons/dlcl16. // TODO extend the extension point to allow disabled images to be specified. - //if + //if ImageDescriptor desc = getPredefinedImageDescriptor(kind, false); Image disabledImage; @@ -179,7 +179,7 @@ public class TreeLabelProvider extends LabelProvider { } else { disabledImage = createGrayedImage(baseImage); } - images.put(state, disabledImage); + images.put(state, disabledImage); } private Image createGrayedImage(Image image) { @@ -212,5 +212,5 @@ public class TreeLabelProvider extends LabelProvider { defaultImage = null; } } - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeTaskExplorer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeTaskExplorer.java index 2a02ab91a..75c64255a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeTaskExplorer.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeTaskExplorer.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,11 +27,11 @@ import org.eclipse.ui.internal.provisional.cheatsheets.TaskExplorer; public class TreeTaskExplorer extends TaskExplorer { private TreeViewer viewer; - + @Override public String getId() { return ICompositeCheatsheetTags.TREE; - } + } @Override public void createControl(Composite parent, FormToolkit toolkit) { @@ -41,7 +41,7 @@ public class TreeTaskExplorer extends TaskExplorer { viewer.setContentProvider(new TreeContentProvider()); viewer.setLabelProvider(new TreeLabelProvider()); } - + @Override public void taskUpdated(ICompositeCheatSheetTask task) { viewer.update(task, null); @@ -69,7 +69,7 @@ public class TreeTaskExplorer extends TaskExplorer { @Override public void dispose() { - viewer.getLabelProvider().dispose(); + viewer.getLabelProvider().dispose(); } @Override diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java index e2ddf8b8d..bd2e9e7fb 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,17 +41,17 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { protected String kind; private Dictionary parameters; - + private String description; - + private String completionMessage; private ArrayList requiredTasks; - + private ArrayList successorTasks; - + private boolean skippable; - + private TaskGroup parent; protected static final ICompositeCheatSheetTask[] EMPTY = new ICompositeCheatSheetTask[0]; @@ -90,11 +90,11 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { public String getDescription() { return description; } - + public void setDescription(String description) { this.description = description; } - + public void setCompletionMessage(String completionMessage) { this.completionMessage = completionMessage; } @@ -114,7 +114,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { if (successorTasks==null) return EMPTY; return (ICompositeCheatSheetTask[])successorTasks.toArray(new ICompositeCheatSheetTask[successorTasks.size()]); } - + public void addRequiredTask(AbstractTask task) { if (requiredTasks==null) requiredTasks = new ArrayList(); @@ -129,7 +129,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { return state; } - public void complete() { + public void complete() { setState(COMPLETED); } @@ -145,7 +145,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { } return startable; } - + /** * Determine whether the candidate task is a required task for this task. * This function does not test for indirectly required tasks @@ -157,7 +157,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { } /** - * Interface used when restoring state from a file. + * Interface used when restoring state from a file. * Not intended to be called from task editors. * @param state */ @@ -165,15 +165,15 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { setStateNoNotify(state); model.sendTaskChangeEvents(); } - + /** * Set the state of a task but don't send out any events yet, - * let them collect so we don't send out multiple events for + * let them collect so we don't send out multiple events for * one task * @param state */ public void setStateNoNotify(int state) { - this.state = state; + this.state = state; if (parent != null) { parent.checkState(); } @@ -203,7 +203,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { public ICompositeCheatSheet getCompositeCheatSheet() { return model; } - + public abstract ITaskParseStrategy getParserStrategy(); @Override @@ -226,7 +226,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask { public ITaskGroup getParent() { return parent; } - + @Override public int hashCode() { return getId().hashCode(); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java index f9cc44419..94981afd4 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import java.util.Set; import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask; public class BlockedTaskFinder { - + private Set stateChangedTasks; private Set impactedTasks; /** @@ -26,17 +26,17 @@ public class BlockedTaskFinder { * can be added to the list of change events. * @param stateChangedTasks The set of tasks which has changed * @return The set of tasks which have become blocked or unblocked by the - * change of state and were not in the original set. The algorithm will sometimes add tasks to - * the result set which were not actually impacted but this is not a major problem + * change of state and were not in the original set. The algorithm will sometimes add tasks to + * the result set which were not actually impacted but this is not a major problem * since it only means that extra events get sent to the explorer. For updates other * than resets the number of extra events is very low. - * + * * This takes several steps. - * <li> If a group is completed, skipped or reset add any non-started children. + * <li> If a group is completed, skipped or reset add any non-started children. * <li> Determine all successors of tasks whose state has changed that are not in the change set * <li> Add the successor and its children to the list if not started */ - + public Set findBlockedTaskChanges(Set stateChangedTasks) { this.stateChangedTasks = stateChangedTasks; impactedTasks = new HashSet(); @@ -51,7 +51,7 @@ public class BlockedTaskFinder { if (nextTask.getState() != ICompositeCheatSheetTask.IN_PROGRESS) { findUnstartedChildren(nextTask); } - } + } } /* @@ -59,7 +59,7 @@ public class BlockedTaskFinder { * add them to the list of impacted tasks. */ private void findUnstartedChildren(ICompositeCheatSheetTask task) { - ICompositeCheatSheetTask[] children = task.getSubtasks(); + ICompositeCheatSheetTask[] children = task.getSubtasks(); for (int i = 0; i < children.length; i++) { ICompositeCheatSheetTask nextChild = children[i]; // Ignore if this task has been seen before @@ -70,7 +70,7 @@ public class BlockedTaskFinder { findUnstartedChildren(nextChild); } } - } + } private void findSuccesors() { for (Iterator iter = stateChangedTasks.iterator(); iter.hasNext(); ) { @@ -83,7 +83,7 @@ public class BlockedTaskFinder { } findUnstartedChildren(nextSuccessor); } - } + } } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java index 64c89316a..0cdd1edf7 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,18 +38,18 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh private URL contentURL; private CheatSheetManager manager; private Set stateChangedSet = new HashSet(); - + public void setRootTask(ICompositeCheatSheetTask task) { rootTask = task; } - + public CompositeCheatSheetModel(String name, String description, String explorerId) { this.name = name; this.description = description; this.explorerId = explorerId; this.dependencies = new TaskDependencies(); } - + public String getName() { return name; } @@ -62,7 +62,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh public String getTaskExplorerId() { return explorerId; } - + @Override public ICompositeCheatSheetTask getRootTask() { return rootTask; @@ -75,15 +75,15 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh public TaskDependencies getDependencies() { return dependencies; } - + public URL getContentUrl() { return contentURL; } public void setContentUrl(URL newUrl) { - contentURL=newUrl; + contentURL=newUrl; } - + public void setId(String id) { this.id = id; } @@ -95,7 +95,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh public void setSaveHelper(CompositeCheatSheetSaveHelper saveHelper) { this.saveHelper = saveHelper; } - + /** * Maintain a set of tasks which have been changed which will * be used to send events to observers. @@ -106,9 +106,9 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh stateChangedSet.add(task); } } - + /** - * At this point we need to determine which blocked tasks have + * At this point we need to determine which blocked tasks have * become unblocked and which unblocked tasks are now blocked and * send events for those also. */ @@ -124,7 +124,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh } stateChangedSet.clear(); } - + public IMemento getTaskMemento(String id) { return saveHelper.getTaskMemento(id); } @@ -133,15 +133,15 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh public ICheatSheetManager getCheatSheetManager() { return manager; } - + public void setCheatSheetManager(CheatSheetManager manager) { - this.manager = manager; + this.manager = manager; } public void loadState(Map layoutData) { - saveHelper.loadCompositeState(this, layoutData); + saveHelper.loadCompositeState(this, layoutData); } - + /* * Reset the state of a task and it's children */ @@ -152,7 +152,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh if (saveHelper != null) { saveHelper.clearTaskMemento(task.getId()); } - } else if (task instanceof TaskGroup) { + } else if (task instanceof TaskGroup) { TaskGroup group = (TaskGroup)task; ICompositeCheatSheetTask[] subtasks = group.getSubtasks(); for (int i = 0; i < subtasks.length; i++) { @@ -170,7 +170,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh manager.setData(cheatSheetData); } } - saveHelper.clearTaskMementos(); + saveHelper.clearTaskMementos(); resetTask(getRootTask()); sendTaskChangeEvents(); } @@ -182,7 +182,7 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh public void resetTasks(ICompositeCheatSheetTask[] restartTasks) { for (int i = 0; i < restartTasks.length; i++) { resetTask(restartTasks[i]); - } + } sendTaskChangeEvents(); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java index 68d0cd752..dd275fe35 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,7 @@ import org.eclipse.ui.internal.provisional.cheatsheets.TaskEditor; /** * Class to save and restore composite cheatsheet state using a memento * There is a child memento for each task which contains keys for the - * state complete. There is also a grandchild memento for + * state complete. There is also a grandchild memento for * each task that has been started. */ @@ -42,7 +42,7 @@ public class CompositeCheatSheetSaveHelper { private ICheatSheetStateManager stateManager; /** - * Constructor + * Constructor */ public CompositeCheatSheetSaveHelper(ICheatSheetStateManager stateManager) { super(); @@ -54,7 +54,7 @@ public class CompositeCheatSheetSaveHelper { XMLMemento readMemento = CheatSheetPlugin.getPlugin().readMemento(model.getId() + DOT_XML); if (readMemento == null) { return Status.OK_STATUS; - } + } taskMementoMap = createTaskMap(readMemento); loadTaskState(taskMementoMap, (AbstractTask)model.getRootTask()); loadCheatsheetManagerData(readMemento, model.getCheatSheetManager()); @@ -85,13 +85,13 @@ public class CompositeCheatSheetSaveHelper { } } if (task instanceof TaskGroup) { - for (int i = 0; i < children.length; i++) { + for (int i = 0; i < children.length; i++) { loadTaskState(taskMap, (AbstractTask) children[i]); } ((TaskGroup)task).checkState(); } } - + private void loadCheatsheetManagerData(XMLMemento readMemento, ICheatSheetManager manager) { if (manager == null) { return; @@ -104,7 +104,7 @@ public class CompositeCheatSheetSaveHelper { manager.setData(key, value); } } - + private void loadLayoutData(XMLMemento readMemento, Map layoutData) { if (layoutData == null) { return; @@ -121,14 +121,14 @@ public class CompositeCheatSheetSaveHelper { /** * Save the state of a composite cheat sheet model * @param model - * @param selectedTask + * @param selectedTask * @param layoutData Will contain pairs of name/value Strings used to save and restore layout * @return */ public IStatus saveCompositeState(CompositeCheatSheetModel model, Map layoutData) { - if (stateManager instanceof NoSaveStateManager) return Status.OK_STATUS; + if (stateManager instanceof NoSaveStateManager) return Status.OK_STATUS; XMLMemento writeMemento = XMLMemento.createWriteRoot(ICompositeCheatsheetTags.COMPOSITE_CHEATSHEET_STATE); - writeMemento.putString(IParserTags.ID, model.getId()); + writeMemento.putString(IParserTags.ID, model.getId()); saveTaskState(writeMemento, (AbstractTask)model.getRootTask()); saveCheatSheetManagerData(writeMemento, model.getCheatSheetManager()); taskMementoMap = createTaskMap(writeMemento); @@ -141,7 +141,7 @@ public class CompositeCheatSheetSaveHelper { private void saveCheatSheetManagerData(XMLMemento writeMemento, ICheatSheetManager manager) { if (!(manager instanceof CheatSheetManager)) { return; - } + } Map data = ((CheatSheetManager)manager).getData(); saveMap(writeMemento, data, ICompositeCheatsheetTags.CHEAT_SHEET_MANAGER); } @@ -152,15 +152,15 @@ public class CompositeCheatSheetSaveHelper { String value = (String) data.get(key); IMemento childMemento = writeMemento.createChild(tag); childMemento.putString(ICompositeCheatsheetTags.KEY, key); - childMemento.putString(ICompositeCheatsheetTags.VALUE, value); + childMemento.putString(ICompositeCheatsheetTags.VALUE, value); } } private void saveTaskState(IMemento writeMemento, AbstractTask task) { IMemento childMemento = writeMemento.createChild(ICompositeCheatsheetTags.TASK); childMemento.putString(ICompositeCheatsheetTags.TASK_ID, task.getId()); - childMemento.putString(ICompositeCheatsheetTags.STATE, Integer.toString(task.getState())); - + childMemento.putString(ICompositeCheatsheetTags.STATE, Integer.toString(task.getState())); + // If this is an editable task that has been started, completed or skipped save the editor state if (task instanceof IEditableTask && task.getState() != ICompositeCheatSheetTask.NOT_STARTED) { TaskEditor editor = getEditor(task); @@ -203,7 +203,7 @@ public class CompositeCheatSheetSaveHelper { public void clearTaskMementos() { taskMementoMap = null; } - + public void clearTaskMemento(String id) { if (taskMementoMap != null) { taskMementoMap.remove(id); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/EditableTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/EditableTask.java index cc8fcaddb..ac3dd5f05 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/EditableTask.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/EditableTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,20 +23,20 @@ import org.eclipse.ui.internal.provisional.cheatsheets.IEditableTask; import org.eclipse.ui.internal.provisional.cheatsheets.TaskEditor; public class EditableTask extends AbstractTask implements IEditableTask { - + private TaskEditor editor; private ITaskParseStrategy parserStrategy; - + private boolean editorInitialized = false; - + private boolean underReview = false; public EditableTask(CompositeCheatSheetModel model, String id, String name, String kind) { super(model, id, name, kind); parserStrategy = new EditableTaskParseStrategy(); } - + @Override public ITaskParseStrategy getParserStrategy() { return parserStrategy; @@ -47,12 +47,12 @@ public class EditableTask extends AbstractTask implements IEditableTask { return EMPTY; } - public void setStarted() { + public void setStarted() { if (state==NOT_STARTED) { setState(IN_PROGRESS); } - } - + } + public void setEditor(TaskEditor editor) { this.editor = editor; } @@ -62,10 +62,10 @@ public class EditableTask extends AbstractTask implements IEditableTask { } public void reset() { - setStateNoNotify(NOT_STARTED); + setStateNoNotify(NOT_STARTED); editorInitialized = false; } - + public void setInput(IMemento memento) { if (editor != null) { editor.setInput(this, memento); @@ -83,6 +83,6 @@ public class EditableTask extends AbstractTask implements IEditableTask { public boolean isUnderReview() { return underReview; - } - + } + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java index 0f9ff1201..8a8f977fa 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask; import org.eclipse.ui.internal.provisional.cheatsheets.ITaskGroup; public class SuccesorTaskFinder { - + private AbstractTask currentTask; ICompositeCheatSheetTask bestLaterTask; ICompositeCheatSheetTask bestEarlierTask; @@ -27,21 +27,21 @@ public class SuccesorTaskFinder { public SuccesorTaskFinder(ICompositeCheatSheetTask task) { currentTask = (AbstractTask)task; } - + /** * Find the next recommended task or tasks to be completed. * Algorithm - visualize the tree as having its root at the top, * children below and to the left of their parents and then - * search the tree from left to right. Look for + * search the tree from left to right. Look for * the best predecessor which is the first task to the - * left of this task that is runnable and the best successor + * left of this task that is runnable and the best successor * which is the first task to the - * right of this task which is runnable. + * right of this task which is runnable. * @param task The task which was just completed * @return An array of tasks which can be started */ - public ICompositeCheatSheetTask[] getRecommendedSuccessors() - { + public ICompositeCheatSheetTask[] getRecommendedSuccessors() + { // TODO this code could be moved to TaskGroup if (ITaskGroup.CHOICE.equals(currentTask.getKind())) { // For a choice if more than one child is runnable return it @@ -100,14 +100,14 @@ public class SuccesorTaskFinder { if (task == currentTask) { seenThisTask = true; } - if (task.getState() == ICompositeCheatSheetTask.COMPLETED || + if (task.getState() == ICompositeCheatSheetTask.COMPLETED || task.getState() == ICompositeCheatSheetTask.SKIPPED ) { if (isTaskAncestor(task, currentTask)) { seenThisTask = true; } return; } - + if ( isStartable(task) && task != currentTask) { if (seenThisTask) { if (bestLaterTask == null) { @@ -123,7 +123,7 @@ public class SuccesorTaskFinder { ICompositeCheatSheetTask[] subtasks = task.getSubtasks(); for (int i = 0; i < subtasks.length; i++) { searchRunnableChildren(subtasks[i]); - } + } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java index a4c7aab61..0d7add724 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java index 2d53d88d5..eba2d9040 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,45 +30,45 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask; */ public class TaskDependencies { - + private class Dependency { private AbstractTask sourceTask; - + private String requiredTaskId; - + public Dependency(AbstractTask sourceTask, String requiredTaskId) { this.sourceTask = sourceTask; this.requiredTaskId = requiredTaskId; } - + public AbstractTask getSourceTask() { return sourceTask; } - + public String getRequiredTaskId() { return requiredTaskId; } } - + private List dependencies; - + private Map taskIdMap = new HashMap(); public void saveId(AbstractTask task) { String id = task.getId(); if (id != null) { taskIdMap.put(id, task); - } + } } - + public AbstractTask getTask(String id) { return (AbstractTask)taskIdMap.get(id); } - + public TaskDependencies() { dependencies = new ArrayList(); } - + /** * Register a dependency between tasks * @param sourceTask a task which cannot be started until another task is completed @@ -77,7 +77,7 @@ public class TaskDependencies { public void addDependency(AbstractTask sourceTask, String requiredTaskId) { dependencies.add(new Dependency(sourceTask, requiredTaskId)); } - + /** * Resolve all of the dependencies updating the individual tasks * @param model The composite cheat sheet @@ -89,7 +89,7 @@ public class TaskDependencies { AbstractTask sourceTask = dep.getSourceTask(); AbstractTask requiredTask = getTask(dep.requiredTaskId); if (requiredTask == null) { - String message = NLS.bind(Messages.ERROR_PARSING_INVALID_ID, (new Object[] {dep.getRequiredTaskId()})); + String message = NLS.bind(Messages.ERROR_PARSING_INVALID_ID, (new Object[] {dep.getRequiredTaskId()})); status.addStatus(IStatus.ERROR, message, null); } else if (!sourceTask.requiresTask(requiredTask)) { sourceTask.addRequiredTask(requiredTask); @@ -137,7 +137,7 @@ public class TaskDependencies { remainingTasks.add(nextTask); } else { makingProgress = true; - } + } } tasks = remainingTasks; } @@ -171,12 +171,12 @@ public class TaskDependencies { lastTask = thisTask; thisTask = task.getName(); if (lastTask != null) { - String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {lastTask, thisTask})); + String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {lastTask, thisTask})); status.addStatus(IStatus.ERROR, message, null); } } } - String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {thisTask, firstTask})); + String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {thisTask, firstTask})); status.addStatus(IStatus.ERROR, message, null); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java index 12fab17d4..bcb43944a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,15 +18,15 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ICompositeCheatSheetTask; import org.eclipse.ui.internal.provisional.cheatsheets.ITaskGroup; public class TaskGroup extends AbstractTask implements ITaskGroup { - + public interface CompletionStrategy { public int computeState(TaskGroup taskGroup); } - + private ITaskParseStrategy parserStrategy; private ArrayList subtasks; - + private CompletionStrategy completionStrategy; public TaskGroup(CompositeCheatSheetModel model, String id, String name, String kind) { @@ -49,13 +49,13 @@ public class TaskGroup extends AbstractTask implements ITaskGroup { public ITaskParseStrategy getParserStrategy() { return parserStrategy; } - + @Override public ICompositeCheatSheetTask[] getSubtasks() { if (subtasks==null) return EMPTY; return (ICompositeCheatSheetTask[])subtasks.toArray(new ICompositeCheatSheetTask[subtasks.size()]); } - + public void addSubtask(ICompositeCheatSheetTask task) { if (subtasks==null) { subtasks = new ArrayList(); @@ -63,7 +63,7 @@ public class TaskGroup extends AbstractTask implements ITaskGroup { subtasks.add(task); ((AbstractTask)task).setParent(this); } - + /** * Called when the state of a child has changed or when the model * has been restored. @@ -76,7 +76,7 @@ public class TaskGroup extends AbstractTask implements ITaskGroup { } /** - * Determine the state based on the state of the children, which + * Determine the state based on the state of the children, which * will use a different computation depending on whether this is a set, * sequence or choice. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java index 0ddad9d5a..b2d39e3a1 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java index c2448a57a..7c667b455 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ITaskGroup; */ public class TaskStateUtilities { - + /** * Find the most recent ancestor of this task that is blocked * @param task @@ -36,13 +36,13 @@ public class TaskStateUtilities { ITaskGroup parent = ((AbstractTask)task).getParent(); if (parent == null) { return null; - } + } if (!parent.requiredTasksCompleted()) { return parent; } - return findBlockedAncestor(parent); + return findBlockedAncestor(parent); } - + /** * Find the most recent ancestor of this task that is skipped * @param task @@ -52,13 +52,13 @@ public class TaskStateUtilities { ITaskGroup parent = ((AbstractTask)task).getParent(); if (parent == null) { return null; - } + } if (parent.getState() == ICompositeCheatSheetTask.SKIPPED) { return parent; } - return findSkippedAncestor(parent); + return findSkippedAncestor(parent); } - + /** * Find the most recent ancestor of this task that is completed * @param task @@ -68,13 +68,13 @@ public class TaskStateUtilities { ITaskGroup parent = ((AbstractTask)task).getParent(); if (parent == null) { return null; - } + } if (parent.getState() == ICompositeCheatSheetTask.COMPLETED) { return parent; } - return findCompletedAncestor(parent); + return findCompletedAncestor(parent); } - + /** * Determine whether a task can be skipped. * A task can be skipped if it is skippable, its state is not SKIPPED or completed @@ -98,7 +98,7 @@ public class TaskStateUtilities { if (!(task instanceof IEditableTask)) return false; return isStartable(task); } - + /** * Determines whether a task is in a state where it has net been started and * cannot be started. This is used to determine when to gray out the icon for a task. @@ -119,7 +119,7 @@ public class TaskStateUtilities { if (findBlockedAncestor(task) != null) return false; return true; } - + /** * Determine which tasks need to be restarted if this tasks is restarted */ @@ -130,7 +130,7 @@ public class TaskStateUtilities { return (AbstractTask[])restartables.toArray(new AbstractTask[restartables.size()]); } - + private static void addRestartableTasks(List restartables, ICompositeCheatSheetTask task, Set visited) { if (visited.contains(task)) { return; @@ -141,13 +141,13 @@ public class TaskStateUtilities { } else if (task.getState() == ICompositeCheatSheetTask.SKIPPED){ restartables.add(task); } - + // Add all children ICompositeCheatSheetTask[] children = task.getSubtasks(); for (int i = 0; i < children.length; i++) { addRestartableTasks(restartables, children[i], visited); } - + // Add all dependents that are started or in progress but not skipped ICompositeCheatSheetTask[] successors = ((AbstractTask)task).getSuccessorTasks(); for (int i = 0; i < successors.length; i++) { @@ -157,7 +157,7 @@ public class TaskStateUtilities { } } } - - + + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java index 79236be82..a9bd61e56 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -39,22 +39,22 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class CompositeCheatSheetParser implements IStatusContainer { - + private DocumentBuilder documentBuilder; - + private IStatus status; - + private int nextTaskId = 0; - - + + /** * Gets the status of the last call to parseGuide */ - + public IStatus getStatus() { return status; } - + /** * Returns the DocumentBuilder to be used by composite cheat sheets. */ @@ -69,15 +69,15 @@ public class CompositeCheatSheetParser implements IStatusContainer { } return documentBuilder; } - + @Override - public void addStatus(int severity, String message, Throwable exception) { + public void addStatus(int severity, String message, Throwable exception) { status = ParserStatusUtility.addStatus(status, severity, message, exception); } - + /** * Parse a composite cheat sheet from a url. The parser status will be set as a result - * of this operation, if the status is IStatus.ERROR the parser returns null + * of this operation, if the status is IStatus.ERROR the parser returns null * @param url The url of the input * @return A valid composite cheat sheet or null if there was an error */ @@ -89,7 +89,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { return null; } - InputStream is = null; + InputStream is = null; try { is = url.openStream(); @@ -104,8 +104,8 @@ public class CompositeCheatSheetParser implements IStatusContainer { addStatus(IStatus.ERROR, message, e); return null; } - - Document document; + + Document document; String filename = url.getFile(); try { InputSource inputSource = new InputSource(is); @@ -128,14 +128,14 @@ public class CompositeCheatSheetParser implements IStatusContainer { } catch (Exception e) { } } - + CompositeCheatSheetModel result = parseCompositeCheatSheet(document, url); - return result; + return result; } /** * Parse a composite cheatsheet. The parser status will be set as a result - * of this operation, if the status is IStatus.ERROR the parser returns null + * of this operation, if the status is IStatus.ERROR the parser returns null * @param url The url of the input. This is only used so the model can record * its input location * @param document the document to be parse @@ -148,18 +148,18 @@ public class CompositeCheatSheetParser implements IStatusContainer { // If the document passed is null return a null tree and update the status if (document != null) { Node rootnode = document.getDocumentElement(); - + // Is the root node correct? if( !rootnode.getNodeName().equals(ICompositeCheatsheetTags.COMPOSITE_CHEATSHEET )) { String message = NLS.bind(Messages.ERROR_PARSING_ROOT_NODE_TYPE, ( new Object[] {ICompositeCheatsheetTags.COMPOSITE_CHEATSHEET})); throw new CheatSheetParserException(message); } - + String name = ""; //$NON-NLS-1$ boolean nameFound = false; String explorerId = ICompositeCheatsheetTags.TREE; - + NamedNodeMap attributes = rootnode.getAttributes(); if (attributes != null) { for (int x = 0; x < attributes.getLength(); x++) { @@ -175,14 +175,14 @@ public class CompositeCheatSheetParser implements IStatusContainer { } } CompositeCheatSheetModel compositeCS = new CompositeCheatSheetModel(name, name, explorerId); - + parseCompositeCheatSheetChildren(rootnode, compositeCS); - + compositeCS.getDependencies().resolveDependencies(this); - + if (compositeCS.getRootTask() == null) { addStatus(IStatus.ERROR, Messages.ERROR_PARSING_NO_ROOT, null); - } + } if (!nameFound) { addStatus(IStatus.ERROR, Messages.ERROR_PARSING_CCS_NO_NAME, null); } @@ -190,12 +190,12 @@ public class CompositeCheatSheetParser implements IStatusContainer { compositeCS.setContentUrl(url); return compositeCS; } - } + } return null; } catch(CheatSheetParserException e) { addStatus(IStatus.ERROR, e.getMessage(), null); return null; - } + } } private void parseCompositeCheatSheetChildren(Node compositeCSNode, CompositeCheatSheetModel model) { @@ -205,21 +205,21 @@ public class CompositeCheatSheetParser implements IStatusContainer { Node nextNode = childNodes.item(index); if (isAbstractTask(nextNode.getNodeName()) ) { AbstractTask task = parseAbstractTask(nextNode, model); - if (model.getRootTask() == null ) { + if (model.getRootTask() == null ) { model.setRootTask(task); parseTaskChildren(nextNode, task, model); } else { addStatus(IStatus.ERROR, Messages.ERROR_PARSING_MULTIPLE_ROOT, null); } } - } + } } public static boolean isAbstractTask(String nodeName) { return nodeName == ICompositeCheatsheetTags.TASK || nodeName == ICompositeCheatsheetTags.TASK_GROUP; } - + private void parseTaskChildren(Node parentNode, AbstractTask parentTask, CompositeCheatSheetModel model) { NodeList childNodes = parentNode.getChildNodes(); ITaskParseStrategy strategy = parentTask.getParserStrategy(); @@ -229,11 +229,11 @@ public class CompositeCheatSheetParser implements IStatusContainer { if (childNode.getNodeType() == Node.ELEMENT_NODE) { String nodeName = childNode.getNodeName(); if (nodeName == IParserTags.PARAM) { - addParameter(parentTask, childNode.getAttributes()); + addParameter(parentTask, childNode.getAttributes()); } else if (nodeName == IParserTags.INTRO) { parentTask.setDescription(MarkupParser.parseAndTrimTextMarkup(childNode)); } else if (nodeName == ICompositeCheatsheetTags.ON_COMPLETION) { - parentTask.setCompletionMessage(MarkupParser.parseAndTrimTextMarkup(childNode)); + parentTask.setCompletionMessage(MarkupParser.parseAndTrimTextMarkup(childNode)); } else if (nodeName == ICompositeCheatsheetTags.DEPENDS_ON) { parseDependency(childNode, parentTask, model); } else if (CompositeCheatSheetParser.isAbstractTask(nodeName)) { @@ -253,7 +253,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { } } } - } + } // Check for missing attributes and add dependencies if this was a sequence strategy.parsingComplete(parentTask, this); } @@ -268,7 +268,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { } else { addStatus(IStatus.ERROR, Messages.ERROR_PARSING_NO_ID, null); } - } + } } private void addParameter(AbstractTask parentTask, NamedNodeMap attributes) { @@ -286,7 +286,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { } if (attributeName.equals(ICompositeCheatsheetTags.VALUE)) { value= attribute.getNodeValue(); - } + } } } if (name == null) { @@ -298,7 +298,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { } else { parentTask.getParameters().put(name, value); } - + } private AbstractTask parseAbstractTask(Node taskNode, CompositeCheatSheetModel model) { @@ -322,10 +322,10 @@ public class CompositeCheatSheetParser implements IStatusContainer { } if (attributeName.equals(IParserTags.ID)) { id = attribute.getNodeValue(); - } + } if (attributeName.equals(IParserTags.SKIP)) { skippable = "true".equalsIgnoreCase(attribute.getNodeValue()); //$NON-NLS-1$ - } + } } } @@ -360,7 +360,7 @@ public class CompositeCheatSheetParser implements IStatusContainer { task.setCompletionMessage(Messages.COMPLETED_TASK); return task; } - + private String autoGenerateId() { return "TaskId_" + nextTaskId++; //$NON-NLS-1$ } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java index 1ec86c11e..71e64b47c 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,9 +19,9 @@ import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetRegistryReader; import org.w3c.dom.Node; public class EditableTaskParseStrategy implements ITaskParseStrategy { - + private boolean editableChildErrorReported; - + @Override public void init() { editableChildErrorReported = false; @@ -29,7 +29,7 @@ public class EditableTaskParseStrategy implements ITaskParseStrategy { @Override public boolean parseElementNode(Node childNode, Node parentNode, - AbstractTask parentTask, IStatusContainer status) { + AbstractTask parentTask, IStatusContainer status) { boolean isElementHandled = true; String nodeName = childNode.getNodeName(); if (CompositeCheatSheetParser.isAbstractTask(nodeName)) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java index f331f9f77..6571e4c3c 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,16 +29,16 @@ public interface ICompositeCheatsheetTags { public static final String ON_COMPLETION = "onCompletion"; //$NON-NLS-1$ public static final String DEPENDS_ON = "dependsOn"; //$NON-NLS-1$ public static final String STATE = "state"; //$NON-NLS-1$ - + // Attribute values public static final String TREE = "tree"; //$NON-NLS-1$ - + // Cheatsheet task parameters public static final String CHEATSHEET_TASK_KIND = "cheatsheet"; //$NON-NLS-1$ public static final String CHEATSHEET_TASK_ID = "id"; //$NON-NLS-1$ public static final String CHEATSHEET_TASK_PATH = "path"; //$NON-NLS-1$ public static final String CHEATSHEET_TASK_SHOW_INTRO = "showIntro"; //$NON-NLS-1$ - + // Tags used in Memento public static final String TASK_DATA = "taskData"; //$NON-NLS-1$ public static final String CHEAT_SHEET_MANAGER = "cheatSheetManager"; //$NON-NLS-1$ @@ -46,5 +46,5 @@ public interface ICompositeCheatsheetTags { public static final String TASK_ID = "id"; //$NON-NLS-1$ public static final String SELECTED_TASK = "selectedTask"; //$NON-NLS-1$ public static final String LAYOUT_DATA = "layout"; //$NON-NLS-1$ - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ITaskParseStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ITaskParseStrategy.java index 3ca4b3e88..5ec02da22 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ITaskParseStrategy.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ITaskParseStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ public interface ITaskParseStrategy { * Called before parsing a new set of children */ public void init(); - + /** * Parse a child node of this task * @param childNode The child node @@ -35,7 +35,7 @@ public interface ITaskParseStrategy { * @return True if this element is a valid child */ public boolean parseElementNode(Node childNode, Node parentNode, AbstractTask parentTask, IStatusContainer status); - + /** * Called afer all the children have been parsed to check for missing children */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java index 37ca10e4e..99acee9e0 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ public class MarkupParser { public static String parseAndTrimTextMarkup(Node parentNode) { return parseMarkup(parentNode).trim(); } - + private static String parseMarkup(Node parentNode) { NodeList children = parentNode.getChildNodes(); StringBuffer text = new StringBuffer(); @@ -43,7 +43,7 @@ public class MarkupParser { text.append(attributeName); text.append(" = \""); //$NON-NLS-1$ text.append(attribute.getNodeValue()); - text.append('"'); + text.append('"'); } } text.append('>'); @@ -87,18 +87,18 @@ public class MarkupParser { } return null; } - + /* * Add paragraph tags if not already present */ public static String createParagraph(String text, String imageTag) { String result = ""; //$NON-NLS-1$ String trimmed = text.trim(); - boolean addParagraphTags = trimmed.length() < 3 || trimmed.charAt(0)!='<' || + boolean addParagraphTags = trimmed.length() < 3 || trimmed.charAt(0)!='<' || (trimmed.charAt(1)!='p' && trimmed.charAt(1) != 'l'); if (addParagraphTags) { result += "<p>"; //$NON-NLS-1$ - } + } if (imageTag != null) { result += "<img href=\""; //$NON-NLS-1$ @@ -109,7 +109,7 @@ public class MarkupParser { result += trimmed; if (addParagraphTags) { - result += "</p>"; //$NON-NLS-1$ + result += "</p>"; //$NON-NLS-1$ } return result; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java index d1980d1b5..c2a29d453 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,14 +24,14 @@ public class TaskGroupParseStrategy implements ITaskParseStrategy { public TaskGroupParseStrategy() { } - + @Override - public void init() { + public void init() { } - + @Override public boolean parseElementNode(Node childNode, Node parentNode, - AbstractTask parentTask, IStatusContainer status) + AbstractTask parentTask, IStatusContainer status) { // Task children are handled by CompositeCheatSheetParser return false; diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java index 062efba42..37967c840 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -39,7 +39,7 @@ public class CheatsheetTaskEditor extends TaskEditor { viewer = (CheatSheetViewer)CheatSheetViewerFactory.createCheatSheetView(); viewer.createPartControl(parent); } - + @Override public Control getControl() { return viewer.getControl(); @@ -48,7 +48,7 @@ public class CheatsheetTaskEditor extends TaskEditor { @Override public void setInput(IEditableTask task, IMemento memento) { - this.task = task; + this.task = task; Dictionary params = task.getParameters(); String id = (String)params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_ID); String path = (String)params.get(ICompositeCheatsheetTags.CHEATSHEET_TASK_PATH); @@ -57,17 +57,17 @@ public class CheatsheetTaskEditor extends TaskEditor { if (showIntroParam != null) { showIntro = showIntroParam.equalsIgnoreCase("true"); //$NON-NLS-1$ } - + MementoStateManager stateManager = new MementoStateManager(memento, task.getCompositeCheatSheet().getCheatSheetManager()); if (path != null) { URL url; try { url = task.getInputUrl(path); - if (id == null) { + if (id == null) { id = task.getId(); } if (url != null) { - viewer.setInput(id, task.getName(), url, stateManager, false); + viewer.setInput(id, task.getName(), url, stateManager, false); } else { errorBadUrl(path); } @@ -86,10 +86,10 @@ public class CheatsheetTaskEditor extends TaskEditor { } private void errorBadUrl(String path) { - String message = NLS.bind(Messages.ERROR_OPENING_FILE_IN_PARSER, (new Object[] {path})); + String message = NLS.bind(Messages.ERROR_OPENING_FILE_IN_PARSER, (new Object[] {path})); viewer.showError(message); } - + /* * Listener for the cheatsheet used by this class */ @@ -99,8 +99,8 @@ public class CheatsheetTaskEditor extends TaskEditor { public void cheatSheetEvent(ICheatSheetEvent event) { if (event.getEventType() == ICheatSheetEvent.CHEATSHEET_COMPLETED) { task.complete(); - } - } + } + } } @Override diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java index 114e7ec99..bbc1be3cc 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -73,19 +73,19 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi public static final String GOTO_TASK_TAG = "__goto__"; //$NON-NLS-1$ public static final String START_HREF = "__start__"; //$NON-NLS-1$ public static final String SKIP_HREF = "__skip__"; //$NON-NLS-1$ - + private ManagedForm mform; private PageBook explorerContainer; private PageBook taskEditorContainer; private CompositeCheatSheetModel model; private TaskExplorer currentExplorer; private DescriptionPanel descriptionPanel; - + private CompositeCheatSheetSaveHelper saveHelper; - + private ICompositeCheatSheetTask selectedTask; private boolean initialized = false;; - + public CompositeCheatSheetPage(CompositeCheatSheetModel model, ICheatSheetStateManager stateManager) { this.model = model; saveHelper = new CompositeCheatSheetSaveHelper(stateManager); @@ -95,7 +95,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi public void createPart(Composite parent) { init(parent.getDisplay()); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); - form = toolkit.createScrolledForm(parent); + form = toolkit.createScrolledForm(parent); form.setLayoutData(new GridData(GridData.FILL_BOTH)); FormColors colors = toolkit.getColors(); /* @@ -129,7 +129,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } }); sash.setBackground(colors.getColor(IFormColors.TB_BG)); - + Composite explorerPanel = new Composite(sash, SWT.NULL); explorerPanel.setBackground(colors.getColor(IFormColors.TB_BORDER)); GridLayout playout = new GridLayout(); @@ -145,12 +145,12 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi playout.marginWidth = 0; playout.marginHeight = 0; editorPanel.setLayout(playout); - editorPanel.setBackground(colors.getColor(IFormColors.TB_BORDER)); + editorPanel.setBackground(colors.getColor(IFormColors.TB_BORDER)); taskEditorContainer = new PageBook(editorPanel, SWT.NULL); toolkit.adapt(taskEditorContainer); taskEditorContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); } - + private void updateSashPanelMargins(SashForm sash) { Control [] children = sash.getChildren(); int orientation = sash.getOrientation(); @@ -190,7 +190,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi String explorerId = model.getTaskExplorerId(); setCurrentExplorerFromId(explorerId); String selectedTaskId = (String) layout.get(ICompositeCheatsheetTags.SELECTED_TASK); - ICompositeCheatSheetTask selectedTask= null; + ICompositeCheatSheetTask selectedTask= null; if (selectedTaskId != null) { selectedTask = model.getDependencies().getTask(selectedTaskId); if (selectedTask != null) { @@ -198,7 +198,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } } if (selectedTask != null) { - updateSelectedTask(selectedTask); + updateSelectedTask(selectedTask); } else { updateSelectedTask(model.getRootTask()); } @@ -235,7 +235,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } } } - + private void setCurrentExplorer(TaskExplorer explorer) { if (currentExplorer!=null) { currentExplorer.getSelectionProvider().removeSelectionChangedListener(this); @@ -258,11 +258,11 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } } } - + // Load the explorer from an extension point TaskExplorerManager explorerManager = TaskExplorerManager.getInstance(); - explorer = explorerManager.getExplorer(id); + explorer = explorerManager.getExplorer(id); if (explorer != null) { explorer.createControl(explorerContainer, mform.getToolkit()); explorer.getControl().setData(ICompositeCheatsheetTags.EXPLORER, explorer); @@ -282,7 +282,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi updateSelectedTask((ICompositeCheatSheetTask)selectedElement); } } - + private void updateSelectedTask(ICompositeCheatSheetTask task) { selectedTask = task; updateTask(selectedTask); @@ -307,7 +307,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } return; } - } + } showDescription(task); } @@ -316,7 +316,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi if (selectedTask != null) { layout.put(ICompositeCheatsheetTags.SELECTED_TASK, selectedTask.getId()); } - saveHelper.saveCompositeState(model, layout); + saveHelper.saveCompositeState(model, layout); } private void showDescription(final ICompositeCheatSheetTask task) { @@ -379,7 +379,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi container.layout(true); showEditor(task); } - + private void endReview(EditableTask task) { TaskEditor taskEditor = getTaskEditor(task); Control editorControl = taskEditor.getControl(); @@ -392,11 +392,11 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi showDescription(task); container.layout(); } - + private void setCurrentEditor(Control c) { taskEditorContainer.showPage(c); } - + /** * Class which responds to hyperlink events originating from the * description panel. @@ -411,7 +411,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi EditableTask task = (EditableTask)data; task.setStarted(); } - } + } if (ref.equals(SKIP_HREF)) { Object data = descriptionPanel.getControl().getData(ICompositeCheatsheetTags.TASK); if (data instanceof AbstractTask) { @@ -430,11 +430,11 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi AbstractTask nextTask = model.getDependencies().getTask(next); currentExplorer.setSelection - (new StructuredSelection(nextTask), true); + (new StructuredSelection(nextTask), true); } } } - + /** * Class which responds to hyperlink events originating from the * end review panel @@ -447,13 +447,13 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi String next = ref.substring(END_REVIEW_TAG.length()); AbstractTask task = model.getDependencies().getTask(next); - endReview((EditableTask)task); + endReview((EditableTask)task); } } } - + private EndReviewListener endReviewListener; - + private EndReviewListener getEndReviewListener() { if (endReviewListener == null) { endReviewListener = new EndReviewListener(); @@ -480,9 +480,9 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi editable.setEditor(editor); GridData gridData = new GridData(GridData.FILL_BOTH); editor.getControl().setLayoutData(gridData); - } + } } - return editable.getEditor(); + return editable.getEditor(); } @Override @@ -506,7 +506,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi } @Override - public int contributeToViewMenu(Menu menu, int index) { + public int contributeToViewMenu(Menu menu, int index) { if (!initialized) { return index; } @@ -523,7 +523,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi public void widgetSelected(SelectionEvent e) { if (model != null) { if (RestartAllAction.confirmRestart()) { - restart(null); + restart(null); } } } @@ -539,10 +539,10 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi MenuItem menuItem = new MenuItem(menu, SWT.CASCADE, index++); menuItem.setText(Messages.EXPLORER_PULLDOWN_MENU); - + Menu subMenu = new Menu(menu); menuItem.setMenu(subMenu); - + for (int i = 0; i < explorerIds.length; i++) { final String id = explorerIds[i]; TaskExplorerNode node = CheatSheetRegistryReader.getInstance().findTaskExplorer(id); @@ -567,7 +567,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi model.resetAllTasks(cheatSheetData); currentExplorer.setSelection (new StructuredSelection(model.getRootTask()), true); - + } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java index ccc32f8fa..42360dd38 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,24 +51,24 @@ import org.eclipse.ui.internal.provisional.cheatsheets.ITaskGroup; */ public class DescriptionPanel { - + public static final String REVIEW_IMAGE = "review"; //$NON-NLS-1$ private static final String GOTO_IMAGE = "goto"; //$NON-NLS-1$ private static final String SKIP_IMAGE = "skip"; //$NON-NLS-1$ private static final String START_IMAGE = "start"; //$NON-NLS-1$ private static final String WARNING_IMAGE = "warning"; //$NON-NLS-1$ - private static final String INFORMATION_IMAGE = "info"; //$NON-NLS-1$ + private static final String INFORMATION_IMAGE = "info"; //$NON-NLS-1$ private Composite panel; private Composite control; private FormText upperText; private FormText lowerText; private ScrolledForm form; protected DescriptionPanel() {} - + public DescriptionPanel(ManagedForm mform, Composite parent) { - + FormToolkit toolkit = mform.getToolkit(); - control = new Composite(parent, SWT.NULL); + control = new Composite(parent, SWT.NULL); final GridLayout controlLayout = new GridLayout(); controlLayout.marginHeight = 0; controlLayout.marginWidth = 0; @@ -77,23 +77,23 @@ public class DescriptionPanel { panel = form.getBody(); form.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.adapt(panel); - + TableWrapLayout layout = new TableWrapLayout(); panel.setLayout(layout); upperText = mform.getToolkit().createFormText(panel, false); - mform.getToolkit().adapt(upperText, false, false); - + mform.getToolkit().adapt(upperText, false, false); + Composite separator = toolkit.createCompositeSeparator(panel); - + TableWrapData data = new TableWrapData(); data.align = TableWrapData.FILL; data.grabHorizontal = true; data.maxHeight = 1; separator.setLayoutData(data); - + lowerText = mform.getToolkit().createFormText(panel, false); - mform.getToolkit().adapt(lowerText, false, false); + mform.getToolkit().adapt(lowerText, false, false); upperText.marginWidth = 5; upperText.marginHeight = 5; @@ -103,37 +103,37 @@ public class DescriptionPanel { lowerText.marginHeight = 5; lowerText.setImage(START_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_START)); lowerText.setImage(SKIP_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_SKIP)); - lowerText.setImage(GOTO_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_GOTO_TASK)); + lowerText.setImage(GOTO_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_GOTO_TASK)); lowerText.setImage(REVIEW_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_REVIEW)); lowerText.setImage(WARNING_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.WARNING)); - lowerText.setImage(INFORMATION_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.INFORMATION)); + lowerText.setImage(INFORMATION_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.INFORMATION)); } - + public Control getControl() { return control; } - + public void addHyperlinkListener(IHyperlinkListener listener) { - lowerText.addHyperlinkListener(listener); + lowerText.addHyperlinkListener(listener); } - + public void showDescription(final ICompositeCheatSheetTask task) { StringBuffer upperMessage = new StringBuffer(); upperMessage.append("<form>"); //$NON-NLS-1$ upperMessage.append("<p><span color=\"title\" font=\"header\">"); //$NON-NLS-1$ upperMessage.append(MarkupParser.escapeText(task.getName())); - upperMessage.append("</span></p>"); //$NON-NLS-1$ + upperMessage.append("</span></p>"); //$NON-NLS-1$ upperMessage.append(MarkupParser.createParagraph(task.getDescription(), null)); upperMessage.append("</form>"); //$NON-NLS-1$ upperText.setText(upperMessage.toString(), true, false); - + StringBuffer buf = new StringBuffer(); buf.append("<form>"); //$NON-NLS-1$ - + boolean startable = false; boolean isBlocked = false; boolean isSkippable = ((AbstractTask)task).isSkippable(); - + if (task.getState() == ICompositeCheatSheetTask.COMPLETED) { buf.append(MarkupParser.createParagraph(task.getCompletionMessage(), null)); isSkippable = false; @@ -142,14 +142,14 @@ public class DescriptionPanel { isSkippable = false; } else if (TaskStateUtilities.findSkippedAncestor(task) != null) { ICompositeCheatSheetTask skipped = TaskStateUtilities.findSkippedAncestor(task); - String skipParentMsg = NLS.bind(Messages.PARENT_SKIPPED, - (new Object[] {MarkupParser.escapeText((skipped.getName()))})); + String skipParentMsg = NLS.bind(Messages.PARENT_SKIPPED, + (new Object[] {MarkupParser.escapeText((skipped.getName()))})); buf.append(MarkupParser.createParagraph(skipParentMsg, WARNING_IMAGE)); isSkippable = false; } else if (TaskStateUtilities.findCompletedAncestor(task) != null) { ICompositeCheatSheetTask completed = TaskStateUtilities.findCompletedAncestor(task); - String completedParentMsg = NLS.bind(Messages.PARENT_COMPLETED, - (new Object[] {MarkupParser.escapeText(completed.getName())})); + String completedParentMsg = NLS.bind(Messages.PARENT_COMPLETED, + (new Object[] {MarkupParser.escapeText(completed.getName())})); buf.append(MarkupParser.createParagraph(completedParentMsg, WARNING_IMAGE)); isSkippable = false; } else if (!task.requiredTasksCompleted()) { @@ -158,27 +158,27 @@ public class DescriptionPanel { } else if (TaskStateUtilities.findBlockedAncestor(task) != null) { isBlocked = true; ICompositeCheatSheetTask blockedAncestor = TaskStateUtilities.findBlockedAncestor(task); - String blockingAncestorMsg = NLS.bind(Messages.PARENT_BLOCKED, - (new Object[] {MarkupParser.escapeText(blockedAncestor.getName())})); + String blockingAncestorMsg = NLS.bind(Messages.PARENT_BLOCKED, + (new Object[] {MarkupParser.escapeText(blockedAncestor.getName())})); showBlockingTasks(blockingAncestorMsg , blockedAncestor, buf); } else { startable = task instanceof IEditableTask && task.getState() == ICompositeCheatSheetTask.NOT_STARTED; } - + if (startable) { addHyperlink(buf, CompositeCheatSheetPage.START_HREF, START_IMAGE, Messages.COMPOSITE_PAGE_START_TASK); } if (task instanceof IEditableTask && task.getState() == ICompositeCheatSheetTask.COMPLETED ) { addHyperlink(buf, CompositeCheatSheetPage.REVIEW_TAG, REVIEW_IMAGE, Messages.COMPOSITE_PAGE_REVIEW_TASK); - } - + } + if (isSkippable) { String skipMessage; if (task instanceof ITaskGroup) { skipMessage = Messages.COMPOSITE_PAGE_SKIP_TASK_GROUP; } else { - skipMessage = Messages.COMPOSITE_PAGE_SKIP_TASK; + skipMessage = Messages.COMPOSITE_PAGE_SKIP_TASK; } addHyperlink(buf, CompositeCheatSheetPage.SKIP_HREF, SKIP_IMAGE, skipMessage); } @@ -186,7 +186,7 @@ public class DescriptionPanel { if (!startable && !isBlocked) { showSuccesorTaskLinks(task, buf); } - + buf.append("</form>"); //$NON-NLS-1$ lowerText.setText(buf.toString(), true, false); @@ -202,7 +202,7 @@ public class DescriptionPanel { buf.append("\"/> "); //$NON-NLS-1$ buf.append(message); buf.append("</p>"); //$NON-NLS-1$// Add the list of blocking tasks - + ICompositeCheatSheetTask[] requiredTasks = task.getRequiredTasks(); for (int i = 0; i < requiredTasks.length; i++) { warnOfIncompleteTask(buf, requiredTasks[i]); @@ -210,7 +210,7 @@ public class DescriptionPanel { buf.append("<p>"); //$NON-NLS-1$ buf.append("</p>"); //$NON-NLS-1$ } - + private void addHyperlink(StringBuffer buf, String href, String imageRef, String message) { buf.append("<p><a href=\""); //$NON-NLS-1$ buf.append(href); @@ -221,7 +221,7 @@ public class DescriptionPanel { buf.append(message); buf.append("</a></p>"); //$NON-NLS-1$ } - + /* * If this task is incomplete create a message to that effect */ @@ -232,23 +232,23 @@ public class DescriptionPanel { buf.append("<a href=\""); //$NON-NLS-1$ buf.append(CompositeCheatSheetPage.GOTO_TASK_TAG); buf.append(task.getId()); - buf.append("\">"); //$NON-NLS-1$ - buf.append(NLS.bind(Messages.COMPOSITE_PAGE_TASK_NOT_COMPLETE, (new Object[] - {MarkupParser.escapeText(task.getName())}))); - buf.append("</a>"); //$NON-NLS-1$ + buf.append("\">"); //$NON-NLS-1$ + buf.append(NLS.bind(Messages.COMPOSITE_PAGE_TASK_NOT_COMPLETE, (new Object[] + {MarkupParser.escapeText(task.getName())}))); + buf.append("</a>"); //$NON-NLS-1$ buf.append("</li>"); //$NON-NLS-1$ } } - + private void showSuccesorTaskLinks(ICompositeCheatSheetTask task, StringBuffer buf) { // Add the links to the next tasks ICompositeCheatSheetTask[] successorTasks = new SuccesorTaskFinder(task).getRecommendedSuccessors(); for (int i = 0; i < successorTasks.length; i++) { ICompositeCheatSheetTask successor = successorTasks[i]; - String message = NLS.bind(Messages.COMPOSITE_PAGE_GOTO_TASK, (new Object[] + String message = NLS.bind(Messages.COMPOSITE_PAGE_GOTO_TASK, (new Object[] {MarkupParser.escapeText(successor.getName())})); addHyperlink(buf, CompositeCheatSheetPage.GOTO_TASK_TAG + successor.getId(), GOTO_IMAGE, message); } } - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java index b942cb2dc..ce93c0287 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskEditorManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,12 +30,12 @@ import org.eclipse.ui.internal.provisional.cheatsheets.TaskEditor; import org.osgi.framework.Bundle; public class TaskEditorManager { - + private static TaskEditorManager instance; - + private TaskEditorManager() { } - + public static TaskEditorManager getInstance() { if (instance == null) { instance = new TaskEditorManager(); @@ -69,7 +69,7 @@ public class TaskEditorManager { IStatus status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); CheatSheetPlugin.getPlugin().getLog().log(status); } - + return editorInstance; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java index 7920e6718..bdcec27c5 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,18 +36,18 @@ public class TaskExplorerManager { private static TaskExplorerManager instance; private Map images; - + private TaskExplorerManager() { - + } - + public static TaskExplorerManager getInstance() { if (instance == null) { instance = new TaskExplorerManager(); } return instance; } - + public TaskExplorer getExplorer(String explorerKind) { CheatSheetRegistryReader.TaskExplorerNode explorerInfo = CheatSheetRegistryReader.getInstance().findTaskExplorer(explorerKind); @@ -74,7 +74,7 @@ private static TaskExplorerManager instance; IStatus status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); CheatSheetPlugin.getPlugin().getLog().log(status); } - + return explorerInstance; } @@ -98,17 +98,17 @@ private static TaskExplorerManager instance; return ImageDescriptor.createFromURL(url); } catch (IOException e) { return null; - } + } } - + private Map getImages() { if (images == null) { initImages(); } return images; } - - + + private void initImages() { if (images == null) { images = new HashMap(); @@ -119,7 +119,7 @@ private static TaskExplorerManager instance; images.put(ids[i], descriptor.createImage()); } } - } + } } public String getName(String explorerKind) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java index bbc38830d..f564f2bb1 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,23 +21,23 @@ import org.w3c.dom.Node; */ public abstract class AbstractExecutable { - + private String[] params; private boolean confirm = false; private String when; private boolean required = true; - + /** * This method returns an array of parameters specified to be passed to the action class * when it is run in the cheat sheet. - * @return an array of string parameters that are passed to the action class when it is run + * @return an array of string parameters that are passed to the action class when it is run */ public String[] getParams() { return params; } /** - * This method returns the expression to be used when determining if this action should used. + * This method returns the expression to be used when determining if this action should used. * @return the when expression to be used for this action */ public String getWhen() { @@ -51,7 +51,7 @@ public abstract class AbstractExecutable { public boolean isConfirm() { return confirm; } - + /** * @return true if this step or substep can only be completed by performing * this executable. @@ -61,7 +61,7 @@ public abstract class AbstractExecutable { } /** - * This method allows you to set the string parameters to be passed to the action class on running it + * This method allows you to set the string parameters to be passed to the action class on running it * in the cheat sheet. * @param params an array of strings that is passed to the action class on running the action */ @@ -76,14 +76,14 @@ public abstract class AbstractExecutable { public void setConfirm(boolean value) { this.confirm = value; } - + /** * Set whether this executable can be by passed. - * @param required if true this action must be performed to complete this + * @param required if true this action must be performed to complete this * step or substep. */ public void setRequired(boolean required) { - this.required = required; + this.required = required; } /** @@ -107,16 +107,16 @@ public abstract class AbstractExecutable { * Check to see if all required attributes are present and are valid. * This method is called after any calls to handleAttributes have been made * @param node the node for this executable. - * @return null if the parameters are valid or an error message if the - * parameters are invalid or incomplete. + * @return null if the parameters are valid or an error message if the + * parameters are invalid or incomplete. */ public abstract String checkAttributes(Node node); - + /** * @return true if calls to execute require a non-null CheatsheetManager */ public abstract boolean isCheatSheetManagerUsed(); - + /** * Execute and return a status * @param csm A cheatsheet manager if this object uses a cheatsheet manager, @@ -125,7 +125,7 @@ public abstract class AbstractExecutable { * completes with a failure result, error status if an exception was thrown * or the executable could not be initiated. */ - public abstract IStatus execute(CheatSheetManager csm); + public abstract IStatus execute(CheatSheetManager csm); /** * @return true if this executable can have parameters diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractSubItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractSubItem.java index 5612b8e6f..208b53cb7 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractSubItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractSubItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,7 +11,7 @@ package org.eclipse.ui.internal.cheatsheets.data; public abstract class AbstractSubItem { - + public AbstractSubItem() { super(); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java index 54638983f..dfc0ae08b 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Action.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,8 +30,8 @@ public class Action extends AbstractExecutable { public Action() { super(); } - - + + /** * This method returns the class specified to be run when the "click to perform" button is pressed for this item. * @return the class name to be run for the item @@ -49,8 +49,8 @@ public class Action extends AbstractExecutable { } /** - * This method allows you to specify the class to be run when the perform button is pressed for this - * item in the cheat sheet. + * This method allows you to specify the class to be run when the perform button is pressed for this + * item in the cheat sheet. * @param classname the class to be run by the item in the cheat sheet */ public void setClass(String aclass) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheet.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheet.java index 94a8d23b9..dd3d8eec0 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheet.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,10 +14,10 @@ import java.util.ArrayList; import java.util.Collection; /** - * + * */ public class CheatSheet implements ICheatSheet { - + protected String title; private Item introItem; private ArrayList items; @@ -25,14 +25,14 @@ public class CheatSheet implements ICheatSheet { /** * Creates a new cheat sheet. - * + * */ public CheatSheet() { } /** * This method sets the title of cheat sheet. - * + * * @param title the title of cheat sheet */ public void setTitle(String title) { @@ -44,7 +44,7 @@ public class CheatSheet implements ICheatSheet { * @return the title of the cheat sheet */ public String getTitle(){ - return title; + return title; } /** @@ -70,7 +70,7 @@ public class CheatSheet implements ICheatSheet { /** * Adds an item to the cheat sheet. - * + * * @param item the item to add */ public void addItem(Item item) { @@ -82,7 +82,7 @@ public class CheatSheet implements ICheatSheet { /** * Adds all the items from the collection to the cheat sheet. - * + * * @param c the collection of items to add */ public void addItems(Collection c) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java index cbd244730..5fd1e21e8 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,11 +27,11 @@ public class CheatSheetCommand extends AbstractExecutable { private String serialization; private String returns; private boolean serializationFound; - + public void setSerialization(String serialization) { - this.serialization = serialization; + this.serialization = serialization; } - + public String getSerialization() { return serialization; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java index 3d9f5e77a..33c17d6d9 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,14 +52,14 @@ import org.xml.sax.SAXParseException; /** * Parser for the cheatsheet content files. - * + * * Construct an intance of the CheatSheetDomParser. * Call <code>parse()</code>. * Then get the content items by calling * <code>getIntroItem()</code> and <code>getItemsList()</code>. * The title of the cheatsheet can be retrieved by calling * <code>getTitle()</code>. - * + * */ public class CheatSheetParser implements IStatusContainer { @@ -68,18 +68,18 @@ public class CheatSheetParser implements IStatusContainer { private DocumentBuilder documentBuilder; private DocumentProcessor processor; private ArrayList itemExtensionContainerList; - + // Cheatsheet kinds that can be parsed public static final int COMPOSITE_ONLY = 1; public static final int SIMPLE_ONLY = 2; public static final int ANY = 3; - + private IStatus status; private int commandCount; private int actionCount; - + /** * Java constructor comment. @@ -88,23 +88,23 @@ public class CheatSheetParser implements IStatusContainer { super(); documentBuilder = CheatSheetPlugin.getPlugin().getDocumentBuilder(); } - + /** * Gets the status of the last call to parse() */ public IStatus getStatus() { return status; } - + @Override - public void addStatus(int severity, String message, Throwable exception) { + public void addStatus(int severity, String message, Throwable exception) { status = ParserStatusUtility.addStatus(status, severity, message, exception); } /** - * Converts any characters required to escaped by an XML parser to + * Converts any characters required to escaped by an XML parser to * their escaped counterpart. - * + * * Characters XML escaped counterpart * < -> < * > -> > @@ -120,13 +120,13 @@ public class CheatSheetParser implements IStatusContainer { private StringBuffer escapeXMLCharacters(StringBuffer text) { // Set the maximum length of the tags to ignore final int MAXIMUM_TAG_LENGTH = 5; - + // Keep a local variable for the orignal string's length int length = text.length(); - + // Create the buffer to store the resulting string StringBuffer result = new StringBuffer(length); - + // Loop for the characters of the original string for(int i=0; i<length; i++) { // Grab the next character and determine how to handle it @@ -211,7 +211,7 @@ public class CheatSheetParser implements IStatusContainer { return node; } } - + return null; } @@ -234,9 +234,9 @@ public class CheatSheetParser implements IStatusContainer { Node attribute = attributes.item(x); String attributeName = attribute.getNodeName(); if (attribute == null || attributeName == null) - continue; + continue; if (attributeName.equals(IParserTags.CONFIRM)) { - executable.setConfirm(attribute.getNodeValue().equals(TRUE_STRING));} + executable.setConfirm(attribute.getNodeValue().equals(TRUE_STRING));} else if (attributeName.equals(IParserTags.WHEN)) { executable.setWhen(attribute.getNodeValue()); } else if (attributeName.equals(IParserTags.REQUIRED)) { @@ -250,7 +250,7 @@ public class CheatSheetParser implements IStatusContainer { } String paramNum = attributeName.substring(IParserTags.PARAM.length()); int num = Integer.parseInt(paramNum)-1; - + if(num>-1 && num<9){ params[num] = attribute.getNodeValue(); } else { @@ -382,7 +382,7 @@ public class CheatSheetParser implements IStatusContainer { Assert.isNotNull(startNode); Node descriptionNode = findNode(startNode, IParserTags.DESCRIPTION); - + if(descriptionNode != null) { String text = handleMarkedUpText(descriptionNode, startNode, IParserTags.DESCRIPTION); item.setDescription(text); @@ -395,29 +395,29 @@ public class CheatSheetParser implements IStatusContainer { throw new CheatSheetParserException(message); } } - + private void handleSubItemDescription(SubItem subItem, Node startNode) throws CheatSheetParserException { Assert.isNotNull(subItem); Assert.isNotNull(startNode); Node descriptionNode = findNode(startNode, IParserTags.DESCRIPTION); - + if(descriptionNode != null) { String text = handleMarkedUpText(descriptionNode, startNode, IParserTags.DESCRIPTION); subItem.setLabel(text); subItem.setFormatted(true); - } + } } private String handleMarkedUpText(Node nodeContainingText, Node startNode, String nodeName ) { - NodeList nodes = nodeContainingText.getChildNodes(); + NodeList nodes = nodeContainingText.getChildNodes(); StringBuffer text = new StringBuffer(); - + boolean containsMarkup = false; - + // The documentation for the content file specifies // that leading whitespace should be ignored at the - // beginning of a description or after a <br/>. This + // beginning of a description or after a <br/>. This // applies also to <onCompletion> elements. // See Bug 129208 and Bug 131185 boolean isLeadingTrimRequired = true; @@ -440,7 +440,7 @@ public class CheatSheetParser implements IStatusContainer { text.append(IParserTags.BOLD_END_TAG); isLeadingTrimRequired = false; } else if(node.getNodeName().equals(IParserTags.BREAK)) { - containsMarkup = true; + containsMarkup = true; text.append(IParserTags.BREAK_TAG); isLeadingTrimRequired = true; } else { @@ -462,7 +462,7 @@ public class CheatSheetParser implements IStatusContainer { } // Replace any tabs with spaces - + private void deTab(StringBuffer text) { for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '\t') { @@ -473,7 +473,7 @@ public class CheatSheetParser implements IStatusContainer { private String trimLeadingWhitespace(String nodeValue) { int firstNonWhitespaceIndex = 0; - while (firstNonWhitespaceIndex < nodeValue.length() && + while (firstNonWhitespaceIndex < nodeValue.length() && Character.isWhitespace(nodeValue.charAt(firstNonWhitespaceIndex))) { firstNonWhitespaceIndex++; } @@ -500,21 +500,21 @@ public class CheatSheetParser implements IStatusContainer { addStatus(IStatus.WARNING, message, null); } - + private void handleOnCompletion(Item item, Node onCompletionNode) { String text = handleMarkedUpText(onCompletionNode, onCompletionNode, IParserTags.ON_COMPLETION); item.setCompletionMessage(text); } - + private void handleIntroNode(CheatSheet cheatSheet, Node introNode) throws CheatSheetParserException { Item introItem = new Item(); introItem.setTitle(Messages.CHEAT_SHEET_INTRO_TITLE); handleIntroAttributes(introItem, introNode); - + boolean hasDescription = false; - + NodeList nodes = introNode.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); @@ -576,9 +576,9 @@ public class CheatSheetParser implements IStatusContainer { handleItemAttributes(item, itemNode); boolean hasDescription = false; - + NodeList nodes = itemNode.getChildNodes(); - + IncompatibleSiblingChecker checker = new IncompatibleSiblingChecker(this, itemNode); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); @@ -617,7 +617,7 @@ public class CheatSheetParser implements IStatusContainer { String message = NLS.bind(Messages.ERROR_PARSING_NO_DESCRIPTION, (new Object[] {itemNode.getNodeName()})); addStatus(IStatus.ERROR, message, null); } - + return item; } @@ -795,7 +795,7 @@ public class CheatSheetParser implements IStatusContainer { Assert.isTrue(subItemNode.getNodeName().equals(IParserTags.SUBITEM)); SubItem subItem = new SubItem(); - + IncompatibleSiblingChecker checker = new IncompatibleSiblingChecker(this, subItemNode); NodeList nodes = subItemNode.getChildNodes(); @@ -887,7 +887,7 @@ public class CheatSheetParser implements IStatusContainer { public ICheatSheet parse(URL url, String pluginId, int cheatSheetKind) { return parse(new ParserInput(url, pluginId, null), cheatSheetKind); } - + public ICheatSheet parse(ParserInput input, int cheatSheetKind) { status = Status.OK_STATUS; commandCount = 0; @@ -905,12 +905,12 @@ public class CheatSheetParser implements IStatusContainer { URL url = input.getUrl(); if (input.getXml() != null) { - StringReader reader = new StringReader(input.getXml()); + StringReader reader = new StringReader(input.getXml()); inputSource = new InputSource(reader); } else if (input.getUrl() != null){ try { is = url.openStream(); - + if (is != null) { inputSource = new InputSource(is); } @@ -922,7 +922,7 @@ public class CheatSheetParser implements IStatusContainer { } else { return null; } - + if (input.getUrl() != null){ filename = url.getFile(); } @@ -968,7 +968,7 @@ public class CheatSheetParser implements IStatusContainer { documentPath = '/' + input.getPluginId() + input.getUrl().getPath(); } processor.process(UAElementFactory.newElement(document.getDocumentElement()), documentPath); - + if ( cheatSheetKind == COMPOSITE_ONLY || (cheatSheetKind == ANY && isComposite(document))) { CompositeCheatSheetParser compositeParser = new CompositeCheatSheetParser(); CompositeCheatSheetModel result = compositeParser.parseCompositeCheatSheet(document, input.getUrl()); @@ -985,7 +985,7 @@ public class CheatSheetParser implements IStatusContainer { private boolean isComposite(Document document) { if (document != null) { - Node rootnode = document.getDocumentElement(); + Node rootnode = document.getDocumentElement(); // Is the root node compositeCheatsheet? return rootnode.getNodeName().equals(ICompositeCheatsheetTags.COMPOSITE_CHEATSHEET) ; } @@ -996,7 +996,7 @@ public class CheatSheetParser implements IStatusContainer { // If the document passed is null return a null tree and update the status if (document != null) { Node rootnode = document.getDocumentElement(); - + // Is the root node really <cheatsheet>? if( !rootnode.getNodeName().equals(IParserTags.CHEATSHEET) ) { throw new CheatSheetParserException(Messages.ERROR_PARSING_CHEATSHEET_ELEMENT); @@ -1009,10 +1009,10 @@ public class CheatSheetParser implements IStatusContainer { boolean hasItem = false; boolean hasIntro = false; - + CheatSheetRegistryReader reader = CheatSheetRegistryReader.getInstance(); itemExtensionContainerList = reader.readItemExtensions(); - + NodeList nodes = rootnode.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); @@ -1035,7 +1035,7 @@ public class CheatSheetParser implements IStatusContainer { } } } - + if(!hasIntro) { addStatus(IStatus.ERROR, Messages.ERROR_PARSING_NO_INTRO, null); } @@ -1046,14 +1046,14 @@ public class CheatSheetParser implements IStatusContainer { //handleIntro(cheatSheet, document); //handleItems(cheatSheet, document); - + if (status.getSeverity() == IStatus.ERROR) { return null; } - + cheatSheet.setContainsCommandOrAction(actionCount != 0 || commandCount != 0); return cheatSheet; - } + } throw new CheatSheetParserException(Messages.ERROR_PARSING_CHEATSHEET_CONTENTS); } @@ -1062,18 +1062,18 @@ public class CheatSheetParser implements IStatusContainer { * qualified paths, e.g. for the path "tasks/mySimpleCheatSheet.xml" in composite cheat * sheet "/my.plugin/cheatsheets/myCompositeCheatSheet.xml", this normalizes to * "/my.plugin/cheatsheets/tasks/mySimpleCheatSheet.xml". - * + * * This is necessary because with dynamic content we are pulling in tasks from other * plug-ins and those tasks have relative paths. It also only applies for cheat sheets * located in running plug-ins. */ private class NormalizeHandler extends ProcessorHandler { - + private static final String ELEMENT_PARAM = "param"; //$NON-NLS-1$ private static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$ private static final String ATTRIBUTE_VALUE = "value"; //$NON-NLS-1$ private static final String NAME_PATH = "path"; //$NON-NLS-1$ - + @Override public short handle(UAElement element, String id) { if (id != null && ELEMENT_PARAM.equals(element.getElementName())) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java index c8c3098e3..ecb9d2b42 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,7 +47,7 @@ public class CheatSheetSaveHelper { protected IPath savePath; private static final String DOT_XML = ".xml"; //$NON-NLS-1$ - + /** * Constructor for CheatSheetSaveHelper. */ @@ -61,7 +61,7 @@ public class CheatSheetSaveHelper { * Create the properties used to save the state of a cheatsheet * @param currentItemNum the current item * @param items a list of the items in this cheatsheet - * @param buttonIsDown + * @param buttonIsDown * @param expandRestoreStates * @param csID the cheatsheet id * @param contentPath will be null if the cheatsheet was launched using information from @@ -157,7 +157,7 @@ public class CheatSheetSaveHelper { public Path getStateFile(String csID) { return getStateFile(csID, savePath); } - + protected Path getStateFile(String csID, IPath rootPath) { return new Path(rootPath.append(csID + ".xml").toOSString()); //$NON-NLS-1$ } @@ -196,13 +196,13 @@ public class CheatSheetSaveHelper { return null; } - + /** * @param saveProperties * @param contentPath * @param csm */ - public IStatus saveState(Properties properties, CheatSheetManager csm) { + public IStatus saveState(Properties properties, CheatSheetManager csm) { String csID = (String) properties.get(IParserTags.ID); XMLMemento writeMemento = XMLMemento.createWriteRoot(IParserTags.CHEATSHEET_STATE); IStatus status = saveToMemento(properties, csm, writeMemento); @@ -211,9 +211,9 @@ public class CheatSheetSaveHelper { } return CheatSheetPlugin.getPlugin().saveMemento(writeMemento, csID + DOT_XML); } - + public IStatus saveToMemento(Properties properties, CheatSheetManager csm, IMemento writeMemento) { - + String csID = (String) properties.get(IParserTags.ID); try { writeMemento.putString(IParserTags.BUTTONSTATE, (String) properties @@ -253,10 +253,10 @@ public class CheatSheetSaveHelper { XMLMemento readMemento = CheatSheetPlugin.getPlugin().readMemento(csID + DOT_XML); if (readMemento == null) { return null; - } + } return loadFromMemento(readMemento); } - + public Properties loadFromMemento(IMemento memento) { Properties properties = new Properties(); properties.put(IParserTags.BUTTON, memento.getString(IParserTags.BUTTONSTATE)); @@ -287,7 +287,7 @@ public class CheatSheetSaveHelper { childMemento.putString(IParserTags.ITEM,(String)iter.next()); } } - + private void addMapToMemento(IMemento memento, Map map, String mapName) { if (map == null) { @@ -300,24 +300,24 @@ public class CheatSheetSaveHelper { childMemento.putString(IParserTags.MANAGERDATAVALUE,(String)map.get(itemKey)); } } - - + + private void getMapFromMemento(IMemento memento, Properties properties, String mapName) { IMemento[] children = memento.getChildren(mapName); Map map = new Hashtable(); for (int i = 0; i < children.length; i++) { - map.put(children[i].getString(IParserTags.MANAGERDATAKEY), + map.put(children[i].getString(IParserTags.MANAGERDATAKEY), children[i].getString(IParserTags.MANAGERDATAVALUE)); - } + } properties.put(mapName, map); } - + private void getListOfStringsFromMemento(IMemento memento, Properties properties, String key) { IMemento[] children = memento.getChildren(key); List list = new ArrayList(); for (int i = 0; i < children.length; i++) { list.add(children[i].getString(IParserTags.ITEM)); - } + } properties.put(key, list); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ConditionalSubItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ConditionalSubItem.java index 6484ff29b..7a41f0ec0 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ConditionalSubItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ConditionalSubItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,12 +26,12 @@ public class ConditionalSubItem extends AbstractSubItem implements ISubItemItem public ConditionalSubItem() { super(); } - + public ConditionalSubItem(String condition) { super(); this.condition = condition; } - + /** * Returns the condition. * @return String diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IActionItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IActionItem.java index c5e1c4e5c..14ad5d5fe 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IActionItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IActionItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,10 +16,10 @@ public interface IActionItem { * @return Returns the action. */ public Action getAction(); - + /** * @param action The action to set. */ public void setAction(Action action); - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IExecutableItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IExecutableItem.java index 627c135bc..122da6a6e 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IExecutableItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IExecutableItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,12 +17,12 @@ package org.eclipse.ui.internal.cheatsheets.data; */ public interface IExecutableItem { - + /** * @return Returns the executable. */ public AbstractExecutable getExecutable(); - + /** * @param executable executable item */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java index 07d236184..84d6ff947 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IParserTags.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public interface IParserTags { public static final String INTRO = "intro"; //$NON-NLS-1$ public static final String CONTEXTID = "contextId"; //$NON-NLS-1$ public static final String HREF = "href"; //$NON-NLS-1$ - + /* * <!ELEMENT description ()> * <!ATTLIST description @@ -49,8 +49,8 @@ public interface IParserTags { public static final String BREAK_TAG = "<br/>"; //$NON-NLS-1$ public static final String FORM_START_TAG = "<form><p>"; //$NON-NLS-1$ public static final String FORM_END_TAG = "</p></form>"; //$NON-NLS-1$ - - + + /* * <!ELEMENT item (description [action|perform-when] | (subitem|repeated-subitem|conditional-subitem)*)> * <!ATTLIST item @@ -85,7 +85,7 @@ public interface IParserTags { */ public static final String CONDITIONALSUBITEM = "conditional-subitem"; //$NON-NLS-1$ public static final String CONDITION = "condition"; //$NON-NLS-1$ - + /* * <!ELEMENT repeated-subitem (subitem)> * <!ATTLIST repeated-subitem @@ -120,7 +120,7 @@ public interface IParserTags { * > */ public static final String PERFORMWHEN = "perform-when"; //$NON-NLS-1$ - + // Miscellaneous tags public static final String COMMAND = "command"; //$NON-NLS-1$ public static final String SERIALIZATION = "serialization"; //$NON-NLS-1$ @@ -136,7 +136,7 @@ public interface IParserTags { public static final String AMPERSAND = "&"; //$NON-NLS-1$ public static final String APOSTROPHE = "'"; //$NON-NLS-1$ public static final String QUOTE = """; //$NON-NLS-1$ - + // Cheat Sheet state data key public static final String ID = "id";//$NON-NLS-1$ @@ -154,5 +154,5 @@ public interface IParserTags { public static final String PATH = "path"; //$NON-NLS-1$ public static final String CHEATSHEET_STATE_REFERENCE = "CHEATSHEET_STATE_REFERENCE"; //$NON-NLS-1$ public static final String CHEATSHEET_STATE = "cheatsheetState"; //$NON-NLS-1$ - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IPerformWhenItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IPerformWhenItem.java index e75c5a1c1..4a41ced59 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IPerformWhenItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IPerformWhenItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ public interface IPerformWhenItem { * @return Returns the performWhen. */ public PerformWhen getPerformWhen(); - + /** * @param performWhen The performWhen to set. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ISubItemItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ISubItemItem.java index 1bec14676..c51549563 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ISubItemItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ISubItemItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,5 +23,5 @@ public interface ISubItemItem { * @return Returns the subItems. */ public ArrayList getSubItems(); - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java index a60682a68..6210265cf 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.w3c.dom.Node; */ public class IncompatibleSiblingChecker { - + private IStatusContainer statusContainer; private Node parentNode; private String existingChild; @@ -32,9 +32,9 @@ public class IncompatibleSiblingChecker { this.statusContainer = statusContainer; this.parentNode = parentNode; } - + /** - * Check to see that adding this new element does not create an error based on + * Check to see that adding this new element does not create an error based on * other elements. The rules are the only one action, command or perform-when can * be declared per item or subitem and none of these can coexist with a subitem, * conditional-subitem or repeated-subitem @@ -55,13 +55,13 @@ public class IncompatibleSiblingChecker { } private boolean isSubitem(String elementKind) { - return IParserTags.SUBITEM.equals(elementKind) + return IParserTags.SUBITEM.equals(elementKind) || IParserTags.CONDITIONALSUBITEM.equals(elementKind) - || IParserTags.REPEATEDSUBITM.equals(elementKind); + || IParserTags.REPEATEDSUBITM.equals(elementKind); } private boolean isExecutable(String elementKind) { - return IParserTags.ACTION.equals(elementKind) + return IParserTags.ACTION.equals(elementKind) || IParserTags.COMMAND.equals(elementKind) || IParserTags.PERFORMWHEN.equals(elementKind); } @@ -75,7 +75,7 @@ public class IncompatibleSiblingChecker { if (elementKind.equals(existingChild)) { message = NLS.bind(Messages.ERROR_PARSING_DUPLICATE_CHILD, (new Object[] {parentNode.getNodeName(), elementKind})); } else { - message = NLS.bind(Messages.ERROR_PARSING_INCOMPATIBLE_CHILDREN, (new Object[] {parentNode.getNodeName(), existingChild, elementKind})); + message = NLS.bind(Messages.ERROR_PARSING_INCOMPATIBLE_CHILDREN, (new Object[] {parentNode.getNodeName(), existingChild, elementKind})); } statusContainer.addStatus(IStatus.ERROR, message, null); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Intro.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Intro.java index c347855aa..12faf8bad 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Intro.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Intro.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,14 +21,14 @@ public class Intro { public Intro() { super(); } - + public Intro(String description, String href, String contextId) { super(); this.description = description; this.href = href; this.contextId = contextId; } - + /** * Returns the contenxtId. * @return String diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java index 0c48fbbfe..d3979e57f 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/Item.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,10 +18,10 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS private boolean skip; private boolean dialog; private ArrayList itemExtensions; - + private AbstractExecutable executable; private PerformWhen performWhen; - + private ArrayList subItems; private String completionMessage; @@ -31,14 +31,14 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public Item() { super(); } - + public Item(String title, String description, String href, String contextId, boolean skip, boolean dialog) { super(description, href, contextId); this.title = title; this.skip = skip; this.dialog = dialog; } - + /** * Returns the title. * @return String @@ -69,7 +69,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public boolean isDialog() { return this.dialog; } - + /** * Returns the skip. * @return boolean @@ -85,7 +85,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public void setDialog(boolean dialog) { this.dialog = dialog; } - + /** * @param skip The skip to set. */ @@ -106,9 +106,9 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS * @param exts the extensions to set */ public void setItemExtensions(ArrayList exts){ - this.itemExtensions = exts; + this.itemExtensions = exts; } - + /** * Returns the item extensions, if any, for this item,. * @return list of the extensions or <code>null</code> @@ -116,7 +116,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public ArrayList getItemExtensions(){ return itemExtensions; } - + /** * @return Returns the performWhen. */ @@ -124,7 +124,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public PerformWhen getPerformWhen() { return performWhen; } - + /** * @param performWhen The performWhen to set. */ @@ -132,7 +132,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public void setPerformWhen(PerformWhen performWhen) { this.performWhen = performWhen; } - + /** * @param subItem the SubItem to add. */ @@ -151,7 +151,7 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS public ArrayList getSubItems() { return subItems; } - + private boolean hasDynamicSubItems() { if( subItems != null) { for (Iterator iter = subItems.iterator(); iter.hasNext();) { @@ -174,13 +174,13 @@ public class Item extends Intro implements IExecutableItem, IPerformWhenItem, IS @Override public void setExecutable(AbstractExecutable executable) { - this.executable = executable; + this.executable = executable; } public void setCompletionMessage(String message) { - this.completionMessage = message; + this.completionMessage = message; } - + public String getCompletionMessage() { return completionMessage; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserInput.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserInput.java index d2587f274..c9a37bedf 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserInput.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserInput.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -24,12 +24,12 @@ public class ParserInput { private String xml; private String pluginId; private String errorMessage; - + public ParserInput() { url = null; xml = null; } - + public ParserInput(String xml, String basePath) { this.xml = xml; this.url = null; @@ -42,18 +42,18 @@ public class ParserInput { } } } - + public ParserInput(URL url, String pluginId, String errorMessage) { this.url = url; this.xml = null; this.errorMessage = errorMessage; this.pluginId = pluginId; } - + public URL getUrl() { return url; } - + public String getXml() { return xml; } @@ -61,7 +61,7 @@ public class ParserInput { public String getPluginId() { return pluginId; } - + public String getErrorMessage() { return errorMessage; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserStatusUtility.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserStatusUtility.java index a53116729..69271759a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserStatusUtility.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/ParserStatusUtility.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,15 +18,15 @@ import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource; import org.eclipse.ui.internal.cheatsheets.Messages; public class ParserStatusUtility { - + public final static int PARSER_ERROR = 1001; // TODO is there another number that would be more meaningful - + /** * Modify an existing IStatus to add information about a new error/warning. * If the old status is OK return a status reflecting the new error condition, otherwise * add to the existing status making it a MultiStatus if necessary. */ - public static IStatus addStatus(IStatus status, int severity, String message, Throwable exception) { + public static IStatus addStatus(IStatus status, int severity, String message, Throwable exception) { Status newStatus = new Status(severity, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, PARSER_ERROR, message, exception); if (status.isOK()) { return newStatus; @@ -34,7 +34,7 @@ public class ParserStatusUtility { ((MultiStatus)status).add(newStatus); return status; } else { - MultiStatus multiStatus = new MultiStatus(ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, + MultiStatus multiStatus = new MultiStatus(ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, Messages.ERROR_MULTIPLE_ERRORS, exception); multiStatus.add(status); multiStatus.add(newStatus); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/PerformWhen.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/PerformWhen.java index e94381a9c..3d437f481 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/PerformWhen.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/PerformWhen.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,7 @@ public class PerformWhen implements IExecutableItem { super(); this.condition = condition; } - + /** * Returns the condition. * @return String @@ -53,7 +53,7 @@ public class PerformWhen implements IExecutableItem { public ArrayList getExecutables() { return executables; } - + /** * @param executable the AbstractExecutable to add. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/RepeatedSubItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/RepeatedSubItem.java index b95c4dddb..f2b480eef 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/RepeatedSubItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/RepeatedSubItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,12 +22,12 @@ public class RepeatedSubItem extends AbstractSubItem implements ISubItemItem { public RepeatedSubItem() { super(); } - + public RepeatedSubItem(String values) { super(); this.values = values; } - + /** * Returns the values. * @return String diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/SubItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/SubItem.java index 1ea1fcaf4..f5dbebec9 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/SubItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/SubItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,7 +11,7 @@ package org.eclipse.ui.internal.cheatsheets.data; public class SubItem extends AbstractSubItem implements IExecutableItem, IPerformWhenItem { - + private String label; private boolean skip = false; private String when; @@ -79,7 +79,7 @@ public class SubItem extends AbstractSubItem implements IExecutableItem, IPerfor public AbstractExecutable getExecutable() { return executable; } - + /** * @param Executable The Executable to set. */ @@ -87,7 +87,7 @@ public class SubItem extends AbstractSubItem implements IExecutableItem, IPerfor public void setExecutable(AbstractExecutable executable) { this.executable = executable; } - + /** * @return Returns the performWhen. */ @@ -95,7 +95,7 @@ public class SubItem extends AbstractSubItem implements IExecutableItem, IPerfor public PerformWhen getPerformWhen() { return performWhen; } - + /** * @param performWhen The performWhen to set. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java index 5297a9aec..b3fdf02e4 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2002, 2011 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -91,15 +91,15 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends private ScrolledFormText desc; private Button showAllButton; - + private Button selectRegisteredRadio; - + private Button selectFileRadio; - + private Button selectUrlRadio; private Combo selectFileCombo; - + private Combo selectUrlCombo; private ActivityViewerFilter activityViewerFilter = new ActivityViewerFilter(); @@ -113,13 +113,13 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends private final static String STORE_EXPANDED_CATEGORIES_ID = "CheatSheetCategoryBasedSelectionDialog.STORE_EXPANDED_CATEGORIES_ID"; //$NON-NLS-1$ private final static String STORE_SELECTED_CHEATSHEET_ID = "CheatSheetCategoryBasedSelectionDialog.STORE_SELECTED_CHEATSHEET_ID"; //$NON-NLS-1$ - + private final static String STORE_RADIO_SETTING = "CheatSheetCategoryBasedSelectionDialog.STORE_RADIO_SELECTION"; //$NON-NLS-1$ - + private final static String STORE_CHEATSHEET_FILENAME = "CheatSheetCategoryBasedSelectionDialog.STORE_CHEATSHEET_FILENAME"; //$NON-NLS-1$ private final static String STORE_CHEATSHEET_URL = "CheatSheetCategoryBasedSelectionDialog.STORE_CHEATSHEET_URL"; //$NON-NLS-1$ - + private final static String STORE_URL_MRU = "CheatSheetCategoryBasedSelectionDialog.STORE_URL_MRU"; //$NON-NLS-1$ private final static String STORE_FILE_MRU = "CheatSheetCategoryBasedSelectionDialog.STORE_FILE_MRU"; //$NON-NLS-1$ @@ -127,14 +127,14 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends private static final int RADIO_REGISTERED = 1; private static final int RADIO_FILE = 2; private static final int RADIO_URL = 3; - + private Button browseFileButton; private String title; private IStatus status = Status.OK_STATUS; - - + + List mostRecentFiles = new ArrayList(); List mostRecentUrls = new ArrayList(); @@ -195,7 +195,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends /** * Creates an instance of this dialog to display the a list of cheat sheets. - * + * * @param shell * the parent shell */ @@ -229,7 +229,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends @Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); - + IDialogSettings workbenchSettings = CheatSheetPlugin.getPlugin() .getDialogSettings(); IDialogSettings dialogSettings = workbenchSettings @@ -254,16 +254,16 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends // Create label createMessageArea(outerContainer); - + // Create radio button selectRegisteredRadio = new Button(outerContainer, SWT.RADIO); selectRegisteredRadio.setText(Messages.SELECTION_DIALOG_OPEN_REGISTERED); - + SashForm sform = new SashForm(outerContainer, SWT.VERTICAL); GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = 300; sform.setLayoutData(data); - + // category tree pane treeViewer = new TreeViewer(sform, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); @@ -277,9 +277,9 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends desc = new ScrolledFormText(sform, true); desc.setEnabled(false); - + sform.setWeights(new int[] {10, 2}); - + if (activityViewerFilter.getHasEncounteredFilteredItem()) createShowAllButton(outerContainer); @@ -298,11 +298,11 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends } } }); - + // Create radio button for select from file selectFileRadio = new Button(outerContainer, SWT.RADIO); selectFileRadio.setText(Messages.SELECTION_DIALOG_OPEN_FROM_FILE); - + Composite selectFileComposite = new Composite(outerContainer, SWT.NULL); GridLayout selectFileLayout = new GridLayout(); selectFileLayout.marginWidth = 0; @@ -320,14 +320,14 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends browseFileButton = new Button(selectFileComposite, SWT.NULL); browseFileButton.setText(Messages.SELECTION_DIALOG_FILEPICKER_BROWSE); setButtonLayoutData(browseFileButton); - + // Create radio button for select from URL selectUrlRadio = new Button(outerContainer, SWT.RADIO); selectUrlRadio.setText(Messages.SELECTION_DIALOG_OPEN_FROM_URL); selectUrlCombo = new Combo(outerContainer, SWT.BORDER); GridData suTextData = new GridData(GridData.FILL_HORIZONTAL); selectUrlCombo.setLayoutData(suTextData); - + restoreWidgetValues(); restoreFileSettings(); @@ -344,12 +344,12 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends checkRadioButtons(); return outerContainer; } - + private class RadioSelectionListener implements SelectionListener { @Override public void widgetSelected(SelectionEvent e) { - checkRadioButtons(); + checkRadioButtons(); } @Override @@ -357,7 +357,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends // do nothing } } - + private class BrowseListener implements SelectionListener { @Override @@ -368,7 +368,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends fileDlg.setText(Messages.SELECTION_DIALOG_FILEPICKER_TITLE); fileDlg.open(); String filename = fileDlg.getFileName(); - if (filename != null) { + if (filename != null) { IPath folderPath = new Path(fileDlg.getFilterPath()); IPath filePath = folderPath.append(filename); selectFileCombo.setText(filePath.toOSString()); @@ -378,24 +378,24 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends @Override public void widgetDefaultSelected(SelectionEvent e) { - // do nothing + // do nothing } } - + private class FileAndUrlListener implements ModifyListener { @Override public void modifyText(ModifyEvent e) { setOkButton(); - } + } } /* * Check the state of the Radio buttons and disable those parts of the UI that don't apply */ private void checkRadioButtons() { - selectFileCombo.setEnabled(selectFileRadio.getSelection()); - browseFileButton.setEnabled(selectFileRadio.getSelection()); + selectFileCombo.setEnabled(selectFileRadio.getSelection()); + browseFileButton.setEnabled(selectFileRadio.getSelection()); if (showAllButton != null) { showAllButton.setEnabled(selectRegisteredRadio.getSelection()); } @@ -406,7 +406,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends /** * Create a show all button in the parent. - * + * * @param parent * the parent <code>Composite</code>. */ @@ -431,7 +431,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends * Method enableOKButton enables/diables the OK button for the dialog and * saves the state, allowing the enabling/disabling to occur even if the * button has not been created yet. - * + * * @param value */ private void enableOKButton(boolean value) { @@ -485,7 +485,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends cheatsheets = new Object[0]; subCategories = new Object[0]; } - + if (cheatsheets.length == 0) { return subCategories; } else if (subCategories.length == 0) { @@ -513,7 +513,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends /** * The user selected either new cheatsheet category(s) or cheatsheet * element(s). Proceed accordingly. - * + * * @param newSelection * ISelection */ @@ -526,17 +526,17 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends currentSelection = (CheatSheetElement) obj; } - String description; + String description; if (currentSelection != null) { description = currentSelection.getDescription(); - } else { + } else { description = ""; //$NON-NLS-1$ } desc.getFormText().setText(description, false, false); desc.reflow(true); setOkButton(); } - + private void setOkButton() { if (selectRegisteredRadio.getSelection()) { enableOKButton(currentSelection != null); @@ -554,7 +554,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends * because it is about to close. */ getShell().setVisible(false); - + if (selectFileRadio.getSelection()) { setResultFromFile(); } else if (selectRegisteredRadio.getSelection() ){ @@ -589,26 +589,26 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends if (extensionIndex > 0) { id = id.substring(0, extensionIndex); } - // Use the id as the name + // Use the id as the name URL url = null; boolean opened = false; - + try { File contentFile = new File(selectFileCombo.getText()); url = contentFile.toURI().toURL(); new OpenCheatSheetAction(id, id ,url).run(); - opened = true; + opened = true; } catch (MalformedURLException e) { opened = false; } - if (!opened) { + if (!opened) { String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectFileCombo.getText()})); - status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null); - CheatSheetView view = ViewUtilities.showCheatSheetView(); + status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null); + CheatSheetView view = ViewUtilities.showCheatSheetView(); view.getCheatSheetViewer().showError(message); } } - + private void setResultFromUrl() { // Use the filename without extension as the id of this cheatsheet IPath filePath = new Path(selectUrlCombo.getText()); @@ -622,23 +622,23 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends } // Use the id as the name URL url = null; - boolean opened = false; + boolean opened = false; CheatSheetView view = ViewUtilities.showCheatSheetView(); if (view == null) { return; } try { - url = new URL(selectUrlCombo.getText()); + url = new URL(selectUrlCombo.getText()); view.getCheatSheetViewer().setInput(id, id, url, new DefaultStateManager(), true); opened = true; } catch (MalformedURLException e) { opened = false; } - if (!opened) { + if (!opened) { String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectUrlCombo.getText()})); - status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null); + status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null); view.getCheatSheetViewer().showError(message); - } + } } /** @@ -655,7 +655,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends if (category != null) selectPreviouslySelectedCheatSheet(category); } - + /** * Restores the state of the radio button and file name fields */ @@ -664,18 +664,18 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends try { radioSetting = settings.getInt(STORE_RADIO_SETTING); } - catch(NumberFormatException n) { + catch(NumberFormatException n) { } - selectFileRadio.setSelection(radioSetting == RADIO_FILE); - selectRegisteredRadio.setSelection(radioSetting == RADIO_REGISTERED); - selectUrlRadio.setSelection(radioSetting == RADIO_URL); + selectFileRadio.setSelection(radioSetting == RADIO_FILE); + selectRegisteredRadio.setSelection(radioSetting == RADIO_REGISTERED); + selectUrlRadio.setSelection(radioSetting == RADIO_URL); String fileName = settings.get(STORE_CHEATSHEET_FILENAME); if (fileName != null) { - selectFileCombo.setText(fileName); - } + selectFileCombo.setText(fileName); + } String url = settings.get(STORE_CHEATSHEET_URL); if (url != null) { - selectUrlCombo.setText(url); + selectUrlCombo.setText(url); } loadMRU(mostRecentUrls, STORE_URL_MRU, selectUrlCombo); loadMRU(mostRecentFiles, STORE_FILE_MRU, selectFileCombo); @@ -690,7 +690,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends } } } - + private void saveMRU(List mostRecentList, String key, String selection) { if (selection.length() > 0 && !mostRecentList.contains(selection)) { mostRecentList.add(0, selection); @@ -706,7 +706,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends /** * Store the current values of self's widgets so that they can be restored * in the next instance of self - * + * */ public void saveWidgetValues() { storeExpandedCategories(); @@ -734,7 +734,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends /** * Set the dialog store to use for widget value storage and retrieval - * + * * @param settings * IDialogSettings */ @@ -776,7 +776,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends settings.put(STORE_SELECTED_CHEATSHEET_ID, element.getID()); } - + /** * Stores the state of the radio button and file name fields */ @@ -791,24 +791,24 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends if (selectUrlRadio.getSelection()) { radioSetting = 3; } - settings.put(STORE_RADIO_SETTING, radioSetting); - settings.put(STORE_CHEATSHEET_FILENAME, selectFileCombo.getText()); - settings.put(STORE_CHEATSHEET_URL, selectUrlCombo.getText()); + settings.put(STORE_RADIO_SETTING, radioSetting); + settings.put(STORE_CHEATSHEET_FILENAME, selectFileCombo.getText()); + settings.put(STORE_CHEATSHEET_URL, selectUrlCombo.getText()); saveMRU(mostRecentUrls, STORE_URL_MRU, selectUrlCombo.getText()); - saveMRU(mostRecentFiles, STORE_FILE_MRU, selectFileCombo.getText()); + saveMRU(mostRecentFiles, STORE_FILE_MRU, selectFileCombo.getText()); } - + @Override protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = CheatSheetPlugin.getPlugin().getDialogSettings(); IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION); if (section == null) { section = settings.addNewSection(DIALOG_SETTINGS_SECTION); - } + } return section; } - + private Label createMessageArea(Composite composite) { Label label = new Label(composite, SWT.NONE); label.setText(Messages.CHEAT_SHEET_SELECTION_DIALOG_MSG); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java index fd0dae6b7..6ee7826bb 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.core.commands.ParameterValueConversionException; /** * A command parameter value converter to convert between Integers and their * String representations for use in the open dialog commands. - * + * * @since 3.2 */ public class DialogIntegerValueConverter extends diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetHandler.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetHandler.java index fa27e7391..ffe16d86a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetHandler.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.ui.internal.cheatsheets.actions.CheatSheetCategoryBasedSelect /** * Opens the cheatsheet identified by the parameter, or if no parameter is given * opens the dialog that allows the user to choose a cheatsheet. - * + * * @since 3.2 */ public class OpenCheatSheetHandler extends AbstractHandler { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetURLHandler.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetURLHandler.java index f15a350e1..7306c5d57 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetURLHandler.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenCheatSheetURLHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.ui.cheatsheets.OpenCheatSheetAction; /** * Opens a cheatsheet given an id, name and a URL to a cheat sheet content file. - * + * * @since 3.2 */ public class OpenCheatSheetURLHandler extends AbstractHandler { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenInputDialogHandler.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenInputDialogHandler.java index bccc3126a..038e0a0ce 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenInputDialogHandler.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenInputDialogHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.ui.PlatformUI; /** * A command handler to open an <code>InputDialog</code> and return the * result. - * + * * @since 3.2 */ public class OpenInputDialogHandler extends AbstractHandler { @@ -49,7 +49,7 @@ public class OpenInputDialogHandler extends AbstractHandler { InputDialog dialog = new InputDialog(shell, title, message, initialValue, null); int returnCode = dialog.open(); - + if (returnCode == Window.CANCEL) { String cancelReturns = event.getParameter(PARAM_ID_CANCEL_RETURNS); if (cancelReturns != null) @@ -57,7 +57,7 @@ public class OpenInputDialogHandler extends AbstractHandler { else throw new ExecutionException("dialog canceled"); //$NON-NLS-1$ } - + return dialog.getValue(); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenMessageDialogHandler.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenMessageDialogHandler.java index 0fae3c850..ad2676e7d 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenMessageDialogHandler.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/OpenMessageDialogHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ import org.eclipse.ui.PlatformUI; /** * A command handler to open a <code>MessageDialog</code> and return the * result. - * + * * @since 3.2 */ public class OpenMessageDialogHandler extends AbstractHandler { @@ -39,11 +39,11 @@ public class OpenMessageDialogHandler extends AbstractHandler { private static final String PARAM_ID_BUTTON_LABEL_PREFIX = "buttonLabel"; //$NON-NLS-1$ private static final int BUTTON_LABEL_COUNT = 4; - + private static final String PARAM_ID_CANCEL_RETURNS = "cancelReturns"; //$NON-NLS-1$ private static final int CANCEL_RETURN_CODE = -1; - + @Override public Object execute(ExecutionEvent event) throws ExecutionException { @@ -73,7 +73,7 @@ public class OpenMessageDialogHandler extends AbstractHandler { MessageDialog dialog = new MessageDialog(shell, title, null, message, imageType, buttonLabels, defaultValue); int returnCode = dialog.open(); - + if (returnCode == CANCEL_RETURN_CODE) { String cancelReturns = event.getParameter(PARAM_ID_CANCEL_RETURNS); if (cancelReturns != null) @@ -81,7 +81,7 @@ public class OpenMessageDialogHandler extends AbstractHandler { else throw new ExecutionException("dialog canceled"); //$NON-NLS-1$ } - + return buttonLabels[returnCode]; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java index 11840dfb8..cc61f2e1e 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Category.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -64,7 +64,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Creates an instance of <code>Category</code> with an ID and label. - * + * * @param id * the unique identifier for the category * @param label @@ -78,7 +78,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Creates an instance of <code>Category</code> using the information from * the specified configuration element. - * + * * @param configElement * the <code>IConfigurationElement<code> containing * the ID, label, and optional parent category path. @@ -95,7 +95,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Add an element to this category. - * + * * @param element * the element to add */ @@ -132,7 +132,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the id for this category. - * + * * @return the id */ public String getId() { @@ -141,7 +141,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the label for this category. - * + * * @return the label */ public String getLabel() { @@ -151,7 +151,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the parent path for this category. - * + * * @return the parent path */ public String[] getParentPath() { @@ -172,7 +172,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the unparsed parent path. May be <code>null</code>. - * + * * @return the unparsed parent path or <code>null</code> */ public String getRawParentPath() { @@ -182,7 +182,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the root path for this category. - * + * * @return the root path */ public String getRootPath() { @@ -195,7 +195,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return the elements contained in this category. - * + * * @return the elements */ public ArrayList getElements() { @@ -204,7 +204,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return whether a given object exists in this category. - * + * * @param o * the object to search for * @return whether the object is in this category @@ -219,7 +219,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Return whether this category has child elements. - * + * * @return whether this category has child elements */ public boolean hasElements() { @@ -247,7 +247,7 @@ public class Category implements IWorkbenchAdapter, IPluginContribution, /** * Clear all elements from this category. - * + * * @since 3.1 */ public void clear() { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java index e067b2c39..2d971ea76 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2008 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.model.WorkbenchAdapter; /** * Instances of this class are a collection of CheatSheetCollectionElements, - * thereby facilitating the definition of tree structures composed of + * thereby facilitating the definition of tree structures composed of * these elements. Instances also store a list of cheatsheets. */ public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPluginContribution { @@ -203,6 +203,6 @@ public class CheatSheetCollectionElement extends WorkbenchAdapter implements IPl } public void add(CheatSheetCollectionElement newElement) { - childCollections.add(newElement); + childCollections.add(newElement); } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionSorter.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionSorter.java index 2d2f55e10..96054802b 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionSorter.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetCollectionSorter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -54,7 +54,7 @@ public class CheatSheetCollectionSorter extends ViewerComparator { } /** - * Return true if this sorter is affected by a property + * Return true if this sorter is affected by a property * change of propertyName on the specified element. */ @Override diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java index 94629d1ef..902a27c99 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -57,7 +57,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I } /** - * + * * @return IConfigurationElement */ public IConfigurationElement getConfigurationElement() { @@ -107,7 +107,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I } /** - * + * * @param newConfigurationElement IConfigurationElement */ public void setConfigurationElement(IConfigurationElement newConfigurationElement) { @@ -174,7 +174,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I IStatus status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); CheatSheetPlugin.getPlugin().getLog().log(status); } - + if (listener != null){ return listener; } @@ -191,7 +191,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I public String getPluginId() { return configurationElement.getContributor().getName(); } - + public void setComposite(boolean composite) { this.composite = composite; } @@ -201,7 +201,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I } /** - * Get a URL which is saved with the state so the cheatsheet can later be + * Get a URL which is saved with the state so the cheatsheet can later be * reopened from the state file. * @return null if the cheatsheet was opened from the registry otherwise * the URL of the content file. @@ -222,9 +222,9 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I } public void setContentXml(String xml) { - this.contentXml = xml; + this.contentXml = xml; } - + public String getContentXml() { return contentXml; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java index 3fe2a69ed..39b8756c3 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetItemExtensionElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,7 +48,7 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements } /** - * + * * @return IConfigurationElement */ public IConfigurationElement getConfigurationElement() { @@ -74,7 +74,7 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements } /** - * + * * @param newConfigurationElement IConfigurationElement */ public void setConfigurationElement(IConfigurationElement newConfigurationElement) { @@ -123,7 +123,7 @@ public class CheatSheetItemExtensionElement extends WorkbenchAdapter implements IStatus status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, message, e); CheatSheetPlugin.getPlugin().getLog().log(status); } - + if (extElement != null){ return extElement; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetParameterValues.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetParameterValues.java index 5a9cc91ce..99bccfd31 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetParameterValues.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetParameterValues.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.core.commands.IParameterValues; /** * Provides the parameter values for the open cheat sheet command. - * + * * @since 3.2 */ public class CheatSheetParameterValues implements IParameterValues { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java index 8e9dd3399..ba695f96b 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -82,7 +82,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr return pluginId; } } - + /** * Represents a taskExplorer entry in the registry */ @@ -145,12 +145,12 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr private final static String UNCATEGORIZED_CHEATSHEET_CATEGORY = "org.eclipse.ui.Other"; //$NON-NLS-1$ private final static String UNCATEGORIZED_CHEATSHEET_CATEGORY_LABEL = Messages.CHEAT_SHEET_OTHER_CATEGORY; public final static String CHEAT_SHEET_CONTENT = "cheatSheetContent"; //$NON-NLS-1$ - + /** * Returns a list of cheatsheets, project and not. * * The return value for this method is cached since computing its value - * requires non-trivial work. + * requires non-trivial work. */ public static CheatSheetRegistryReader getInstance() { if (instance == null) { @@ -170,7 +170,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr protected Map taskExplorers = new HashMap(); protected Map taskEditors = new HashMap(); private Map nestedCategoryIds = new HashMap(); - + /** * Create an instance of this class. */ @@ -191,9 +191,9 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr /** * Returns a new CheatSheetElement configured according to the parameters - * contained in the passed Registry. + * contained in the passed Registry. * - * May answer null if there was not enough information in the Extension to create + * May answer null if there was not enough information in the Extension to create * an adequate cheatsheet */ protected CheatSheetElement createCheatSheetElement(IConfigurationElement element) { @@ -275,7 +275,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } return null; } - + /** * Returns the first task editor * with a given id. @@ -286,7 +286,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } return (TaskEditorNode)taskEditors.get(id); } - + /** * Returns the first task explorer * with a given id. @@ -297,7 +297,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } return (TaskExplorerNode)taskExplorers.get(id); } - + /** * Get the list of explorer ids * @return an iterator for the explorer ids @@ -355,7 +355,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr String[] categoryPath = category.getParentPath(); CheatSheetCollectionElement parent = currentResult; // ie.- root - // Traverse down into parent category. + // Traverse down into parent category. if (categoryPath != null) { nestedCategoryIds.put(category.getId(), category); for (int i = 0; i < categoryPath.length; i++) { @@ -376,7 +376,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr return; if (parent != null) { - CheatSheetCollectionElement collectionElement = + CheatSheetCollectionElement collectionElement = createCollectionElement(parent, category.getPluginId(), category.getId(), category.getLabel()); if (categoryPath != null) { nestedCategoryIds.put(category.getId(), collectionElement); @@ -389,7 +389,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr * based upon its defining extension's CATEGORY tag value * * @param element CheatSheetElement - * @param extension + * @param extension * @param currentResult CheatSheetCollectionElement */ private void finishCheatSheet(CheatSheetElement element, IConfigurationElement config, CheatSheetCollectionElement result) { @@ -457,7 +457,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr * Returns a list of cheatsheets, project and not. * * The return value for this method is cached since computing its value - * requires non-trivial work. + * requires non-trivial work. */ public CheatSheetCollectionElement getCheatSheets() { if (cheatsheets == null) @@ -533,7 +533,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } /** - * Removes the empty categories from a cheatsheet collection. + * Removes the empty categories from a cheatsheet collection. */ private void pruneEmptyCategories(CheatSheetCollectionElement parent) { Object[] children = parent.getChildren(); @@ -544,10 +544,10 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } /** - * Reads the cheatsheets in a registry. + * Reads the cheatsheets in a registry. * <p> - * This implementation uses a defering strategy. All of the elements - * (categories, cheatsheets) are read. The categories are created as the read occurs. + * This implementation uses a defering strategy. All of the elements + * (categories, cheatsheets) are read. The categories are created as the read occurs. * The cheatsheets are just stored for later addition after the read completes. * This ensures that cheatsheet categorization is performed after all categories * have been read. @@ -602,9 +602,9 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr itemExtensionElement.setItemAttribute(itemAttribute); itemExtensionElement.setConfigurationElement(element); - cheatsheetItemExtensions.add(itemExtensionElement); + cheatsheetItemExtensions.add(itemExtensionElement); } - + /* * Get a required attribute. Log an error if it has no value. */ @@ -615,7 +615,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr } return result; } - + private void createTaskExplorerElement(IConfigurationElement element) { String icon = element.getAttribute(ATT_ICON); String className = getAndCheckAttribute(element, ATT_CLASS); @@ -630,7 +630,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr node.setName(name); node.setPluginId(pluginId); taskExplorers.put(id, node); - } + } } private void createTaskEditorElement(IConfigurationElement element) { @@ -645,7 +645,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr node.setClassName(className); node.setPluginId(pluginId); taskEditors.put(id, node); - } + } } /** @@ -690,7 +690,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr cheatsheetItemExtensions = null; } } - + public void stop() { IExtensionRegistry xregistry = Platform.getExtensionRegistry(); xregistry.removeRegistryChangeListener(instance); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java index 1f9f06f50..8e2ccf9b4 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/RegistryReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -108,7 +108,7 @@ public abstract class RegistryReader { * Implement this method to read element's attributes. * If children should also be read, then implementor * is responsible for calling <code>readElementChildren</code>. - * Implementor is also responsible for logging missing + * Implementor is also responsible for logging missing * attributes. * * @return true if element was recognized, false if not. diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Sorter.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Sorter.java index 73395e8c9..b39f0ae4c 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Sorter.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/Sorter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,7 @@ public abstract class Sorter { * Returns true if elementTwo is 'greater than' elementOne * This is the 'ordering' method of the sort operation. * Each subclass overides this method with the particular - * implementation of the 'greater than' concept for the + * implementation of the 'greater than' concept for the * objects being sorted. */ /*package*/ abstract boolean compare(Object elementOne, Object elementTwo); @@ -65,7 +65,7 @@ public abstract class Sorter { int size = unSortedCollection.length; Object[] sortedCollection = new Object[size]; - //copy the array so can return a new sorted collection + //copy the array so can return a new sorted collection System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size); if (size > 1) quickSort(sortedCollection, 0, size - 1); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/DefaultStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/DefaultStateManager.java index 820517a5f..b16f2eee3 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/DefaultStateManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/DefaultStateManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ *******************************************************************************/ /** - * The default state manager for a cheat sheet. The data will be saved and restored + * The default state manager for a cheat sheet. The data will be saved and restored * using a file in metadata whose name is derived from the id */ @@ -47,7 +47,7 @@ public class DefaultStateManager implements ICheatSheetStateManager { } @Override - public CheatSheetManager getCheatSheetManager() { + public CheatSheetManager getCheatSheetManager() { CheatSheetManager result = new CheatSheetManager(element); if (getProperties() != null) { result.setData((Hashtable) getProperties().get(IParserTags.MANAGERDATA)); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/ICheatSheetStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/ICheatSheetStateManager.java index 2b46a6675..9d095cd03 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/ICheatSheetStateManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/ICheatSheetStateManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager; */ public interface ICheatSheetStateManager { - + /** * Will be called before any of the functions to get or save state * @param element @@ -41,7 +41,7 @@ public interface ICheatSheetStateManager { * Load the cheat sheet manager from state file/memento/memory */ public CheatSheetManager getCheatSheetManager(); - + /** * Save the properties and the cheat sheet manager * @param properties diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/MementoStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/MementoStateManager.java index 78b271917..acc907961 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/MementoStateManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/MementoStateManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/NoSaveStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/NoSaveStateManager.java index 5647537e2..7f3f69907 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/NoSaveStateManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/NoSaveStateManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ *******************************************************************************/ /** - * The default state manager for a cheat sheet. The data will be saved and restored + * The default state manager for a cheat sheet. The data will be saved and restored * using a file in metadata whose name is derived from the id */ @@ -37,7 +37,7 @@ public class NoSaveStateManager implements ICheatSheetStateManager { } @Override - public CheatSheetManager getCheatSheetManager() { + public CheatSheetManager getCheatSheetManager() { CheatSheetManager result = new CheatSheetManager(element); return result; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java index bf336d1be..b7092b164 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager; /** * A state manager used to pass cheat sheet state to and from a tray dialog. - * It does not save any data to a file, it just acts as a conduit between + * It does not save any data to a file, it just acts as a conduit between * two different CheatSheetViewers */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetEvent.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetEvent.java index 8eab7ddef..bd452f525 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetEvent.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetExpandRestoreAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetExpandRestoreAction.java index 2e1257070..746cb17b5 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetExpandRestoreAction.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetExpandRestoreAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,15 +38,15 @@ public class CheatSheetExpandRestoreAction extends Action { setImageDescriptor(collapseImage); setCollapsed(initValue); } - + /* * @see Action#actionPerformed */ @Override public void run() { - viewer.toggleExpandRestore(); + viewer.toggleExpandRestore(); } - + public boolean isCollapsed() { return collapsed; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetHelpPart.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetHelpPart.java index 994a834d8..b20c4fbd6 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetHelpPart.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetHelpPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,15 +33,15 @@ import org.eclipse.ui.internal.cheatsheets.state.ICheatSheetStateManager; * cheat sheets inside the ReusableHelpPart. */ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { - + public static final String ID = "cheatsheet-page"; //$NON-NLS-1$ - + private CheatSheetViewer viewer; private String id; - + /** * Constructs a new part. - * + * * @param parent the parent Composite that will contain the widgets * @param toolkit the form toolkit to use for creating the widgets * @param tbm the toolbar we will contribute to @@ -57,7 +57,7 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { /** * Contributes any actions we have to the toolbar. - * + * * @param tbm the toolbar to contribute to */ private void contributeToToolBar(IToolBarManager tbm) { @@ -70,7 +70,7 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { tbm.insertBefore("back", new Separator()); //$NON-NLS-1$ viewer.setExpandRestoreAction(expandRestoreAction); } - + /** * This part doesn't require a context menu. */ @@ -78,7 +78,7 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { public boolean fillContextMenu(IMenuManager manager) { return false; } - + /** * Returns the part's top Control. */ @@ -86,7 +86,7 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { public Control getControl() { return viewer.getControl(); } - + /** * This part doesn't use any global actions. */ @@ -94,28 +94,28 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { public IAction getGlobalAction(String id) { return null; } - + /** * Returns the part's unique identifier. - * + * * @param the unique id for the part */ @Override public String getId() { return id; } - + /** * Returns whether or not this part contains the given Control, which * is in focus. - * + * * @param control the Control in focus */ @Override public boolean hasFocusControl(Control control) { return viewer.hasFocusControl(control); } - + /** * Initializes the part. */ @@ -130,31 +130,31 @@ public class CheatSheetHelpPart extends AbstractFormPart implements IHelpPart { @Override public void refilter() { } - + /** * The cheat sheet automatically saves its state; no action required. */ @Override public void saveState(IMemento memento) { } - + /** * Sets the visibility of the part. - * + * * @param whether or not the part should be visible */ @Override public void setVisible(boolean visible) { viewer.getControl().setVisible(visible); } - + /** * No action needed for this part here. */ @Override public void stop() { } - + /** * No action needed for this part here. */ diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java index 105db8edb..74f8c9214 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2006 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,7 +33,7 @@ public class CheatSheetManager implements ICheatSheetManager { private List listeners; private Map dataTable = null; private ICheatSheetManager parent; - + public CheatSheetManager(CheatSheetElement element) { cheatsheetID = element.getID(); listeners = new ArrayList(); @@ -63,7 +63,7 @@ public class CheatSheetManager implements ICheatSheetManager { public Map getData() { return dataTable; } - + /** * Initialize all variables * @param data a map containg values for all variables @@ -78,7 +78,7 @@ public class CheatSheetManager implements ICheatSheetManager { return null; return (String) dataTable.get(key); } - + /** * Similar to get data except that if the key is prefixed with "parent." * get the data from the parent @@ -101,12 +101,12 @@ public class CheatSheetManager implements ICheatSheetManager { } return result; } - + /** * Substitute occurences of ${data} with values from the cheatsheetmanager. * @param input The input string * @param csm The cheatsheet manager - * @return The input string with substitutions made for any cheatsheet + * @return The input string with substitutions made for any cheatsheet * variables encountered. */ public String performVariableSubstitution(String input) @@ -154,9 +154,9 @@ public class CheatSheetManager implements ICheatSheetManager { dataTable.put(key, data); } - + /** - * Similar to setData except that if the key is prefixed by "parent." + * Similar to setData except that if the key is prefixed by "parent." * set the data in the parent. * @param qualifiedKey A key which may be prefixed by parent. * @param data The value to set @@ -186,7 +186,7 @@ public class CheatSheetManager implements ICheatSheetManager { public ICheatSheetManager getParent() { return parent; } - + public void setParent(ICheatSheetManager parent) { this.parent = parent; } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java index f1a889a6f..b98c6887d 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -58,11 +58,11 @@ public class CheatSheetPage extends Page implements IMenuContributor { @Override public void createPart(Composite parent) { - CheatSheetStopWatch.startStopWatch("CheatSheetPage.createPart()"); //$NON-NLS-1$ + CheatSheetStopWatch.startStopWatch("CheatSheetPage.createPart()"); //$NON-NLS-1$ super.createPart(parent); HyperlinkGroup hyperlinkGroup = toolkit.getHyperlinkGroup(); hyperlinkGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); - + CheatSheetStopWatch .printLapTime( "CheatSheetPage.createPart()", "Time in CheatSheetPage.createInfoArea() after super.createInfoArea(): "); //$NON-NLS-1$ //$NON-NLS-2$ @@ -105,7 +105,7 @@ public class CheatSheetPage extends Page implements IMenuContributor { /** * Creates the cheatsheet's title areawhich will consists of a title and * image. - * + * * @param parent * the SWT parent for the title area composite */ @@ -127,7 +127,7 @@ public class CheatSheetPage extends Page implements IMenuContributor { if (activeColor != null) activeColor.dispose(); - + if (introColor != null) introColor.dispose(); inactiveColor1 = null; @@ -146,7 +146,7 @@ public class CheatSheetPage extends Page implements IMenuContributor { RGB rgb; RGB white = new RGB(255, 255, 255); RGB black = new RGB(0, 0, 0); - + if (isReverseVideo()) { computeReverseVideoColors(display); return; @@ -168,8 +168,8 @@ public class CheatSheetPage extends Page implements IMenuContributor { rgb = FormColors.blend(rgb, white, 90); } // final check - if gray - if (Math.abs(rgb.blue-rgb.green) <5 && - Math.abs(rgb.blue-rgb.red)<5 && + if (Math.abs(rgb.blue-rgb.green) <5 && + Math.abs(rgb.blue-rgb.red)<5 && Math.abs(rgb.green-rgb.red)<5) { // blend with blue rgb = FormColors.blend(rgb, new RGB(100, 100, 255), 90); @@ -207,14 +207,14 @@ public class CheatSheetPage extends Page implements IMenuContributor { RGB white = new RGB(255, 255, 255); // Create new colors, they will get disposed RGB rgb = background.getRGB(); - activeColor = new Color(display, rgb ); + activeColor = new Color(display, rgb ); rgb = FormColors.blend(rgb, white, 85); inactiveColor1 = new Color(display, rgb); rgb = FormColors.blend(rgb, white, 85); - inactiveColor2 = new Color(display, rgb ); - introColor = new Color(display, rgb ); + inactiveColor2 = new Color(display, rgb ); + introColor = new Color(display, rgb ); } - + private boolean isReverseVideo() { Color bg = toolkit.getColors().getBackground(); return ((bg.getBlue() + bg.getRed() + bg.getGreen()) < 380); @@ -239,12 +239,12 @@ public class CheatSheetPage extends Page implements IMenuContributor { public FormToolkit getToolkit() { return toolkit; } - + private int contributeRestartItem(Menu menu, int index) { MenuItem item = new MenuItem(menu, SWT.PUSH, index++); item.setText(Messages.RESTART_MENU); item.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_RETURN)); - + item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetView.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetView.java index 051e27778..09828d0d8 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetView.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. + * Copyright (c) 2003, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,21 +32,21 @@ import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetRegistryReader; import org.eclipse.ui.part.ViewPart; public class CheatSheetView extends ViewPart { - + private boolean actionBarContributed = false; private CheatSheetExpandRestoreAction expandRestoreAction; private Action copyAction; private CheatSheetViewer viewer; private IMemento memento; private static final String CHEAT_SHEET_VIEW_HELP_ID = "org.eclipse.ui.cheatsheets.cheatSheetView"; //$NON-NLS-1$ - + private void contributeToActionBars() { IActionBars bars = getViewSite().getActionBars(); IMenuManager menuManager = bars.getMenuManager(); IToolBarManager tbmanager = bars.getToolBarManager(); - + expandRestoreAction = new CheatSheetExpandRestoreAction(Messages.COLLAPSE_ALL_BUT_CURRENT_TOOLTIP, false, viewer); - + copyAction = new Action("copy") { //$NON-NLS-1$ @Override public void run() { @@ -59,7 +59,7 @@ public class CheatSheetView extends ViewPart { viewer.setExpandRestoreAction(expandRestoreAction); viewer.setCopyAction(copyAction); - + CheatSheetMenu cheatsheetMenuMenuItem = new CheatSheetMenu(); menuManager.add(cheatsheetMenuMenuItem); @@ -94,7 +94,7 @@ public class CheatSheetView extends ViewPart { viewer = new CheatSheetViewer(false); viewer.createPartControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CHEAT_SHEET_VIEW_HELP_ID); - + if (!actionBarContributed) { contributeToActionBars(); actionBarContributed = true; @@ -114,7 +114,7 @@ public class CheatSheetView extends ViewPart { public void dispose() { super.dispose(); } - + public CheatSheetElement getContent() { if(viewer != null) { return viewer.getContent(); @@ -135,7 +135,7 @@ public class CheatSheetView extends ViewPart { public CheatSheetViewer getCheatSheetViewer() { return viewer; } - + @Override public void init(IViewSite site, IMemento memento) throws PartInitException { init(site); @@ -150,10 +150,10 @@ public class CheatSheetView extends ViewPart { if (contentMemento != null) { String id = contentMemento.getString(ICheatSheetResource.MEMENTO_ID); String name = contentMemento.getString(ICheatSheetResource.MEMENTO_NAME); - + // Using an if/else if here because at a point in time there was a different // attribute used. As a result an if/else could cause setInput(null) to be - // invoked but this would throw an IllegalArgumentException. + // invoked but this would throw an IllegalArgumentException. if(name != null) { try { URL fileURL = new URL(contentMemento.getString(ICheatSheetResource.MEMENTO_URL)); @@ -173,7 +173,7 @@ public class CheatSheetView extends ViewPart { CheatSheetElement element = viewer.getContent(); if(element == null) { - // Currently no cheat sheet is being displayed so just return + // Currently no cheat sheet is being displayed so just return return; } @@ -197,12 +197,12 @@ public class CheatSheetView extends ViewPart { * Passing the focus request to the viewer's control. */ @Override - public void setFocus() { + public void setFocus() { if(viewer != null) { viewer.setFocus(); } } - + public void setInput(String id) { CheatSheetStopWatch.startStopWatch("CheatSheetView.setInput"); //$NON-NLS-1$ @@ -222,6 +222,6 @@ public class CheatSheetView extends ViewPart { public void setInputFromXml(String id, String name, String xml, String basePath) { if(viewer != null) { viewer.setInputFromXml(id, name, xml, basePath); - } + } } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java index d09d0f0b4..b6e84f466 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Tom Hofmann, Perspectix AG - https://bugs.eclipse.org/bugs/show_bug.cgi?id=291750 @@ -109,24 +109,24 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { protected Composite control; private Cursor busyCursor; - + // The page currently displayed, may be a CheatSheetPage, CompositeCheatSheetPage // or ErrorPage - private Page currentPage; + private Page currentPage; private Label howToBegin; private boolean inDialog; private Listener listener; - + private ICheatSheetStateManager stateManager; // The state manager to use when saving private ICheatSheetStateManager preTrayManager; // The state manager in use before a tray was opened private String restorePath; - + private int dialogReturnCode; private boolean isRestricted; - + /** * The constructor. - * + * * @param inDialog whether or not this viewer will be placed in a modal dialog */ public CheatSheetViewer(boolean inDialog) { @@ -152,7 +152,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { /* LP-item event */ // fireManagerItemEvent(ICheatSheetItemEvent.ITEM_ACTIVATED, nextItem); collapseAllButCurrent(false); - + saveCurrentSheet(); } @@ -197,7 +197,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { introItem.setRestartImage(); } - /*package*/ + /*package*/ /* * This function can do one of three things * 1. If this item has a completion message which has not been displayed, display it @@ -208,9 +208,9 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { currentItem = (ViewItem) link.getData(); int indexNextItem = getIndexOfItem(currentItem) +1; boolean isFinalItem = indexNextItem >= viewItemList.size(); - - if (markAsCompleted - && currentItem.hasCompletionMessage() + + if (markAsCompleted + && currentItem.hasCompletionMessage() && !currentItem.isCompletionMessageExpanded()) { currentItem.setCompletionMessageExpanded(isFinalItem); currentItem.setComplete(); @@ -314,8 +314,8 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } else if (allAttempted && anySkipped) { advanceItem(link, false); return; - } - + } + setFocus(); saveCurrentSheet(); } @@ -346,20 +346,20 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { Properties props = stateManager.getProperties(); manager = stateManager.getCheatSheetManager(); - + // There is a bug which causes the background of the buttons to // remain white, even though the color is set. So instead of calling // clearBackgrounds() only the following line should be needed. D'oh! // ((ViewItem) viewItemList.get(0)).setOriginalColor(); clearBackgrounds(); - + if (props == null) { getViewItemAtIndex(0).setAsCurrentActiveItem(); /* LP-item event */ // fireManagerItemEvent(ICheatSheetItemEvent.ITEM_ACTIVATED, items[0]); return true; } - + boolean buttonIsDown = (Integer.parseInt((String) props.get(IParserTags.BUTTON)) == 0) ? false : true; int itemNum = Integer.parseInt((String) props.get(IParserTags.CURRENT)); ArrayList completedStatesList = (ArrayList) props.get(IParserTags.COMPLETED); @@ -368,35 +368,35 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { String cid = (String) props.get(IParserTags.ID); Hashtable completedSubItems = (Hashtable) props.get(IParserTags.SUBITEMCOMPLETED); Hashtable skippedSubItems = (Hashtable) props.get(IParserTags.SUBITEMSKIPPED); - + ArrayList completedSubItemsItemList = new ArrayList(); ArrayList skippedSubItemsItemList = new ArrayList(); - + Enumeration e = completedSubItems.keys(); while (e.hasMoreElements()) completedSubItemsItemList.add(e.nextElement()); - + Enumeration e2 = skippedSubItems.keys(); while (e2.hasMoreElements()) skippedSubItemsItemList.add(e2.nextElement()); - + if (cid != null) currentID = cid; - + if (itemNum >= 0) { currentItemNum = itemNum; - + currentItem = getViewItemAtIndex(itemNum); - + CheatSheetStopWatch.startStopWatch("CheatSheetViewer.checkSavedState()"); //$NON-NLS-1$ for (int i = 0; i < viewItemList.size(); i++) { - + ViewItem item = getViewItemAtIndex(i); if (i > 0 && item.item.isDynamic() && i <= currentItemNum) { item.handleButtons(); item.setOriginalColor(); } - + if (completedStatesList.contains(Integer.toString(i))) { item.setComplete(); item.setRestartImage(); @@ -440,7 +440,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { s.getStartButton().setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_RESTART)); s.getStartButton().setToolTipText(Messages.RESTART_TASK_TOOLTIP); } - + } } } @@ -459,30 +459,30 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { CheatSheetStopWatch.printLapTime("CheatSheetViewer.checkSavedState()", "Time in CheatSheetViewer.checkSavedState() after loop #"+i+": "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } CheatSheetStopWatch.printLapTime("CheatSheetViewer.checkSavedState()", "Time in CheatSheetViewer.checkSavedState() after loop: "); //$NON-NLS-1$ //$NON-NLS-2$ - + if (buttonIsDown) { if(expandRestoreAction != null) expandRestoreAction.setCollapsed(true); } - + // If the last item is the current one and it is complete then // we should collapse the last item and set the focus on intro. // For all other cases, set the current item as the active item. if(viewItemList.size()-1 == itemNum && currentItem.isCompleted()) { currentItem.setCollapsed(); getViewItemAtIndex(0).getMainItemComposite().setFocus(); - + // The cheat sheet has been restored but is also completed so fire both events getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_RESTORED); getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_COMPLETED); } else { currentItem.setAsCurrentActiveItem(); - + // If the intro item is completed, than the cheat sheet has been restored. if(getViewItemAtIndex(0).isCompleted()) getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_RESTORED); } - + /* LP-item event */ // fireManagerItemEvent(ICheatSheetItemEvent.ITEM_ACTIVATED, currentItem); } else { @@ -490,23 +490,23 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { /* LP-item event */ // fireManagerItemEvent(ICheatSheetItemEvent.ITEM_ACTIVATED, items[0]); } - + return true; } catch(Exception e) { // An exception while restoring the saved state data usually only occurs if // the cheat sheet has been modified since this previous execution. This most // often occurs during development of cheat sheets and as such an end user is // not as likely to encounter this. - - boolean reset = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + + boolean reset = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.CHEATSHEET_STATE_RESTORE_FAIL_TITLE, Messages.CHEATSHEET_STATE_RESET_CONFIRM); if (reset) { restart(); return true; - } - + } + // Log the exception String stateFile = saveHelper.getStateFile(currentID).toOSString(); String message = NLS.bind(Messages.ERROR_APPLYING_STATE_DATA_LOG, (new Object[] {stateFile, currentID})); @@ -525,7 +525,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { currentPage = null; expandRestoreList = new ArrayList(); viewItemList = new ArrayList(); - + // Create the errorpage to show the user createErrorPage(Messages.ERROR_APPLYING_STATE_DATA); @@ -583,7 +583,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { currentPage.createPart(control); control.layout(true); } - + private void showStartPage() { setCollapseExpandButtonEnabled(false); internalDispose(); @@ -594,7 +594,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { currentPage = null; control.layout(true); } - + private void createErrorPage(IStatus status) { setCollapseExpandButtonEnabled(false); currentPage = new ErrorPage(status); @@ -639,7 +639,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { dispose(); } }); - + showStartPage(); Display display = parent.getDisplay(); @@ -655,7 +655,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { * Called when any TrayDialog is opened. The viewer must react by disabling * itself and moving the cheat sheet to the dialog's tray if the current item * was flagged as one that opens a modal dialog. - * + * * @param dialog the dialog that was opened */ private void dialogOpened(final TrayDialog dialog) { @@ -677,7 +677,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { page.addPart(CheatSheetHelpPart.ID, true); helpPart.addPage(page); helpPart.showPage(CheatSheetHelpPart.ID); - + /* * Disable the viewer until the tray is closed, then show it again. */ @@ -710,18 +710,18 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } /* - * Returns the cheat sheet being viewed. + * Returns the cheat sheet being viewed. */ public ICheatSheet getCheatSheet() { return model; } - + @Override public String getCheatSheetID() { if(getContent() != null) { return getContent().getID(); } - + return null; } @@ -758,7 +758,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { manager = new CheatSheetManager(contentElement); return manager; } - + private CheatSheetManager initManager(){ CheatSheetManager csManager = getManager(); csManager.setData(new Hashtable()); @@ -771,22 +771,22 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } return null; } - + /** * Returns whether or not this viewer contains the given Control, which * is currently in focus. - * + * * @param control the Control currently in focus * @return whether this viewer contains the given Control or not */ public boolean hasFocusControl(Control control) { return (control == this.control) || (currentPage.getControl() == control); } - + /** * If in a dialog-opening step, will add the appropriate listener for * the cheatsheet to jump into the dialog's tray once opened. - * + * * Should be called before executing any action. */ private void hookDialogListener() { @@ -806,10 +806,10 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { Display.getCurrent().addFilter(SWT.Show, listener); } } - + /** * Removes the dialog-opening listener, if it was added. - * + * * Should be called after executing any action. */ private void unhookDialogListener() { @@ -817,7 +817,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { Display.getCurrent().removeFilter(SWT.Show, listener); } } - + /* * return true if a cheat sheet was opened successfully */ @@ -837,22 +837,22 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { // Reset the page variable currentPage = null; - + if(howToBegin != null) { howToBegin.dispose(); howToBegin = null; } - + // If a null cheat sheet id was specified, return leaving the cheat sheet empty. if(nullCheatSheetId) { return false; } - + if(invalidCheatSheetId) { createErrorPage(Messages.ERROR_CHEATSHEET_DOESNOT_EXIST); return false; } - + // read our contents, if there are problems reading the file an error page should be created. CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() before readFile() call: "); //$NON-NLS-1$ //$NON-NLS-2$ IStatus parseStatus = readFile(); @@ -868,13 +868,13 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { createErrorPage(parseStatus); return false; } - + control.setRedraw(false); - if (model instanceof CheatSheet) { + if (model instanceof CheatSheet) { CheatSheet cheatSheetModel = (CheatSheet)model; if (isRestricted && cheatSheetModel.isContainsCommandOrAction()) { - boolean isOK = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + boolean isOK = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.CHEATSHEET_FROM_URL_WITH_EXEC_TITLE, Messages.CHEATSHEET_FROM_URL_WITH_EXEC); @@ -882,9 +882,9 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { control.setRedraw(true); showStartPage(); return true; - } + } } - + currentPage = new CheatSheetPage(cheatSheetModel, viewItemList, this); setCollapseExpandButtonEnabled(true); } else if (model instanceof CompositeCheatSheetModel) { @@ -898,9 +898,9 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { currentPage.createPart(control); CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after CheatSheetPage.createPart() call: "); //$NON-NLS-1$ //$NON-NLS-2$ - if (model instanceof CheatSheet) { + if (model instanceof CheatSheet) { CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after fireEvent() call: "); //$NON-NLS-1$ //$NON-NLS-2$ - + if(!loadState()) { // An error occurred when apply the saved state data. control.setRedraw(true); @@ -926,7 +926,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { private void internalDispose() { if(manager != null) manager.fireEvent(ICheatSheetEvent.CHEATSHEET_CLOSED); - + saveCurrentSheet(); for (Iterator iter = viewItemList.iterator(); iter.hasNext();) { @@ -943,7 +943,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { /** * Returns whether or not the cheat sheet viewer is currently active. This * means it is visible to the user and enabled. - * + * * @return whether or not this viewer is active */ private boolean isActive() { @@ -954,7 +954,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } return false; } - + /* * Show the collapse/expand button if we have access to the toolbar */ @@ -967,7 +967,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { /** * Returns whether or not the currently active item requires opening a * modal dialog. - * + * * @return whether the current item opens a modal dialog */ private boolean isInDialogItem() { @@ -976,20 +976,20 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } return false; } - + /** * Returns whether or not this cheat sheet viewer is inside a modal * dialog. - * + * * @return whether this viewer is inside a modal dialog */ public boolean isInDialogMode() { return inDialog; } - + /** * Returns whether the given widget is a TrayDialog. - * + * * @param widget the widget to check * @return whether or not the widget is a TrayDialog */ @@ -1007,14 +1007,14 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { // If the cheat sheet was registered then // search for a specific type - composite or simple int cheatSheetKind = CheatSheetParser.ANY; - if (contentElement.isRegistered()) { + if (contentElement.isRegistered()) { if (contentElement.isComposite()) { cheatSheetKind = CheatSheetParser.COMPOSITE_ONLY; } else { cheatSheetKind = CheatSheetParser.SIMPLE_ONLY; } } - + model = parser.parse(parserInput, cheatSheetKind); return parser.getStatus(); } @@ -1032,7 +1032,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } catch (Exception e) { } } - + /*package*/ void runPerformExecutable(ImageHyperlink link) { link.setCursor(busyCursor); currentItem = (ViewItem) link.getData(); @@ -1046,7 +1046,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { IStatus status = coreItem.runExecutable(getManager()); if ( status.getSeverity() == IStatus.ERROR) { CheatSheetPlugin.getPlugin().getLog().log(status); - org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status); + org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status); } if (page != currentPage) { // action closed the cheatsheet view or changed the cheatsheet @@ -1110,23 +1110,23 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } } } - + private boolean getExpandRestoreActionState() { boolean expandRestoreActionState = false; if(expandRestoreAction != null) expandRestoreActionState = expandRestoreAction.isCollapsed(); - return expandRestoreActionState; + return expandRestoreActionState; } /*package*/ void setContent(CheatSheetElement element, ICheatSheetStateManager inputStateManager) { CheatSheetStopWatch.startStopWatch("CheatSheetViewer.setContent(CheatSheetElement element)"); //$NON-NLS-1$ - + // Cleanup previous contents internalDispose(); // Set the current content to new content contentElement = element; - stateManager = inputStateManager; + stateManager = inputStateManager; stateManager.setElement(element); currentID = null; @@ -1145,7 +1145,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { contentElement = null; stateManager = null; } - // If the cheat sheet failed to open clear the content element so we don't see an + // If the cheat sheet failed to open clear the content element so we don't see an CheatSheetStopWatch.printLapTime("CheatSheetViewer.setContent(CheatSheetElement element)", "Time in CheatSheetViewer.setContent() after initCheatSheetView() call: "); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -1155,10 +1155,10 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { URL contentURL = null; restorePath = element.getRestorePath(); String errorMessage = null; - + if (contentXml != null) { parserInput = new ParserInput(contentXml, element.getHref()); - return; + return; } // The input was not an XML string, find the content URL @@ -1189,8 +1189,8 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { String pluginId = bundle != null ? bundle.getSymbolicName() : null; parserInput = new ParserInput(contentURL, pluginId, errorMessage); } - - + + /*package*/ void setExpandRestoreAction(CheatSheetExpandRestoreAction action) { expandRestoreAction = action; } @@ -1207,7 +1207,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { getControl().setFocus(); } } - + @Override public void setInput(String id) { @@ -1249,7 +1249,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { public void setInput(String id, String name, URL url) { setInput(id, name, url, new DefaultStateManager(), false); } - + public void setInputFromXml(String id, String name, String xml, String basePath) { if (id == null || name == null || xml == null) { throw new IllegalArgumentException(); @@ -1265,7 +1265,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { setContent(element, new NoSaveStateManager()); } - public void setInput(String id, String name, URL url, + public void setInput(String id, String name, URL url, ICheatSheetStateManager inputStateManager, boolean isRestricted) { if (id == null || name == null || url == null) { throw new IllegalArgumentException(); @@ -1279,7 +1279,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { this.isRestricted = isRestricted; setContent(element, inputStateManager); } - + /*package*/ void toggleExpandRestore() { if(expandRestoreAction == null) return; @@ -1301,7 +1301,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { public void setCopyAction(Action copyAction) { this.copyAction = copyAction; } - + public void copy() { if (currentItem!=null) currentItem.copy(); @@ -1309,7 +1309,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { public void addListener(CheatSheetListener listener) { if (contentElement != null ) { - getManager().addListener(listener); + getManager().addListener(listener); } } @@ -1320,14 +1320,14 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { } return index; } - + public void restart() { resetItemState(); currentItemNum = 0; collapseAllButCurrent(false); IntroItem introItem = (IntroItem) getViewItemAtIndex(0); introItem.setIncomplete(); - showIntroItem(); + showIntroItem(); } public void saveState(IMemento memento) { @@ -1344,16 +1344,16 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor { getManager().setData(cheatSheetData); } else if (currentPage instanceof CompositeCheatSheetPage) { ((CompositeCheatSheetPage)currentPage).restart(cheatSheetData); - } + } } - + public void showError(String message) { internalDispose(); if(howToBegin != null) { howToBegin.dispose(); howToBegin = null; } - createErrorPage(message); + createErrorPage(message); } }
\ No newline at end of file diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java index 654100590..195ab77cf 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -113,7 +113,7 @@ public class CoreItem extends ViewItem { private void createSubItemButtonComposite() { buttonComposite = page.getToolkit().createComposite(bodyWrapperComposite); - + TableWrapLayout xbuttonlayout = new TableWrapLayout(); xbuttonlayout.numColumns = SUBITEM_COLUMNS; xbuttonlayout.leftMargin = 0; @@ -134,7 +134,7 @@ public class CoreItem extends ViewItem { } final int LABEL_MARGIN = 5; // space to the left and right of the label SubItemCompositeHolder holder = new SubItemCompositeHolder(sub); - + //Spacer label added. Label checkDoneLabel = page.getToolkit().createLabel(buttonComposite, null); checkDoneLabel.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_COMPLETE)); @@ -156,7 +156,7 @@ public class CoreItem extends ViewItem { formText.setText(labelText, labelText.startsWith(IParserTags.FORM_START_TAG), false); formText.setBackground(itemColor); subItemLabel = formText; - } else { + } else { Text text = new Text(buttonComposite, SWT.READ_ONLY + SWT.WRAP); text.setText(labelText); text.setBackground(itemColor); @@ -167,9 +167,9 @@ public class CoreItem extends ViewItem { subItemLabel.setLayoutData(labelData); holder.setSubitemLabel(subItemLabel); added++; - + // Add some space to the right of the label - + Label spacer = page.getToolkit().createLabel(buttonComposite, null); TableWrapData spacerData = new TableWrapData(); spacerData.maxWidth = 0; @@ -184,7 +184,7 @@ public class CoreItem extends ViewItem { } else { subExecutable = sub.getExecutable(); } - + /* * Actions are disabled while inside dialogs. */ @@ -244,7 +244,7 @@ public class CoreItem extends ViewItem { TableWrapData padData = new TableWrapData(); padData.maxWidth = 0; pad.setLayoutData(padData); - Label separator = new Label(buttonComposite, SWT.SEPARATOR + SWT.HORIZONTAL); + Label separator = new Label(buttonComposite, SWT.SEPARATOR + SWT.HORIZONTAL); TableWrapData separatorData = new TableWrapData(); separatorData.align = TableWrapData.FILL; separatorData.grabHorizontal = true; @@ -348,7 +348,7 @@ public class CoreItem extends ViewItem { Control control = children[i]; control.dispose(); } - + refreshRequired = true; } else { createSubItemButtonComposite(); @@ -380,13 +380,13 @@ public class CoreItem extends ViewItem { } SubItem sub = (SubItem)repeatedSubItem.getSubItems().get(0); - + StringTokenizer tokenizer = new StringTokenizer(values, ","); //$NON-NLS-1$ while(tokenizer.hasMoreTokens()) { String value = tokenizer.nextToken(); createSubItemButtons(sub, value, i++); } - + // Decrement the counter by because the outer loop increments it prior to the next iteration i--; } else if( subItem instanceof ConditionalSubItem ) { @@ -429,7 +429,7 @@ public class CoreItem extends ViewItem { control.dispose(); } } - + refreshRequired = true; } else { createButtonComposite(); @@ -439,7 +439,7 @@ public class CoreItem extends ViewItem { AbstractExecutable performExecutable = item.getPerformWhen().getSelectedExecutable(); createButtons(performExecutable); - + if(refreshRequired) { refresh(buttonComposite); } @@ -452,7 +452,7 @@ public class CoreItem extends ViewItem { listOfSubItemCompositeHolders = new ArrayList(20); ArrayList sublist = item.getSubItems(); - + createSubItemButtonComposite(); //loop throught the number of sub items, make a new composite for each sub item. @@ -462,7 +462,7 @@ public class CoreItem extends ViewItem { } buttonsHandled = true; } - + /*package*/ boolean hasConfirm() { AbstractExecutable executable = getExecutable(); @@ -502,16 +502,16 @@ public class CoreItem extends ViewItem { return buffer.toString(); } - + /*package*/ IStatus runExecutable(CheatSheetManager csm) { - return runExecutable(getExecutable(), csm); + return runExecutable(getExecutable(), csm); } - + IStatus runExecutable(AbstractExecutable executable, CheatSheetManager csm) { if(executable != null) { return executable.execute(csm); - } + } return Status.OK_STATUS; } @@ -528,12 +528,12 @@ public class CoreItem extends ViewItem { csm.setData("this", s.getThisValue()); //$NON-NLS-1$ } IStatus status = runExecutable(executable, csm); - if ( status.isOK()) { + if ( status.isOK()) { return VIEWITEM_ADVANCE; } if ( status.getSeverity() == IStatus.ERROR) { CheatSheetPlugin.getPlugin().getLog().log(status); - org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status); + org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status); } return VIEWITEM_DONOT_ADVANCE; } finally { @@ -550,11 +550,11 @@ public class CoreItem extends ViewItem { /*package*/void setButtonsHandled(boolean handled){ buttonsHandled = handled; } - + /*package*/ @Override void setIncomplete() { super.setIncomplete(); - + //check for sub items and reset their icons. ArrayList l = getListOfSubItemCompositeHolders(); if(l != null){ @@ -563,11 +563,11 @@ public class CoreItem extends ViewItem { if(s.isCompleted() || s.isSkipped()) s.getCheckDoneLabel().setVisible(false); //setImage(null); if(s.getStartButton() != null) { - s.getStartButton().setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_START)); + s.getStartButton().setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_START)); s.getStartButton().setToolTipText(Messages.PERFORM_TASK_TOOLTIP); } - } - } + } + } } /*package*/ @Override @@ -596,8 +596,8 @@ public class CoreItem extends ViewItem { boolean hasCompletionMessage() { return item.getCompletionMessage() != null; } - - + + @Override void createCompletionComposite(boolean isFinalItem) { String completionMessage = viewer.getManager().performVariableSubstitution @@ -621,8 +621,8 @@ public class CoreItem extends ViewItem { final ImageHyperlink completeButton = createButtonWithText( completionComposite, getCompletionButtonIcon(isFinalItem), - this, - backgroundColor, + this, + backgroundColor, getCompletionButtonTooltip(isFinalItem)); completeButton.addHyperlinkListener(new HyperlinkAdapter() { @Override @@ -650,26 +650,26 @@ public class CoreItem extends ViewItem { .getImage( ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_COMPLETE); } - + private String getCompletionButtonTooltip(boolean isFinalItem) { if (isFinalItem) { return Messages.RETURN_TO_INTRO_TOOLTIP; } - return Messages.ADVANCE_TASK_TOOLTIP; + return Messages.ADVANCE_TASK_TOOLTIP; } - + private void refresh(Composite composite) { composite.layout(); getMainItemComposite().layout(); page.getForm().reflow(true); } - + public void refreshItem() { if (buttonComposite != null) { refresh(buttonComposite); } } - + @Override protected void setFocus() { ArrayList list = getListOfSubItemCompositeHolders(); @@ -681,7 +681,7 @@ public class CoreItem extends ViewItem { if (!holder.isCompleted() && !holder.isSkipped()) { subitemLabel = holder.getSubitemLabel(); } - } + } } if (subitemLabel != null) { FormToolkit.ensureVisible(subitemLabel); @@ -695,5 +695,5 @@ public class CoreItem extends ViewItem { super.setFocus(); } } - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java index 57ed099ff..fd5c0a0d3 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2002, 2008 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -26,7 +26,7 @@ import org.eclipse.ui.internal.cheatsheets.Messages; public class ErrorPage extends Page { - + /* * Class used to sort status with errors first, then warnings */ @@ -34,11 +34,11 @@ public class ErrorPage extends Page { private List errors = new ArrayList(); private List warnings = new ArrayList(); private List info = new ArrayList(); - + public StatusSorter(IStatus status) { sortStatus(status); } - + private void sortStatus(IStatus status) { if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); @@ -56,9 +56,9 @@ public class ErrorPage extends Page { default: info.add(status); } - } + } } - + public List getSortedStatus() { List result = new ArrayList(); result.addAll(errors); @@ -70,14 +70,14 @@ public class ErrorPage extends Page { private String message; private IStatus status; - + public ErrorPage() { } public ErrorPage(String errorMessage) { this.message = errorMessage; } - + public ErrorPage(IStatus status) { this.status = status; } @@ -96,7 +96,7 @@ public class ErrorPage extends Page { } Label errorLabel = toolkit.createLabel(form.getBody(), errorString, SWT.WRAP); errorLabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); - } + } } private void showStatus(IStatus status) { @@ -109,10 +109,10 @@ public class ErrorPage extends Page { Label messageLabel = toolkit.createLabel(form.getBody(), nextStatus.getMessage(), SWT.WRAP); TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB); layoutData.indent = 10; - messageLabel.setLayoutData(layoutData); + messageLabel.setLayoutData(layoutData); } } - + /** * Return the image for a status message * @@ -120,7 +120,7 @@ public class ErrorPage extends Page { */ private Image getImage(int severity) { switch(severity) { - case IStatus.ERROR: + case IStatus.ERROR: return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.ERROR); case IStatus.WARNING: return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.WARNING); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/IntroItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/IntroItem.java index 06d739f87..bcd8cf22f 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/IntroItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/IntroItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -87,7 +87,7 @@ public class IntroItem extends ViewItem { @Override void createCompletionComposite(boolean isFinalItem) { - // Not called + // Not called } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/Page.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/Page.java index 35172ceb2..6ba7cb17e 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/Page.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/Page.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -73,7 +73,7 @@ public abstract class Page { CheatSheetStopWatch .printLapTime( - "Page.createInfoArea()", "Time in Page.createInfoArea() end of method: "); //$NON-NLS-1$ //$NON-NLS-2$ + "Page.createInfoArea()", "Time in Page.createInfoArea() end of method: "); //$NON-NLS-1$ //$NON-NLS-2$ } public void dispose() { @@ -96,5 +96,5 @@ public abstract class Page { protected abstract String getTitle(); public abstract void initialized(); - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java index f284d7c5c..6e9c8dbd7 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/SubItemCompositeHolder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ public class SubItemCompositeHolder { private Control skipButton; private Control completeButton; private Control subitemLabel; - + SubItemCompositeHolder(SubItem subItem) { super(); this.subItem = subItem; @@ -95,7 +95,7 @@ public class SubItemCompositeHolder { public SubItem getSubItem() { return subItem; } - + /** * Hide or reveal all the action/complete/skip buttons * @param isVisible @@ -115,11 +115,11 @@ public class SubItemCompositeHolder { public void setSubitemLabel(Control label) { this.subitemLabel = label; } - + public Control getSubitemLabel() { return subitemLabel; } - + public void setStartButton(ImageHyperlink startButton) { this.startButton = startButton; } @@ -145,6 +145,6 @@ public class SubItemCompositeHolder { } public void setCheckDoneLabel(Label checkDoneLabel) { - this.checkDoneLabel = checkDoneLabel; + this.checkDoneLabel = checkDoneLabel; } } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java index 2a96d3b82..2eef391fc 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -118,7 +118,7 @@ public abstract class ViewItem { } CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after create mainItemComposite: "); //$NON-NLS-1$ //$NON-NLS-2$ - + mainItemComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { @@ -173,7 +173,7 @@ public abstract class ViewItem { mainItemComposite.setTextClient(titleComposite); GridLayout layout = new GridLayout(number, false); GridData data = new GridData(GridData.FILL_BOTH); - + titleComposite.setLayout(layout); titleComposite.setLayoutData(data); layout.marginWidth = 0; @@ -216,7 +216,7 @@ public abstract class ViewItem { // bodyText = toolkit.createLabel(bodyWrapperComposite, item.getDescription(), SWT.WRAP); bodyText.setText(item.getDescription(), item.getDescription().startsWith(IParserTags.FORM_START_TAG), false); - //Set up the body text portion here. + //Set up the body text portion here. bodyText.setBackground(itemColor); bodyText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after create FormText: "); //$NON-NLS-1$ //$NON-NLS-2$ @@ -242,7 +242,7 @@ public abstract class ViewItem { } regularFont = new Font(mainItemComposite.getDisplay(), fontDatas); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after font initlization: "); //$NON-NLS-1$ //$NON-NLS-2$ - + setBold(false); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after setBold: "); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -277,7 +277,7 @@ public abstract class ViewItem { bodyText.dispose(); if (buttonComposite != null) buttonComposite.dispose(); - if (completionComposite != null) + if (completionComposite != null) completionComposite.dispose(); if (bodyComp != null) bodyComp.dispose(); @@ -353,7 +353,7 @@ public abstract class ViewItem { public boolean isExpanded() { return mainItemComposite.isExpanded(); } - + public boolean isCompletionMessageExpanded() { return completionMessageExpanded; } @@ -361,13 +361,13 @@ public abstract class ViewItem { /** * Returns whether or not cheat sheet viewer containing this item is in * a modal dialog. - * + * * @return whether the cheat sheet viewer is in a modal dialog */ public boolean isInDialogMode() { return viewer.isInDialogMode(); } - + /*package*/ boolean isSkipped() { return isSkipped; @@ -436,7 +436,7 @@ public abstract class ViewItem { setBackgroundColor(buttonComposite, color); setBackgroundColor(completionComposite, color); } - + /* * Set the background color of this composite and its children. * If the composite is null do nothing. @@ -464,7 +464,7 @@ public abstract class ViewItem { } bold = value; } - + //collapse or expand the item /*package*/ void setButtonsVisible(boolean isVisible) { @@ -477,13 +477,13 @@ public abstract class ViewItem { buttonComposite.setVisible(isVisible); } } - + if(isVisible && initialized) { FormToolkit.ensureVisible(getMainItemComposite()); } buttonExpanded = isVisible; } - + protected void setCompletionMessageExpanded(boolean isFinalItem) { if (hasCompletionMessage()) { if (completionComposite == null) { @@ -495,12 +495,12 @@ public abstract class ViewItem { } } } - + abstract void createCompletionComposite(boolean isFinalItem); protected void setCompletionMessageCollapsed() { if (completionComposite != null) { - if (completionMessageExpanded) { + if (completionMessageExpanded) { completionComposite.dispose(); completionComposite = null; page.getForm().reflow(true); @@ -534,7 +534,7 @@ public abstract class ViewItem { //marks the item as complete. /*package*/ void setComplete() { - completed = true; + completed = true; checkDoneLabel.setImage(getCompleteImage()); if(initialized) { @@ -606,7 +606,7 @@ public abstract class ViewItem { public void initialized() { initialized = true; } - + public boolean canCopy() { return (bodyText!=null && !bodyText.isDisposed())?bodyText.canCopy():false; } @@ -614,7 +614,7 @@ public abstract class ViewItem { if (bodyText!=null && !bodyText.isDisposed()) bodyText.copy(); } - + abstract boolean hasCompletionMessage(); } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java index 43557c701..3ebbd5b1a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewUtilities.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class ViewUtilities { if (message.indexOf('&') < 0) { return message; } - + int next = 0; StringBuffer result = new StringBuffer(); int index = message.indexOf('&'); @@ -48,7 +48,7 @@ public class ViewUtilities { result.append(message.substring(next)); return result.toString(); } - + /** * Get the cheaetSheetView, opening it if necessary and making visible * @return The cheat sheet view, or null if it could not be opened. @@ -74,5 +74,5 @@ public class ViewUtilities { } return view; } - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheet.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheet.java index a00c5e9d1..2b2631d7c 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheet.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,8 +14,8 @@ package org.eclipse.ui.internal.provisional.cheatsheets; import org.eclipse.ui.cheatsheets.ICheatSheetManager; /** - * Interface representing a composite cheatsheet. - * A composite cheat sheet has a single root task, each task may have + * Interface representing a composite cheatsheet. + * A composite cheat sheet has a single root task, each task may have * zero or more children. * <p> * This interface is not intended to be implemented by clients. @@ -23,7 +23,7 @@ import org.eclipse.ui.cheatsheets.ICheatSheetManager; */ public interface ICompositeCheatSheet { - + /** * The ID of the task explorer that should be the * default for this composite cheat sheet. Can be null. @@ -31,13 +31,13 @@ public interface ICompositeCheatSheet { * the view's default should be used. */ String getTaskExplorerId(); - + /** * The root task of this composite cheat sheet * @return the root task object */ ICompositeCheatSheetTask getRootTask(); - + /** * Get the manager which allows data to be shared between tasks. * @return the CheatSheetManager for this composite cheat cheet. May not be null. diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java index 0a731c002..16a83841d 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ICompositeCheatSheetTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -58,23 +58,23 @@ public interface ICompositeCheatSheetTask { * @return the parameter names and values as specified in the * composite cheatsheet content file. */ - public Dictionary getParameters(); + public Dictionary getParameters(); /** - * Returns the description of the task. - * @return a plain String, or XML markup that can + * Returns the description of the task. + * @return a plain String, or XML markup that can * be understood by FormText widget. * @see org.eclipse.ui.forms.widgets.FormText */ public String getDescription(); - + /** * Gets the text to be displayed when this task is completed - * @return a plain String, or XML markup that can + * @return a plain String, or XML markup that can * be understood by FormText widget. * @see org.eclipse.ui.forms.widgets.FormText */ public String getCompletionMessage(); - + /** * Get the subtasks of this task. Each subtask may be * a task group or editable task. If the task is an editable task @@ -82,10 +82,10 @@ public interface ICompositeCheatSheetTask { * @return an array of subtasks for this task */ public ICompositeCheatSheetTask [] getSubtasks(); - + /** - * get the tasks which are required to be completed - * before this task is started. + * get the tasks which are required to be completed + * before this task is started. * @return an array of tasks that must be completed * before this task can be started. The array will be * empty if this tasks is independent of other tasks. @@ -95,26 +95,26 @@ public interface ICompositeCheatSheetTask { /** * Determine whether the required tasks for this task have * all been completed. - * @return true if there are noi required tasks or all required + * @return true if there are noi required tasks or all required * tasks have been completed. */ public boolean requiredTasksCompleted(); - + /** * Get the state of this task * @return NOT_STARTED, IN_PROGRESS, SKIPPED or COMPLETED. */ public int getState(); - + /** * Get the enclosing composite cheat sheet * @return the composite cheat sheet which contains this task */ public ICompositeCheatSheet getCompositeCheatSheet(); - + /** * Get the parent task group - * @return The task group which contains this task or <code>null</code> + * @return The task group which contains this task or <code>null</code> * if this is the root of the composite cheat sheet. */ public ITaskGroup getParent(); @@ -123,7 +123,7 @@ public interface ICompositeCheatSheetTask { * Test whether this task can be skipped. Skippable tasks are optional * tasks which are identified in the content file by having the attribute * <code>skip = "true"</code>. Only skippable tasks can be skipped. - * @return true if this task has the skip attribute set to true in the + * @return true if this task has the skip attribute set to true in the * content file. */ public boolean isSkippable(); diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/IEditableTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/IEditableTask.java index 8348f5cb3..47a8d1988 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/IEditableTask.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/IEditableTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,17 +23,17 @@ import java.net.URL; */ public interface IEditableTask extends ICompositeCheatSheetTask { - + /** * Set the state of this task to COMPLETED */ public void complete(); - + /** - * Gets a URL which can be used to open the content file for this + * Gets a URL which can be used to open the content file for this * task if the content file is specified by a path. * @param path the path to the content file - * @throws MalformedURLException + * @throws MalformedURLException * @return a URL to the content file */ public URL getInputUrl(String path) throws MalformedURLException; diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ITaskGroup.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ITaskGroup.java index 050ba9788..beb6414a7 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ITaskGroup.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/ITaskGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,24 +21,24 @@ package org.eclipse.ui.internal.provisional.cheatsheets; */ public interface ITaskGroup extends ICompositeCheatSheetTask { - + /** * A task kind of <b>set</b> indicates that this task is complete when * all subtasks have been completed. */ public static final String SET = "set"; //$NON-NLS-1$ - + /** * A task kind of <b>set</b> indicates that this task is complete when - * all subtasks have been completed. The subtasks must be completed in + * all subtasks have been completed. The subtasks must be completed in * order. */ public static final String SEQUENCE = "sequence"; //$NON-NLS-1$ - + /** * A task kind of <b>choice</b> indicates that this task is complete when * any of its children has been completed. */ public static final String CHOICE = "choice"; //$NON-NLS-1$ - + } diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskEditor.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskEditor.java index 5b8ed96e7..e05861e1a 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskEditor.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; * An editor which provides the UI for a task within a composite cheat sheet. * A task editor is responsible for saving the state of the task whenever * it changes. - * + * */ public abstract class TaskEditor { @@ -41,7 +41,7 @@ public abstract class TaskEditor { * Starts editing the provided task. The editor is responsible * for saving its state. createControl() will always be called before setInput(). * @param task The task associated with this editor - * @param memento The state of this task saved from a previous invocation. + * @param memento The state of this task saved from a previous invocation. * The memento will be <b>null</b> if the task has not been previously started * or if it is being restarted. If the editor is being restored from a previous * session the memento will contain the last saved state. diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskExplorer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskExplorer.java index 899345d77..8588d35bd 100644 --- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskExplorer.java +++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/provisional/cheatsheets/TaskExplorer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,7 +34,7 @@ public abstract class TaskExplorer { /** * Create a control which will display the structure of the composite cheat * sheet and allow tasks within the composite cheat sheet to be selected. - * + * * @param parent * @param toolkit */ @@ -42,7 +42,7 @@ public abstract class TaskExplorer { /** * Get the control created by a previous call to createControl - * + * * @return the task explorer control */ public abstract Control getControl(); @@ -55,7 +55,7 @@ public abstract class TaskExplorer { /** * Get the selection provider for this explorer. The selections returned by * the selection provider should represent IGuideTasks. - * + * * @return the selection provider for the task explorer */ public abstract ISelectionProvider getSelectionProvider(); @@ -63,7 +63,7 @@ public abstract class TaskExplorer { /** * Sets the composite cheat sheet to be displayed. createControl will * already have been called. - * + * * @param compositeCheatSheet */ public abstract void setCompositeCheatSheet(ICompositeCheatSheet compositeCheatSheet); @@ -77,7 +77,7 @@ public abstract class TaskExplorer { /** * Called when the state of a task changes and the representation of the * task may need to be redrawn. - * + * * @param task */ public abstract void taskUpdated(ICompositeCheatSheetTask task); @@ -86,10 +86,10 @@ public abstract class TaskExplorer { * Called to set the provided selection and optionally reveal it * if the scroll bars are active and the selected tasks * are partially or fully hidden. - * + * * @param selection the new selection * @param reveal if <code>true</code>, expose the task if hidden; * otherwise, just select. - */ + */ public abstract void setSelection(ISelection selection, boolean reveal); } |