Package de.innovationgate.eclipse.utils.wga

Examples of de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper


    super(parent);
    setTitle("Labeling");
    _textSelection = textselection;
    _doc = doc;
    _replaceHandeler = new LabelTagReplaceHandler(_doc, "");
    _wgaDesign = new WGADesignStructureHelper(Plugin.getDefault().getActiveFile());
    setHelpAvailable(false);
  }
View Full Code Here


    }
    return references;
  }

    private void createReferenceValues(IFile activeFile, Set<String> references) {
        WGADesignStructureHelper helper = new WGADesignStructureHelper(activeFile);
        VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(activeFile);
        Iterator<IFolder> containers = helper.getFileContainers().iterator();
        while (containers.hasNext()) {
           
            IFolder container = containers.next();
           
            if (versionCompliance != null && versionCompliance.toWGAVersion() != null && versionCompliance.toWGAVersion().isAtLeast(5, 4)) {                               
                IPath refPath = container.getFullPath().makeRelativeTo(helper.getFileContainerRoot().getFullPath());
              references.add(refPath.toString().toLowerCase().replaceAll("\\/",":"));
             
              IPath activeFolderPath = activeFile.getParent().getFullPath().makeRelativeTo(helper.getTmlRoot().getFullPath());
              // remove medium
              activeFolderPath = activeFolderPath.removeFirstSegments(1);
               if (activeFolderPath.segmentCount() > 0 && (refPath.segmentCount() >= activeFolderPath.segmentCount())) {
                    int a = refPath.segmentCount();
                    int b = activeFolderPath.segmentCount();
View Full Code Here

   
    String tagName = region.getTagName();
    if (tagName != null && tagName.equals("url") && region.hasAttribute("type") && !region.isDynamicAttributeValue("type")) {
      String type = region.getAttributeValue("type");
      if (type != null && ( type.equals(WGADesignStructureHelper.SCRIPT_TYPE_CSS) || type.equals(WGADesignStructureHelper.SCRIPT_TYPE_JS)) ) {
        WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
            VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(activeFile);
           
        IContainer designRoot = designHelper.getDesignRoot();
        String medium = WGADesignStructureHelper.determineMediaKey(activeFile);
       
        ResourceIndexManager rsm = Plugin.getDefault().getResourceIndexManager();
        if (rsm != null) {
          // the path to the file which we are currently editing
          IPath pathOfEditedFile = activeFile.getParent().getProjectRelativePath();
          // the path of the medium of the current file
          IPath mediumPath = designHelper.getTmlRoot().getFolder(new Path(medium)).getProjectRelativePath();
          pathOfEditedFile = pathOfEditedFile.removeFirstSegments(mediumPath.segmentCount());
                         
          Iterator<String> scriptPaths = rsm.getScriptPaths(designRoot, type).iterator();
         
          while (scriptPaths.hasNext()) {
View Full Code Here

public class LabelKeyLookup implements AttributeValueLookup {

  public Set<String> lookupValues(TMLRegion region, IDocument document, ITextViewer viewer, IFile activeFile) {
    Set<String> labelKeys = new HashSet<String>();

    WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
    if (region.getTagName() != null && region.getTagName().equals("label")) {
      String labelFilename = "general";
      if (region.hasAttribute("file") && !region.isDynamicAttributeValue("file")) {
        labelFilename = region.getAttributeValue("file");
      }     
      labelKeys.addAll(designHelper.getLabelKeys(labelFilename));
    }
    return labelKeys;
  }
View Full Code Here

        if (file.getFileExtension().equalsIgnoreCase(".properties")) {
          _encoding = "ISO-8859-1";
        } else if (file.getName().toLowerCase().endsWith(".metadata.xml")) {
          _encoding = "UTF-8";
        } else {
          _encoding = new WGADesignStructureHelper(((IFileEditorInput) element).getFile()).determineDesignEncoding();         
        }
        return super.createDocument(element)
      } else {
        throw new CoreException(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Unsupported editorinput."))
      }
View Full Code Here

      label.setText("Development language:");
      _comboLanguage = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
     
      // fill combo
      List<String> languages = new ArrayList<String>();
      WGADesignStructureHelper helper = new WGADesignStructureHelper(getDesignRoot());
      try {
        languages.addAll(helper.getAvailableLableLanguages());         
      } catch (CoreException e) {
        Plugin.getDefault().getLog().log(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Unable to retrieve configured label languages.", e));
      }
      if (languages.isEmpty()) {
        languages.add(WGADesignStructureHelper.DEFAULT_DESIGN_DEV_LANGUAGE);
      }
      _comboLanguage.setItems(languages.toArray(new String[0]));
     
      // set combo default     
      int index = 0;     
      try {
        String devLang = helper.getDevelopmentLanguage();
        int pos = _comboLanguage.indexOf(devLang);
        if (pos != -1) {
          index = pos;
        }
      } catch (CoreException e) {
        Plugin.getDefault().getLog().log(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Unable to retrieve dev language of resource '" + getDesignRoot().getLocation() + "'.", e));
      }     
      _comboLanguage.select(index);
     
      label = new Label(composite, SWT.None);
      label.setText("AutoSort label files:");
     
      _chkSortLabelFiles = new Button(composite, SWT.CHECK);
      _chkSortLabelFiles.setText("enabled");
      _chkSortLabelFiles.setSelection(helper.isSortLabelFiles());
    }   
   
    return composite;
  }
View Full Code Here

  }

  @Override
  public boolean performOk() {
    try {
      WGADesignStructureHelper helper = new WGADesignStructureHelper(getDesignRoot());
      helper.setDevelopmentLanguage(_comboLanguage.getText());
      helper.setSortLabelFiles(_chkSortLabelFiles.getSelection());
    } catch (Exception e) {
      Plugin.getDefault().getLog().log(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Unable to save design metadata of resource '" + getDesignRoot().getLocation() + "'.", e));
    }
    return true;
  }
View Full Code Here

          return;
        }
        boolean result = MessageDialog.openQuestion(fShell, "Enforce design encoding", "Enforcing design encoding will change encoding resource settings and perform a revalidation of the design. Continue?");
        if (result) {
          try {
            new WGADesignStructureHelper(_model.getDesignContainer()).enforceDesignEncoding();
            RunValidation.call(_model.getDesignContainer(), fShell);
          } catch (CoreException e1) {
            WorkbenchUtils.showErrorDialog(Plugin.getDefault(), fShell, "Error", "Enforce design encoding failed.", e1);
          }         
        }
View Full Code Here

    }
   
    if (element instanceof IContainer) {
      IContainer container = (IContainer) element;
      if (container.isAccessible() && WGADesignStructureHelper.isDesignFolder(container)) {
        WGADesignStructureHelper helper = new WGADesignStructureHelper(container);
        if (helper.hasPluginConfig()) {
          return WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_PLUGIN);
        } else {
          return WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_DESIGN);
        }
      } else if (container.isAccessible()) {
        // we might have to resolve dirlinks
        IFile dirlink = container.getFile(new Path("dirlink.xml"));
        if (dirlink.exists()) {
          File target = WGUtils.resolveDirLink(dirlink.getParent().getLocation().toFile());
          if (WGADesignStructureHelper.isDesignFolder(target)) {
            IContainer targets[] = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(new Path(target.getAbsolutePath()));
            if (targets != null && targets.length >= 1) {
              WGADesignStructureHelper helper = new WGADesignStructureHelper(targets[0]);
              if (helper.hasPluginConfig()) {
                return WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_PLUGIN_LINK);
              } else {
                return WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_DESIGN_LINK)
              }
            } else {
View Full Code Here

                  }
              } else {
                  IFolder[] pluginFolders = runtime.getPluginsAsFolder(true);
                        for (IFolder pluginFolder : pluginFolders) {
                            if (WGADesignStructureHelper.isDesignFolder(pluginFolder)) {
                                WGADesignStructureHelper helper = new WGADesignStructureHelper(pluginFolder);
                                WGADesignConfigurationModel model = helper.createModel();
                                if (model != null && model.hasPluginConfig()) {
                                    String pluginUName = model.getPluginUniqueName();
                                    if (pluginUName != null) {
                                        String pluginDBKey = null;                                   
                                        if (pluginUName.contains(".")) {
                                            pluginDBKey = "plugin-" + pluginUName.substring(pluginUName.lastIndexOf("."));   
                                        } else {
                                            pluginDBKey = "plugin-" + pluginUName;
                                        }       
                                        if (pluginDBKey != null && _warning.getDb().equalsIgnoreCase(pluginDBKey)) {
                                            designContainer = pluginFolder;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
              }
          }
               
        if (designContainer != null && WGADesignStructureHelper.isDesignFolder(designContainer)) {
          WGADesignStructureHelper helper = new WGADesignStructureHelper(designContainer);
          IFile file = helper.findReferencedTMLModule(_warning.getResource(), _warning.getMedium());
          if (file != null && file.exists()) {
            IEditorPart editor = WorkbenchUtils.openEditor(WGADesignerPlugin.getDefault().getWorkbench(), file);
            if (editor instanceof ITextEditor) {
              ITextEditor textEditor = (ITextEditor) editor;
              int offset = 0;
View Full Code Here

TOP

Related Classes of de.innovationgate.eclipse.utils.wga.WGADesignStructureHelper

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.