eclipse plugin: make the wmltools menu entry available for folders too
This commit is contained in:
parent
1f4fb24536
commit
158b43fc6d
6 changed files with 46 additions and 77 deletions
|
@ -47,27 +47,6 @@
|
|||
label="Wesnoth project report"
|
||||
menubarPath="_wesnoth">
|
||||
</action>
|
||||
<menu
|
||||
icon="icons/wesnoth-icon_16.png"
|
||||
id="plugin.wmltoolsProjMenu"
|
||||
label="WML Tools"
|
||||
path="_wesnoth">
|
||||
<groupMarker
|
||||
name="wmltoolsProjMenuMarker">
|
||||
</groupMarker>
|
||||
</menu>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLIndentOnSelection"
|
||||
id="action.proj.wmlindent"
|
||||
label="Run "wmlindent" on the project this file"
|
||||
menubarPath="plugin.wmltoolsProjMenu/wmltoolsProjMenuMarker">
|
||||
</action>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLScopeOnSelection"
|
||||
id="action.proj.wmlscope"
|
||||
label="Run "wmlscope" on the project"
|
||||
menubarPath="plugin.wmltoolsProjMenu/wmltoolsProjMenuMarker">
|
||||
</action>
|
||||
</objectContribution>
|
||||
<objectContribution
|
||||
adaptable="false"
|
||||
|
@ -141,7 +120,7 @@
|
|||
</groupMarker>
|
||||
</menu>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLLintOnFile"
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLLintOnSelection"
|
||||
id="action.cfg.wmllintOnFile"
|
||||
label="Run "wmllint" on this file"
|
||||
menubarPath="plugin.wmltoolsCfgMenu/wmltoolsCfgMenuMarker">
|
||||
|
@ -186,6 +165,33 @@
|
|||
label="Open campaign in game"
|
||||
menubarPath="_wesnoth">
|
||||
</action>
|
||||
<menu
|
||||
icon="icons/wesnoth-icon_16.png"
|
||||
id="plugin.wmltoolsContainerMenu"
|
||||
label="WML Tools"
|
||||
path="_wesnoth">
|
||||
<groupMarker
|
||||
name="wmltoolsContainerMenuMarker">
|
||||
</groupMarker>
|
||||
</menu>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLScopeOnSelection"
|
||||
id="action.container.wmlscope"
|
||||
label="Run "wmlscope" on the container"
|
||||
menubarPath="plugin.wmltoolsContainerMenu/wmltoolsContainerMenuMarker">
|
||||
</action>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLIndentOnSelection"
|
||||
id="action.container.wmlindent"
|
||||
label="Run "wmlindent" on the container"
|
||||
menubarPath="plugin.wmltoolsContainerMenu/wmltoolsContainerMenuMarker">
|
||||
</action>
|
||||
<action
|
||||
class="wesnoth_eclipse_plugin.action.RunWMLLintOnSelection"
|
||||
id="action.container.wmllintOnFile"
|
||||
label="Run "wmllint" on the container"
|
||||
menubarPath="plugin.wmltoolsContainerMenu/wmltoolsContainerMenuMarker">
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -16,9 +16,9 @@ import org.eclipse.ui.IWorkbenchPart;
|
|||
import wesnoth_eclipse_plugin.utils.WMLTools;
|
||||
import wesnoth_eclipse_plugin.utils.WMLTools.Tools;
|
||||
|
||||
public class RunWMLLintOnFile implements IObjectActionDelegate
|
||||
public class RunWMLLintOnSelection implements IObjectActionDelegate
|
||||
{
|
||||
public RunWMLLintOnFile() {
|
||||
public RunWMLLintOnSelection() {
|
||||
}
|
||||
|
||||
@Override
|
|
@ -24,6 +24,7 @@ public class TestHandler extends AbstractHandler
|
|||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException
|
||||
{
|
||||
//System.out.println(WorkspaceUtils.getSelectedContainer());
|
||||
// MessageConsole con = GUIUtils.createConsole("TIMO", null, true);
|
||||
// List<String> arguments = new ArrayList<String>();
|
||||
// arguments.add(Preferences.getString(Constants.P_WESNOTH_WORKING_DIR));
|
||||
|
@ -42,7 +43,7 @@ public class TestHandler extends AbstractHandler
|
|||
// tool.kill(true);
|
||||
// }
|
||||
//tool.waitForTool();
|
||||
System.out.println("Exitt");
|
||||
//System.out.println("Exitt");
|
||||
//String stdin = EditorUtils.getEditorDocument().get();
|
||||
//EditorUtils.replaceEditorText(WMLTools.runWMLIndent(null, stdin, false, false, false));
|
||||
// IEditorReference[] files =
|
||||
|
|
|
@ -175,8 +175,8 @@ public class WMLTools
|
|||
{
|
||||
if (selFile != null)
|
||||
location = selFile.getLocation().toOSString();
|
||||
else //TODO: add container instead of project?
|
||||
location = WorkspaceUtils.getSelectedProject().getLocation().toOSString();
|
||||
else
|
||||
location = WorkspaceUtils.getSelectedContainer().getLocation().toOSString();
|
||||
}
|
||||
|
||||
switch(tool)
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Locale;
|
|||
import java.util.Random;
|
||||
|
||||
import org.eclipse.core.resources.FileInfoMatcherDescription;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -114,6 +115,17 @@ public class WorkspaceUtils
|
|||
return getSelectedStructuredSelection(WorkspaceUtils.getWorkbenchWindow());
|
||||
}
|
||||
|
||||
public static IContainer getSelectedContainer()
|
||||
{
|
||||
IStructuredSelection selection = getSelectedStructuredSelection();
|
||||
if (selection == null ||
|
||||
!(selection.getFirstElement() instanceof IFolder ||
|
||||
selection.getFirstElement() instanceof IProject))
|
||||
return null;
|
||||
|
||||
return (IContainer) selection.getFirstElement();
|
||||
}
|
||||
|
||||
public static IResource getSelectedResource()
|
||||
{
|
||||
IResource res = getSelectedFile();
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 by Timotei Dolean <timotei21@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
package wesnoth_eclipse_plugin.wizards;
|
||||
|
||||
import org.wesnoth.wml.schema.SchemaTag;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
/**
|
||||
* @author fabi
|
||||
*
|
||||
*/
|
||||
public class WmlTagWizardPage extends WizardPage {
|
||||
|
||||
/**
|
||||
* @param pageName
|
||||
*/
|
||||
public WmlTagWizardPage(SchemaTag tag, ImageDescriptor titleImage) {
|
||||
super(tag.getName(), tag.getName(), titleImage);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param pageName
|
||||
// * @param title
|
||||
// * @param titleImage
|
||||
// */
|
||||
// public WmlTagWizardPage(String pageName, String title,
|
||||
// ImageDescriptor titleImage) {
|
||||
// super(pageName, title, titleImage);
|
||||
// // TODO Auto-generated constructor stub
|
||||
// }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
public void createControl(Composite parent) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue