Package com.google.gdt.eclipse.designer.model.widgets.support

Examples of com.google.gdt.eclipse.designer.model.widgets.support.IGwtStateProvider


      };

  private void openEditDialog(Property property) throws Exception {
    ObjectProperty objectProperty = (ObjectProperty) property;
    ObjectInfo objectInfo = objectProperty.getObjectInfo();
    IGwtStateProvider stateProvider = (IGwtStateProvider) objectInfo;
    // prepare not empty array of CSS files
    List<IFile> cssFiles = stateProvider.getState().getCssSupport().getFiles();
    if (cssFiles.isEmpty()) {
      MessageDialog.openError(
          DesignerPlugin.getShell(),
          "Error",
          "There are no CSS files referenced from module or HTML.");
      return;
    }
    // prepare dialog
    StylesEditDialog stylesDialog;
    {
      String currentText = getText(property);
      stylesDialog =
          new StylesEditDialog(DesignerPlugin.getShell(),
              cssFiles,
              StringUtils.isEmpty(currentText) ? "" : "." + currentText,
              true);
    }
    // open dialog and edit CSS files
    int result = stylesDialog.open();
    if (result == Window.CANCEL) {
      return;
    }
    // wait for auto-build - for coping CSS files from source folder to binary
    ProjectUtils.waitForAutoBuild();
    // check CSS files modification
    stateProvider.getState().isModified();
    // do edit
    switch (result) {
      case Window.OK :
        // "OK" button pressed, refresh for displaying modified styles
        ExecutionUtils.refresh(objectInfo);
View Full Code Here


  }

  private void openNewDialog(Property property) throws Exception {
    ObjectProperty objectProperty = (ObjectProperty) property;
    ObjectInfo objectInfo = objectProperty.getObjectInfo();
    IGwtStateProvider stateProvider = (IGwtStateProvider) objectInfo;
    // prepare default name
    String initialName = "newStyleName";
    if (property.getValue() instanceof String) {
      initialName = (String) property.getValue();
    }
    // ask for style name
    InputDialog inputDialog =
        new InputDialog(DesignerPlugin.getShell(),
            "New style name",
            "Enter new style name (without leading '.'):",
            initialName,
            null);
    if (inputDialog.open() == Window.CANCEL) {
      return;
    }
    String newStyleName = inputDialog.getValue();
    // actually add style
    {
      RuleAccessor ruleAccessor = RuleAccessor.get(objectInfo);
      List<ContextDescription> contexts = ruleAccessor.getContexts();
      ContextDescription context = getTargetContextDescription(contexts, newStyleName);
      if (context != null) {
        newStyleName = context.addNewStyle(newStyleName);
        context.commit();
      }
    }
    // check CSS files modification
    stateProvider.getState().isModified();
    // apply style name
    property.setValue(newStyleName);
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.support.IGwtStateProvider

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.