import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.ResourcesPlugin;
openWikiFile(ei.getFile(), textRegion);
}
- void openWikiFile(IFile cfile, String word) {
+ public static void openWikiUrl(IProject project, String word) {
+ if (word != null && !word.equals("")) {
+ IFile cfile = project.getFile("dummy.wp");
+ IFile file = getWikiFile(cfile, word);
+ try {
+ createNewFileIfNeeded(file, word);
+ // if (WikiEditorPlugin.getDefault().getPreferenceStore().getBoolean(WikiConstants.REUSE_EDITOR)) {
+ // saveIfNeeded();
+ // getActivePage().reuseEditor(reusableEditor, new FileEditorInput(file));
+ // } else {
+ IDE.openEditor(WikiEditorPlugin.getDefault().getActivePage(), file, true);
+ // redrawText();
+ // }
+ } catch (Exception e) {
+ // WikiEditorPlugin.getDefault().logAndReport(WikiEditorPlugin.getResourceString(WikiConstants.RESOURCE_WIKI_ERROR_DIALOGUE_OPEN_WIKI_FILE_TITLE),
+ // WikiPlugin.getResourceString(WikiConstants.RESOURCE_WIKI_ERROR_DIALOGUE_OPEN_WIKI_FILE_TEXT), e);
+ }
+ }
+ }
+
+ public static void openWikiFile(IFile cfile, String word) {
if (word != null && !word.equals("")) {
IFile file = getWikiFile(cfile, word);
try {
}
}
- private void createNewFileIfNeeded(IFile file, String word) throws CoreException {
+ private static void createNewFileIfNeeded(IFile file, String word) throws CoreException {
if (!file.exists()) {
createWikiFile(file, word);
}
}
- private IFile getWikiFile(IFile file, String word) {
+ private static IFile getWikiFile(IFile file, String word) {
String wikiFileName = Util.getWikiFileName(word, file, WikiEditorPlugin.HTML_OUTPUT_PATH);
IPath path = new Path(wikiFileName);
return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
* @return the new folder resource handle
* @see #createFolder
*/
- private IFolder createFolderHandle(IPath folderPath) {
+ private static IFolder createFolderHandle(IPath folderPath) {
return IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFolder(folderPath);
}
- private void createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
+ private static void createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
try {
// Create the folder resource in the workspace
// Recursive to create any folders which do not exist already
}
}
- private void createWikiFile(IFile file, String word) throws CoreException {
+ private static void createWikiFile(IFile file, String word) throws CoreException {
IContainer parent = file.getParent();
if (parent instanceof IFolder && (!((IFolder) parent).exists())) {
createFolder((IFolder) parent, null);