org.eclipse.wst.common.frameworks_1.2.102.v201201190400

16:48:50.994 INFO  jd.cli.Main - Decompiling org.eclipse.wst.common.frameworks_1.2.102.v201201190400.jar
package org.eclipse.wst.common.frameworks.datamodel;

import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.wst.common.environment.IEnvironment;

public abstract class AbstractDataModelOperation
  extends AbstractOperation
  implements IDataModelOperation
{
  protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
  private String id;
  private IEnvironment environment;
  protected IDataModel model;
  
  public AbstractDataModelOperation()
  {
    super("");
    id = getClass().getName();
  }
  
  public AbstractDataModelOperation(IDataModel model)
  {
    super("");
    this.model = model;
    id = getClass().getName();
  }
  
  public void setID(String id)
  {
    this.id = id;
  }
  
  public String getID()
  {
    return id;
  }
  
  public void setDataModel(IDataModel model)
  {
    this.model = model;
  }
  
  public IDataModel getDataModel()
  {
    return model;
  }
  
  public ISchedulingRule getSchedulingRule()
  {
    return ResourcesPlugin.getWorkspace().getRoot();
  }
  
  public int getOperationExecutionFlags()
  {
    return 1;
  }
  
  public final void setEnvironment(IEnvironment env)
  {
    environment = env;
  }
  
  public final IEnvironment getEnvironment()
  {
    return environment;
  }
  
  public IStatus redo(IProgressMonitor monitor, IAdaptable info)
    throws ExecutionException
  {
    return Status.OK_STATUS;
  }
  
  public IStatus undo(IProgressMonitor monitor, IAdaptable info)
    throws ExecutionException
  {
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;

public abstract class AbstractDataModelProvider
  implements IDataModelProvider
{
  protected IDataModel model = null;
  
  public Set getPropertyNames()
  {
    return new HashSet();
  }
  
  public void init() {}
  
  public final void setDataModel(IDataModel dataModel)
  {
    model = dataModel;
  }
  
  public final IDataModel getDataModel()
  {
    return model;
  }
  
  public boolean propertySet(String propertyName, Object propertyValue)
  {
    return true;
  }
  
  public Object getDefaultProperty(String propertyName)
  {
    if ("IDataModelProperties.ALLOW_EXTENSIONS".equals(propertyName)) {
      return Boolean.TRUE;
    }
    if ("IDataModelProperties.RESTRICT_EXTENSIONS".equals(propertyName)) {
      return Collections.EMPTY_LIST;
    }
    return null;
  }
  
  public boolean isPropertyEnabled(String propertyName)
  {
    return true;
  }
  
  public IStatus validate(String name)
  {
    return null;
  }
  
  public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName)
  {
    return null;
  }
  
  public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName)
  {
    return null;
  }
  
  public List getExtendedContext()
  {
    return null;
  }
  
  public IDataModelOperation getDefaultOperation()
  {
    return null;
  }
  
  public String getID()
  {
    return getClass().getName();
  }
  
  public void dispose() {}
  
  protected final Object getProperty(String propertyName)
  {
    return model.getProperty(propertyName);
  }
  
  protected final void setProperty(String propertyName, Object propertyValue)
  {
    model.setProperty(propertyName, propertyValue);
  }
  
  protected final boolean getBooleanProperty(String propertyName)
  {
    return model.getBooleanProperty(propertyName);
  }
  
  protected final void setBooleanProperty(String propertyName, boolean propertyValue)
  {
    model.setBooleanProperty(propertyName, propertyValue);
  }
  
  protected final int getIntProperty(String propertyName)
  {
    return model.getIntProperty(propertyName);
  }
  
  protected final void setIntProperty(String propertyName, int propertyValue)
  {
    model.setIntProperty(propertyName, propertyValue);
  }
  
  protected final String getStringProperty(String propertyName)
  {
    return model.getStringProperty(propertyName);
  }
  
  protected final boolean isPropertySet(String propertyName)
  {
    return model.isPropertySet(propertyName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

public final class DataModelEvent
{
  public static final int VALUE_CHG = 1;
  static final int DEFAULT_CHG = 2;
  public static final int ENABLE_CHG = 3;
  public static final int VALID_VALUES_CHG = 4;
  private IDataModel dataModel;
  private String propertyName;
  private int flag;
  
  public DataModelEvent(IDataModel dataModel, String propertyName, int flag)
  {
    this.dataModel = dataModel;
    this.propertyName = propertyName;
    this.flag = flag;
  }
  
  public IDataModel getDataModel()
  {
    return dataModel;
  }
  
  public String getPropertyName()
  {
    return propertyName;
  }
  
  public int getFlag()
  {
    return flag;
  }
  
  public Object getProperty()
  {
    return dataModel.getProperty(propertyName);
  }
  
  public boolean isPropertyEnabled()
  {
    return dataModel.isPropertyEnabled(propertyName);
  }
  
  public DataModelPropertyDescriptor[] getValidPropertyDescriptors()
  {
    return dataModel.getValidPropertyDescriptors(propertyName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.DataModelEvent
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

import java.lang.reflect.Field;
import org.eclipse.wst.common.frameworks.internal.datamodel.DataModelExtensionReader;
import org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;

public class DataModelFactory
{
  private static DataModelExtensionReader reader;
  
  public static IDataModel createDataModel(String dataModelProviderID)
  {
    IDataModelProvider provider = loadProvider(dataModelProviderID);
    if (provider == null) {
      return null;
    }
    return createDataModel(provider);
  }
  
  private static IDataModelProvider loadProvider(String id)
  {
    if (reader == null) {
      reader = new DataModelExtensionReader();
    }
    return reader.getProvider(id);
  }
  
  public static String[] getDataModelProviderIDsForKind(String dataModelProviderKindID)
  {
    String[] validProviderIDs = loadProviderForProviderKind(dataModelProviderKindID);
    return validProviderIDs != null ? validProviderIDs : new String[0];
  }
  
  private static String[] loadProviderForProviderKind(String providerKind)
  {
    if (reader == null) {
      reader = new DataModelExtensionReader();
    }
    return reader.getProviderDescriptorsForProviderKind(providerKind);
  }
  
  public static IDataModel createDataModel(Class aClass)
  {
    if (aClass.isInterface()) {
      try
      {
        Class clazz = (Class)aClass.getField("_provider_class").get(null);
        if (clazz != null)
        {
          IDataModelProvider provider = (IDataModelProvider)clazz.newInstance();
          return createDataModel(provider);
        }
      }
      catch (NoSuchFieldException localNoSuchFieldException) {}catch (IllegalArgumentException e)
      {
        WTPCommonPlugin.logError(e);
      }
      catch (SecurityException e)
      {
        WTPCommonPlugin.logError(e);
      }
      catch (IllegalAccessException e)
      {
        WTPCommonPlugin.logError(e);
      }
      catch (InstantiationException e)
      {
        WTPCommonPlugin.logError(e);
      }
    }
    return createDataModel(aClass.getName());
  }
  
  public static IDataModel createDataModel(IDataModelProvider provider)
  {
    if (provider == null) {
      throw new NullPointerException();
    }
    DataModelImpl dataModel = new DataModelImpl(provider);
    return dataModel;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

public final class DataModelPropertyDescriptor
{
  private Object propertyValue;
  private String propertyDescription;
  
  public static DataModelPropertyDescriptor[] createDescriptors(Object[] values)
  {
    if (values == null) {
      return new DataModelPropertyDescriptor[0];
    }
    DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[values.length];
    for (int i = 0; i < descriptors.length; i++) {
      descriptors[i] = new DataModelPropertyDescriptor(values[i]);
    }
    return descriptors;
  }
  
  public static DataModelPropertyDescriptor[] createDescriptors(Object[] values, String[] descriptions)
  {
    if (values == null) {
      return new DataModelPropertyDescriptor[0];
    }
    DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[values.length];
    for (int i = 0; i < descriptors.length; i++) {
      descriptors[i] = new DataModelPropertyDescriptor(values[i], descriptions[i]);
    }
    return descriptors;
  }
  
  public DataModelPropertyDescriptor(Object propertyValue)
  {
    this.propertyValue = propertyValue;
  }
  
  public DataModelPropertyDescriptor(Object propertyValue, String propertyDescription)
  {
    this.propertyValue = propertyValue;
    this.propertyDescription = propertyDescription;
  }
  
  public Object getPropertyValue()
  {
    return propertyValue;
  }
  
  public String getPropertyDescription()
  {
    if (propertyDescription != null) {
      return propertyDescription;
    }
    String str = propertyValue != null ? propertyValue.toString() : null;
    return str != null ? str : "";
  }
  
  public String toString()
  {
    return getPropertyDescription();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.IStatus;

public abstract interface IDataModel
{
  public static final int VALUE_CHG = 1;
  public static final int DEFAULT_CHG = 2;
  public static final int ENABLE_CHG = 3;
  public static final int VALID_VALUES_CHG = 4;
  
  public abstract String getID();
  
  public abstract IDataModelOperation getDefaultOperation();
  
  public abstract List getExtendedContext();
  
  public abstract Object getProperty(String paramString);
  
  public abstract Object getDefaultProperty(String paramString);
  
  public abstract int getIntProperty(String paramString);
  
  public abstract boolean getBooleanProperty(String paramString);
  
  public abstract String getStringProperty(String paramString);
  
  public abstract void setProperty(String paramString, Object paramObject);
  
  public abstract void setIntProperty(String paramString, int paramInt);
  
  public abstract void setBooleanProperty(String paramString, boolean paramBoolean);
  
  public abstract void setStringProperty(String paramString1, String paramString2);
  
  public abstract boolean addNestedModel(String paramString, IDataModel paramIDataModel);
  
  public abstract IDataModel removeNestedModel(String paramString);
  
  public abstract boolean isNestedModel(String paramString);
  
  public abstract IDataModel getNestedModel(String paramString);
  
  public abstract Collection getNestedModels();
  
  public abstract Collection getNestedModelNames();
  
  public abstract Collection getNestingModels();
  
  public abstract Collection getBaseProperties();
  
  public abstract Collection getNestedProperties();
  
  public abstract Collection getAllProperties();
  
  public abstract boolean isBaseProperty(String paramString);
  
  public abstract boolean isProperty(String paramString);
  
  public abstract boolean isNestedProperty(String paramString);
  
  public abstract boolean isPropertySet(String paramString);
  
  public abstract boolean isPropertyEnabled(String paramString);
  
  public abstract boolean isPropertyValid(String paramString);
  
  public abstract IStatus validateProperty(String paramString);
  
  public abstract boolean isValid();
  
  public abstract IStatus validate();
  
  public abstract IStatus validate(boolean paramBoolean);
  
  public abstract DataModelPropertyDescriptor getPropertyDescriptor(String paramString);
  
  public abstract DataModelPropertyDescriptor[] getValidPropertyDescriptors(String paramString);
  
  public abstract void addListener(IDataModelListener paramIDataModelListener);
  
  public abstract void removeListener(IDataModelListener paramIDataModelListener);
  
  public abstract void notifyPropertyChange(String paramString, int paramInt);
  
  public abstract void dispose();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.IDataModel
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

public abstract interface IDataModelListener
{
  public abstract void propertyChanged(DataModelEvent paramDataModelEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.IDataModelListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.wst.common.environment.IEnvironment;

public abstract interface IDataModelOperation
  extends IUndoableOperation
{
  public abstract void setID(String paramString);
  
  public abstract String getID();
  
  public abstract void setDataModel(IDataModel paramIDataModel);
  
  public abstract IDataModel getDataModel();
  
  public abstract ISchedulingRule getSchedulingRule();
  
  public abstract int getOperationExecutionFlags();
  
  public abstract void setEnvironment(IEnvironment paramIEnvironment);
  
  public abstract IEnvironment getEnvironment();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

public abstract interface IDataModelProperties
{
  public static final String ALLOW_EXTENSIONS = "IDataModelProperties.ALLOW_EXTENSIONS";
  public static final String RESTRICT_EXTENSIONS = "IDataModelProperties.RESTRICT_EXTENSIONS";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.datamodel;

import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

public abstract interface IDataModelProvider
  extends IDataModelProperties
{
  public static final IStatus OK_STATUS = new Status(0, "org.eclipse.wst.common.frameworks.internal", 0, "OK", null);
  
  public abstract void setDataModel(IDataModel paramIDataModel);
  
  public abstract IDataModel getDataModel();
  
  public abstract Set getPropertyNames();
  
  public abstract void init();
  
  public abstract Object getDefaultProperty(String paramString);
  
  public abstract boolean isPropertyEnabled(String paramString);
  
  public abstract IStatus validate(String paramString);
  
  public abstract boolean propertySet(String paramString, Object paramObject);
  
  public abstract DataModelPropertyDescriptor getPropertyDescriptor(String paramString);
  
  public abstract DataModelPropertyDescriptor[] getValidPropertyDescriptors(String paramString);
  
  public abstract List getExtendedContext();
  
  public abstract IDataModelOperation getDefaultOperation();
  
  public abstract String getID();
  
  public abstract void dispose();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.wst.common.frameworks.internal.enablement.FunctionGroupRegistry;
import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementIdentifier;
import org.eclipse.wst.common.frameworks.internal.enablement.IEnablementManager;
import org.eclipse.wst.common.frameworks.internal.enablement.Identifiable;

public abstract class AbstractRegistryDescriptor
  extends ConfigurationElementWrapper
  implements Identifiable
{
  protected Integer priority;
  
  public AbstractRegistryDescriptor(IConfigurationElement anElement)
  {
    super(anElement);
  }
  
  public IEnablementIdentifier getEnablementIdentifier(IProject project)
  {
    return IEnablementManager.INSTANCE.getIdentifier(getID(), project);
  }
  
  public abstract String getID();
  
  public int getPriority()
  {
    if (priority == null) {
      priority = new Integer(FunctionGroupRegistry.getInstance().getFunctionPriority(getID()));
    }
    return priority.intValue();
  }
  
  public boolean isEnabled(IProject p)
  {
    IEnablementIdentifier id = getEnablementIdentifier(p);
    return id.isEnabled();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.AbstractRegistryDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;

public class AdaptabilityUtility
{
  public static Object getAdapter(Object element, Class adapter)
  {
    if (element == null) {
      return null;
    }
    if ((element instanceof IAdaptable)) {
      return ((IAdaptable)element).getAdapter(adapter);
    }
    return Platform.getAdapterManager().getAdapter(element, adapter);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.AdaptabilityUtility
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;

public class ConfigurationElementWrapper
{
  protected IConfigurationElement element;
  
  public ConfigurationElementWrapper(IConfigurationElement element)
  {
    this.element = element;
  }
  
  protected IConfigurationElement getElement()
  {
    return element;
  }
  
  public String getPluginId()
  {
    String pluginId = null;
    if (element != null)
    {
      IExtension extension = element.getDeclaringExtension();
      if (extension != null) {
        pluginId = extension.getNamespace();
      }
    }
    return pluginId;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.ConfigurationElementWrapper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

/**
 * @deprecated
 */
public abstract interface DoNotUseMeThisWillBeDeletedPost15 {}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.util.ArrayList;
import java.util.List;

public class ExceptionHelper
{
  public static String[] getAllMessages(IWrappedException exception)
  {
    List messages = new ArrayList(4);
    messages.add(exception.getMessage());
    Exception nested = exception.getNestedException();
    while (nested != null)
    {
      messages.add(nested.getMessage());
      if ((nested instanceof IWrappedException)) {
        nested = ((IWrappedException)nested).getNestedException();
      } else {
        nested = null;
      }
    }
    return (String[])messages.toArray(new String[messages.size()]);
  }
  
  public static String getConcatenatedMessages(IWrappedException exception)
  {
    String[] messages = getAllMessages(exception);
    StringBuffer sb = new StringBuffer(256);
    for (int i = 0; i < messages.length; i++)
    {
      sb.append(messages[i]);
      if (i < messages.length - 1) {
        sb.append('\n');
      }
    }
    return sb.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.ExceptionHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

public class HashUtil
{
  public static int SEED = 11;
  private static int MULTI = 31;
  
  public static int hash(int seed, int i)
  {
    return seed * MULTI + i;
  }
  
  public static int hash(int seed, Object obj)
  {
    return hash(seed, obj != null ? obj.hashCode() : SEED);
  }
  
  public static int hash(int seed, boolean b)
  {
    return hash(seed, b ? 1 : SEED);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.HashUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;

public abstract interface ISaveHandler
{
  public abstract void access();
  
  public abstract void handleSaveFailed(SaveFailedException paramSaveFailedException, IProgressMonitor paramIProgressMonitor);
  
  public abstract void release();
  
  public abstract boolean shouldContinueAndMakeFileEditable(IFile paramIFile);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.ISaveHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;

public abstract interface ISimpleValidateEditContext
{
  public static final String CLASS_KEY = "ISimpleValidateEditContext";
  
  public abstract IStatus validateEdit(IFile[] paramArrayOfIFile);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.ISimpleValidateEditContext
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.io.PrintStream;
import java.io.PrintWriter;

public abstract interface IWrappedException
{
  public abstract String[] getAllMessages();
  
  public abstract String getConcatenatedMessages();
  
  public abstract Exception getInnerMostNestedException();
  
  public abstract String getMessage();
  
  public abstract Exception getNestedException();
  
  public abstract void printStackTrace();
  
  public abstract void printStackTrace(PrintStream paramPrintStream);
  
  public abstract void printStackTrace(PrintWriter paramPrintWriter);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.IWrappedException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public abstract class Messages
{
  protected ResourceBundle resourceBundle;
  
  public Messages()
  {
    initializeBundle();
  }
  
  protected abstract void initializeBundle();
  
  protected String doGetResourceString(String key)
  {
    try
    {
      return resourceBundle != null ? resourceBundle.getString(key) : key;
    }
    catch (MissingResourceException localMissingResourceException) {}
    return "!" + key + "!";
  }
  
  protected String doGetResourceString(String key, Object[] args)
  {
    String pattern = doGetResourceString(key);
    if (pattern != null) {
      return MessageFormat.format(pattern, args);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

public class SaveFailedException
  extends WrappedRuntimeException
{
  private static final long serialVersionUID = -4640018901910731240L;
  
  public SaveFailedException() {}
  
  public SaveFailedException(Exception e)
  {
    super(e);
  }
  
  public SaveFailedException(String s)
  {
    super(s);
  }
  
  public SaveFailedException(String s, Exception e)
  {
    super(s, e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.SaveFailedException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.common.frameworks.internal.enablement.nonui.IWFTWrappedException;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;

public class SaveHandlerHeadless
  implements ISaveHandler
{
  public void access() {}
  
  public void handleSaveFailed(SaveFailedException ex, IProgressMonitor monitor)
  {
    throw ex;
  }
  
  public static boolean isFailedWriteFileFailure(IWFTWrappedException ex)
  {
    Exception nested = ex.getInnerMostNestedException();
    if (nested == null) {
      return false;
    }
    return isFailedWriteFileFailure(nested);
  }
  
  public static boolean isFailedWriteFileFailure(Exception ex)
  {
    if ((ex instanceof IWFTWrappedException)) {
      return isFailedWriteFileFailure((IWFTWrappedException)ex);
    }
    if ((ex instanceof CoreException)) {
      return isFailedWriteFileFailure((CoreException)ex);
    }
    return false;
  }
  
  public static boolean isFailedWriteFileFailure(CoreException ex)
  {
    IStatus status = ex.getStatus();
    if (status == null) {
      return false;
    }
    Throwable nested = status.getException();
    if ((nested instanceof CoreException)) {
      return isFailedWriteFileFailure((CoreException)nested);
    }
    return status.getCode() == 272;
  }
  
  public void release() {}
  
  public boolean shouldContinueAndMakeFileEditable(IFile aFile)
  {
    if (aFile == null) {
      return false;
    }
    String error = WTPResourceHandler.getString("Unable_to_save_read-only_f_ERROR_", new Object[] { aFile.getFullPath() });
    WTPCommonPlugin.logError(error);
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.SaveHandlerHeadless
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.wst.common.core.util.UIContextDetermination;

public class SaveHandlerRegister
{
  private static ISaveHandler saveHandler;
  
  public static ISaveHandler getSaveHandler()
  {
    if (saveHandler == null) {
      saveHandler = (ISaveHandler)UIContextDetermination.createInstance("saveHandler");
    }
    return saveHandler;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.SaveHandlerRegister
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.common.core.util.UIContextDetermination;

public class SimpleValidateEdit
{
  public static boolean validateEdit(List files)
  {
    if ((files == null) || (files.size() == 0)) {
      return true;
    }
    return validateEdit((IFile[])files.toArray(new IFile[files.size()]));
  }
  
  public static boolean validateEdit(IFile[] files)
  {
    if ((files == null) || (files.length == 0)) {
      return true;
    }
    ISimpleValidateEditContext validator = (ISimpleValidateEditContext)UIContextDetermination.createInstance("ISimpleValidateEditContext");
    if (validator != null)
    {
      IStatus status = validator.validateEdit(files);
      if (status != null) {
        return status.isOK();
      }
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.SimpleValidateEdit
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;

public class SimpleValidateEditContextHeadless
  implements ISimpleValidateEditContext
{
  public IStatus validateEdit(IFile[] files)
  {
    List filesList = new ArrayList();
    for (int i = 0; i < files.length; i++) {
      if ((files[i].exists()) && (files[i].isReadOnly())) {
        filesList.add(files[i]);
      }
    }
    if (filesList.size() > 0)
    {
      IFile[] filesToValidate = (IFile[])filesList.toArray(new IFile[filesList.size()]);
      return validateEditImpl(filesToValidate);
    }
    return IDataModelProvider.OK_STATUS;
  }
  
  protected IStatus validateEditImpl(IFile[] filesToValidate)
  {
    return ResourcesPlugin.getWorkspace().validateEdit(filesToValidate, null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.SimpleValidateEditContextHeadless
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.util.ResourceBundle;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WorkbenchUtil;
import org.osgi.framework.BundleContext;

public abstract class WTPPlugin
  extends Plugin
{
  protected static WTPPlugin instance = null;
  public ResourceBundle resourceBundle;
  
  public WTPPlugin()
  {
    instance = this;
  }
  
  public static boolean isPlatformCaseSensitive()
  {
    return !"macosx".equals(Platform.getOS());
  }
  
  public abstract String getPluginID();
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    WorkbenchUtil.setWorkbenchIsRunning(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.WTPPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Status;

public class WTPProjectUtilities
{
  public static void addOldNatureToProject(IProject proj, String natureId)
    throws CoreException
  {
    IProjectDescription description = proj.getDescription();
    String[] prevNatures = description.getNatureIds();
    
    boolean addNature = true;
    for (int i = 0; i < prevNatures.length; i++)
    {
      String nature = prevNatures[i];
      if (nature.equals(natureId))
      {
        addNature = false;
        break;
      }
    }
    if (addNature)
    {
      String[] newNatures = new String[prevNatures.length + 1];
      System.arraycopy(prevNatures, 0, newNatures, 1, prevNatures.length);
      newNatures[0] = natureId;
      description.setNatureIds(newNatures);
      proj.setDescription(description, 64, null);
    }
  }
  
  public static void addOldNatureToProject(IProject proj, String natureId, int index)
    throws CoreException
  {
    IProjectDescription description = proj.getDescription();
    String[] prevNatures = description.getNatureIds();
    
    boolean addNature = true;
    for (int i = 0; i < prevNatures.length; i++)
    {
      String nature = prevNatures[i];
      if (nature.equals(natureId))
      {
        addNature = false;
        break;
      }
    }
    if (addNature)
    {
      String[] newNatures = new String[prevNatures.length + 1];
      System.arraycopy(prevNatures, 0, newNatures, 0, index);
      
      newNatures[index] = natureId;
      System.arraycopy(prevNatures, index, newNatures, index + 1, prevNatures.length - index);
      description.setNatureIds(newNatures);
      proj.setDescription(description, 64, null);
    }
  }
  
  public static void addNatureToProject(IProject proj, String natureId)
    throws CoreException
  {
    IProjectDescription description = proj.getDescription();
    String[] prevNatures = description.getNatureIds();
    String[] newNatures = new String[prevNatures.length + 1];
    System.arraycopy(prevNatures, 0, newNatures, 1, prevNatures.length);
    newNatures[0] = natureId;
    description.setNatureIds(newNatures);
    proj.setDescription(description, null);
  }
  
  public static void addNatureToProjectLast(IProject proj, String natureId)
    throws CoreException
  {
    IProjectDescription description = proj.getDescription();
    String[] prevNatures = description.getNatureIds();
    String[] newNatures = new String[prevNatures.length + 1];
    System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
    newNatures[prevNatures.length] = natureId;
    description.setNatureIds(newNatures);
    proj.setDescription(description, null);
  }
  
  public static void removeNatureFromProject(IProject project, String natureId)
    throws CoreException
  {
    IProjectDescription description = project.getDescription();
    String[] prevNatures = description.getNatureIds();
    int size = prevNatures.length;
    int newsize = 0;
    String[] newNatures = new String[size];
    boolean matchfound = false;
    for (int i = 0; i < size; i++) {
      if (prevNatures[i].equals(natureId)) {
        matchfound = true;
      } else {
        newNatures[(newsize++)] = prevNatures[i];
      }
    }
    if (!matchfound) {
      throw new CoreException(new Status(4, "org.eclipse.wst.common.frameworks", 0, "The nature id " + natureId + " does not exist on the project " + project.getName(), null));
    }
    String[] temp = newNatures;
    newNatures = new String[newsize];
    System.arraycopy(temp, 0, newNatures, 0, newsize);
    description.setNatureIds(newNatures);
    if (ResourcesPlugin.getWorkspace().getNatureDescriptor(natureId) == null) {
      project.setDescription(description, 66, null);
    } else {
      project.setDescription(description, null);
    }
  }
  
  public static IProject getProject(Object object)
  {
    IProject result = null;
    if ((object instanceof IProject)) {
      result = (IProject)object;
    } else if ((object instanceof IResource)) {
      result = ((IResource)object).getProject();
    } else if ((object instanceof IAdaptable)) {
      result = (IProject)((IAdaptable)object).getAdapter(IProject.class);
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.WTPProjectUtilities
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class WTPResourceHandler
{
  private static ResourceBundle fgResourceBundle;
  
  public static ResourceBundle getResourceBundle()
  {
    try
    {
      return ResourceBundle.getBundle("wtp_common");
    }
    catch (MissingResourceException localMissingResourceException) {}
    return null;
  }
  
  public static String getString(String key)
  {
    if (fgResourceBundle == null) {
      fgResourceBundle = getResourceBundle();
    }
    if (fgResourceBundle != null) {
      try
      {
        return fgResourceBundle.getString(key);
      }
      catch (MissingResourceException localMissingResourceException)
      {
        return "!" + key + "!";
      }
    }
    return "!" + key + "!";
  }
  
  public static String getString(String key, Object[] args)
  {
    try
    {
      return MessageFormat.format(getString(key), args);
    }
    catch (IllegalArgumentException localIllegalArgumentException) {}
    return getString(key);
  }
  
  public static String getString(String key, Object[] args, int x)
  {
    return getString(key);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.WTPResourceHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;

public class WrappedException
  extends InvocationTargetException
{
  private static final long serialVersionUID = -9221925581603648538L;
  
  protected WrappedException() {}
  
  public WrappedException(Throwable target)
  {
    super(target);
  }
  
  public WrappedException(Throwable target, String s)
  {
    super(target, s);
  }
  
  public void printStackTrace()
  {
    printStackTrace(System.err);
  }
  
  public void printStackTrace(PrintStream s)
  {
    if (getTargetException() != null)
    {
      s.println(this);
      s.println("Stack trace of nested exception:");
      getTargetException().printStackTrace(s);
    }
    else
    {
      super.printStackTrace(s);
    }
  }
  
  public void printStackTrace(PrintWriter s)
  {
    if (getTargetException() != null)
    {
      s.println(this);
      s.println("Stack trace of nested exception:");
      getTargetException().printStackTrace(s);
    }
    else
    {
      super.printStackTrace(s);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.WrappedException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal;

import java.io.PrintStream;
import java.io.PrintWriter;

public class WrappedRuntimeException
  extends RuntimeException
  implements IWrappedException
{
  private static final long serialVersionUID = 2684637746275620101L;
  protected Exception nestedException;
  
  public WrappedRuntimeException() {}
  
  public WrappedRuntimeException(Exception e)
  {
    setNestedException(e);
  }
  
  public WrappedRuntimeException(String s)
  {
    super(s);
  }
  
  public WrappedRuntimeException(String s, Exception e)
  {
    super(s);
    setNestedException(e);
  }
  
  public String[] getAllMessages()
  {
    return ExceptionHelper.getAllMessages(this);
  }
  
  public String getConcatenatedMessages()
  {
    return ExceptionHelper.getConcatenatedMessages(this);
  }
  
  public Exception getInnerMostNestedException()
  {
    Exception n = getNestedException();
    if (n == null) {
      return this;
    }
    if ((n instanceof IWrappedException)) {
      return ((IWrappedException)n).getInnerMostNestedException();
    }
    return n;
  }
  
  public Exception getNestedException()
  {
    return nestedException;
  }
  
  public Throwable getCause()
  {
    return getNestedException();
  }
  
  public void printStackTrace()
  {
    p
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd