Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Status


      getLog().log(new Status(Status.INFO, PLUGIN_ID, message));
  }

  public void logWarning(String message, Throwable e) {
    if (e != null)
      getLog().log(new Status(Status.WARNING, PLUGIN_ID, message, e));
    else
      getLog().log(new Status(Status.WARNING, PLUGIN_ID, message));
  }
View Full Code Here


      // third try - case insensitiv match on all files in folder
      CaseInsensitivReferenceSearcher searcher = new CaseInsensitivReferenceSearcher(referencePath, folder);
      try {
        folder.accept(searcher);
      } catch (CoreException e) {
        Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Error searching for file reference.", e));
      }
      return searcher.getReferenceFile();
    } else {
      return null;
    }
View Full Code Here

              // third try - case insensitiv match on all files in folder
              CaseInsensitivFolderReferenceSearcher searcher = new CaseInsensitivFolderReferenceSearcher(referencePath, folder);
              try {
                  folder.accept(searcher);
              } catch (CoreException e) {
                  Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Error searching for folder reference.", e));
              }
              return searcher.getReferenceFolder();
          } else {
              return null;
          }
View Full Code Here

        Encoding encoding = model.getDesignEncoding();
        if (encoding != null && !encoding.getKey().equals(WGADesignConfigurationModel.STRING_NOT_SET)) {
          return encoding.getKey();
        } else {
          Activator.getDefault().getLog().log(
              new Status(Status.WARNING, Activator.PLUGIN_ID, "Design encoding not set for design '" + syncInfo.getParent().getLocation().toString() + "'. Using platform encoding '"
                  + fallBackEncoding + "'."));
          return fallBackEncoding;
        }
      } catch (IOException e) {
        Activator.getDefault().getLog().log(
            new Status(Status.ERROR, Activator.PLUGIN_ID, "Unable to determine design encoding for design '" + syncInfo.getParent().getLocation().toString()
                + "'. Using platform encoding '" + fallBackEncoding + "'."));
        return fallBackEncoding;
      }
    } else {
      Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, "TMLFile is not member of an WGADesign. Using platform encoding '" + fallBackEncoding + "'."));
      return fallBackEncoding;
    }
  }
View Full Code Here

      if (labelFile != null && labelFile.exists()) {
         fileStream = new FileInputStream(labelFile.getLocation().toFile());
        props.load(fileStream);
      }
    } catch (FileNotFoundException e) {
      Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't find propertyfile : " + labelFile.getLocation(), e));
    } catch (IOException e) {
      Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't read propertyfile : " + labelFile.getLocation(), e));

    }finally{
      if(fileStream!=null){
        try {
          fileStream.close();
View Full Code Here

        }
        ByteArrayInputStream byteStream = new ByteArrayInputStream("".getBytes());
        labelFile.create(byteStream, true, new NullProgressMonitor());
       
      } catch (CoreException e) {
        Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't create propertyfile : " + labelFile.getLocation(), e));
      }      
    }

    // stores labelfile
    FileOutputStream labelFileStream = null;
    BufferedWriter writer = null;
    try {
      if (isSortLabelFiles()) {
        Properties labelProperties = loadLabel(labelFile);
        labelProperties.setProperty(key, value);
        SortedProperties sortedProperties = new SortedProperties();
        sortedProperties.putAll(labelProperties);
        labelFileStream = new FileOutputStream(labelFile.getLocation().toString());
        sortedProperties.store(labelFileStream, null);
     
       
      } else {
        // append new label to existing file
        Properties labelProperties = loadLabel(labelFile);
        if (!labelProperties.containsKey(key)) {
          writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(labelFile.getLocation().toFile(), true), "8859_1"));
          if(labelProperties.entrySet().size()>0){
            writer.newLine();
          }         
          writer.write(LabelFileEncodingHelper.saveConvert(key, true));
          writer.write("=");
          writer.write(LabelFileEncodingHelper.saveConvert(value, false));         
          writer.flush();
       
        }
      }
      labelFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
    } catch (FileNotFoundException e) {
      Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't find propertyfile : " + labelFile.getLocation(), e));
    } catch (IOException e) {
      Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't write propertyfile : " + labelFile.getLocation(), e));
    } catch (CoreException e) {
      Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, "Can't find propertyfile : " + labelFile.getLocation(), e));
    }finally{
      if(labelFileStream!=null){
        try {
          labelFileStream.close();
        } catch (IOException e) {       
View Full Code Here

        List<IStatus> list = new ArrayList<IStatus>();
        String nameOfmodelToCreate = _moduleName.getText();
       
        if (nameOfmodelToCreate.equals("")) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "No name given."));

        } else if (!WGADesignStructureHelper.isValidModuleName(nameOfmodelToCreate)) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Invalid chars in modulename."));
        } else {
            if(nameOfmodelToCreate.contains(".")){
                String suffix = nameOfmodelToCreate.substring(nameOfmodelToCreate.lastIndexOf(".")+1,nameOfmodelToCreate.length());
                if(suffix.equals(_typeLable.getText())){
                    nameOfmodelToCreate = nameOfmodelToCreate.substring(0, nameOfmodelToCreate.lastIndexOf("."));
                }              
            }      
           
            IFolder targetContainer = _selectedContainer.getFolder(new Path(nameOfmodelToCreate));
            IFile targetFile = _selectedContainer.getFile(new Path(nameOfmodelToCreate + "." + _typeLable.getText()));

            if (targetContainer.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a folder named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else if (targetFile.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a file named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else {
                _scriptFile = targetFile;

            }
View Full Code Here

        List<IStatus> list = new ArrayList<IStatus>();
        String nameOfmodelToCreate = _moduleName.getText();
       
       
        if (nameOfmodelToCreate.equals("")) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please specify a name for the module."));
        } else if (!WGADesignStructureHelper.isValidModuleName(nameOfmodelToCreate)) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Invalid chars in module name."));
        } else {
            IFolder targetContainer = _selectedContainer.getFolder(new Path(nameOfmodelToCreate));
           
            if(nameOfmodelToCreate.contains(".")){
                String suffix = nameOfmodelToCreate.substring(nameOfmodelToCreate.lastIndexOf("."),nameOfmodelToCreate.length());
                if(suffix.equals(".tml")){
                    nameOfmodelToCreate = nameOfmodelToCreate.substring(0, nameOfmodelToCreate.lastIndexOf("."));
                }              
            }
           
            IFile targetFile = _selectedContainer.getFile(new Path(nameOfmodelToCreate + ".tml"));

            if (targetContainer.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a folder named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else if (targetFile.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a file named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else {
                _tmlFile = targetFile;

            }
View Full Code Here

  @Override
  public List<IStatus> validate() {
    List<IStatus> list = new ArrayList<IStatus>();

    if (!(getTreeViewer().getTree().getSelectionCount() > 0)) {
      list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is no designfolder in workspace."));
    } else {
      IContainer treeSelection = (IContainer) getTreeViewer().getTree().getSelection()[0].getData();

      if (!WGADesignStructureHelper.isValidTMLLocation(treeSelection)) {
        list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "You cannot create a TML module here. Please select a folder below the tml folder."));
      }
    }
    return list;
  }
View Full Code Here

  public List<IStatus> validate() {
    List<IStatus> messages = new ArrayList<IStatus>();
   
    String outerLayoutName = _txtOuterLayoutName.getText();
    if (outerLayoutName == null || outerLayoutName.trim().equals("")) {
      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please define a name for the outerlayout."));
    } else if (!WGADesignStructureHelper.isValidModuleName(outerLayoutName)) {
      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "The name for the outerlayout contains invalid characters. Only alphanumeric ascii characters and '.', '_', '-' and '$' are allowed."));
    }
   
    String innerLayoutName = _txtInnerLayoutName.getText();
    if (innerLayoutName == null || innerLayoutName.trim().equals("")) {
      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please define a name for the innerlayout."));
    } else if (!WGADesignStructureHelper.isValidModuleName(innerLayoutName)) {
      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "The name for the innerlayout contains invalid characters. Only alphanumeric ascii characters and '.', '_', '-' and '$' are allowed."));
    }
   
    // check if the resources already exist
    IContainer designRoot = null;
    if (getPreviousPage() instanceof DesignFolderSelectionPage) {
      designRoot = (IContainer)((DesignFolderSelectionPage)getPreviousPage()).getSelectedResource();
    }
    if (designRoot == null) {
      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "No design folder selected."));
    } else {
      WGADesignStructureHelper helper = new WGADesignStructureHelper(designRoot);
      IFolder html = helper.getTmlRoot().getFolder("html");
      if (html.exists()) {
        IFile outerLayoutFile = html.getFile(new Path(getOuterLayoutName() + ".tml"));
        if (outerLayoutFile.exists()) {
          messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "A module with name '" + outerLayoutName + "' already exists in '" + outerLayoutFile.getParent().getFullPath().toString() + "'."));   
        }
        IFile innerLayoutFile = html.getFile(new Path("inner").append(getInnerLayoutName() + ".tml"));
        if (innerLayoutFile.exists()) {
          messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "A module with name '" + innerLayoutName + "' already exists in '" + innerLayoutFile.getParent().getFullPath().toString() + "'."));   
        }
      }
    }
    return messages;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.Status

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.