Package eu.ha3.matmos.editor.filechooser

Examples of eu.ha3.matmos.editor.filechooser.OverwriteWarningJasonFileChooser


  private void whenUninitializedAction()
  {
    if (this.mod.isInitialized())
      return;
   
    TimeStatistic stat = new TimeStatistic();
    this.mod.initializeAndEnable();
    this.mod.getChatter().printChat(
      ChatColorsSimple.COLOR_BRIGHTGREEN, "Loading for the first time (" + stat.getSecondsAsString(2) + "s)");
  }
View Full Code Here


 
  private void whenWantsForcing()
  {
    if (!this.mod.isActivated() && this.mod.isInitialized())
    {
      TimeStatistic stat = new TimeStatistic();
      this.mod.reloadEverything();
      this.mod.activate();
      this.mod.getChatter().printChat(
        ChatColorsSimple.COLOR_BRIGHTGREEN, "Reloading expansions (" + stat.getSecondsAsString(2) + "s)");
    }
    else if (!this.mod.isInitialized())
    {
      whenUninitializedAction();
    }
View Full Code Here

    util().registerPrivateGetter("isJumping", EntityLivingBase.class, -1, "isJumping", "field_70703_bu", "bd");
    util().registerPrivateGetter("isInWeb", Entity.class, -1, "isInWeb", "field_70134_J", "J");
   
    ((OperatorCaster) op()).setTickEnabled(true);
   
    TimeStatistic timeMeasure = new TimeStatistic(Locale.ENGLISH);
    this.userControl = new UserControl(this);
    this.expansionManager =
      new ExpansionManager(new File(util().getModsFolder(), "matmos/expansions_r27_userconfig/"), this);
   
    // Create default configuration
    this.updateNotifier.fillDefaults(this.config);
    this.config.setProperty("world.height", 256);
    this.config.setProperty("dump.sheets.enabled", false);
    this.config.setProperty("start.enabled", true);
    this.config.setProperty("reversed.controls", false);
    this.config.setProperty("sound.autopreview", true);
    this.config.setProperty("globalvolume.scale", 1f);
    this.config.setProperty("key.code", 65);
    this.config.setProperty("useroptions.altitudes.high", true);
    this.config.setProperty("useroptions.altitudes.low", true);
    this.config.setProperty("useroptions.biome.override", -1);
    this.config.setProperty("debug.mode", 0);
    this.config.setProperty("minecraftsound.ambient.volume", 1f);
    this.config.commit();
   
    // Load configuration from source
    try
    {
      this.config.setSource(new File(util().getModsFolder(), "matmos/userconfig.cfg").getCanonicalPath());
      this.config.load();
    }
    catch (IOException e)
    {
      e.printStackTrace();
      throw new RuntimeException("Error caused config not to work: " + e.getMessage());
    }
   
    this.expansionManager.setVolumeAndUpdate(this.config.getFloat("globalvolume.scale"));
    resetAmbientVolume();
   
    this.updateNotifier.loadConfig(this.config);
   
    // This registers stuff to Minecraft (key bindings...)
    this.userControl.load();
   
    MAtLog.info("Took " + timeMeasure.getSecondsAsString(3) + " seconds to setup MAtmos base.");
   
    if (this.config.getBoolean("start.enabled"))
    {
      initializeAndEnable();
    }
View Full Code Here

      return;
   
    this.expansionManager.deactivate();
    this.expansionManager.dispose();
   
    TimeStatistic stat = new TimeStatistic(Locale.ENGLISH);
   
    this.dataGatherer = new ModularDataGatherer(this);
    this.dataGatherer.load();
    this.visualDebugger = new VisualDebugger(this, this.dataGatherer);
    this.expansionManager.setData(this.dataGatherer.getData());
    this.expansionManager.setCollector(this.dataGatherer);
    this.expansionManager.loadExpansions();
   
    this.hasResourcePacks = true;
    if (this.expansionManager.getExpansions().size() == 0)
    {
      MAtResourcePackDealer dealer = new MAtResourcePackDealer();
      if (dealer.findResourcePacks().size() == 0)
      {
        this.hasResourcePacks = false;
        this.hasDisabledResourcePacks = dealer.findDisabledResourcePacks().size() > 0;
      }
    }
   
    MAtLog.info("Expansions loaded (" + stat.getSecondsAsString(1) + "s).");
  }
View Full Code Here

  }
 
  @Override
  public void process()
  {
    TimeStatistic stat = new TimeStatistic();
    for (String requiredModule : this.iteratedThroughModules)
    {
      this.watch.reset();
      try
      {
        this.modules.get(requiredModule).process();
      }
      catch (Exception e)
      {
        e.printStackTrace();
        IDontKnowHowToCode.whoops__printExceptionToChat(this.mod.getChatter(), e, requiredModule.hashCode());
      }
      this.watch.stop();
      if (this.watch.getMilliseconds() > 50 && this.mod.isDebugMode())
      {
        MAtLog.warning("WARNING: Module " + requiredModule + " took " + stat.getMilliseconds() + "ms!!!");
      }
    }
   
    this.ticksPassed = this.ticksPassed + 1;
   
View Full Code Here

    gbc_lblSheet.insets = new Insets(0, 0, 5, 5);
    gbc_lblSheet.gridx = 0;
    gbc_lblSheet.gridy = 0;
    activation.add(lblSheet, gbc_lblSheet);
   
    this.sheet = new InstantTextField() {
      @Override
      protected void editEvent()
      {
        String text = getText();
        if (!EditCondition.this.condition.sheet.equals(text))
        {
          EditCondition.this.condition.sheet = text;
          EditCondition.this.edit.flagChange();
        }
      };
    };
    GridBagConstraints gbc_sheet = new GridBagConstraints();
    gbc_sheet.fill = GridBagConstraints.HORIZONTAL;
    gbc_sheet.insets = new Insets(0, 0, 5, 0);
    gbc_sheet.gridx = 1;
    gbc_sheet.gridy = 0;
    activation.add(this.sheet, gbc_sheet);
   
    JLabel lblIndex = new JLabel("Index");
    GridBagConstraints gbc_lblIndex = new GridBagConstraints();
    gbc_lblIndex.anchor = GridBagConstraints.EAST;
    gbc_lblIndex.insets = new Insets(0, 0, 5, 5);
    gbc_lblIndex.gridx = 0;
    gbc_lblIndex.gridy = 1;
    activation.add(lblIndex, gbc_lblIndex);
   
    this.index = new InstantTextField() {
      @Override
      protected void editEvent()
      {
        String text = getText();
        if (!EditCondition.this.condition.index.equals(text))
        {
          EditCondition.this.condition.index = text;
          EditCondition.this.edit.flagChange();
        }
      };
    };
    GridBagConstraints gbc_index = new GridBagConstraints();
    gbc_index.fill = GridBagConstraints.HORIZONTAL;
    gbc_index.insets = new Insets(0, 0, 5, 0);
    gbc_index.gridx = 1;
    gbc_index.gridy = 1;
    activation.add(this.index, gbc_index);
   
    this.comboBox = new JComboBox();
    this.comboBox.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0)
      {
        if (Operator.fromSerializedForm(EditCondition.this.condition.symbol) != EditCondition.this.comboBox
          .getSelectedItem())
        {
          EditCondition.this.condition.symbol =
            ((Operator) EditCondition.this.comboBox.getSelectedItem()).getSerializedForm();
          EditCondition.this.edit.flagChange();
        }
      }
    });
    GridBagConstraints gbc_comboBox = new GridBagConstraints();
    gbc_comboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox.insets = new Insets(0, 0, 5, 0);
    gbc_comboBox.gridx = 1;
    gbc_comboBox.gridy = 2;
    activation.add(this.comboBox, gbc_comboBox);
    this.comboBox.setModel(new DefaultComboBoxModel(Operator.values()));
   
    JLabel lblValue = new JLabel("Value");
    GridBagConstraints gbc_lblValue = new GridBagConstraints();
    gbc_lblValue.anchor = GridBagConstraints.EAST;
    gbc_lblValue.insets = new Insets(0, 0, 0, 5);
    gbc_lblValue.gridx = 0;
    gbc_lblValue.gridy = 3;
    activation.add(lblValue, gbc_lblValue);
   
    this.value = new InstantTextField() {
      @Override
      protected void editEvent()
      {
        String text = getText();
        if (!EditCondition.this.condition.value.equals(text))
View Full Code Here

    gridBagLayout.rowHeights = new int[] { 23, 0 };
    gridBagLayout.columnWeights = new double[] { 1.0, 0.0, 0.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel.setLayout(gridBagLayout);
   
    this.textField = new InstantTextField() {
      @Override
      protected void editEvent()
      {
        evaluateRename();
      }
View Full Code Here

      return;
   
    if (!forceSelect)
      return;
   
    KnowledgeItemType k = KnowledgeItemType.fromSerialClass(item.getClass());
    if (k == null)
      return;
   
    if (this.itemTree.getSelectionPath().getLastPathComponent() instanceof ItemTreeNode
      && ((ItemTreeNode) this.itemTree.getSelectionPath().getLastPathComponent()).getItemName().equals(name))
View Full Code Here

    this.edit.flagChange();
  }
 
  protected void addSoundDialog()
  {
    OggFileChooser fc = new OggFileChooser(this.edit.getSoundDirectory());
    fc.setMultiSelectionEnabled(true);
    int returnValue = fc.showOpenDialog(this);
    if (returnValue != JFileChooser.APPROVE_OPTION)
      return;
   
    File[] files = fc.getSelectedFiles();
    if (files.length == 0)
      return;
   
    for (File file : files)
    {
View Full Code Here

    this.mntmFSaveAs = new JMenuItem("Save as...");
    this.mntmFSaveAs.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fc = new OverwriteWarningJasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showSaveDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
          }
          else
          {
            showErrorPopup("Unexpected error: No file pointer.");
          }
          return;
        }
       
        boolean success = EditorWindow.this.model.longSave(file, true);
        if (!success)
        {
          actionPerformed(e);
        }
      }
    });
    mnFile.add(this.mntmFSaveAs);
   
    JMenuItem mntmFSaveACopy = new JMenuItem("Save a backup copy...");
    mntmFSaveACopy.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fc = new OverwriteWarningJasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showSaveDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
          }
          else
          {
            showErrorPopup("Unexpected error: No file pointer.");
          }
          return;
        }
       
        boolean success = EditorWindow.this.model.longSave(file, false);
        if (!success)
        {
          actionPerformed(e);
        }
      }
    });
    mntmFSaveACopy
      .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK | InputEvent.ALT_MASK));
    mnFile.add(mntmFSaveACopy);
   
    JSeparator separator_2 = new JSeparator();
    mnFile.add(separator_2);
   
    this.mntmReplaceCurrentFile = new JMenuItem("Replace current file with backup... (NOT IMPLEMENTED)");
    mnFile.add(this.mntmReplaceCurrentFile);
   
    this.mntmFDiscardChanges = new JMenuItem("Discard changes and reload (NOT IMPLEMENTED)");
    mnFile.add(this.mntmFDiscardChanges);
   
    JSeparator separator_7 = new JSeparator();
    mnFile.add(separator_7);
   
    JMenuItem mntmMergeAnotherFile = new JMenuItem("Merge another file in...");
    mntmMergeAnotherFile.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0)
      {
        if (!continueUnsavedChangesWarningIfNecessary())
          return;
       
        JFileChooser fc = new JasonFileChooser(EditorWindow.this.model.getExpansionDirectory());
        int returnValue = fc.showOpenDialog(EditorWindow.this);
        if (returnValue != JFileChooser.APPROVE_OPTION)
          return;
       
        File file = fc.getSelectedFile();
        if (file == null || !file.exists() || file.isDirectory())
        {
          if (file.isDirectory())
          {
            showErrorPopup("Unexpected error: The file is a directory.");
View Full Code Here

TOP

Related Classes of eu.ha3.matmos.editor.filechooser.OverwriteWarningJasonFileChooser

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.