Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.jet.taglib.workspace
Class ActionsUtil

java.lang.Object
  extended by 
org.eclipse.jet.taglib.workspace.ActionsUtil

public final class ActionsUtil
extends java.lang.Object

Utility class for workspace actions. Provides implementations of typical workspace operations needed by Workspace actions.

This class is not intended to be instantiated or subclassed by clients.


Method Summary
static void checkpointWorkspace (boolean build)
          Deprecated. Use checkpointWorkspace(boolean,IProgressMonitor) instead
static void checkpointWorkspace (boolean build, org.eclipse.core.runtime.IProgressMonitor monitor)
          Force the workspace to broadcast accumulated workspace change events, and optionally do a build.
static void createProject (org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
          Create a new project.
static boolean createProject (org.eclipse.core.resources.IProject project, org.eclipse.core.resources.IProjectDescription description, org.eclipse.core.runtime.IProgressMonitor monitor)
          Create a new project.
static boolean ensureFolderExists (org.eclipse.core.resources.IFolder folder, org.eclipse.core.runtime.IProgressMonitor monitor)
          Ensure that a folder exists by creating it and any of its parents if necessary.
static byte[] readBinaryFile (java.net.URL url)
          Read a binary file from the given URL.
static byte[] readBinaryStream (java.io.InputStream input)
           
static java.lang.String readTextFile (java.net.URL url, java.lang.String encoding)
          Return the contents of the text file at the specified URL.
static boolean writeBinaryFile (org.eclipse.core.resources.IFile file, boolean replace, byte[] contents, org.eclipse.core.runtime.IProgressMonitor monitor)
          Write a binary file from a byte buffer.
static boolean writeTextFile (org.eclipse.core.resources.IFile file, boolean replace, java.lang.String encoding, boolean derived, java.lang.String contents, org.eclipse.core.runtime.IProgressMonitor monitor)
          Write the specified text file from a string.
static boolean writeTextFileFromWriter (org.eclipse.core.resources.IFile file, boolean replace, java.lang.String encoding, boolean derived, JET2Writer writer, org.eclipse.core.runtime.IProgressMonitor monitor)
          Write the file with the specified options from a JET writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeTextFileFromWriter

public static boolean writeTextFileFromWriter(org.eclipse.core.resources.IFile file,
                                              boolean replace,
                                              java.lang.String encoding,
                                              boolean derived,
                                              
JET2Writer writer,
                                              org.eclipse.core.runtime.IProgressMonitor monitor)
                                       throws 
JET2TagException
Write the file with the specified options from a JET writer.

This method delegates to writeTextFile after finalizing the writer's content and notifying writer listeners via IWriterListener.finalizeContent(JET2Writer, Object). If the content is written, then the writer listeners are informed of this after the write via IWriterListener.postCommitContent(JET2Writer, Object).

Parameters:
file - the file to write
replace - true if existing verions of the file should be overwritten.
encoding - the file encoding or null for the default encoding.
derived - true if the file is derived (and will be ignored by the team environment.
writer - the writer containing the file's content.
monitor - a progress monitor
Returns:
true if the file was written, false if replace is true and the file already exists..
Throws:
JET2TagException - if the file cannot be created or written, or the encoding is invalid.
See Also:
IWriterListener.finalizeContent(JET2Writer, Object), IWriterListener.postCommitContent(JET2Writer, Object)

writeTextFile

public static boolean writeTextFile(org.eclipse.core.resources.IFile file,
                                    boolean replace,
                                    java.lang.String encoding,
                                    boolean derived,
                                    java.lang.String contents,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
                             throws 
JET2TagException
Write the specified text file from a string.

Parameters:
file - the file to write
replace - true if existing verions of the file should be overwritten.
encoding - the file encoding or null for the default encoding.
derived - true if the file is derived (and will be ignored by the team environment.
contents - the contents to write.
monitor - a progress monitor
Returns:
false replace was true and the file existed; true otherwise.
Throws:
JET2TagException - if the file cannot be created or written, or the encoding is invalid.

ensureFolderExists

public static boolean ensureFolderExists(org.eclipse.core.resources.IFolder folder,
                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                  throws 
JET2TagException
Ensure that a folder exists by creating it and any of its parents if necessary.

Parameters:
folder - the folder to ensure exists.
monitor - a progress monitor
Returns:
true if folders were created...
Throws:
JET2TagException - if the folder cannot be created

writeBinaryFile

public static boolean writeBinaryFile(org.eclipse.core.resources.IFile file,
                                      boolean replace,
                                      byte[] contents,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                               throws 
JET2TagException
Write a binary file from a byte buffer.

Parameters:
file - the file to write
replace - true if existing versions of the file should be overwritten.
contents - the contents to write.
monitor - a progress monitor
Returns:
true if the file was written, false if replace was true and the file already exists.
Throws:
JET2TagException - if the file cannot be created or updated.

readTextFile

public static java.lang.String readTextFile(java.net.URL url,
                                            java.lang.String encoding)
                                     throws 
JET2TagException
Return the contents of the text file at the specified URL.

Returns:
the file contents
Throws:
JET2TagException - if an IOException is thrown (the IOException is wrapped).

readBinaryFile

public static byte[] readBinaryFile(java.net.URL url)
                             throws 
JET2TagException
Read a binary file from the given URL.

Parameters:
url - the file URL
Returns:
a byte buffer containing the file's contents
Throws:
JET2TagException - if an IOException occurs (the exception is wrapped).

readBinaryStream

public static byte[] readBinaryStream(java.io.InputStream input)
                               throws java.io.IOException
Throws:
java.io.IOException

createProject

public static void createProject(org.eclipse.core.resources.IProject project,
                                 org.eclipse.core.runtime.IProgressMonitor monitor)
                          throws 
JET2TagException
Create a new project.

Parameters:
project - the project to create
monitor - a progress monitor
Throws:
JET2TagException - if an error occurs

createProject

public static boolean createProject(org.eclipse.core.resources.IProject project,
                                    org.eclipse.core.resources.IProjectDescription description,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
                             throws 
JET2TagException
Create a new project.

Parameters:
project - the project to create
description - an option project description
monitor - a progress monitor
Returns:
true if the project was created, false if the project already existed.
Throws:
JET2TagException - if an error occurs
Since:
0.7.1

checkpointWorkspace

public static void checkpointWorkspace(boolean build)
Deprecated. Use checkpointWorkspace(boolean,IProgressMonitor) instead

Force the workspace to broadcast accumulated workspace change events, and optionally do a build. This method is useful if a pending workspace action depends on prior actions being processed by other actors. For example, if a Project and corresponding .project file are created that describe the project as having the Java nature, then JDT must be informed of these changes before JDT APIs will see the new project properly.

Generally, workspace actions authors will not need this tag.

Parameters:
build - true if a workspace build should be performed after the event broadcast.
See Also:
IWorkspace.checkpoint(boolean)

checkpointWorkspace

public static void checkpointWorkspace(boolean build,
                                       org.eclipse.core.runtime.IProgressMonitor monitor)
Force the workspace to broadcast accumulated workspace change events, and optionally do a build. This method is useful if a pending workspace action depends on prior actions being processed by other actors. For example, if a Project and corresponding .project file are created that describe the project as having the Java nature, then JDT must be informed of these changes before JDT APIs will see the new project properly.

Generally, workspace actions authors will not need this tag.

Parameters:
build - true if a workspace build should be performed after the event broadcast.
monitor - TODO
See Also:
IWorkspace.checkpoint(boolean)

Copyright 2006 IBM Corporation and others.
All Rights Reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire